All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
@ 2022-11-25  0:02 ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2022-11-25  0:02 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Stephen Boyd, David Airlie, Daniel Vetter, Bjorn Andersson,
	linux-arm-msm, dri-devel, freedreno

Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
drvdata") reading the MDP5 hw revision on db410c will crash the board
as the MDSS_GDSC is not enabled. Revert a part of the offending commit
(moving rpm enablement) and set priv->kms earlier. This make it possible
to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
power up both the MDP5 and MDSS devices.

Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index b46f983f2b46..29ae5c9613f3 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms,
 	struct device *dev = &mdp5_kms->pdev->dev;
 	u32 version;
 
-	/* Manually enable the MDP5, as pm runtime isn't usable yet. */
-	mdp5_enable(mdp5_kms);
+	pm_runtime_get_sync(dev);
 	version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
-	mdp5_disable(mdp5_kms);
+	pm_runtime_put_sync(dev);
 
 	*major = FIELD(version, MDP5_HW_VERSION_MAJOR);
 	*minor = FIELD(version, MDP5_HW_VERSION_MINOR);
@@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 	 */
 	clk_set_rate(mdp5_kms->core_clk, 200000000);
 
+	/* set uninit-ed kms */
+	priv->kms = &mdp5_kms->base.base;
+
+	pm_runtime_enable(&pdev->dev);
+	mdp5_kms->rpm_enabled = true;
+
 	read_mdp_hw_revision(mdp5_kms, &major, &minor);
 
 	mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
@@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 	if (ret)
 		goto fail;
 
-	/* set uninit-ed kms */
-	priv->kms = &mdp5_kms->base.base;
-
-	pm_runtime_enable(&pdev->dev);
-	mdp5_kms->rpm_enabled = true;
-
 	return 0;
 fail:
 	if (mdp5_kms)
-- 
2.35.1


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

