All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: make devfreq optional again
@ 2019-05-31 12:37 Neil Armstrong
  2019-05-31 13:34 ` Ezequiel Garcia
  2019-06-03 19:54 ` Ezequiel Garcia
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Armstrong @ 2019-05-31 12:37 UTC (permalink / raw)
  To: robh, tomeu.vizoso; +Cc: ezequiel, dri-devel, Neil Armstrong

Devfreq runtime usage was made mandatory, thus making panfrost fail to probe
on Amlogic S912 SoCs missin the "operating-points-v2" property.
Make it optional again, leaving PM_DEVFREQ is selected by default.

Fixes: f3617b449d ("drm/panfrost: Select devfreq")
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/gpu/drm/panfrost/panfrost_devfreq.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 29fcffdf2d57..dc75f99ad53b 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -140,7 +140,9 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
 		return 0;
 
 	ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
-	if (ret)
+	if (ret == -ENODEV) /* Optional, continue without devfreq */
+		return 0;
+	else
 		return ret;
 
 	panfrost_devfreq_reset(pfdev);
@@ -170,6 +172,9 @@ void panfrost_devfreq_resume(struct panfrost_device *pfdev)
 {
 	int i;
 
+	if (!pfdev->devfreq.devfreq)
+		return;
+
 	panfrost_devfreq_reset(pfdev);
 	for (i = 0; i < NUM_JOB_SLOTS; i++)
 		pfdev->devfreq.slot[i].busy = false;
@@ -179,6 +184,9 @@ void panfrost_devfreq_resume(struct panfrost_device *pfdev)
 
 void panfrost_devfreq_suspend(struct panfrost_device *pfdev)
 {
+	if (!pfdev->devfreq.devfreq)
+		return;
+
 	devfreq_suspend_device(pfdev->devfreq.devfreq);
 }
 
@@ -188,6 +196,9 @@ static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev, i
 	ktime_t now;
 	ktime_t last;
 
+	if (!pfdev->devfreq.devfreq)
+		return;
+
 	now = ktime_get();
 	last = pfdev->devfreq.slot[slot].time_last_update;
 
-- 
2.21.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panfrost: make devfreq optional again
  2019-05-31 12:37 [PATCH] drm/panfrost: make devfreq optional again Neil Armstrong
@ 2019-05-31 13:34 ` Ezequiel Garcia
  2019-06-03 19:54 ` Ezequiel Garcia
  1 sibling, 0 replies; 4+ messages in thread
From: Ezequiel Garcia @ 2019-05-31 13:34 UTC (permalink / raw)
  To: Neil Armstrong, robh, tomeu.vizoso; +Cc: linux-rockchip, dri-devel

On Fri, 2019-05-31 at 14:37 +0200, Neil Armstrong wrote:
> Devfreq runtime usage was made mandatory, thus making panfrost fail to probe
> on Amlogic S912 SoCs missin the "operating-points-v2" property.
> Make it optional again, leaving PM_DEVFREQ is selected by default.
> 
> Fixes: f3617b449d ("drm/panfrost: Select devfreq")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> index 29fcffdf2d57..dc75f99ad53b 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> @@ -140,7 +140,9 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
>  		return 0;
>  
>  	ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
> -	if (ret)
> +	if (ret == -ENODEV) /* Optional, continue without devfreq */
> +		return 0;
> +	else
>  		return ret;
>  
>  	panfrost_devfreq_reset(pfdev);
> @@ -170,6 +172,9 @@ void panfrost_devfreq_resume(struct panfrost_device *pfdev)
>  {
>  	int i;
>  
> +	if (!pfdev->devfreq.devfreq)
> +		return;
> +
>  	panfrost_devfreq_reset(pfdev);
>  	for (i = 0; i < NUM_JOB_SLOTS; i++)
>  		pfdev->devfreq.slot[i].busy = false;
> @@ -179,6 +184,9 @@ void panfrost_devfreq_resume(struct panfrost_device *pfdev)
>  
>  void panfrost_devfreq_suspend(struct panfrost_device *pfdev)
>  {
> +	if (!pfdev->devfreq.devfreq)
> +		return;
> +
>  	devfreq_suspend_device(pfdev->devfreq.devfreq);
>  }
>  
> @@ -188,6 +196,9 @@ static void panfrost_devfreq_update_utilization(struct panfrost_device *pfdev, i
>  	ktime_t now;
>  	ktime_t last;
>  
> +	if (!pfdev->devfreq.devfreq)
> +		return;
> +
>  	now = ktime_get();
>  	last = pfdev->devfreq.slot[slot].time_last_update;
>  

This patch should also fix RK3288 platforms, which at the moment are broken
as well by my patch.

I will test and confirm next week.

Thanks for the fix,
Ezequiel 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panfrost: make devfreq optional again
  2019-05-31 12:37 [PATCH] drm/panfrost: make devfreq optional again Neil Armstrong
  2019-05-31 13:34 ` Ezequiel Garcia
@ 2019-06-03 19:54 ` Ezequiel Garcia
  2019-06-05 10:08   ` Neil Armstrong
  1 sibling, 1 reply; 4+ messages in thread
From: Ezequiel Garcia @ 2019-06-03 19:54 UTC (permalink / raw)
  To: Neil Armstrong, robh, tomeu.vizoso; +Cc: dri-devel

On Fri, 2019-05-31 at 14:37 +0200, Neil Armstrong wrote:
> Devfreq runtime usage was made mandatory, thus making panfrost fail to probe
> on Amlogic S912 SoCs missin the "operating-points-v2" property.
> Make it optional again, leaving PM_DEVFREQ is selected by default.
> 
> Fixes: f3617b449d ("drm/panfrost: Select devfreq")
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> index 29fcffdf2d57..dc75f99ad53b 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> @@ -140,7 +140,9 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
>  		return 0;
>  
>  	ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
> -	if (ret)
> +	if (ret == -ENODEV) /* Optional, continue without devfreq */
> +		return 0;
> +	else
>  		return ret;
>  

This looks incorrect, should be:

       else if (ret)
                return ret;

Otherwise, if ret == 0, we are bailing out.

Thanks,
Eze

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/panfrost: make devfreq optional again
  2019-06-03 19:54 ` Ezequiel Garcia
@ 2019-06-05 10:08   ` Neil Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2019-06-05 10:08 UTC (permalink / raw)
  To: Ezequiel Garcia, robh, tomeu.vizoso; +Cc: dri-devel

On 03/06/2019 21:54, Ezequiel Garcia wrote:
> On Fri, 2019-05-31 at 14:37 +0200, Neil Armstrong wrote:
>> Devfreq runtime usage was made mandatory, thus making panfrost fail to probe
>> on Amlogic S912 SoCs missin the "operating-points-v2" property.
>> Make it optional again, leaving PM_DEVFREQ is selected by default.
>>
>> Fixes: f3617b449d ("drm/panfrost: Select devfreq")
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 13 ++++++++++++-
>>  1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
>> index 29fcffdf2d57..dc75f99ad53b 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
>> @@ -140,7 +140,9 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
>>  		return 0;
>>  
>>  	ret = dev_pm_opp_of_add_table(&pfdev->pdev->dev);
>> -	if (ret)
>> +	if (ret == -ENODEV) /* Optional, continue without devfreq */
>> +		return 0;
>> +	else
>>  		return ret;
>>  
> 
> This looks incorrect, should be:
> 
>        else if (ret)
>                 return ret;
> 
> Otherwise, if ret == 0, we are bailing out.

Indeed, thanks for spotting this...

Will resend.

Neil

> 
> Thanks,
> Eze
> 

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-06-05 10:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 12:37 [PATCH] drm/panfrost: make devfreq optional again Neil Armstrong
2019-05-31 13:34 ` Ezequiel Garcia
2019-06-03 19:54 ` Ezequiel Garcia
2019-06-05 10:08   ` Neil Armstrong

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.