[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240928163631.04e11191@jic23-huawei>
Date: Sat, 28 Sep 2024 16:36:31 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Abhash Jha <abhashkumarjha123@...il.com>
Cc: linux-iio@...r.kernel.org, anshulusr@...il.com, lars@...afoo.de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/4] iio: light: ltr390: Suspend and Resume support
On Sat, 14 Sep 2024 23:42:44 +0530
Abhash Jha <abhashkumarjha123@...il.com> wrote:
> Added support for suspend and resume PM ops.
> We suspend the sensor by clearing the ALS_UVS_EN bit in the MAIN CONTROL
> register. And we resume it by setting that bit.
>
> Signed-off-by: Abhash Jha <abhashkumarjha123@...il.com>
I made a few tweaks whilst applying.
> ---
> drivers/iio/light/ltr390.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/iio/light/ltr390.c b/drivers/iio/light/ltr390.c
> index c50ea31e2..e152009b5 100644
> --- a/drivers/iio/light/ltr390.c
> +++ b/drivers/iio/light/ltr390.c
> @@ -24,6 +24,7 @@
> #include <linux/mutex.h>
> #include <linux/regmap.h>
> #include <linux/bitfield.h>
> +#include <linux/device.h>
This is already out of order, but moving the new include to the top
means only bitfield.h is misplaced.
>
> #include <linux/iio/iio.h>
>
> @@ -430,6 +431,26 @@ static int ltr390_probe(struct i2c_client *client)
> return devm_iio_device_register(dev, indio_dev);
> }
>
> +static int ltr390_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> + struct ltr390_data *data = iio_priv(indio_dev);
> +
> + return regmap_clear_bits(data->regmap, LTR390_MAIN_CTRL,
> + LTR390_SENSOR_ENABLE);
> +}
> +
> +static int ltr390_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> + struct ltr390_data *data = iio_priv(indio_dev);
> +
> + return regmap_set_bits(data->regmap, LTR390_MAIN_CTRL,
> + LTR390_SENSOR_ENABLE);
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(ltr390_pm_ops, ltr390_suspend, ltr390_resume);
> +
> static const struct i2c_device_id ltr390_id[] = {
> { "ltr390" },
> { /* Sentinel */ }
> @@ -446,6 +467,7 @@ static struct i2c_driver ltr390_driver = {
> .driver = {
> .name = "ltr390",
> .of_match_table = ltr390_of_table,
> + .pm = pm_sleep_ptr(<r390_pm_ops),
Tabs for aligning these go wrong so often by creating noise
in future patches + this code doesn't use them. So I dropped that
to be a space.
Thanks,
Jonathan
> },
> .probe = ltr390_probe,
> .id_table = ltr390_id,
Powered by blists - more mailing lists