From: Jonathan Cameron <jic23@kernel.org>
To: Claudiu <claudiu.beznea@tuxon.dev>
Cc: prabhakar.mahadev-lad.rj@bp.renesas.com, lars@metafoo.de,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
geert+renesas@glider.be, magnus.damm@gmail.com,
mturquette@baylibre.com, sboyd@kernel.org,
p.zabel@pengutronix.de, linux-iio@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 07/14] iio: adc: rzg2l_adc: Enable runtime PM autosuspend support
Date: Tue, 3 Dec 2024 20:00:46 +0000 [thread overview]
Message-ID: <20241203200046.0dfb784a@jic23-huawei> (raw)
In-Reply-To: <20241203111314.2420473-8-claudiu.beznea.uj@bp.renesas.com>
On Tue, 3 Dec 2024 13:13:07 +0200
Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Enable runtime PM autosuspend support for the rzg2l_adc driver. With this
> change, consecutive conversion requests will no longer cause the device to
> be runtime-enabled/disabled after each request. Instead, the device will
> transition based on the delay configured by the user.
>
> This approach reduces the frequency of hardware register access during
> runtime PM suspend/resume cycles, thereby saving CPU cycles. The default
> autosuspend delay is set to zero to maintain the previous driver behavior.
Unless you have a weird user who is polling slow enough to not trigger
autosuspend with a non zero period, but is still saving power I'm not convinced
anyone will notice if you just enable this for a sensible autosuspend delay.
There will of course be a small increase in power usage for each read but
hopefully that is trivial.
So I'd not go with a default of 0, though what value makes sense depends
on the likely usecase + how much power is saved by going to sleep.
If you really want to keep 0 I don't mind that much, just seems odd!
Jonathan
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
> drivers/iio/adc/rzg2l_adc.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c
> index eed2944bd98d..fda8b42ded81 100644
> --- a/drivers/iio/adc/rzg2l_adc.c
> +++ b/drivers/iio/adc/rzg2l_adc.c
> @@ -207,7 +207,8 @@ static int rzg2l_adc_conversion(struct iio_dev *indio_dev, struct rzg2l_adc *adc
> rzg2l_adc_start_stop(adc, false);
>
> rpm_put:
> - pm_runtime_put_sync(dev);
> + pm_runtime_mark_last_busy(dev);
> + pm_runtime_put_autosuspend(dev);
> return ret;
> }
>
> @@ -372,7 +373,8 @@ static int rzg2l_adc_hw_init(struct device *dev, struct rzg2l_adc *adc)
> rzg2l_adc_writel(adc, RZG2L_ADM(3), reg);
>
> exit_hw_init:
> - pm_runtime_put_sync(dev);
> + pm_runtime_mark_last_busy(dev);
> + pm_runtime_put_autosuspend(dev);
> return ret;
> }
>
> @@ -412,6 +414,9 @@ static int rzg2l_adc_probe(struct platform_device *pdev)
> return PTR_ERR(adc->presetn);
> }
>
> + /* Default 0 for power saving. Can be overridden via sysfs. */
> + pm_runtime_set_autosuspend_delay(dev, 0);
> + pm_runtime_use_autosuspend(dev);
> ret = devm_pm_runtime_enable(dev);
> if (ret)
> return ret;
next prev parent reply other threads:[~2024-12-03 20:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 11:13 [PATCH 00/14] iio: adc: rzg2l_adc: Add support for RZ/G3S Claudiu
2024-12-03 11:13 ` [PATCH 01/14] clk: renesas: r9a08g045: Add clocks, resets and power domain support for the ADC IP Claudiu
2024-12-03 11:13 ` [PATCH 02/14] iio: adc: rzg2l_adc: Use devres helpers to request pre-deasserted reset controls Claudiu
2024-12-03 19:51 ` Jonathan Cameron
2024-12-03 11:13 ` [PATCH 03/14] iio: adc: rzg2l_adc: Simplify the runtime PM code Claudiu
2024-12-03 12:53 ` Paul Barker
2024-12-03 13:40 ` Claudiu Beznea
2024-12-03 14:20 ` Paul Barker
2024-12-03 11:13 ` [PATCH 04/14] iio: adc: rzg2l_adc: Switch to RUNTIME_PM_OPS() and pm_ptr() Claudiu
2024-12-03 11:13 ` [PATCH 05/14] iio: adc: rzg2l_adc: Use read_poll_timeout() Claudiu
2024-12-03 11:13 ` [PATCH 06/14] iio: adc: rzg2l_adc: Simplify the locking scheme in rzg2l_adc_read_raw() Claudiu
2024-12-03 13:03 ` Paul Barker
2024-12-03 18:07 ` Jonathan Cameron
2024-12-03 11:13 ` [PATCH 07/14] iio: adc: rzg2l_adc: Enable runtime PM autosuspend support Claudiu
2024-12-03 20:00 ` Jonathan Cameron [this message]
2024-12-04 8:31 ` Claudiu Beznea
2024-12-04 9:09 ` Biju Das
2024-12-03 11:13 ` [PATCH 08/14] iio: adc: rzg2l_adc: Prepare for the addition of RZ/G3S support Claudiu
2024-12-03 20:09 ` Jonathan Cameron
2024-12-04 9:40 ` Geert Uytterhoeven
2024-12-07 17:37 ` Jonathan Cameron
2024-12-03 11:13 ` [PATCH 09/14] iio: adc: rzg2l_adc: Add support for channel 8 Claudiu
2024-12-03 20:18 ` Jonathan Cameron
2024-12-04 8:50 ` Claudiu Beznea
2024-12-07 17:42 ` Jonathan Cameron
2024-12-03 11:13 ` [PATCH 10/14] iio: adc: rzg2l_adc: Add suspend/resume support Claudiu
2024-12-03 11:13 ` [PATCH 11/14] dt-bindings: iio: adc: renesas,rzg2l-adc: Document RZ/G3S SoC Claudiu
2024-12-03 16:04 ` Conor Dooley
2024-12-03 11:13 ` [PATCH 12/14] iio: adc: rzg2l_adc: Add support for Renesas RZ/G3S Claudiu
2024-12-03 22:08 ` Jonathan Cameron
2024-12-03 11:13 ` [PATCH 13/14] arm64: dts: renesas: r9a08g045: Add ADC node Claudiu
2024-12-03 11:13 ` [PATCH 14/14] arm64: dts: renesas: rzg3s-smarc-som: Enable ADC Claudiu
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=20241203200046.0dfb784a@jic23-huawei \
--to=jic23@kernel.org \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-clk@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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;
as well as URLs for NNTP newsgroup(s).