* [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
@ 2022-11-25  0:02 ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2022-11-25  0:02 UTC (permalink / raw)
  To: Rob Clark, Sean Paul, Abhinav Kumar
  Cc: freedreno, linux-arm-msm, Bjorn Andersson, dri-devel, Stephen Boyd

Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
drvdata") reading the MDP5 hw revision on db410c will crash the board
as the MDSS_GDSC is not enabled. Revert a part of the offending commit
(moving rpm enablement) and set priv->kms earlier. This make it possible
to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
power up both the MDP5 and MDSS devices.

Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
index b46f983f2b46..29ae5c9613f3 100644
--- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
@@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms,
 	struct device *dev = &mdp5_kms->pdev->dev;
 	u32 version;
 
-	/* Manually enable the MDP5, as pm runtime isn't usable yet. */
-	mdp5_enable(mdp5_kms);
+	pm_runtime_get_sync(dev);
 	version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
-	mdp5_disable(mdp5_kms);
+	pm_runtime_put_sync(dev);
 
 	*major = FIELD(version, MDP5_HW_VERSION_MAJOR);
 	*minor = FIELD(version, MDP5_HW_VERSION_MINOR);
@@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 	 */
 	clk_set_rate(mdp5_kms->core_clk, 200000000);
 
+	/* set uninit-ed kms */
+	priv->kms = &mdp5_kms->base.base;
+
+	pm_runtime_enable(&pdev->dev);
+	mdp5_kms->rpm_enabled = true;
+
 	read_mdp_hw_revision(mdp5_kms, &major, &minor);
 
 	mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
@@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
 	if (ret)
 		goto fail;
 
-	/* set uninit-ed kms */
-	priv->kms = &mdp5_kms->base.base;
-
-	pm_runtime_enable(&pdev->dev);
-	mdp5_kms->rpm_enabled = true;
-
 	return 0;
 fail:
 	if (mdp5_kms)
-- 
2.35.1


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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
  2022-11-25  0:02 ` Dmitry Baryshkov
@ 2022-11-25  5:45   ` Abhinav Kumar
  -1 siblings, 0 replies; 8+ messages in thread
From: Abhinav Kumar @ 2022-11-25  5:45 UTC (permalink / raw)
  To: Dmitry Baryshkov, Rob Clark, Sean Paul
  Cc: Stephen Boyd, David Airlie, Daniel Vetter, Bjorn Andersson,
	linux-arm-msm, dri-devel, freedreno



On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
> drvdata") reading the MDP5 hw revision on db410c will crash the board
> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
> (moving rpm enablement) and set priv->kms earlier. This make it possible
> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
> power up both the MDP5 and MDSS devices.
> 

This is the exact concern I had even when c6122688f265 was pushed.

https://patchwork.freedesktop.org/patch/508334/#comment_917689

Was the response given that time not correct then?

https://patchwork.freedesktop.org/patch/508334/#comment_917713
> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>   1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index b46f983f2b46..29ae5c9613f3 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms,
>   	struct device *dev = &mdp5_kms->pdev->dev;
>   	u32 version;
>   
> -	/* Manually enable the MDP5, as pm runtime isn't usable yet. */
> -	mdp5_enable(mdp5_kms);
> +	pm_runtime_get_sync(dev);
>   	version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
> -	mdp5_disable(mdp5_kms);
> +	pm_runtime_put_sync(dev);
>   
>   	*major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>   	*minor = FIELD(version, MDP5_HW_VERSION_MINOR);
> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
>   	 */
>   	clk_set_rate(mdp5_kms->core_clk, 200000000);
>   
> +	/* set uninit-ed kms */
> +	priv->kms = &mdp5_kms->base.base;
> +
> +	pm_runtime_enable(&pdev->dev);
> +	mdp5_kms->rpm_enabled = true;
> +
>   	read_mdp_hw_revision(mdp5_kms, &major, &minor);
>   
>   	mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
>   	if (ret)
>   		goto fail;
>   
> -	/* set uninit-ed kms */
> -	priv->kms = &mdp5_kms->base.base;
> -
> -	pm_runtime_enable(&pdev->dev);
> -	mdp5_kms->rpm_enabled = true;
> -
>   	return 0;
>   fail:
>   	if (mdp5_kms)

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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
@ 2022-11-25  5:45   ` Abhinav Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Abhinav Kumar @ 2022-11-25  5:45 UTC (permalink / raw)
  To: Dmitry Baryshkov, Rob Clark, Sean Paul
  Cc: freedreno, linux-arm-msm, Bjorn Andersson, dri-devel, Stephen Boyd



On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
> drvdata") reading the MDP5 hw revision on db410c will crash the board
> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
> (moving rpm enablement) and set priv->kms earlier. This make it possible
> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
> power up both the MDP5 and MDSS devices.
> 

This is the exact concern I had even when c6122688f265 was pushed.

https://patchwork.freedesktop.org/patch/508334/#comment_917689

Was the response given that time not correct then?

https://patchwork.freedesktop.org/patch/508334/#comment_917713
> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>   1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> index b46f983f2b46..29ae5c9613f3 100644
> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms *mdp5_kms,
>   	struct device *dev = &mdp5_kms->pdev->dev;
>   	u32 version;
>   
> -	/* Manually enable the MDP5, as pm runtime isn't usable yet. */
> -	mdp5_enable(mdp5_kms);
> +	pm_runtime_get_sync(dev);
>   	version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
> -	mdp5_disable(mdp5_kms);
> +	pm_runtime_put_sync(dev);
>   
>   	*major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>   	*minor = FIELD(version, MDP5_HW_VERSION_MINOR);
> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
>   	 */
>   	clk_set_rate(mdp5_kms->core_clk, 200000000);
>   
> +	/* set uninit-ed kms */
> +	priv->kms = &mdp5_kms->base.base;
> +
> +	pm_runtime_enable(&pdev->dev);
> +	mdp5_kms->rpm_enabled = true;
> +
>   	read_mdp_hw_revision(mdp5_kms, &major, &minor);
>   
>   	mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)
>   	if (ret)
>   		goto fail;
>   
> -	/* set uninit-ed kms */
> -	priv->kms = &mdp5_kms->base.base;
> -
> -	pm_runtime_enable(&pdev->dev);
> -	mdp5_kms->rpm_enabled = true;
> -
>   	return 0;
>   fail:
>   	if (mdp5_kms)

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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
  2022-11-25  5:45   ` Abhinav Kumar
@ 2022-11-25  9:21     ` Dmitry Baryshkov
  -1 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2022-11-25  9:21 UTC (permalink / raw)
  To: Abhinav Kumar, Rob Clark, Sean Paul
  Cc: Stephen Boyd, David Airlie, Daniel Vetter, Bjorn Andersson,
	linux-arm-msm, dri-devel, freedreno

On 25/11/2022 07:45, Abhinav Kumar wrote:
> On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
>> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
>> drvdata") reading the MDP5 hw revision on db410c will crash the board
>> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
>> (moving rpm enablement) and set priv->kms earlier. This make it possible
>> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
>> power up both the MDP5 and MDSS devices.
>>
> 
> This is the exact concern I had even when c6122688f265 was pushed.
> 
> https://patchwork.freedesktop.org/patch/508334/#comment_917689
> 
> Was the response given that time not correct then?

Not fully correct. I did not notice, that non-rpm-enabled mdp5 node 
doesn't force mdss to be in the on state. (Which is strange. Maybe we 
are leaking pm_runtime_enable() for it somewhere.)

> 
> https://patchwork.freedesktop.org/patch/508334/#comment_917713
>> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>>   1 file changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> index b46f983f2b46..29ae5c9613f3 100644
>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms 
>> *mdp5_kms,
>>       struct device *dev = &mdp5_kms->pdev->dev;
>>       u32 version;
>> -    /* Manually enable the MDP5, as pm runtime isn't usable yet. */
>> -    mdp5_enable(mdp5_kms);
>> +    pm_runtime_get_sync(dev);
>>       version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
>> -    mdp5_disable(mdp5_kms);
>> +    pm_runtime_put_sync(dev);
>>       *major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>>       *minor = FIELD(version, MDP5_HW_VERSION_MINOR);
>> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device 
>> *pdev, struct drm_device *dev)
>>        */
>>       clk_set_rate(mdp5_kms->core_clk, 200000000);
>> +    /* set uninit-ed kms */
>> +    priv->kms = &mdp5_kms->base.base;
>> +
>> +    pm_runtime_enable(&pdev->dev);
>> +    mdp5_kms->rpm_enabled = true;
>> +
>>       read_mdp_hw_revision(mdp5_kms, &major, &minor);
>>       mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
>> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device 
>> *pdev, struct drm_device *dev)
>>       if (ret)
>>           goto fail;
>> -    /* set uninit-ed kms */
>> -    priv->kms = &mdp5_kms->base.base;
>> -
>> -    pm_runtime_enable(&pdev->dev);
>> -    mdp5_kms->rpm_enabled = true;
>> -
>>       return 0;
>>   fail:
>>       if (mdp5_kms)

-- 
With best wishes
Dmitry


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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
@ 2022-11-25  9:21     ` Dmitry Baryshkov
  0 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2022-11-25  9:21 UTC (permalink / raw)
  To: Abhinav Kumar, Rob Clark, Sean Paul
  Cc: freedreno, linux-arm-msm, Bjorn Andersson, dri-devel, Stephen Boyd

On 25/11/2022 07:45, Abhinav Kumar wrote:
> On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
>> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
>> drvdata") reading the MDP5 hw revision on db410c will crash the board
>> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
>> (moving rpm enablement) and set priv->kms earlier. This make it possible
>> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
>> power up both the MDP5 and MDSS devices.
>>
> 
> This is the exact concern I had even when c6122688f265 was pushed.
> 
> https://patchwork.freedesktop.org/patch/508334/#comment_917689
> 
> Was the response given that time not correct then?

Not fully correct. I did not notice, that non-rpm-enabled mdp5 node 
doesn't force mdss to be in the on state. (Which is strange. Maybe we 
are leaking pm_runtime_enable() for it somewhere.)

