From patchwork Wed Jul 20 15:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2191 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 929793F03E for ; Wed, 20 Jul 2022 17:53:01 +0200 (CEST) Received: by mail-pj1-f69.google.com with SMTP id r13-20020a17090a454d00b001f04dfc6195sf1293643pjm.2 for ; Wed, 20 Jul 2022 08:53:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658332380; cv=pass; d=google.com; s=arc-20160816; b=dT8xvnYDBvzEfakcJhaTEvAFGMjkR/o4UAbuQzK/OUvm45JFggvZEbvKWdgaUPoD3n UcNxhmJeRwbUdIOLO0GQ5kbnrBV27V3tszYbx0GST8nNNfGjx6kK71NhsSHboL9KMhBw +kRcSC+PwqQigifIH5u8ite+a9lVxvhUbYqtW9u/jvYen+COUbzp8k0VgZR1Nb0XuX3+ DTc3M4KPxPEO9NXaVnjcmr7YwPt/C43rpXxQZ6EMtK0nlEgAOgSnDROkgkdKhrs+wmd6 J1DglRNC0NdUTa5bcg8EincshtCi83FVvQc7Ad8yaVqAzL9rNMk1udVAzwCpAxpuIUAa 53WA== 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=S9qqh82dKdPolqJ7c80aGvKtxD7ryle0W5CyzbajKjI=; b=FNAlVY6Ukfz/OQfqB2Ts8h2gHS5XmRW/pGlYAz00A7uiI/C64WMkRyYXtQwPeGKT3S GjWKrk+78SXUPO6FQs59YzV4mdFXLbP6bnYZS8eAC3wefG5cVoctw+6Gb+BhamxPJb2X SRPGQN9In+K/Xcr2BPrg6rrHn0JP0HTrFhqNLXMTFOHF7vgWjnPyjgj/WfjmPpTPIuis ppm8YrS0Y8PAfFeJDDS4mfRqvfac/aTT27S6ooAA60BvSCzzaJ/7mUTLj8kpLFrARE30 FNHcpMN6NN8lnaJLRrgjxEtJMW6V9msXzmKmRx8AgA7OBhowP3Q5LxYvW8gCzsnUxAa4 Oc2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QE+SPnmp; 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=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=S9qqh82dKdPolqJ7c80aGvKtxD7ryle0W5CyzbajKjI=; b=nekK8+3xd5D61ULey5MTxKZETN8+wcN6WkgqFUzJECiT+2j9vtb3xr1GFeppaFdyZK 3Ayc+9cYnpEQv4tOcrJ3vj7drFkhOXcXF+PxQbaxRtEvS+xBvPFrR4uwmeBjCHPBq+lb XoYpJ1t2xsOUkmBUf9X5RtByFnxF9TLnvHyU0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=S9qqh82dKdPolqJ7c80aGvKtxD7ryle0W5CyzbajKjI=; b=KUMaFryAdluoA9oI0f8983Y/gPXHU24s2OLPQQ6UVp/Eb7makaZNDPxcOI3DbnNU5R pXUQykT/dNQNHascmQDgzTCxI6idouVXpUkrgdjKK6jcZPVLLlggcudj6IjwSqL7Tjmj UHmpgzj9DlVd8n5USTnu+EQF4zf2njQT2GE8oS4sk4UEQxz1WrscMCBI8ZDbTeemP8VK 98uHNS//dOnnD73b0oB2K1xBnD8sg7Hmlw6o/WR7lrogzEI8e8vD6zojX1g/6G8t1+J2 7PqCe645rr5pU1Ww9QP8qEvtx+vKZMAJ4AWGeAa1leHNNdjVzlI/1hKKBcdoaeA/S3ue bkgQ== X-Gm-Message-State: AJIora9XN9JkeMWH9It5p28x6ZsvUUAL3b/EeEihZwdJJC6KwKxMRYgI mdGgVrz5sj91OH/RbRCOvTcgYC82 X-Google-Smtp-Source: AGRyM1t0KmPZBX8/50ImafYfHlDrF7p0VcBHM02vvKPHqGz2FipQVSQMNiXQ+8GS4vooUtWRbYlTFw== X-Received: by 2002:a17:90a:5d05:b0:1ef:91ab:de15 with SMTP id s5-20020a17090a5d0500b001ef91abde15mr6100494pji.85.1658332380294; Wed, 20 Jul 2022 08:53:00 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:7308:b0:1ef:8e4b:444d with SMTP id m8-20020a17090a730800b001ef8e4b444dls1031202pjk.0.-pod-control-gmail; Wed, 20 Jul 2022 08:52:59 -0700 (PDT) X-Received: by 2002:a17:902:d544:b0:16b:d981:5c2e with SMTP id z4-20020a170902d54400b0016bd9815c2emr38273105plf.22.1658332379439; Wed, 20 Jul 2022 08:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658332379; cv=none; d=google.com; s=arc-20160816; b=Yzct6TH79/hZKAVEolmeNTnhufsxhOS5BWnAm97r78HHjur5IAtorKNsS15Vkm/yQU QoOQeqyabQsDi7ayS9GjFKOEsidsP4zcVTBWZ8Pok3I4qiXstZr47M98MqoqbcOfxUhW hVuqFZUqvcNcK3+xw3eBh2OonH0jSMB9twV4WCu09nHhDNQkPGnRtgDjYoxUvPQm5ppZ b0llH+pjrlEKiJZYaC4vjoTxvB2XmVSIrFV15v4dfJYF8NyULmfX3hS4ApxUra8g0kqA dkWT32lqICNAw2ozq0YkXH4rW84DV8//FxvUjsFd0MnM8Vv62pjAdImdzhleXRj+2jU6 yY9Q== 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=SvFqcqX31Dpa8PvnhTvPWiOoGd8kdnJv5vFHkC7+/vs=; b=jxng4tTxs3boQBnyFTpKS67WRwEh+lAhH7lwpzDsMAp3BKvWE/V+VP4vc2Hj7M1QFm wL+pqNHqp6LJDotAU/ncKzpDRI2N+SCvD4huqsD9McVukLaUq5+NvTrjsZAW+Q0Z5Zsr hc7NvK/Iut4ccEmfBmsQuzN1DNMq2c1/8tH2aE34nfvTIRv1hZEAmUvqo0fiMMgK7sqv jnMG7P5xNQXBQOburL80lGQQdILYuWtuzfEWxlf/oQCcYRN1YBn4GafEEkbbykX6n1uR zcBJS5sxQCbspESOl1pZRCfPAqSNhZUpwhA0l0yRgPzhDX4anguzG9x0zE8cFGqyMzLE caGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QE+SPnmp; 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 r6-20020a634406000000b00412aa42c665sor7901076pga.38.2022.07.20.08.52.59 for (Google Transport Security); Wed, 20 Jul 2022 08:52:59 -0700 (PDT) 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:a63:5cc:0:b0:412:b2ea:c6fe with SMTP id 195-20020a6305cc000000b00412b2eac6femr34992899pgf.596.1658332379069; Wed, 20 Jul 2022 08:52:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d177:d5:aee:4f03]) by smtp.gmail.com with ESMTPSA id a8-20020a170902710800b0015e8d4eb1d7sm13919198pll.33.2022.07.20.08.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:52:58 -0700 (PDT) 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 v3 04/13] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Wed, 20 Jul 2022 21:22:01 +0530 Message-Id: <20220720155210.365977-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720155210.365977-1-jagan@amarulasolutions.com> References: <20220720155210.365977-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=QE+SPnmp; 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: , In order to make a common Samsung DSIM bridge driver some platform specific glue code needs to maintain separately as it is hard to maintain platform specific glue and conventional component_ops on the drm bridge drivers side. This patch is trying to support that glue code initialization based on the DSIM_QUIRK_PLAT_DATA set from respective driver_data. So, the platforms which enable DSIM_QUIRK_PLAT_DATA flags will handle all platform specific initialization via samsung_dsim_plat_probe. The platform probe is responsible to - initialize samsung_dsim_plat_data and install hooks - initialize component_ops - preserve samsung_dsim structure pointer v3: * update samsung_dsim_plat_probe return value * add plat_data quirk to handle platform init v2: * fix samsung_dsim_plat_probe return pointer v1: * use platform_init instead of exynos_specific * handle component_ops in glue code Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 16 ++++++++++++++-- include/drm/bridge/samsung-dsim.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 20db345abf8b..4d5f72de2240 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -369,6 +369,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -381,6 +382,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -391,6 +393,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { @@ -402,6 +405,7 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .wait_for_reset = 0, .num_bits_resol = 12, .reg_values = exynos5433_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { @@ -413,6 +417,7 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 12, .reg_values = exynos5422_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct of_device_id samsung_dsim_of_match[] = { @@ -1609,7 +1614,11 @@ static int samsung_dsim_probe(struct platform_device *pdev) dsi->bridge.of_node = dev->of_node; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; - ret = samsung_dsim_plat_probe(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + ret = samsung_dsim_plat_probe(dsi); + else + ret = mipi_dsi_host_register(&dsi->dsi_host); + if (ret) goto err_disable_runtime; @@ -1627,7 +1636,10 @@ static int samsung_dsim_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); - samsung_dsim_plat_remove(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + samsung_dsim_plat_remove(dsi); + else + mipi_dsi_host_unregister(&dsi->dsi_host); return 0; } diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 2e245bffd1b6..97fdee5ef5df 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -33,6 +33,10 @@ struct samsung_dsim_transfer { u16 rx_done; }; +enum samsung_dsim_quirks { + DSIM_QUIRK_PLAT_DATA = BIT(0), +}; + struct samsung_dsim_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; @@ -43,6 +47,7 @@ struct samsung_dsim_driver_data { unsigned int wait_for_reset; unsigned int num_bits_resol; const unsigned int *reg_values; + enum samsung_dsim_quirks quirks; }; struct samsung_dsim_host_ops {