mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Steven Price <steven.price@arm.com>, boris.brezillon@collabora.com
Cc: robh@kernel.org, maarten.lankhorst@linux.intel.com,
	mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
	daniel@ffwll.ch, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, wenst@chromium.org,
	kernel@collabora.com
Subject: Re: [PATCH 3/4] drm/panfrost: Implement ability to turn on/off regulators in suspend
Date: Tue, 31 Oct 2023 10:00:18 +0100	[thread overview]
Message-ID: <85cc1cae-7135-4118-b70a-96eb8d3f0842@collabora.com> (raw)
In-Reply-To: <2b553f07-71d0-4d06-8f60-7cd8f29d78e1@arm.com>

Il 30/10/23 15:57, Steven Price ha scritto:
> On 30/10/2023 13:22, AngeloGioacchino Del Regno wrote:
>> Some platforms/SoCs can power off the GPU entirely by completely cutting
>> off power, greatly enhancing battery time during system suspend: add a
>> new pm_feature GPU_PM_VREG_OFF to allow turning off the GPU regulators
>> during full suspend only on selected platforms.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   drivers/gpu/drm/panfrost/panfrost_device.c | 19 ++++++++++++++++++-
>>   drivers/gpu/drm/panfrost/panfrost_device.h |  2 ++
>>   2 files changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
>> index 2022ed76a620..51b22eb0971d 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_device.c
>> +++ b/drivers/gpu/drm/panfrost/panfrost_device.c
>> @@ -431,10 +431,21 @@ static int panfrost_device_resume(struct device *dev)
>>   	struct panfrost_device *pfdev = dev_get_drvdata(dev);
>>   	int ret;
>>   
>> +	if (pfdev->comp->pm_features & BIT(GPU_PM_VREG_OFF)) {
>> +		unsigned long freq = pfdev->pfdevfreq.fast_rate;
>> +		struct dev_pm_opp *opp;
>> +
>> +		opp = dev_pm_opp_find_freq_ceil(dev, &freq);
>> +		if (IS_ERR(opp))
>> +			return PTR_ERR(opp);
>> +		dev_pm_opp_put(opp);
>> +		dev_pm_opp_set_opp(dev, opp);
> 
> These lines look the wrong way round - surely we want to hang onto the
> reference until the set_opp call is made?
> 

Whoops! Yes, thanks, this happened during a cleanup for whatever reason.
I'll invert those for v2.

Angelo

> Steve
> 
>> +	}
>> +
>>   	if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS)) {
>>   		ret = clk_enable(pfdev->clock);
>>   		if (ret)
>> -			return ret;
>> +			goto err_clk;
>>   
>>   		if (pfdev->bus_clock) {
>>   			ret = clk_enable(pfdev->bus_clock);
>> @@ -455,6 +466,9 @@ static int panfrost_device_resume(struct device *dev)
>>   err_bus_clk:
>>   	if (pfdev->comp->pm_features & BIT(GPU_PM_CLK_DIS))
>>   		clk_disable(pfdev->clock);
>> +err_clk:
>> +	if (pfdev->comp->pm_features & BIT(GPU_PM_VREG_OFF))
>> +		dev_pm_opp_set_opp(dev, NULL);
>>   	return ret;
>>   }
>>   
>> @@ -474,6 +488,9 @@ static int panfrost_device_suspend(struct device *dev)
>>   			clk_disable(pfdev->bus_clock);
>>   	}
>>   
>> +	if (pfdev->comp->pm_features & BIT(GPU_PM_VREG_OFF))
>> +		dev_pm_opp_set_opp(dev, NULL);
>> +
>>   	return 0;
>>   }
>>   
>> diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
>> index d7f179eb8ea3..0fc558db6bfd 100644
>> --- a/drivers/gpu/drm/panfrost/panfrost_device.h
>> +++ b/drivers/gpu/drm/panfrost/panfrost_device.h
>> @@ -28,9 +28,11 @@ struct panfrost_perfcnt;
>>   /**
>>    * enum panfrost_gpu_pm - Supported kernel power management features
>>    * @GPU_PM_CLK_DIS:  Allow disabling clocks during system suspend
>> + * @GPU_PM_VREG_OFF: Allow turning off regulators during system suspend
>>    */
>>   enum panfrost_gpu_pm {
>>   	GPU_PM_CLK_DIS,
>> +	GPU_PM_VREG_OFF,
>>   };
>>   
>>   struct panfrost_features {
> 
> _______________________________________________
> Kernel mailing list -- kernel@mailman.collabora.com
> To unsubscribe send an email to kernel-leave@mailman.collabora.com




  reply	other threads:[~2023-10-31  9:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30 13:22 [PATCH 0/4] drm/panfrost: Turn off clocks and regulators in PM AngeloGioacchino Del Regno
2023-10-30 13:22 ` [PATCH 1/4] drm/panfrost: Implement ability to turn on/off GPU clocks in suspend AngeloGioacchino Del Regno
2023-10-30 14:57   ` Steven Price
2023-10-31  8:59     ` AngeloGioacchino Del Regno
2023-10-31 10:33       ` AngeloGioacchino Del Regno
2023-11-01 11:28         ` Steven Price
2023-10-31  3:18   ` Chen-Yu Tsai
2023-10-31 13:20     ` AngeloGioacchino Del Regno
2023-10-30 13:22 ` [PATCH 2/4] drm/panfrost: Set clocks on/off during system sleep on MediaTek SoCs AngeloGioacchino Del Regno
2023-10-30 13:22 ` [PATCH 3/4] drm/panfrost: Implement ability to turn on/off regulators in suspend AngeloGioacchino Del Regno
2023-10-30 14:57   ` Steven Price
2023-10-31  9:00     ` AngeloGioacchino Del Regno [this message]
2023-10-30 13:22 ` [PATCH 4/4] drm/panfrost: Set regulators on/off during system sleep on MediaTek SoCs AngeloGioacchino Del Regno

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85cc1cae-7135-4118-b70a-96eb8d3f0842@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=robh@kernel.org \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®