All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: ktsai@capellamicro.com, lars@metafoo.de, hdegoede@redhat.com,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: light: cm32181: Add PM support
Date: Wed, 13 Jul 2022 09:30:52 +0800	[thread overview]
Message-ID: <CAAd53p6OS+WH+vP3GUyrExmy_a7KoGyN6-v5hspcFaBoS1S07Q@mail.gmail.com> (raw)
In-Reply-To: <20220707175037.1352fa6b@jic23-huawei>

On Fri, Jul 8, 2022 at 12:40 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Thu,  7 Jul 2022 08:01:51 +0800
> Kai-Heng Feng <kai.heng.feng@canonical.com> wrote:
>
> > The read on in_illuminance_input keeps at 0 after system sleep.
> >
> > So add proper suspend and resume callback to make the sensor keep
> > working after system sleep.
> >
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> Applied to the togreg branch of iio.git and pushed out as testing for
> the autobuilders to poke at it and see if we missed anything,

This commit doesn't seem to be included in iio/togreg branch.

Kai-Heng

>
> Thanks,
>
> Jonathan
>
> > ---
> > v2:
> >  - Use dev_get_drvdata() instead of i2c_get_clientdata() to avoid extra
> >    dereference.
> >
> >  drivers/iio/light/cm32181.c | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> >
> > diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
> > index 97649944f1df6..edbe6a3138d0b 100644
> > --- a/drivers/iio/light/cm32181.c
> > +++ b/drivers/iio/light/cm32181.c
> > @@ -460,6 +460,8 @@ static int cm32181_probe(struct i2c_client *client)
> >                       return PTR_ERR(client);
> >       }
> >
> > +     i2c_set_clientdata(client, indio_dev);
> > +
> >       cm32181 = iio_priv(indio_dev);
> >       cm32181->client = client;
> >       cm32181->dev = dev;
> > @@ -486,6 +488,25 @@ static int cm32181_probe(struct i2c_client *client)
> >       return 0;
> >  }
> >
> > +static int cm32181_suspend(struct device *dev)
> > +{
> > +     struct i2c_client *client = to_i2c_client(dev);
> > +
> > +     return i2c_smbus_write_word_data(client, CM32181_REG_ADDR_CMD,
> > +                                      CM32181_CMD_ALS_DISABLE);
> > +}
> > +
> > +static int cm32181_resume(struct device *dev)
> > +{
> > +     struct i2c_client *client = to_i2c_client(dev);
> > +     struct cm32181_chip *cm32181 = iio_priv(dev_get_drvdata(dev));
> > +
> > +     return i2c_smbus_write_word_data(client, CM32181_REG_ADDR_CMD,
> > +                                      cm32181->conf_regs[CM32181_REG_ADDR_CMD]);
> > +}
> > +
> > +DEFINE_SIMPLE_DEV_PM_OPS(cm32181_pm_ops, cm32181_suspend, cm32181_resume);
> > +
> >  static const struct of_device_id cm32181_of_match[] = {
> >       { .compatible = "capella,cm3218" },
> >       { .compatible = "capella,cm32181" },
> > @@ -506,6 +527,7 @@ static struct i2c_driver cm32181_driver = {
> >               .name   = "cm32181",
> >               .acpi_match_table = ACPI_PTR(cm32181_acpi_match),
> >               .of_match_table = cm32181_of_match,
> > +             .pm = pm_sleep_ptr(&cm32181_pm_ops),
> >       },
> >       .probe_new      = cm32181_probe,
> >  };
>

  reply	other threads:[~2022-07-13  1:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-07  0:01 [PATCH v2] iio: light: cm32181: Add PM support Kai-Heng Feng
2022-07-07 16:50 ` Jonathan Cameron
2022-07-13  1:30   ` Kai-Heng Feng [this message]
2022-07-13 16:40     ` Jonathan Cameron

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=CAAd53p6OS+WH+vP3GUyrExmy_a7KoGyN6-v5hspcFaBoS1S07Q@mail.gmail.com \
    --to=kai.heng.feng@canonical.com \
    --cc=hdegoede@redhat.com \
    --cc=jic23@kernel.org \
    --cc=ktsai@capellamicro.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.