diff mbox series

[v1,3/3] drm/mediatek: Move the getting bridge node function to mtk_dsi_bind

Message ID 1643283773-7081-4-git-send-email-xinlei.lee@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add mt8186 dsi compatoble & Move the getting bridge node function | expand

Commit Message

Xinlei Lee (李昕磊) Jan. 27, 2022, 11:42 a.m. UTC
From: xinlei lee <xinlei.lee@mediatek.com>

The order of probe function for bridge drivers and dsi drivers is uncertain.
To avoid the dsi probe cannot be executed, we place getting bridge node function in
mtk_dsi_bind.

Signed-off-by:Xinlei Lee <xinlei.lee@mediatek.com>
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

Comments

CK Hu (胡俊光) Jan. 28, 2022, 5:03 a.m. UTC | #1
Hi, Xinlei:

On Thu, 2022-01-27 at 19:42 +0800, xinlei.lee@mediatek.com wrote:
> From: xinlei lee <xinlei.lee@mediatek.com>
> 
> The order of probe function for bridge drivers and dsi drivers is
> uncertain.
> To avoid the dsi probe cannot be executed, we place getting bridge
> node function in
> mtk_dsi_bind.

It seems this patch want to fix the same problem as [1]. Does [1] fix
your problem? If so, let's ignore this patch.

[1] 
https://patchwork.kernel.org/project/linux-mediatek/patch/20220127143623.123025-1-angelogioacchino.delregno@collabora.com/

Regards,
CK

> 
> Signed-off-by:Xinlei Lee <xinlei.lee@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 29 +++++++++++++++-------------
> -
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c
> b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 62af60d..a390f26 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -991,6 +991,21 @@ static int mtk_dsi_bind(struct device *dev,
> struct device *master, void *data)
>  	int ret;
>  	struct drm_device *drm = data;
>  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
> +	struct drm_panel *panel;
> +
> +	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> +					  &panel, &dsi->next_bridge);
> +	if (ret)
> +		return ret;
> +
> +	if (panel) {
> +		dsi->next_bridge = devm_drm_panel_bridge_add(dev,
> panel);
> +		if (IS_ERR(dsi->next_bridge)) {
> +			ret = PTR_ERR(dsi->next_bridge);
> +			dev_err(dev, "failed to add bridge: %d\n",
> ret);
> +			return ret;
> +		}
> +	}
>  
>  	ret = mtk_dsi_encoder_init(drm, dsi);
>  	if (ret)
> @@ -1016,7 +1031,6 @@ static int mtk_dsi_probe(struct platform_device
> *pdev)
>  {
>  	struct mtk_dsi *dsi;
>  	struct device *dev = &pdev->dev;
> -	struct drm_panel *panel;
>  	struct resource *regs;
>  	int irq_num;
>  	int ret;
> @@ -1033,19 +1047,6 @@ static int mtk_dsi_probe(struct
> platform_device *pdev)
>  		return ret;
>  	}
>  
> -	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> -					  &panel, &dsi->next_bridge);
> -	if (ret)
> -		goto err_unregister_host;
> -
> -	if (panel) {
> -		dsi->next_bridge = devm_drm_panel_bridge_add(dev,
> panel);
> -		if (IS_ERR(dsi->next_bridge)) {
> -			ret = PTR_ERR(dsi->next_bridge);
> -			goto err_unregister_host;
> -		}
> -	}
> -
>  	dsi->driver_data = of_device_get_match_data(dev);
>  
>  	dsi->engine_clk = devm_clk_get(dev, "engine");
Xinlei Lee (李昕磊) Feb. 14, 2022, 8:10 a.m. UTC | #2
On Fri, 2022-01-28 at 13:03 +0800, CK Hu wrote:
> Hi, Xinlei:
> 
> On Thu, 2022-01-27 at 19:42 +0800, xinlei.lee@mediatek.com wrote:
> > From: xinlei lee <xinlei.lee@mediatek.com>
> > 
> > The order of probe function for bridge drivers and dsi drivers is
> > uncertain.
> > To avoid the dsi probe cannot be executed, we place getting bridge
> > node function in
> > mtk_dsi_bind.
> 
> It seems this patch want to fix the same problem as [1]. Does [1] fix
> your problem? If so, let's ignore this patch.
> 
> [1] 
> 
https://patchwork.kernel.org/project/linux-mediatek/patch/20220127143623.123025-1-angelogioacchino.delregno@collabora.com/
> 
> Regards,
> CK
> 
Hi, CK:

