From: Jonathan Cameron <jic23@kernel.org>
To: Kevin Tsai <ktsai@capellamicro.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 1/1] iio: light: Added PM support for Capella CM3232 ambient light sensor driver.
Date: Sun, 08 Mar 2015 12:05:56 +0000 [thread overview]
Message-ID: <54FC3B24.5080601@kernel.org> (raw)
In-Reply-To: <1424386971-811-1-git-send-email-ktsai@capellamicro.com>
On 19/02/15 23:02, Kevin Tsai wrote:
> Added Power Management Support.
>
> Signed-off-by: Kevin Tsai <ktsai@capellamicro.com>
Applied to the togreg branch of iio.git - initially pushed out
as testing for the autobuilders to play.
Thanks,
Jonathan
> ---
> v2:
> Added CONFIG_PM_SLEEP to suspend/resume functions to fix the build warning
> when CONFIG_PM_SLEEP is not selected.
>
> v1:
> Added Power Management support.
>
> drivers/iio/light/cm3232.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c
> index 90e3519..39c8d99 100644
> --- a/drivers/iio/light/cm3232.c
> +++ b/drivers/iio/light/cm3232.c
> @@ -378,6 +378,39 @@ static const struct i2c_device_id cm3232_id[] = {
> {}
> };
>
> +#ifdef CONFIG_PM_SLEEP
> +static int cm3232_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct cm3232_chip *chip = iio_priv(indio_dev);
> + struct i2c_client *client = chip->client;
> + int ret;
> +
> + chip->regs_cmd |= CM3232_CMD_ALS_DISABLE;
> + ret = i2c_smbus_write_byte_data(client, CM3232_REG_ADDR_CMD,
> + chip->regs_cmd);
> +
> + return ret;
> +}
> +
> +static int cm3232_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> + struct cm3232_chip *chip = iio_priv(indio_dev);
> + struct i2c_client *client = chip->client;
> + int ret;
> +
> + chip->regs_cmd &= ~CM3232_CMD_ALS_DISABLE;
> + ret = i2c_smbus_write_byte_data(client, CM3232_REG_ADDR_CMD,
> + chip->regs_cmd | CM3232_CMD_ALS_RESET);
> +
> + return ret;
> +}
> +
> +static const struct dev_pm_ops cm3232_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(cm3232_suspend, cm3232_resume)};
> +#endif
> +
> MODULE_DEVICE_TABLE(i2c, cm3232_id);
>
> static const struct of_device_id cm3232_of_match[] = {
> @@ -390,6 +423,9 @@ static struct i2c_driver cm3232_driver = {
> .name = "cm3232",
> .owner = THIS_MODULE,
> .of_match_table = of_match_ptr(cm3232_of_match),
> +#ifdef CONFIG_PM_SLEEP
> + .pm = &cm3232_pm_ops,
> +#endif
> },
> .id_table = cm3232_id,
> .probe = cm3232_probe,
>
prev parent reply other threads:[~2015-03-08 12:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 23:02 [PATCH V2 1/1] iio: light: Added PM support for Capella CM3232 ambient light sensor driver Kevin Tsai
2015-03-08 12:05 ` Jonathan Cameron [this message]
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=54FC3B24.5080601@kernel.org \
--to=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=ktsai@capellamicro.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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.