linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Jagan Teki <jagan@amarulasolutions.com>
Cc: 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>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Frieder Schrempf <frieder.schrempf@kontron.de>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Marek Vasut <marex@denx.de>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	Fabio Estevam <festevam@gmail.com>,
	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: [RFC PATCH 06/17] drm/exynos: dsi: Handle exynos specifics via driver_data
Date: Sun, 25 Jul 2021 19:25:43 +0200	[thread overview]
Message-ID: <YP2el40V3K4R7ner@ravnborg.org> (raw)
In-Reply-To: <20210704090230.26489-7-jagan@amarulasolutions.com>

On Sun, Jul 04, 2021 at 02:32:19PM +0530, Jagan Teki wrote:
> Exynos DSI driver is actually a Samsung MIPI DSIM bridge
> IP which is also used in i.MX8MM platforms.
> 
> Right now the existing driver has some exynos drm specific
> code bases like te_irq, crtc and component_ops.
> 
> In order to switch this driver into a common bridge driver
> We can see 2 options to handle the exynos specific code.
> 
> A. Drop the component_ops, and rework other specifics.
>    This may lead to more foundation work as it requires
>    more changes in exynos drm drivers stack.
> 
> B. Handle the exynos specifics via driver data, and make
>    the common bridge work in different platforms and plan
>    for option A in future.
> 
> So, this patch is trying to add option B) changes to handle
> exynos specifics via driver_data.

We really should find someone that has the time, energy, knowledge and
hardware that can include device_link support once anf for all for
bridges.
Then we would avoid hacks like this.

I see no other options at the moment, but look forward for a better
solution.

	Sam


> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 37 +++++++++++++++++++------
>  1 file changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index 99a1b8c22313..53d878d4d2d7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -250,6 +250,7 @@ struct exynos_dsi_driver_data {
>  	unsigned int wait_for_reset;
>  	unsigned int num_bits_resol;
>  	const unsigned int *reg_values;
> +	bool exynos_specific;
>  };
>  
>  struct exynos_dsi {
> @@ -459,6 +460,7 @@ static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = {
>  	.wait_for_reset = 1,
>  	.num_bits_resol = 11,
>  	.reg_values = reg_values,
> +	.exynos_specific = true,
>  };
>  
>  static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
> @@ -471,6 +473,7 @@ static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = {
>  	.wait_for_reset = 1,
>  	.num_bits_resol = 11,
>  	.reg_values = reg_values,
> +	.exynos_specific = true,
>  };
>  
>  static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
> @@ -481,6 +484,7 @@ static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = {
>  	.wait_for_reset = 1,
>  	.num_bits_resol = 11,
>  	.reg_values = reg_values,
> +	.exynos_specific = true,
>  };
>  
>  static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
> @@ -492,6 +496,7 @@ static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = {
>  	.wait_for_reset = 0,
>  	.num_bits_resol = 12,
>  	.reg_values = exynos5433_reg_values,
> +	.exynos_specific = true,
>  };
>  
>  static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
> @@ -503,6 +508,7 @@ static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = {
>  	.wait_for_reset = 1,
>  	.num_bits_resol = 12,
>  	.reg_values = exynos5422_reg_values,
> +	.exynos_specific = true,
>  };
>  
>  static const struct of_device_id exynos_dsi_of_match[] = {
> @@ -1484,7 +1490,8 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>  	 * If attached panel device is for command mode one, dsi should register
>  	 * TE interrupt handler.
>  	 */
> -	if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO)) {
> +	if (dsi->driver_data->exynos_specific &&
> +	    !(device->mode_flags & MIPI_DSI_MODE_VIDEO)) {
>  		int ret = exynos_dsi_register_te_irq(dsi, &device->dev);
>  		if (ret)
>  			return ret;
> @@ -1495,8 +1502,9 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>  	dsi->lanes = device->lanes;
>  	dsi->format = device->format;
>  	dsi->mode_flags = device->mode_flags;
> -	exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD)->i80_mode =
> -			!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO);
> +	if (dsi->driver_data->exynos_specific)
> +		exynos_drm_crtc_get_by_type(drm, EXYNOS_DISPLAY_TYPE_LCD)->i80_mode =
> +					    !(dsi->mode_flags & MIPI_DSI_MODE_VIDEO);
>  
>  	mutex_unlock(&drm->mode_config.mutex);
>  
> @@ -1515,7 +1523,8 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host,
>  	if (drm->mode_config.poll_enabled)
>  		drm_kms_helper_hotplug_event(drm);
>  
> -	exynos_dsi_unregister_te_irq(dsi);
> +	if (dsi->driver_data->exynos_specific)
> +		exynos_dsi_unregister_te_irq(dsi);
>  
>  	return 0;
>  }
> @@ -1737,6 +1746,15 @@ static int exynos_dsi_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> +	if (!dsi->driver_data->exynos_specific) {
> +		ret = mipi_dsi_host_register(&dsi->dsi_host);
> +		if (ret) {
> +			dev_err(dev, "failed to register mipi dsi host: %d\n",
> +				ret);
> +			return ret;
> +		}
> +	}
> +
>  	platform_set_drvdata(pdev, dsi);
>  
>  	pm_runtime_enable(dev);
> @@ -1747,9 +1765,11 @@ static int exynos_dsi_probe(struct platform_device *pdev)
>  
>  	drm_bridge_add(&dsi->bridge);
>  
> -	ret = component_add(dev, &exynos_dsi_component_ops);
> -	if (ret)
> -		goto err_disable_runtime;
> +	if (dsi->driver_data->exynos_specific) {
> +		ret = component_add(dev, &exynos_dsi_component_ops);
> +		if (ret)
> +			goto err_disable_runtime;
> +	}
>  
>  	return 0;
>  
> @@ -1767,7 +1787,8 @@ static int exynos_dsi_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(&pdev->dev);
>  
> -	component_del(&pdev->dev, &exynos_dsi_component_ops);
> +	if (dsi->driver_data->exynos_specific)
> +		component_del(&pdev->dev, &exynos_dsi_component_ops);
>  
>  	return 0;
>  }
> -- 
> 2.25.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-07-25 17:27 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04  9:02 [RFC PATCH 00/17] drm: bridge: Samsung MIPI DSIM bridge Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 01/17] drm/exynos: dsi: Convert to bridge driver Jagan Teki
2021-07-25 17:08   ` Sam Ravnborg
2021-07-04  9:02 ` [RFC PATCH 02/17] drm/exynos: dsi: Handle drm_device for bridge Jagan Teki
2021-07-25 17:09   ` Sam Ravnborg
2021-07-04  9:02 ` [RFC PATCH 03/17] drm/exynos: dsi: Use the drm_panel_bridge API Jagan Teki
2021-07-05 11:47   ` Marek Szyprowski
2021-07-05 12:00     ` Jagan Teki
2021-07-05 12:13       ` Marek Szyprowski
2021-07-05 12:34         ` Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 04/17] drm/exynos: dsi: Create bridge connector for encoder Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 05/17] drm/exynos: dsi: Get the mode from bridge Jagan Teki
2021-07-25 17:17   ` Sam Ravnborg
2021-07-29 13:20   ` Robert Foss
2021-07-29 16:50     ` Sam Ravnborg
2021-07-04  9:02 ` [RFC PATCH 06/17] drm/exynos: dsi: Handle exynos specifics via driver_data Jagan Teki
2021-07-25 17:25   ` Sam Ravnborg [this message]
2021-07-25 17:31     ` Jagan Teki
2021-08-13  6:50     ` Inki Dae
2021-08-13 12:16       ` Laurent Pinchart
2021-08-18  6:09         ` Inki Dae
2021-07-04  9:02 ` [RFC PATCH 07/17] drm: bridge: Move exynos_drm_dsi into bridges Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 08/17] dt-bindings: display: bridge: Add Samsung MIPI DSIM bridge Jagan Teki
2021-07-12 15:13   ` Rob Herring
2021-07-12 15:23     ` Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 09/17] drm: bridge: samsung-dsim: Add module init, exit Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 10/17] drm: bridge: samsung-dsim: Update the of_node for port(s) Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 11/17] drm: bridge: samsung-dsim: Find the possible DSI devices Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 12/17] dt-bindings: display: bridge: samsung, mipi-dsim: Add i.MX8MM support Jagan Teki
2021-07-14 22:59   ` [RFC PATCH 12/17] dt-bindings: display: bridge: samsung,mipi-dsim: " Rob Herring
2021-07-04  9:02 ` [RFC PATCH 13/17] drm: bridge: samsung-dsim: " Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 14/17] drm: bridge: samsung-dsim: Add input_bus_flags Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 15/17] drm: bridge: samsung-dsim: Move DSI init in bridge enable Jagan Teki
2021-07-04  9:02 ` [RFC PATCH 16/17] drm: bridge: samsung-dsim: Fix PLL_P offset Jagan Teki
2021-07-25 17:48   ` Sam Ravnborg
2021-07-04  9:02 ` [RFC PATCH 17/17] drm: bridge: samsung-dsim: Add bridge mode_fixup Jagan Teki
2021-07-25 17:50   ` Sam Ravnborg
2021-07-25 17:05 ` [RFC PATCH 00/17] drm: bridge: Samsung MIPI DSIM bridge Sam Ravnborg
2021-07-25 17:13   ` Jagan Teki
2021-10-05 21:43     ` Tim Harvey
2021-12-09  8:36       ` Michael Nazzareno Trimarchi
2021-12-09 16:40         ` Tim Harvey
2021-12-09 17:09           ` Michael Nazzareno Trimarchi
2021-12-09 17:57             ` Tim Harvey
2021-12-09 20:24             ` Lucas Stach
2021-12-09 21:24               ` Michael Nazzareno Trimarchi
2021-12-15 13:34                 ` 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=YP2el40V3K4R7ner@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=daniel.vetter@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@kontron.de \
    --cc=inki.dae@samsung.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jy0922.shim@samsung.com \
    --cc=krzysztof.kozlowski@canonical.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=marex@denx.de \
    --cc=narmstrong@baylibre.com \
    --cc=robert.foss@linaro.org \
    --cc=sw0312.kim@samsung.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).