> 
> https://patchwork.freedesktop.org/patch/508334/#comment_917713
>> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>>   1 file changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> index b46f983f2b46..29ae5c9613f3 100644
>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms 
>> *mdp5_kms,
>>       struct device *dev = &mdp5_kms->pdev->dev;
>>       u32 version;
>> -    /* Manually enable the MDP5, as pm runtime isn't usable yet. */
>> -    mdp5_enable(mdp5_kms);
>> +    pm_runtime_get_sync(dev);
>>       version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
>> -    mdp5_disable(mdp5_kms);
>> +    pm_runtime_put_sync(dev);
>>       *major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>>       *minor = FIELD(version, MDP5_HW_VERSION_MINOR);
>> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device 
>> *pdev, struct drm_device *dev)
>>        */
>>       clk_set_rate(mdp5_kms->core_clk, 200000000);
>> +    /* set uninit-ed kms */
>> +    priv->kms = &mdp5_kms->base.base;
>> +
>> +    pm_runtime_enable(&pdev->dev);
>> +    mdp5_kms->rpm_enabled = true;
>> +
>>       read_mdp_hw_revision(mdp5_kms, &major, &minor);
>>       mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
>> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device 
>> *pdev, struct drm_device *dev)
>>       if (ret)
>>           goto fail;
>> -    /* set uninit-ed kms */
>> -    priv->kms = &mdp5_kms->base.base;
>> -
>> -    pm_runtime_enable(&pdev->dev);
>> -    mdp5_kms->rpm_enabled = true;
>> -
>>       return 0;
>>   fail:
>>       if (mdp5_kms)

