dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers
@ 2022-04-28  9:48 ` Jagan Teki
  2022-04-28 10:43   ` Marek Szyprowski
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jagan Teki @ 2022-04-28  9:48 UTC (permalink / raw)
  To: Marek Szyprowski, Maxime Ripard, Inki Dae, dri-devel, linux-samsung-soc
  Cc: linux-amarula, Jagan Teki

commit <711c7adc4687> ("drm: exynos: dsi: Use drm panel_bridge API")
added devm_drm_of_get_bridge for looking up if child node has panel
or bridge.

However commit <b089c0a9b14c> ("Revert "drm: of: Lookup if child node
has panel or bridge") has reverted panel or bridge child node lookup
from devm_drm_of_get_bridge which eventually failed to find the DSI
devices in exynos drm dsi driver.

So, use the conventional child panel bridge lookup helpers like it
does before.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index f067c86b0b12..ec673223d6b7 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -25,6 +25,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
@@ -1451,9 +1452,18 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
 	struct device *dev = dsi->dev;
 	struct drm_encoder *encoder = &dsi->encoder;
 	struct drm_device *drm = encoder->dev;
+	struct drm_panel *panel;
 	int ret;
 
-	dsi->out_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
+	panel = of_drm_find_panel(device->dev.of_node);
+	if (!IS_ERR(panel)) {
+		dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel);
+	} else {
+		dsi->out_bridge = of_drm_find_bridge(device->dev.of_node);
+		if (!dsi->out_bridge)
+			dsi->out_bridge = ERR_PTR(-EINVAL);
+	}
+
 	if (IS_ERR(dsi->out_bridge)) {
 		ret = PTR_ERR(dsi->out_bridge);
 		DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers
  2022-04-28  9:48 ` [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers Jagan Teki
@ 2022-04-28 10:43   ` Marek Szyprowski
  2022-04-28 12:14   ` Maxime Ripard
  2022-05-04 15:13   ` (subset) " Maxime Ripard
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2022-04-28 10:43 UTC (permalink / raw)
  To: Jagan Teki, Maxime Ripard, Inki Dae, dri-devel, linux-samsung-soc
  Cc: linux-amarula

On 28.04.2022 11:48, Jagan Teki wrote:
> commit <711c7adc4687> ("drm: exynos: dsi: Use drm panel_bridge API")
> added devm_drm_of_get_bridge for looking up if child node has panel
> or bridge.
>
> However commit <b089c0a9b14c> ("Revert "drm: of: Lookup if child node
> has panel or bridge") has reverted panel or bridge child node lookup
> from devm_drm_of_get_bridge which eventually failed to find the DSI
> devices in exynos drm dsi driver.
>
> So, use the conventional child panel bridge lookup helpers like it
> does before.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

This restores Exynos DSI driver operation in linux-next after the 
mentioned commits went via drm-misc-fixes tree.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index f067c86b0b12..ec673223d6b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -25,6 +25,7 @@
>   #include <drm/drm_atomic_helper.h>
>   #include <drm/drm_bridge.h>
>   #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
>   #include <drm/drm_print.h>
>   #include <drm/drm_probe_helper.h>
>   #include <drm/drm_simple_kms_helper.h>
> @@ -1451,9 +1452,18 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>   	struct device *dev = dsi->dev;
>   	struct drm_encoder *encoder = &dsi->encoder;
>   	struct drm_device *drm = encoder->dev;
> +	struct drm_panel *panel;
>   	int ret;
>   
> -	dsi->out_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
> +	panel = of_drm_find_panel(device->dev.of_node);
> +	if (!IS_ERR(panel)) {
> +		dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel);
> +	} else {
> +		dsi->out_bridge = of_drm_find_bridge(device->dev.of_node);
> +		if (!dsi->out_bridge)
> +			dsi->out_bridge = ERR_PTR(-EINVAL);
> +	}
> +
>   	if (IS_ERR(dsi->out_bridge)) {
>   		ret = PTR_ERR(dsi->out_bridge);
>   		DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret);

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers
  2022-04-28  9:48 ` [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers Jagan Teki
  2022-04-28 10:43   ` Marek Szyprowski
@ 2022-04-28 12:14   ` Maxime Ripard
  2022-04-29  8:25     ` Marek Szyprowski
  2022-05-04 15:13   ` (subset) " Maxime Ripard
  2 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2022-04-28 12:14 UTC (permalink / raw)
  To: Jagan Teki; +Cc: linux-samsung-soc, linux-amarula, dri-devel, Marek Szyprowski

[-- Attachment #1: Type: text/plain, Size: 2152 bytes --]

On Thu, Apr 28, 2022 at 03:18:08PM +0530, Jagan Teki wrote:
> commit <711c7adc4687> ("drm: exynos: dsi: Use drm panel_bridge API")
> added devm_drm_of_get_bridge for looking up if child node has panel
> or bridge.
> 
> However commit <b089c0a9b14c> ("Revert "drm: of: Lookup if child node
> has panel or bridge") has reverted panel or bridge child node lookup
> from devm_drm_of_get_bridge which eventually failed to find the DSI
> devices in exynos drm dsi driver.
> 
> So, use the conventional child panel bridge lookup helpers like it
> does before.
> 
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index f067c86b0b12..ec673223d6b7 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -25,6 +25,7 @@
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
>  #include <drm/drm_print.h>
>  #include <drm/drm_probe_helper.h>
>  #include <drm/drm_simple_kms_helper.h>
> @@ -1451,9 +1452,18 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>  	struct device *dev = dsi->dev;
>  	struct drm_encoder *encoder = &dsi->encoder;
>  	struct drm_device *drm = encoder->dev;
> +	struct drm_panel *panel;
>  	int ret;
>  
> -	dsi->out_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
> +	panel = of_drm_find_panel(device->dev.of_node);
> +	if (!IS_ERR(panel)) {
> +		dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel);
> +	} else {
> +		dsi->out_bridge = of_drm_find_bridge(device->dev.of_node);
> +		if (!dsi->out_bridge)
> +			dsi->out_bridge = ERR_PTR(-EINVAL);
> +	}
> +

We should just revert 711c7adc4687 entirely (and make it very explicit
in the commit log). The out_bridge lifetime is completely screwed-up in
that patch now. If there's a panel it will be managed, but it's not if
there's a bridge.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers
  2022-04-28 12:14   ` Maxime Ripard
@ 2022-04-29  8:25     ` Marek Szyprowski
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2022-04-29  8:25 UTC (permalink / raw)
  To: Maxime Ripard, Jagan Teki; +Cc: linux-samsung-soc, linux-amarula, dri-devel

Hi Maxime,

On 28.04.2022 14:14, Maxime Ripard wrote:
> On Thu, Apr 28, 2022 at 03:18:08PM +0530, Jagan Teki wrote:
>> commit <711c7adc4687> ("drm: exynos: dsi: Use drm panel_bridge API")
>> added devm_drm_of_get_bridge for looking up if child node has panel
>> or bridge.
>>
>> However commit <b089c0a9b14c> ("Revert "drm: of: Lookup if child node
>> has panel or bridge") has reverted panel or bridge child node lookup
>> from devm_drm_of_get_bridge which eventually failed to find the DSI
>> devices in exynos drm dsi driver.
>>
>> So, use the conventional child panel bridge lookup helpers like it
>> does before.
>>
>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
>> ---
>>   drivers/gpu/drm/exynos/exynos_drm_dsi.c | 12 +++++++++++-
>>   1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> index f067c86b0b12..ec673223d6b7 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> @@ -25,6 +25,7 @@
>>   #include <drm/drm_atomic_helper.h>
>>   #include <drm/drm_bridge.h>
>>   #include <drm/drm_mipi_dsi.h>
>> +#include <drm/drm_panel.h>
>>   #include <drm/drm_print.h>
>>   #include <drm/drm_probe_helper.h>
>>   #include <drm/drm_simple_kms_helper.h>
>> @@ -1451,9 +1452,18 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
>>   	struct device *dev = dsi->dev;
>>   	struct drm_encoder *encoder = &dsi->encoder;
>>   	struct drm_device *drm = encoder->dev;
>> +	struct drm_panel *panel;
>>   	int ret;
>>   
>> -	dsi->out_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0);
>> +	panel = of_drm_find_panel(device->dev.of_node);
>> +	if (!IS_ERR(panel)) {
>> +		dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel);
>> +	} else {
>> +		dsi->out_bridge = of_drm_find_bridge(device->dev.of_node);
>> +		if (!dsi->out_bridge)
>> +			dsi->out_bridge = ERR_PTR(-EINVAL);
>> +	}
>> +
> We should just revert 711c7adc4687 entirely (and make it very explicit
> in the commit log). The out_bridge lifetime is completely screwed-up in
> that patch now. If there's a panel it will be managed, but it's not if
> there's a bridge.

Nope, this patch does exactly what is needed there.

If there is a panel, it creates a managed panel_bridge() proxy. If there 
is a bridge, it simply gets a pointer to it. There is nothing to manage 
if there is a bridge attached next to DSI. See devm_drm_of_get_bridge() 
function, it does exactly the same things (managed panel_bridge or 
simple pointer to the real next bridge). I agree that this is not very 
obvious at the first sight, but that's how the code is now structured.

Please queue this to drm-misc-next, so the Exynos DSI will be again 
operational after merging the drm-misc-fixes and drm-misc-next.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: (subset) [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers
  2022-04-28  9:48 ` [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers Jagan Teki
  2022-04-28 10:43   ` Marek Szyprowski
  2022-04-28 12:14   ` Maxime Ripard
@ 2022-05-04 15:13   ` Maxime Ripard
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2022-05-04 15:13 UTC (permalink / raw)
  To: linux-samsung-soc, Marek Szyprowski, Inki Dae, Jagan Teki, dri-devel
  Cc: linux-amarula, Maxime Ripard

On Thu, 28 Apr 2022 15:18:08 +0530, Jagan Teki wrote:
> commit <711c7adc4687> ("drm: exynos: dsi: Use drm panel_bridge API")
> added devm_drm_of_get_bridge for looking up if child node has panel
> or bridge.
> 
> However commit <b089c0a9b14c> ("Revert "drm: of: Lookup if child node
> has panel or bridge") has reverted panel or bridge child node lookup
> from devm_drm_of_get_bridge which eventually failed to find the DSI
> devices in exynos drm dsi driver.
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-04 15:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20220428094854eucas1p2c7252b3e6aba5c55a25aef398e8517d4@eucas1p2.samsung.com>
2022-04-28  9:48 ` [PATCH] drm: exynos: dsi: Use child panel or bridge find helpers Jagan Teki
2022-04-28 10:43   ` Marek Szyprowski
2022-04-28 12:14   ` Maxime Ripard
2022-04-29  8:25     ` Marek Szyprowski
2022-05-04 15:13   ` (subset) " Maxime Ripard

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).