dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Jagan Teki <jagan@amarulasolutions.com>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Inki Dae <inki.dae@samsung.com>,
	Joonyoung Shim <jy0922.shim@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Fancy Fang <chen.fang@nxp.com>,
	Tim Harvey <tharvey@gateworks.com>,
	Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
	Adam Ford <aford173@gmail.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-amarula <linux-amarula@amarulasolutions.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 02/11] drm: bridge: samsung-dsim: Handle platform init via driver_data
Date: Tue, 12 Apr 2022 11:55:36 +0200	[thread overview]
Message-ID: <5823f59a-9c57-5f9a-0ebd-1ea2f39e73cb@samsung.com> (raw)
In-Reply-To: <20220408162108.184583-3-jagan@amarulasolutions.com>


On 08.04.2022 18:20, Jagan Teki wrote:
> 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 and invocation
> in the form of platform_init flag in driver_data.
>
> So, the platforms which enable platform_init 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
>
> v1:
> * use platform_init instead of exynos_specific
> * handle component_ops in glue code
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   drivers/gpu/drm/bridge/samsung-dsim.c | 20 ++++++++++++++++----
>   include/drm/bridge/samsung-dsim.h     |  1 +
>   2 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index ee5d7e5518a6..0e6a5d1c7e4e 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -370,6 +370,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = {
>   	.wait_for_reset = 1,
>   	.num_bits_resol = 11,
>   	.reg_values = reg_values,
> +	.platform_init = true,
>   };
>   
>   static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = {
> @@ -382,6 +383,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = {
>   	.wait_for_reset = 1,
>   	.num_bits_resol = 11,
>   	.reg_values = reg_values,
> +	.platform_init = true,
>   };
>   
>   static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = {
> @@ -392,6 +394,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = {
>   	.wait_for_reset = 1,
>   	.num_bits_resol = 11,
>   	.reg_values = reg_values,
> +	.platform_init = true,
>   };
>   
>   static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = {
> @@ -403,6 +406,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,
> +	.platform_init = true,
>   };
>   
>   static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = {
> @@ -414,6 +418,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,
> +	.platform_init = true,
>   };
>   
>   static const struct of_device_id samsung_dsim_of_match[] = {
> @@ -1565,12 +1570,16 @@ static int samsung_dsim_probe(struct platform_device *pdev)
>   	dsi->bridge.of_node = dev->of_node;
>   	dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
>   
> -	dsi->plat_data = samsung_dsim_plat_probe(dsi);
> -	if (IS_ERR(dsi->plat_data)) {
> +	if (dsi->driver_data->platform_init) {
> +		dsi->plat_data = samsung_dsim_plat_probe(dsi);
>   		ret = PTR_ERR(dsi->plat_data);

ret = IS_ERR(dsi->plat_data) ? PTR_ERR(dsi->plat_data) : 0;

otherwise it always fails.

> -		goto err_disable_runtime;
> +	} else {
> +		ret = mipi_dsi_host_register(&dsi->dsi_host);
>   	}
>   
> +	if (ret)
> +		goto err_disable_runtime;
> +
>   	return 0;
>   
>   err_disable_runtime:
> @@ -1585,7 +1594,10 @@ static int samsung_dsim_remove(struct platform_device *pdev)
>   
>   	pm_runtime_disable(&pdev->dev);
>   
> -	samsung_dsim_plat_remove(dsi);
> +	if (dsi->driver_data->platform_init)
> +		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 59a43f9c4477..eca7eacb5910 100644
> --- a/include/drm/bridge/samsung-dsim.h
> +++ b/include/drm/bridge/samsung-dsim.h
> @@ -39,6 +39,7 @@ struct samsung_dsim_driver_data {
>   	unsigned int wait_for_reset;
>   	unsigned int num_bits_resol;
>   	const unsigned int *reg_values;
> +	bool platform_init;
>   };
>   
>   struct samsung_dsim_host_ops {

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2022-04-12  9:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220408162213eucas1p158d7c7ee27006a61d4af95d3c72c58e3@eucas1p1.samsung.com>
2022-04-08 16:20 ` [PATCH 00/11] drm: bridge: Add Samsung MIPI DSIM bridge Jagan Teki
2022-04-08 16:20   ` [PATCH 01/11] drm: bridge: Add Samsung DSIM bridge driver Jagan Teki
2022-04-12  9:45     ` Marek Szyprowski
2022-05-04  9:16       ` Jagan Teki
2022-05-04  9:44         ` Marek Szyprowski
2022-04-08 16:20   ` [PATCH 02/11] drm: bridge: samsung-dsim: Handle platform init via driver_data Jagan Teki
2022-04-12  9:55     ` Marek Szyprowski [this message]
2022-04-08 16:21   ` [PATCH 03/11] drm: bridge: samsung-dsim: Mark PHY as optional Jagan Teki
2022-04-08 16:21   ` [PATCH 04/11] drm: bridge: samsung-dsim: Add DSI init in bridge pre_enable() Jagan Teki
2022-04-11 12:23     ` Adam Ford
2022-04-08 16:21   ` [PATCH 05/11] drm: bridge: samsung-dsim: Fix PLL_P (PMS_P) offset Jagan Teki
2022-04-08 16:21   ` [PATCH 06/11] drm: bridge: samsung-dsim: Add module init, exit Jagan Teki
2022-04-08 16:21   ` [PATCH 07/11] drm: bridge: samsung-dsim: Add atomic_check Jagan Teki
2022-04-08 16:21   ` [PATCH 08/11] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts Jagan Teki
2022-04-08 16:21   ` [PATCH 09/11] drm: bridge: samsung-dsim: Add input_bus_flags Jagan Teki
2022-04-08 16:21   ` [PATCH 10/11] dt-bindings: display: exynos: dsim: Add NXP i.MX8MM support Jagan Teki
2022-04-10 18:12     ` Laurent Pinchart
2022-04-29  9:40       ` Jagan Teki
2022-04-08 16:21   ` [PATCH 11/11] drm: bridge: samsung-dsim: Add " Jagan Teki
2022-04-10 18:06     ` Laurent Pinchart
2022-04-09  0:25   ` [PATCH 00/11] drm: bridge: Add Samsung MIPI DSIM bridge Tim Harvey
2022-04-11 13:11   ` (EXT) " Alexander Stein
2022-04-11 13:56   ` Marek Szyprowski
2022-04-11 14:39     ` Adam Ford
2022-04-11 15:29       ` Adam Ford
2022-04-11 16:25       ` Marek Szyprowski
2022-04-11 20:26         ` Adam Ford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5823f59a-9c57-5f9a-0ebd-1ea2f39e73cb@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=aford173@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=chen.fang@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=inki.dae@samsung.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jy0922.shim@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=narmstrong@baylibre.com \
    --cc=robert.foss@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sw0312.kim@samsung.com \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).