diff options
| author | Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> | 2024-12-06 14:13:30 +0300 |
|---|---|---|
| committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2024-12-11 22:18:48 +0300 |
| commit | d7c3e3463492f50644168cbb4e443034052d1c22 (patch) | |
| tree | 3efd43bf4719ddd4ed41ba60f9e1d82d2faaf598 | |
| parent | 5d7fb2d589c56877bf220f73debd134c09e8209f (diff) | |
| download | linux-d7c3e3463492f50644168cbb4e443034052d1c22.tar.xz | |
iio: adc: rzg2l_adc: Enable runtime PM autosuspend support
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.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20241206111337.726244-9-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| -rw-r--r-- | drivers/iio/adc/rzg2l_adc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index 7da84224a292..4191b090ec74 100644 --- a/drivers/iio/adc/rzg2l_adc.c +++ b/drivers/iio/adc/rzg2l_adc.c @@ -208,7 +208,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; } @@ -373,7 +374,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; } @@ -411,6 +413,8 @@ static int rzg2l_adc_probe(struct platform_device *pdev) return dev_err_probe(dev, PTR_ERR(adc->presetn), "failed to get/deassert presetn\n"); + pm_runtime_set_autosuspend_delay(dev, 300); + pm_runtime_use_autosuspend(dev); ret = devm_pm_runtime_enable(dev); if (ret) return ret; |