-- 
With best wishes
Dmitry


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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
  2022-11-25  9:21     ` Dmitry Baryshkov
@ 2022-11-25 11:21       ` Abhinav Kumar
  -1 siblings, 0 replies; 8+ messages in thread
From: Abhinav Kumar @ 2022-11-25 11:21 UTC (permalink / raw)
  To: Dmitry Baryshkov, Rob Clark, Sean Paul
  Cc: Stephen Boyd, David Airlie, Daniel Vetter, Bjorn Andersson,
	linux-arm-msm, dri-devel, freedreno



On 11/25/2022 1:21 AM, Dmitry Baryshkov wrote:
> On 25/11/2022 07:45, Abhinav Kumar wrote:
>> On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
>>> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
>>> drvdata") reading the MDP5 hw revision on db410c will crash the board
>>> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
>>> (moving rpm enablement) and set priv->kms earlier. This make it possible
>>> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
>>> power up both the MDP5 and MDSS devices.
>>>
>>
>> This is the exact concern I had even when c6122688f265 was pushed.
>>
>> https://patchwork.freedesktop.org/patch/508334/#comment_917689
>>
>> Was the response given that time not correct then?
> 
> Not fully correct. I did not notice, that non-rpm-enabled mdp5 node 
> doesn't force mdss to be in the on state. (Which is strange. Maybe we 
> are leaking pm_runtime_enable() for it somewhere.)
> 

hmmm, this is a safer change as we are atleast not bypassing pm runtime.

 From that perspective,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>
>> https://patchwork.freedesktop.org/patch/508334/#comment_917713
>>> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>>>   1 file changed, 8 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
>>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> index b46f983f2b46..29ae5c9613f3 100644
>>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms 
>>> *mdp5_kms,
>>>       struct device *dev = &mdp5_kms->pdev->dev;
>>>       u32 version;
>>> -    /* Manually enable the MDP5, as pm runtime isn't usable yet. */
>>> -    mdp5_enable(mdp5_kms);
>>> +    pm_runtime_get_sync(dev);
>>>       version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
>>> -    mdp5_disable(mdp5_kms);
>>> +    pm_runtime_put_sync(dev);
>>>       *major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>>>       *minor = FIELD(version, MDP5_HW_VERSION_MINOR);
>>> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device 
>>> *pdev, struct drm_device *dev)
>>>        */
>>>       clk_set_rate(mdp5_kms->core_clk, 200000000);
>>> +    /* set uninit-ed kms */
>>> +    priv->kms = &mdp5_kms->base.base;
>>> +
>>> +    pm_runtime_enable(&pdev->dev);
>>> +    mdp5_kms->rpm_enabled = true;
>>> +
>>>       read_mdp_hw_revision(mdp5_kms, &major, &minor);
>>>       mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
>>> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device 
>>> *pdev, struct drm_device *dev)
>>>       if (ret)
>>>           goto fail;
>>> -    /* set uninit-ed kms */
>>> -    priv->kms = &mdp5_kms->base.base;
>>> -
>>> -    pm_runtime_enable(&pdev->dev);
>>> -    mdp5_kms->rpm_enabled = true;
>>> -
>>>       return 0;
>>>   fail:
>>>       if (mdp5_kms)
> 

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

