From patchwork Mon Jan 23 12:23:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2642 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id AB1BB3F039 for ; Mon, 23 Jan 2023 13:24:29 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id l7-20020a62be07000000b0058de3976793sf5225106pff.18 for ; Mon, 23 Jan 2023 04:24:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674476668; cv=pass; d=google.com; s=arc-20160816; b=ByEzHP6wuABkR9ovEY3bcswrjgJOk0Iic+29FdvC4ghb5F19oVBwYWPFptVmP7oEfX vThdoe+ePcWTnK0qp1jz7edfAOZ4ziPJSj7EVQwBvPnjgt8zIZpOjAAjT180FWc7Fx0L WgkiP62mu7avBgWRKqiwaGbXIUS7l3X07+vZeR1OfcknNJE+Z4/rxyzHV5Z5ftf9A+i0 kbPK1s4Ax/HOUWAeKVZp4gZWJHaA7ScxAdYtP78JUcGhsP506tVKSg5mMqX9Z+vAHWc1 fq4uEpUeCvom8I7px9fjaUsbtQ9dTrt2mwgn6lJlIijqI6n6st+9V6ZU5ww4+pnEGFkC 3kTw== 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=lSzeO6hBSceBA8RS5jVGAPZfCtVU/53KSfg1EUbTTzY=; b=alX+FqxGTpcLcybuW5l65KZcZ7JYKoEOW2OEOVDualRnlMmt/eUcfdXJcGbW08CpIJ 53xNApIBO9cxeR8i7WGcIDyRGpbir/TZy6v8UBi2BPbFhJGYxLLs6NdeYIhe51G5VQNZ ruteCEzdIAAjiuHiAUad6Qv7c2EdjNfB6EHhCVbs3LgsvveGbVE2VTLSFd6FKveUYGSw o/He7zGDpWh8hnr51wdn1noGt06pEN4RFQtsdD9m7d4M3/Z6QwL71qziHxQbRrOD9451 tMDlLCjco10IpU0VHYdakp0ctUAYs8t8AjkclrQaxuV3uCu11xwKAQzjCaggPHE3y6Ki nVsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eNjD6AW8; 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=lSzeO6hBSceBA8RS5jVGAPZfCtVU/53KSfg1EUbTTzY=; b=M58PJxJ0Q6docYN+ioNZGxKouSCCxZbh1XavFnUFf2e7bZquwz3/YuhK7OuJViBxRq v1vIvIALLcmFUd2sTZl/HcQz1gMZeLNrLJZw+tmfktWq6JwseuokzzjWFdNzwlbxTC4P 6u5YcPlgRAd7W6L/NDvd498T4mv4q9ai1BxWQ= 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=lSzeO6hBSceBA8RS5jVGAPZfCtVU/53KSfg1EUbTTzY=; b=UEqsLeirWpV4wEjITwQyZhwqZ3Ryo8thCRlX8hnA7E4DiQqLiBJJvfx8nYa11NW+cA 3e2I+z4itOB6HehwCqfCBPIH+XuzHhefEquTNvZjdwbpDJs5Z5jyOh/zCcANorpn4oOj YUeqpETcPx7lpwNmY3yfsefrxVAAKQpT+5RKZ+GINYJUyJJHI6tXB2sB6UkS3k+Tmzyu D+YGWQzBzY9R9UToGUhiBhx32y725T6dmMfJW6u3FiOyYp/WDP6/J81eleEC0LyeQx8Y EHwl2U1Ox4fhWJt4VmStG/bole+4PtsrG/4HEIj9/096ORcoYyuIdUWn2y6pPH6RU0tJ 19zA== X-Gm-Message-State: AFqh2kp/8qkPS0xlrLmf7JJ1lsHj1MYoBH9mYBd3dGxNmocF9MQWiAz4 jMcNAhvvV7PhSBzdwbi5la75txd+ X-Google-Smtp-Source: AMrXdXuEX5FQa17SidnI/Tpwb8CsR6pSDptt+5KuhnJFeu5u2yOa0t3l7tFdgmawwHIbxpQyu1zrdA== X-Received: by 2002:a62:e118:0:b0:581:8b72:35db with SMTP id q24-20020a62e118000000b005818b7235dbmr2660990pfh.5.1674476668462; Mon, 23 Jan 2023 04:24:28 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:d507:b0:22b:b830:313 with SMTP id t7-20020a17090ad50700b0022bb8300313ls8132634pju.3.-pod-control-gmail; Mon, 23 Jan 2023 04:24:27 -0800 (PST) X-Received: by 2002:a17:903:244f:b0:194:6400:cd37 with SMTP id l15-20020a170903244f00b001946400cd37mr34399274pls.14.1674476667439; Mon, 23 Jan 2023 04:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674476667; cv=none; d=google.com; s=arc-20160816; b=jnNSMHHlYKHVv7i9Wcfz+dWKBhwx2vxEMkR0sml8hvNJ+8m09Bf2s/xVXc/bA5/4tL m43qyyHvveJjr6W1uhDxC7NVncLQzYr6VF+ocuhEG5TpuqaiK/JF+IIowaBx5iyaiQNX gtFWSihhJn6INTTkMuULXf8zuQYwuG/9OynasTkYVVGPkRfZI2Y01ATb1gTbsA/kH6rU jSYestMOM1g4POw+JOkS5hsw3TKUE8fiCL9XbWcj/Og0BCSnFEzifvkXBgdksUfwCl6S /9eyPY7bqzrL+eJuf5+YajvnyB4XLGhK1h4Hyz47oPNZXYsKmryPXnpCi3UMARR5vEXP /q6w== 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=JAvQp2V3Vm1L1L/g4jdQdxESIHHdfq30+cBP/7icSHY=; b=K9k/5ezQSlVoaguFH5zofO5VUfVDrJJeArv61GD2apzA89oTHf2xcrDgRnIYET0EHk gp4MwKbV1oQMgGpJ85Gc/NE7+p+9J0bCsg0+Xj6b/XLSHDUQrBIUpf/TOQIXqToegrak Hxo06Httma1ds7P0SQeKcIHG4EFXEupWq6aRJ8Cp48YR+HeiXbAo1w0lzBJQQMj+SSE6 G4Or8MaGwyWLA2vbnBKAzf6xLAV55vc9VSHvh5oD/0ktwS9NzDu0/20+oCyPa0zUyzL8 DDe6RcdcR/duDzlDUr52PuggsYGmTojPGZYBCMIUSLWjH4+P6t+XUDV63TcDjBivzX2Q z/6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eNjD6AW8; 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 e8-20020a170902744800b00194768d4461sor2812281plt.148.2023.01.23.04.24.27 for (Google Transport Security); Mon, 23 Jan 2023 04:24:27 -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:902:7889:b0:192:b5a8:3eb6 with SMTP id q9-20020a170902788900b00192b5a83eb6mr20874074pll.44.1674476667125; Mon, 23 Jan 2023 04:24:27 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id w10-20020a170902e88a00b001960806728asm1291811plg.88.2023.01.23.04.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 04:24:26 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , 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 v11 07/18] drm: exynos: dsi: Introduce hw_type platform data Date: Mon, 23 Jan 2023 17:53:08 +0530 Message-Id: <20230123122319.261341-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123122319.261341-1-jagan@amarulasolutions.com> References: <20230123122319.261341-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=eNjD6AW8; 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: Frieder Schrempf Suggested-by: Marek Szyprowski Signed-off-by: Jagan Teki --- 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,