From patchwork Thu Jan 26 14:44:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2680 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 38E7E3F046 for ; Thu, 26 Jan 2023 15:46:09 +0100 (CET) Received: by mail-pf1-f197.google.com with SMTP id c5-20020aa78805000000b0058d983c708asf1023503pfo.22 for ; Thu, 26 Jan 2023 06:46:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674744368; cv=pass; d=google.com; s=arc-20160816; b=qeZnH8lsZs8fcKmNINollnKRoMMbfxiGFSOvvvrNNYHvJ6PnSA4qKJzV2gQ1C6D8Ot EU9S60dMg6zYVYLhFaIllKqrMjrNxwIPFbLIxqzv+FmGrprQeOQj/vnMNmJviZdlAYd9 MkmOcNldCttEsGZwsyOh0Kct/Ah6GYyalvLL6G0bYGhzsAHa2gkUG5dL6Z7Ai3eCCSuO WaixVFtCmy65Vfy2GckQGQsNdgJ8lPPvMdWdbWZtUnimENhqTQmX+Sp9XUnQg35iiDDY HUZotqy0iX351oiwL+HAHuE9JbCWxASI8s+ibtHETVojwHevOqQCvm0IcVdv8Fo1SbR3 sZlw== 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=G5AYDUuk8gxdK+L5/ZdBVuJz+6Oo/zBITkF+mcw8XWU=; b=iajr0a3mKC4KkJmIQty8mMC0uUpFRQivBkLBaGogLvVUPaRdltU4emzN4qXF6glE3x QKU/DH0hg609MnF70/Z75T2IoMdkg5ijUwh4l9RnwlMKvLPM+5IeePIl+OpOeuDv0Gx2 dAGGFSNqA9vcagpY4WnkmwCamoho2Fue30qXRkBTfCHoVGK9rF0HHkKrA1OOHsltph8r lMw2ss4gghh42+oKghXgj0UPn8EB3QQV2Wif8+R/NoiqslHjC+1gzk3PHafmrVWCP7jb YhCRrYyhhmBaF5b3yaDLZVDXQIPeCpq6FcwJ0OD1NwtfZLA6eO3Ke2yc0lue/2hwi1P4 tPyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=atzopN0Z; 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; 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=G5AYDUuk8gxdK+L5/ZdBVuJz+6Oo/zBITkF+mcw8XWU=; b=j7cx6bxGmTXi/kIrFvNwCYvyVngBfp/Hpz5m5iBt8r+GTF0u+0pSRzdThERMBtQ4hi xQQZALvXVNBawV2fLzbFkLBBmylFhAk20gublJlg5OUxyRquOIeUxOLcrHRPQKvkiol3 FCqHJuv+w4qakJSKwmII4p1As/zV6GwF8iO44= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=G5AYDUuk8gxdK+L5/ZdBVuJz+6Oo/zBITkF+mcw8XWU=; b=o++VxsYbpa4GNHcJhAfbOFk5uJj4Jx3aJPMRNvhDp4ONGXwbv11A5N9RYby/ZsfcII 45y6WEezdvsfE0eZGmouoWMV3yInY6kSVgkuuXf1ctE5bhlNVyd2k+YKh34LWIpkFXjC rZMhdy/1JeWIEfkO7c8NimfHE77MLeFG/AEYTq7gb02cDnu94tXyo5eS8oI2l5+JsdOL yHaKG5VDn0IteVtjWpXghIdsHnDBe7ntS5+QrP29eW8jwZB6F210Dmwi25x3Xn3cXcvY r6PMJjvD1Aa9F7YaIQNRjWqJaZIPeZ0wXwmLlPRDp/st0b5Shi4a7OpHzonnIbrx9odM 1LDg== X-Gm-Message-State: AFqh2kqCNoyDH/1VPKN0l0usHEHyzWNlHEmXfGEUx9jXHBc5Txky5ECI ovVeRpNs3sHVTI7+d3r18fBWoQCo X-Google-Smtp-Source: AMrXdXvx8ZWuAHDrJksatJbje+xB/9IEEk03EBAkrzQHfRg0qnQyUWXDEuOwi4Qrh7UKc2Q+lcwaFw== X-Received: by 2002:a17:90a:30d:b0:215:f80c:18e6 with SMTP id 13-20020a17090a030d00b00215f80c18e6mr5324702pje.45.1674744368068; Thu, 26 Jan 2023 06:46:08 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:bb97:b0:196:f81:2760 with SMTP id m23-20020a170902bb9700b001960f812760ls2379320pls.2.-pod-prod-gmail; Thu, 26 Jan 2023 06:46:07 -0800 (PST) X-Received: by 2002:a17:90a:1917:b0:22c:3a4f:83bf with SMTP id 23-20020a17090a191700b0022c3a4f83bfmr278412pjg.9.1674744367105; Thu, 26 Jan 2023 06:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674744367; cv=none; d=google.com; s=arc-20160816; b=sq3Nj1wzrlQpI+BaGK6X60Ia3MawWuQFOcJ4PaxftLcRhUChYyUW1S06GMM5dry2am 6Oq8VFs/txmtcl8xNWmchAVvYwqvP44OHW3agbtqiko3IYJcbAQGHGkpYSHKjRiG2zl2 PWrU2PWUI//kFB6DHZurYYTO1lUsWR6HLAFaQGMZD8z7eC2CKnc9EMh64PaNmSpaG6NM eoIqLy1VF4phtyZb7BO+0T4lxaopia4aXOnvJjkf85+/KPvBQQ4yKYH22DpnymY6XxP6 kj388BwlBbgHUm9HJv29F6TuWS98NKP0rdwfuJ+FuGchds9yB6ujb4OQsJVPT6CjyRcf 1xPQ== 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=4zNn/ghEcnKtGn+53b6UsMOLZnA5YwEKlrMufet3kNE=; b=iRWg5C/uAwvcJUhur/CdEM343vAU303qmD4roxL7gNVKDcgVmp6LJy5akPNysKa0vh 98vD7L5CfoHZzy0u9rguZeB78Y6ocEF0Tly3shSDoNvccDyTGRw1HW8kZtsapsAuLodi ZZ76OT19it3QYs8GoMqpZcWQUxT7nbj1SaTkXxICYL88hkhSOKBiCqBxr/KqfIdi0izB /aQ7vrdxrqE+ItzhUINiYmTYtZVgYYkdjTxb4qo5yTLJLqtWyEkIx3nSS/stZ8y9/Okf jPSrvfvB4M7wLBwJ26LFvN/mcum398mq8rbLlMqjmi14tQc5Mq3inavHTO2Ejged6TRr bS9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=atzopN0Z; 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 c5-20020a17090a1d0500b0022722f138dfsor2220397pjd.32.2023.01.26.06.46.07 for (Google Transport Security); Thu, 26 Jan 2023 06:46:07 -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:90b:4b83:b0:22b:eb43:a1b9 with SMTP id lr3-20020a17090b4b8300b0022beb43a1b9mr10827566pjb.41.1674744366758; Thu, 26 Jan 2023 06:46:06 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a238:3cb1:2156:ef87:8af5]) by smtp.gmail.com with ESMTPSA id d197-20020a6336ce000000b0042988a04bfdsm823660pga.9.2023.01.26.06.45.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:46:06 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Robert Foss , Laurent Pinchart , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [PATCH v12 07/18] drm: exynos: dsi: Introduce hw_type platform data Date: Thu, 26 Jan 2023 20:14:16 +0530 Message-Id: <20230126144427.607098-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com> References: <20230126144427.607098-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=atzopN0Z; 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. Reviewed-by: Marek Vasut Reviewed-by: Frieder Schrempf Suggested-by: Marek Szyprowski Signed-off-by: Jagan Teki --- 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 7a845badb1b2..902bd46964cb 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) { @@ -1659,7 +1666,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"; @@ -1817,6 +1825,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,