* Re: [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform
@ 2022-11-25 11:21       ` Abhinav Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Abhinav Kumar @ 2022-11-25 11:21 UTC (permalink / raw)
  To: Dmitry Baryshkov, Rob Clark, Sean Paul
  Cc: freedreno, linux-arm-msm, Bjorn Andersson, dri-devel, Stephen Boyd



On 11/25/2022 1:21 AM, Dmitry Baryshkov wrote:
> On 25/11/2022 07:45, Abhinav Kumar wrote:
>> On 11/24/2022 4:02 PM, Dmitry Baryshkov wrote:
>>> Since the commit commit c6122688f265 ("drm/msm/mdp5: stop overriding
>>> drvdata") reading the MDP5 hw revision on db410c will crash the board
>>> as the MDSS_GDSC is not enabled. Revert a part of the offending commit
>>> (moving rpm enablement) and set priv->kms earlier. This make it possible
>>> to use pm_runtime_get_sync() during read_mdp_hw_revision(), which will
>>> power up both the MDP5 and MDSS devices.
>>>
>>
>> This is the exact concern I had even when c6122688f265 was pushed.
>>
>> https://patchwork.freedesktop.org/patch/508334/#comment_917689
>>
>> Was the response given that time not correct then?
> 
> Not fully correct. I did not notice, that non-rpm-enabled mdp5 node 
> doesn't force mdss to be in the on state. (Which is strange. Maybe we 
> are leaking pm_runtime_enable() for it somewhere.)
> 

hmmm, this is a safer change as we are atleast not bypassing pm runtime.

 From that perspective,

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>
>> https://patchwork.freedesktop.org/patch/508334/#comment_917713
>>> Fixes: c6122688f265 ("drm/msm/mdp5: stop overriding drvdata")
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>>   drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 17 ++++++++---------
>>>   1 file changed, 8 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c 
>>> b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> index b46f983f2b46..29ae5c9613f3 100644
>>> --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c
>>> @@ -519,10 +519,9 @@ static void read_mdp_hw_revision(struct mdp5_kms 
>>> *mdp5_kms,
>>>       struct device *dev = &mdp5_kms->pdev->dev;
>>>       u32 version;
>>> -    /* Manually enable the MDP5, as pm runtime isn't usable yet. */
>>> -    mdp5_enable(mdp5_kms);
>>> +    pm_runtime_get_sync(dev);
>>>       version = mdp5_read(mdp5_kms, REG_MDP5_HW_VERSION);
>>> -    mdp5_disable(mdp5_kms);
>>> +    pm_runtime_put_sync(dev);
>>>       *major = FIELD(version, MDP5_HW_VERSION_MAJOR);
>>>       *minor = FIELD(version, MDP5_HW_VERSION_MINOR);
>>> @@ -839,6 +838,12 @@ static int mdp5_init(struct platform_device 
>>> *pdev, struct drm_device *dev)
>>>        */
>>>       clk_set_rate(mdp5_kms->core_clk, 200000000);
>>> +    /* set uninit-ed kms */
>>> +    priv->kms = &mdp5_kms->base.base;
>>> +
>>> +    pm_runtime_enable(&pdev->dev);
>>> +    mdp5_kms->rpm_enabled = true;
>>> +
>>>       read_mdp_hw_revision(mdp5_kms, &major, &minor);
>>>       mdp5_kms->cfg = mdp5_cfg_init(mdp5_kms, major, minor);
>>> @@ -887,12 +892,6 @@ static int mdp5_init(struct platform_device 
>>> *pdev, struct drm_device *dev)
>>>       if (ret)
>>>           goto fail;
>>> -    /* set uninit-ed kms */
>>> -    priv->kms = &mdp5_kms->base.base;
>>> -
>>> -    pm_runtime_enable(&pdev->dev);
>>> -    mdp5_kms->rpm_enabled = true;
>>> -
>>>       return 0;
>>>   fail:
>>>       if (mdp5_kms)
> 

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

end of thread, other threads:[~2022-11-25 11:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25  0:02 [PATCH] drm/msm/mdp5: fix reading hw revision on db410c platform Dmitry Baryshkov
2022-11-25  0:02 ` Dmitry Baryshkov
2022-11-25  5:45 ` Abhinav Kumar
2022-11-25  5:45   ` Abhinav Kumar
2022-11-25  9:21   ` Dmitry Baryshkov
2022-11-25  9:21     ` Dmitry Baryshkov
2022-11-25 11:21     ` Abhinav Kumar
2022-11-25 11:21       ` Abhinav Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.