diff mbox

[v2,1/5] drm/exynos: dsi: Fix the parse_dt function

Message ID 1486603601-26826-2-git-send-email-hoegeun.kwon@samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Hoegeun Kwon Feb. 9, 2017, 1:26 a.m. UTC
The dsi + panel is a parental relationship, so OF grpah is not needed.
Therefore, the current dsi_parse_dt function will throw an error,
because there is no linked OF graph for case such as fimd + dsi +
panel. So this patch parse the Pll, burst and esc clock frequency
properties in dsi_parse_dt and modified to create a bridge_node only
if there is an OF graph associated with dsi.
So I think the ABI breakage is needed.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)

Comments

Andrzej Hajda Feb. 9, 2017, 6:57 a.m. UTC | #1
On 09.02.2017 02:26, Hoegeun Kwon wrote:
> The dsi + panel is a parental relationship, so OF grpah is not needed.
> Therefore, the current dsi_parse_dt function will throw an error,
> because there is no linked OF graph for case such as fimd + dsi +
> panel. So this patch parse the Pll, burst and esc clock frequency
> properties in dsi_parse_dt and modified to create a bridge_node only
> if there is an OF graph associated with dsi.
> So I think the ABI breakage is needed.
>
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>

Nice diffstat, more importantly it fixes bad design of early days of
of_graph.

Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

One comment below.

> ---
>  drivers/gpu/drm/exynos/exynos_drm_dsi.c | 32 ++++++++------------------------
>  1 file changed, 8 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> index e07cb1f..214d486 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
> @@ -1652,39 +1652,23 @@ static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
>  	if (ret < 0)
>  		return ret;
>  
> -	ep = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0);
> -	if (!ep) {
> -		dev_err(dev, "no output port with endpoint specified\n");
> -		return -EINVAL;
> -	}
> -
> -	ret = exynos_dsi_of_read_u32(ep, "samsung,burst-clock-frequency",
> +	ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency",
>  				     &dsi->burst_clk_rate);
>  	if (ret < 0)
> -		goto end;
> +		return ret;
>  
> -	ret = exynos_dsi_of_read_u32(ep, "samsung,esc-clock-frequency",
> +	ret = exynos_dsi_of_read_u32(node, "samsung,esc-clock-frequency",
>  				     &dsi->esc_clk_rate);
>  	if (ret < 0)
> -		goto end;
> -
> -	of_node_put(ep);
> +		return ret;
>  
>  	ep = of_graph_get_next_endpoint(node, NULL);
> -	if (!ep) {
> -		ret = -EINVAL;
> -		goto end;
> -	}
> -
> -	dsi->bridge_node = of_graph_get_remote_port_parent(ep);
> -	if (!dsi->bridge_node) {
> -		ret = -EINVAL;
> -		goto end;
> +	if (ep) {
> +		dsi->bridge_node = of_graph_get_remote_port_parent(ep);
> +		of_node_put(ep);

It looks like there is no of_node_put on dsi->bridge_node, but this is
for another patch.

Regards
Andrzej

>  	}
> -end:
> -	of_node_put(ep);
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static int exynos_dsi_bind(struct device *dev, struct device *master,


--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hoegeun Kwon Feb. 9, 2017, 12:08 p.m. UTC | #2
On 02/09/2017 03:57 PM, Andrzej Hajda wrote:
> On 09.02.2017 02:26, Hoegeun Kwon wrote:
>> The dsi + panel is a parental relationship, so OF grpah is not needed.
>> Therefore, the current dsi_parse_dt function will throw an error,
>> because there is no linked OF graph for case such as fimd + dsi +
>> panel. So this patch parse the Pll, burst and esc clock frequency
>> properties in dsi_parse_dt and modified to create a bridge_node only
>> if there is an OF graph associated with dsi.
>> So I think the ABI breakage is needed.
>>
>> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> Nice diffstat, more importantly it fixes bad design of early days of
> of_graph.
>
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
>
> One comment below.
>
>> ---
>>   drivers/gpu/drm/exynos/exynos_drm_dsi.c | 32 ++++++++------------------------
>>   1 file changed, 8 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> index e07cb1f..214d486 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
>> @@ -1652,39 +1652,23 @@ static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
>>   	if (ret < 0)
>>   		return ret;
>>   
>> -	ep = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0);
>> -	if (!ep) {
>> -		dev_err(dev, "no output port with endpoint specified\n");
>> -		return -EINVAL;
>> -	}
>> -
>> -	ret = exynos_dsi_of_read_u32(ep, "samsung,burst-clock-frequency",
>> +	ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency",
>>   				     &dsi->burst_clk_rate);
>>   	if (ret < 0)
>> -		goto end;
>> +		return ret;
>>   
>> -	ret = exynos_dsi_of_read_u32(ep, "samsung,esc-clock-frequency",
>> +	ret = exynos_dsi_of_read_u32(node, "samsung,esc-clock-frequency",
>>   				     &dsi->esc_clk_rate);
>>   	if (ret < 0)
>> -		goto end;
>> -
>> -	of_node_put(ep);
>> +		return ret;
>>   
>>   	ep = of_graph_get_next_endpoint(node, NULL);
>> -	if (!ep) {
>> -		ret = -EINVAL;
>> -		goto end;
>> -	}
>> -
>> -	dsi->bridge_node = of_graph_get_remote_port_parent(ep);
>> -	if (!dsi->bridge_node) {
>> -		ret = -EINVAL;
>> -		goto end;
>> +	if (ep) {
>> +		dsi->bridge_node = of_graph_get_remote_port_parent(ep);
>> +		of_node_put(ep);
> It looks like there is no of_node_put on dsi->bridge_node, but this is
> for another patch.

Thanks for your review.

Yes right, so i will make another patch.

Best Regards,
Hoegeun

>
> Regards
> Andrzej
>
>>   	}
>> -end:
>> -	of_node_put(ep);
>>   
>> -	return ret;
>> +	return 0;
>>   }
>>   
>>   static int exynos_dsi_bind(struct device *dev, struct device *master,
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index e07cb1f..214d486 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -1652,39 +1652,23 @@  static int exynos_dsi_parse_dt(struct exynos_dsi *dsi)
 	if (ret < 0)
 		return ret;
 
-	ep = of_graph_get_endpoint_by_regs(node, DSI_PORT_OUT, 0);
-	if (!ep) {
-		dev_err(dev, "no output port with endpoint specified\n");
-		return -EINVAL;
-	}
-
-	ret = exynos_dsi_of_read_u32(ep, "samsung,burst-clock-frequency",
+	ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency",
 				     &dsi->burst_clk_rate);
 	if (ret < 0)
-		goto end;
+		return ret;
 
-	ret = exynos_dsi_of_read_u32(ep, "samsung,esc-clock-frequency",
+	ret = exynos_dsi_of_read_u32(node, "samsung,esc-clock-frequency",
 				     &dsi->esc_clk_rate);
 	if (ret < 0)
-		goto end;
-
-	of_node_put(ep);
+		return ret;
 
 	ep = of_graph_get_next_endpoint(node, NULL);
-	if (!ep) {
-		ret = -EINVAL;
-		goto end;
-	}
-
-	dsi->bridge_node = of_graph_get_remote_port_parent(ep);
-	if (!dsi->bridge_node) {
-		ret = -EINVAL;
-		goto end;
+	if (ep) {
+		dsi->bridge_node = of_graph_get_remote_port_parent(ep);
+		of_node_put(ep);
 	}
-end:
-	of_node_put(ep);
 
-	return ret;
+	return 0;
 }
 
 static int exynos_dsi_bind(struct device *dev, struct device *master,