RE: [PATCH 07/14] iio: adc: rzg2l_adc: Enable runtime PM autosuspend support

Biju Das
2024-12-04T09:09:46Z

Hi All,

> -----Original Message-----
> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Sent: 04 December 2024 08:32
> Subject: Re: [PATCH 07/14] iio: adc: rzg2l_adc: Enable runtime PM autosuspend support
>
> Hi, Jonathan,
>
> On 03.12.2024 22:00, Jonathan Cameron wrote:
> > 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!
>
> I agree with you. I chose it like this as I got internal request (on other drivers enabling
> autosuspend support) to keep the previous behavior in place.

On I2C driver after every transfer we turn off the clocks to save power(transaction based).

If we introduce autosupend with 100msec, we are consuming power for 100msec. So, to keep
previous behaviour, we are setting the value to 0, when auto suspend feature is introduced there.

ADC case maybe different, you can have sensible delay between reading the temperature/voltage
and next request as it uses polling.

Cheers,
Biju