From patchwork Mon Jan 23 15:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2661 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5135F3F039 for ; Mon, 23 Jan 2023 16:13:22 +0100 (CET) Received: by mail-pl1-f198.google.com with SMTP id s5-20020a170903214500b00195e3b26848sf5203631ple.7 for ; Mon, 23 Jan 2023 07:13:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674486802; cv=pass; d=google.com; s=arc-20160816; b=HO0xSsBlkkHRlAQAQG/9XczRAG6yfSyqEtoTNl6UdIsVo8yA2gYvZwHXNoqLuSJQfB j3oFmes3nbIJMQx7cDmvldeWpVyXQgqIvVtfk6hjC8QRje8A4jjAbQO+nvBPgJOK1ybc fUzkkHm08OgSYSQUxsgXqgjIH5l4mVww+/dpgBqJHTQaypMR8RXjGuBUpO6TfedoxbeB wTViy8Ac6TMMW/wWhQvx+MbpJoZPNbJSy3fgAxT+tWnNrZGK5OkUnlgM0VOFkGoSL8sD nIDEHGK2vk9FRrLzABvdrbSVFx0PhUuIPXoAncJUJMqg3gs45XI8Ae2bnIifQrV+Pkr8 N8WQ== 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=d4bfE6lYKReG3TKYurgl3q/pvTXTdtnR6aaXcUzjJNgZiV64MRV6gdJcgw3s5g/+wI k6LDVpxGvpXdx5/VZc+6jkDsP8wER1v0VlIzklsKx/0jhKbzfBSX0Ccg8OS8EuaYhcXJ bEpQ1POzT4l8d9ZYpILQblMEYXqt7TQZDRlr1tL9rEI0E9xBHfiDfFjcbb7p0NX04wRc WNaf/DMm8ipDJnoNQ/WVRpQEPTcOxEiH+kV+ndNDQ7UdVZB18rFxV+JjWyS2JB7aDcK7 yJJstuQCIZtj+Ls7Gc58urvAUD/ceX41XgVrAUgEpig21BnivEtimwKxpq/2VdlQW9rp twFg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rNYUxj7H; 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=G6OVDBZnye80mYX8oNODSUb6cjeWKp2OpJRp0RkSxUpO1odhw1hk3V210IXBHnKJ8O 4UowqwC6e09dTY8KNZ/PIx0u2PlqVazrac/BOwOZA5ilzcADYYctZtZ6AivjtTyszoHV t0LAwMxekrMlBr1J9oVnMvxXL5DLOjUGbGnOs= 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=MTkusreg8Dz7PoA1QN7V1b9e15CwWJTZcgQQ047GT2+NPA3IG9D+eBjqd5gYfIIA68 gqzzr3v3WATDFeUsqXziVdGDvFzHXyF8ACAynkP28tCI3DaHe0rbG/4WZm9/IsnmTyS3 mQUx0swYltUpVxlKyaOWgqssUhl4cg6vHX420EHPeEIG58C06NT/kg2F1Pcp7sO0ROFy 75qFMiH9pdZMIuvQL3OP9ZoqIXX7VACTOFyALJsGMd8X+98g1KsrCMGopg7einEMcr3w cXyY1bMr5xQEADKobZD8q19hcp5rhJ5h4864M+TO4le9976SMzbR8j1t0kHoBJv4Pxfs TiHA== X-Gm-Message-State: AFqh2kq/0VGSGKzow5hL8584A5MwRcxbN3kADmluN3kK8XgJ7awwYlLW q1UXo67L9dgX54F1HWMbKbqQqDGP X-Google-Smtp-Source: AMrXdXugeqjW3OUF4lGEZ/Joo9aDattWUNcPQ9Xzts01FoREsiYIuxkOPxs0w9rhSzxSP+97ZgzZwA== X-Received: by 2002:a63:4e57:0:b0:4cf:977f:6eb1 with SMTP id o23-20020a634e57000000b004cf977f6eb1mr2164088pgl.216.1674486801927; Mon, 23 Jan 2023 07:13:21 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:b406:b0:189:b2b2:56d5 with SMTP id x6-20020a170902b40600b00189b2b256d5ls13175202plr.0.-pod-prod-gmail; Mon, 23 Jan 2023 07:13:21 -0800 (PST) X-Received: by 2002:a17:902:cec4:b0:195:f3d5:bead with SMTP id d4-20020a170902cec400b00195f3d5beadmr12107675plg.36.1674486800837; Mon, 23 Jan 2023 07:13:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486800; cv=none; d=google.com; s=arc-20160816; b=xK9N1LNCbrRS3qXTu4fRSJTx9ebo1wTtpJkYuHtjKaZdsipJ2bqPCJC9mckTl3nFRo sSPqyHj8JYJ7rUAtXeGzBuXBRlOsUL57QFKsSU8ZiFBBoTiPXYmdcxKCvQaTPlM670PQ nm5NFjBAi4p7nY29q9GR+KBtr45uggtck/FATtGlA0Ey1LXrdcQFtPPPOiykv5xhad3T m4UAR3ljJv8ZXtOSM9DCWBi8r0YhlCNV7KMxSKFfby8dfain2XdFJW7pSTsBt0rIt5YC UcKOrO5UiylmIHqUYVOexO6x3p+xOzca6vCJK2Pfo6gGIrQVh6/cyNlc/bwO/aNNAOl6 Bj2A== 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=lMGVE21U8928XSd0x+P3nNSSvmwYfq4/zfiDymyFJKDz3R5DHQ6v9hfaEA0ExF/Zqg 57e2iMTChqWVI6M9P/ncz4tEuBqTWplrqOTogfCbsjkHEETd9hXk9HqgU6HaB5ob/4xv JHkuw600ORwSx9Pi+rOYxfKQ/aAYCsLzunrTQB8k4FVLslKH+eChjJrX4jCT/NFWsJG0 CYP1gPfVvVFYOGdntcwjob/ve0mcs+HmI3PvgL1rtLPNP2kYKpJALbcFhnGfAvhmH8pU YBxR7SwJVQ39URbr17f7MyJJC+cyjLC5UUkHyYrdLGcSmf8kU8ky2n8L3aGmcmIg3/Kt iV1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rNYUxj7H; 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 o18-20020a170902779200b001949e879626sor8606918pll.75.2023.01.23.07.13.20 for (Google Transport Security); Mon, 23 Jan 2023 07:13:20 -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:8304:b0:194:9de0:bed1 with SMTP id bd4-20020a170902830400b001949de0bed1mr22176414plb.32.1674486800519; Mon, 23 Jan 2023 07:13:20 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id d5-20020a170903230500b001754fa42065sm19207111plh.143.2023.01.23.07.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:13:19 -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: [RESEND PATCH v11 07/18] drm: exynos: dsi: Introduce hw_type platform data Date: Mon, 23 Jan 2023 20:42:01 +0530 Message-Id: <20230123151212.269082-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123151212.269082-1-jagan@amarulasolutions.com> References: <20230123151212.269082-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=rNYUxj7H; 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 Reviewed-by: Marek Vasut --- 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,