As you describe,these two patches modify the same thing,we can ignore
this patch.
Thanks for your suggestion.

Best Regards!
xinlei
> > 
> > Signed-off-by:Xinlei Lee <xinlei.lee@mediatek.com>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 29 +++++++++++++++-----------
> > --
> > -
> >  1 file changed, 15 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index 62af60d..a390f26 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -991,6 +991,21 @@ static int mtk_dsi_bind(struct device *dev,
> > struct device *master, void *data)
> >  	int ret;
> >  	struct drm_device *drm = data;
> >  	struct mtk_dsi *dsi = dev_get_drvdata(dev);
> > +	struct drm_panel *panel;
> > +
> > +	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> > +					  &panel, &dsi->next_bridge);
> > +	if (ret)
> > +		return ret;
> > +
> > +	if (panel) {
> > +		dsi->next_bridge = devm_drm_panel_bridge_add(dev,
> > panel);
> > +		if (IS_ERR(dsi->next_bridge)) {
> > +			ret = PTR_ERR(dsi->next_bridge);
> > +			dev_err(dev, "failed to add bridge: %d\n",
> > ret);
> > +			return ret;
> > +		}
> > +	}
> >  
> >  	ret = mtk_dsi_encoder_init(drm, dsi);
> >  	if (ret)
> > @@ -1016,7 +1031,6 @@ static int mtk_dsi_probe(struct
> > platform_device
> > *pdev)
> >  {
> >  	struct mtk_dsi *dsi;
> >  	struct device *dev = &pdev->dev;
> > -	struct drm_panel *panel;
> >  	struct resource *regs;
> >  	int irq_num;
> >  	int ret;
> > @@ -1033,19 +1047,6 @@ static int mtk_dsi_probe(struct
> > platform_device *pdev)
> >  		return ret;
> >  	}
> >  
> > -	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> > -					  &panel, &dsi->next_bridge);
> > -	if (ret)
> > -		goto err_unregister_host;
> > -
> > -	if (panel) {
> > -		dsi->next_bridge = devm_drm_panel_bridge_add(dev,
> > panel);
> > -		if (IS_ERR(dsi->next_bridge)) {
> > -			ret = PTR_ERR(dsi->next_bridge);
> > -			goto err_unregister_host;
> > -		}
> > -	}
> > -
> >  	dsi->driver_data = of_device_get_match_data(dev);
> >  
> >  	dsi->engine_clk = devm_clk_get(dev, "engine");
> 
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 62af60d..a390f26 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -991,6 +991,21 @@  static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
 	int ret;
 	struct drm_device *drm = data;
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
+	struct drm_panel *panel;
+
+	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
+					  &panel, &dsi->next_bridge);
+	if (ret)
+		return ret;
+
+	if (panel) {
+		dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
+		if (IS_ERR(dsi->next_bridge)) {
+			ret = PTR_ERR(dsi->next_bridge);
+			dev_err(dev, "failed to add bridge: %d\n", ret);
+			return ret;
+		}
+	}
 
 	ret = mtk_dsi_encoder_init(drm, dsi);
 	if (ret)
@@ -1016,7 +1031,6 @@  static int mtk_dsi_probe(struct platform_device *pdev)
 {
 	struct mtk_dsi *dsi;
 	struct device *dev = &pdev->dev;
-	struct drm_panel *panel;
 	struct resource *regs;
 	int irq_num;
 	int ret;
@@ -1033,19 +1047,6 @@  static int mtk_dsi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
-					  &panel, &dsi->next_bridge);
-	if (ret)
-		goto err_unregister_host;
-
-	if (panel) {
-		dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
-		if (IS_ERR(dsi->next_bridge)) {
-			ret = PTR_ERR(dsi->next_bridge);
-			goto err_unregister_host;
-		}
-	}
-
 	dsi->driver_data = of_device_get_match_data(dev);
 
 	dsi->engine_clk = devm_clk_get(dev, "engine");