From patchwork Wed Mar 8 16:39:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2785 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D8218414B5 for ; Wed, 8 Mar 2023 17:40:50 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id c3-20020a170902724300b0019d1ffec36dsf9602926pll.9 for ; Wed, 08 Mar 2023 08:40:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678293649; cv=pass; d=google.com; s=arc-20160816; b=c/OQhLnswsXf/FEv5sVduGWgQmScC9HQZcf9skcSj6kbGmHdr5uJNgOZE9FRVmRIen J/emjJHOOvIskV6Jqt2RUCLe5i3f54XMpak3iln/yRFifBquK2babmpq6zKSZ2ROZ0Wi Z2Uds8I1d3I7Y9GyIM1KPFIoopJ2bT1L3uy9GbKQTJ3xisat26+DHQ08XjgkAfyOmEYO 1bK33utnMmOv8VzWsqBesMjwHk4bOCbanw3Glq7SKrEpSKra0XFY3ZIs4eOf2tbIJjRx wT1iCPHfZzyori1SQXDDgCN2kYQ/t/CehMu2HFEzkY+/lPQERaJBniABuoOSsu5Bfazh fNcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Y0bRP8DTxcmThovQjA8al6368BjsrxCNZORvQM4clbo=; b=Qsb0WTlsGZKJvL9NavNiRDhFNADfzrV1vZ/xkn6s4DMdANhrkLdnfocowyY+jEOCkH ruQ8UlbyfjRApGnUk97smzUX5iCHcXMQL2JLhGrduLqsed7/9vgzsnZEFCVj4E/zdecB k7TY5uh3+1sCeVmd+c8x9Kv8MmK+/2ezZl1AM6UxgFFebTfzpNbFHm6ZuZEOH0Bodwci Qg3Y6NBwL5K4lMAeJz10Q0O9Ez2rKbJhutk7Dj1PwKzqUmdSseBww5EALN+pvb61LRnF 5yk0i0h5rT5qObQHE6bJdz2zkZQKnCNm3tf0rXvpiY5L+v0fut8uyEX00l+xMi15oxL3 eX4Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cdcXoPOG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1678293649; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y0bRP8DTxcmThovQjA8al6368BjsrxCNZORvQM4clbo=; b=i8pQK6l6j7VJ6FK9m7P4T0wIGEqDsIE3RKssbQCcsVTm1QaV6ZGwXyAT+Ka1jUxdIN UXeq2B2by+iYM84Xdz7+68sHz4AToznxTDQpSEsxH5Cs42AqLCTpIINNwmwlN7xAJ5HY 77J8wQj0FzImDi72HNiYdbHaIeC5faH+a5dz0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678293649; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y0bRP8DTxcmThovQjA8al6368BjsrxCNZORvQM4clbo=; b=aXassOrTT4Q5jIO4Jqx7LbwC5aDcXEKuT10xLQvtosYxbZva55bQO/8J/Zq2dqsPvr iHUtb/x96yjBlwR3qHpErtb28LbjnfGyUbE49tF582B16lVfUq1OLqlOCCRx2FuZ8rur i20whjBHLkH7z4nCzRE4n5GnFqfA4A3ju61tjk6mrY6sMF3RLmIX+jRZ50DWFsrhyAH4 /oszoTrrvm/kDDmThtdlHVjPlbr62ost4kx7VnpYM5AFUg6IaI/cs8FTDUT9fO6WnFtN iRVD/GaivtO3nz7a7VV0ZF/5DvmFqJLEmWiCLK3aN2eQqCrRsVrVEF5cEyqqgvsAZMee VioA== X-Gm-Message-State: AO0yUKUsYuZveBzPdTmGMabbWtuu+fA/WH1DNdXpnhHthq7hJkkLqqZz ckppiv1W6cknrmlwvwCScv3Ft4I+nOZC6c2w X-Google-Smtp-Source: AK7set+Xc3qDgE3S64huoPaj/Vy9Z8dICGV+qSfaTpWIuFTpok90MVvH3Izm5Pyd/6r/AiHH0ZOQwg== X-Received: by 2002:a63:9c0a:0:b0:502:e4df:5f3f with SMTP id f10-20020a639c0a000000b00502e4df5f3fmr6178258pge.6.1678293649659; Wed, 08 Mar 2023 08:40:49 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:5ac7:b0:237:7ef0:5b8 with SMTP id n65-20020a17090a5ac700b002377ef005b8ls1992848pji.3.-pod-canary-gmail; Wed, 08 Mar 2023 08:40:49 -0800 (PST) X-Received: by 2002:a17:902:c40d:b0:19e:6955:36af with SMTP id k13-20020a170902c40d00b0019e695536afmr23882253plk.26.1678293648677; Wed, 08 Mar 2023 08:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678293648; cv=none; d=google.com; s=arc-20160816; b=hwYdsCsTILYPc0t0tLH3rT+A1qO10Fv3quG5J2jYS1EY3nLy4sbSPem4fNSUYUi52o GWGCVgLALGQtVte6ERnDWdvEaIzI/kBpYRKZ/0F2mCJQtHLIJNjKKAfjE7spKOzkkHmm Uv5XsU/f7aKzbVkI02x/rVtrnZhgzU02gGoA0zMHnzBOUUh5vP5OPnfmI6aGc2cHJ8DA RAGakmod7JiWeXAw+5p6lMpBUYVu0nDH67p55eVgvDgDRS2dEdY6wzSGa2ZVPpwEXovV VbcWeiGYpur8z327IErrsbWFHvQS4QbjBErzHEXy30kfJWOaoP4ZEImfU35W05aXJoiY tKJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=zuaaNlwtvX1EiEc/sO04f/d6DRUpib29L7439uIhr/E=; b=KcGHzwH95dY27SXq87Dv9KtUme+QSM5wj2zPI5hwoOvW0z1x10ST24qUvTPSQCteWs R+8nO+NznLkQQBsCW8Z1olWangKAnXE5V/RTIcrb52JIgaV+PA3XYZYh7cjP/fxmK5Js hVZHjZwPlFR50FhYl9S24GUaxtAv9QpJmhDIvgZOwDMYCJRDEJ7SCRS+4a/AxeMM9Zkp +tYrQUOxvx0fsY3EJW87Wxk/DbzDsrHg6VsXOiFfWdvTunDmsLp2CxV7ymZmc2dyXRvT SdjIL5KJacN2cm6bpYomHXsZufNp/SSa6C7e2F69tHSyMiJPxJujYfYPHyPJ+fVxI4dH 2qwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cdcXoPOG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q17-20020a170902edd100b0019cc2c4a107sor6768911plk.135.2023.03.08.08.40.48 for (Google Transport Security); Wed, 08 Mar 2023 08:40:48 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:903:41c4:b0:19c:c184:d208 with SMTP id u4-20020a17090341c400b0019cc184d208mr22161867ple.66.1678293648307; Wed, 08 Mar 2023 08:40:48 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a8a1:b545:91cc:80b2:f9fe]) by smtp.gmail.com with ESMTPSA id kq3-20020a170903284300b0019b9a075f1fsm10046540plb.80.2023.03.08.08.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:40:47 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v16 05/16] drm: exynos: dsi: Introduce hw_type platform data Date: Wed, 8 Mar 2023 22:09:42 +0530 Message-Id: <20230308163953.28506-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230308163953.28506-1-jagan@amarulasolutions.com> References: <20230308163953.28506-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cdcXoPOG; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Samsung MIPI DSIM controller is common DSI IP that can be used in various SoCs like Exynos, i.MX8M Mini/Nano/Plus. Add hw_type enum via platform_data so that accessing the different controller data between various platforms becomes easy and meaningful. Tested-by: Marek Szyprowski Reviewed-by: Marek Vasut Reviewed-by: Frieder Schrempf Suggested-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v16: - collect TB from Marek S Changes for v15, v13: - none Changes for v12: - collect RB from Marek Changes for v11: - collect RB from Frieder - drop extra line Changes for v10: - split from previous series patch "drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge" - update enum type names drivers/gpu/drm/exynos/exynos_drm_dsi.c | 83 ++++++++++++++++++++----- 1 file changed, 68 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 90ff40af005c..0f0834ebbdf3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,6 +254,15 @@ struct exynos_dsi_transfer { #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +enum exynos_dsi_type { + DSIM_TYPE_EXYNOS3250, + DSIM_TYPE_EXYNOS4210, + DSIM_TYPE_EXYNOS5410, + DSIM_TYPE_EXYNOS5422, + DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_COUNT, +}; + struct exynos_dsi_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; @@ -267,6 +276,10 @@ struct exynos_dsi_driver_data { const unsigned int *reg_values; }; +struct exynos_dsi_plat_data { + enum exynos_dsi_type hw_type; +}; + struct exynos_dsi { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; @@ -297,6 +310,7 @@ struct exynos_dsi { struct list_head transfer_list; const struct exynos_dsi_driver_data *driver_data; + const struct exynos_dsi_plat_data *plat_data; }; #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) @@ -524,18 +538,13 @@ static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = { .reg_values = exynos5422_reg_values, }; -static const struct of_device_id exynos_dsi_of_match[] = { - { .compatible = "samsung,exynos3250-mipi-dsi", - .data = &exynos3_dsi_driver_data }, - { .compatible = "samsung,exynos4210-mipi-dsi", - .data = &exynos4_dsi_driver_data }, - { .compatible = "samsung,exynos5410-mipi-dsi", - .data = &exynos5_dsi_driver_data }, - { .compatible = "samsung,exynos5422-mipi-dsi", - .data = &exynos5422_dsi_driver_data }, - { .compatible = "samsung,exynos5433-mipi-dsi", - .data = &exynos5433_dsi_driver_data }, - { } +static const struct exynos_dsi_driver_data * +exynos_dsi_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, }; static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi) @@ -1468,8 +1477,6 @@ static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { .attach = exynos_dsi_attach, }; -MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); - static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { @@ -1704,7 +1711,8 @@ static int exynos_dsi_probe(struct platform_device *pdev) dsi->dsi_host.dev = dev; dsi->dev = dev; - dsi->driver_data = of_device_get_match_data(dev); + dsi->plat_data = of_device_get_match_data(dev); + dsi->driver_data = exynos_dsi_types[dsi->plat_data->hw_type]; dsi->supplies[0].supply = "vddcore"; dsi->supplies[1].supply = "vddio"; @@ -1862,6 +1870,51 @@ static const struct dev_pm_ops exynos_dsi_pm_ops = { pm_runtime_force_resume) }; +static const struct exynos_dsi_plat_data exynos3250_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS3250, +}; + +static const struct exynos_dsi_plat_data exynos4210_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS4210, +}; + +static const struct exynos_dsi_plat_data exynos5410_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5410, +}; + +static const struct exynos_dsi_plat_data exynos5422_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5422, +}; + +static const struct exynos_dsi_plat_data exynos5433_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5433, +}; + +static const struct of_device_id exynos_dsi_of_match[] = { + { + .compatible = "samsung,exynos3250-mipi-dsi", + .data = &exynos3250_dsi_pdata, + }, + { + .compatible = "samsung,exynos4210-mipi-dsi", + .data = &exynos4210_dsi_pdata, + }, + { + .compatible = "samsung,exynos5410-mipi-dsi", + .data = &exynos5410_dsi_pdata, + }, + { + .compatible = "samsung,exynos5422-mipi-dsi", + .data = &exynos5422_dsi_pdata, + }, + { + .compatible = "samsung,exynos5433-mipi-dsi", + .data = &exynos5433_dsi_pdata, + }, + { /* sentinel. */ } +}; +MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); + struct platform_driver dsi_driver = { .probe = exynos_dsi_probe, .remove = exynos_dsi_remove,