From patchwork Mon Feb 27 11:39:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2747 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8DF023F9C2 for ; Mon, 27 Feb 2023 12:40:28 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id t185-20020a635fc2000000b00502e332493fsf1788860pgb.12 for ; Mon, 27 Feb 2023 03:40:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677498027; cv=pass; d=google.com; s=arc-20160816; b=eTQA4yrF+Q2O3fiM6IgJXob+FOBWByJ2zcxKObcVNVH90ephJCwu5079MQ/KA2WpED WIUJg6Ry7ldtXth/LC50FRZRd4v7a3/fckCQ4qWEIoMZm0Z9eZ4aepV8Ve6N97vcpNtk arB6iPYF5BH47oQQVQfRiGOVxX0QsPywxNqAlImXgL/QVtlbH0sRj9lSVelA4+t40SRX HZ87KOrKHmmYfGNVzcoud5tY/MEH7wAeUcqloKgDtsj2u8blzV9212E9CaiBOAkTuRxa gqZeryPLultBgVcM1gyLUcYULEOFGXQaIflImP3V8hluIwfZRQAKoYBRyYNlfbP6hDwC 2MwQ== 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=5pMj6UDO7ZqMMA0luGGI04Sml4DsgPfi6gWVvFexHyU=; b=YVtM9z4hCuBjyYynZgcdUkzRGzmBeJotdS+l5iWslloXBWdRnO+p3o8O1vpipTgoKS VBb3ubVMAYAHEL/sM5qAr0UzXAkKvscTON5ZqsiiCBNtF6CT8YpbOFmBRPXCAq8r0cqz s9/MyeNCAPVT8eitb8GUrPfwpLK7QU8QI0h/fb0dKj7FrE5Zfygka4H395PVGSJGxxzL 49a4jc78FIYgpIYX7OXmWVARMY7MSbwIdmUiRxB7t26rcxWat+q1pVUUUGYUBXIJxCQu G6hjDxc8wm6U2HsQKPoThBXRK+SMLI6R8MqFKHGxInHvVh88jMnf1enC8bCnSClZr3P1 IARg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jpNudG2O; 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=5pMj6UDO7ZqMMA0luGGI04Sml4DsgPfi6gWVvFexHyU=; b=IC3hYttA1NhxxYcMsQ+AL9TO5t8E+GSvaofUBmhMQPVCNgDdw927p2S80P6eFBAJHx VG3BdkMkE5HF+NhvoZ5CTHrcWL1FNyd6uSxvjdlOV4ssgwpnQ5axA/dILM9+c0RGPtqo ksjvuqXFn4DL3FMRtyrIizGmRiBIwojPATK8c= 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=5pMj6UDO7ZqMMA0luGGI04Sml4DsgPfi6gWVvFexHyU=; b=5ye7YwFAjfcC1dNYHMpTzbNLmF1Zr5DhIHzRIijA0XO+WsLtnntQKfnA9Gdby2w9n4 SeFFYVR5qGN8UnH9Gp89z0rhnaWqVruQPT/lKvfP2MtbknuJWGndyDRz5Wui0xXXcXFv P1I1M6BjiO+5jkl2ThO7Essg7yFB/lDGNIZD+z+ZBBXtWbFKut+0sA4aFEiHDm0Zt+ty MgpmkmqWCD9XHwwx2eHgrf7e9DhG5VXu/e3xnCxstAOsWxsVLk07eXnjebppxPobrEuq NbtAyi7oa4tyUGZCq0bQ8WgFU3fCIN1G7P45hfNvJXgUyQd+aj6y7hDvf/J7LD3S5Eky M9vQ== X-Gm-Message-State: AO0yUKVAQ5/cdGchI7mD7jcMEEWYruO2zWjhMSqK49Izt6EeQzqL8L1u AweL0sDwFe0/luj3CRdXJrV+wNia X-Google-Smtp-Source: AK7set/md6Rzd3lEy6nEulxnS6HN0T3qPYToptDkX6GAoAaP/L0XpHoliAA1iypiGPywwjjt90VQkA== X-Received: by 2002:aa7:87cf:0:b0:5a8:fc35:8e99 with SMTP id i15-20020aa787cf000000b005a8fc358e99mr5626039pfo.4.1677498027368; Mon, 27 Feb 2023 03:40:27 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d50d:b0:199:50f5:6729 with SMTP id b13-20020a170902d50d00b0019950f56729ls10425570plg.11.-pod-prod-gmail; Mon, 27 Feb 2023 03:40:26 -0800 (PST) X-Received: by 2002:a17:902:f990:b0:19c:df17:7c99 with SMTP id ky16-20020a170902f99000b0019cdf177c99mr9508741plb.33.1677498026573; Mon, 27 Feb 2023 03:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677498026; cv=none; d=google.com; s=arc-20160816; b=sEOf7qWIGkEuMBaHUQL08NGdD3MDO+R6HspV7CqHT5czWEKOZ2PMKeWjd4/xDTgrEm MFomZiIHduex+lwcPdZnnW30FPURddD5cjy1/rbv2EyMToS8AixatIWiG8NNNKlt/1pe Vx4YAH6em//X/TxXGe+jmFd0CXvzNragQTeAiVmLd00ZFXFo7p8cgFR+Twi/cChhdEbR ykrqLSqJ1ZP8X9EfS3MNpMYuViyrxipQsXutTtVSTCx30RoJZs9C5Oq/fyn+Ics/VbHI s4YfRsNk2jHazJHTLl/zfi1ztu933ZZ9gdpGtTEKMyKm89IZonI04mXT8lsSaFrvdRhE o2pA== 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=42ThMJ2/t+fXcxS7gPtZrrUkoIWrhAnkLbSBJwEbg+c=; b=bjNaspbe/Y27pLsX3qzFTI38mgXHTGWRBUv1w/IEkC3e+xfcjXrEkNYeyiueKYKrt7 EBGzuvXPUFiTw4h8SluzkmMlSpJVCwkNXpJcVY4hhhnp2nYtYmlBOKfZxN3ATXHD6rAP DvGD8/ExRxwI/i2Y0L8qInxlBAwu4MXOhYfA2FhPVaZ96pWYBF2F5JZNw7vipXUEiSr3 65989CAN7JDMRY2qqaW7nRoS29Z5OhobRthZZIKG4wv/u+iwmZ7hobTRmZD2wuVDpkwz FY/1DXlCIoP5jEdH6lNDhYDkq/0ORX1ho9JWzZ62sBPpbeez3Gc4pmOWsiZSRyxeH7mG QmxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jpNudG2O; 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 jc4-20020a17090325c400b0019c97fadf44sor2351935plb.15.2023.02.27.03.40.26 for (Google Transport Security); Mon, 27 Feb 2023 03:40:26 -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:22c8:b0:19b:64bb:d547 with SMTP id y8-20020a17090322c800b0019b64bbd547mr26874568plg.62.1677498026250; Mon, 27 Feb 2023 03:40:26 -0800 (PST) Received: from localhost.localdomain ([94.140.8.120]) by smtp.gmail.com with ESMTPSA id k10-20020a170902ba8a00b0019c919bccf8sm4395277pls.86.2023.02.27.03.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 03:40:25 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , 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 v13 07/18] drm: exynos: dsi: Introduce hw_type platform data Date: Mon, 27 Feb 2023 17:09:14 +0530 Message-Id: <20230227113925.875425-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227113925.875425-1-jagan@amarulasolutions.com> References: <20230227113925.875425-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=jpNudG2O; 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 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 8eac1c6e35c2..9217b362224a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -255,6 +255,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; @@ -268,6 +277,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; @@ -298,6 +311,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) @@ -525,18 +539,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) @@ -1469,8 +1478,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) { @@ -1671,7 +1678,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"; @@ -1829,6 +1837,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,