public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Baluta <daniel.baluta@intel.com>,
	pmeerw@pmeerw.net, srinivas.pandruvada@linux.intel.com,
	knaack.h@gmx.de
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 4/6] iio: imu: kmx61: Add PM sleep support
Date: Fri, 12 Dec 2014 13:45:27 +0000	[thread overview]
Message-ID: <548AF177.9010307@kernel.org> (raw)
In-Reply-To: <1417613513-28285-5-git-send-email-daniel.baluta@intel.com>

On 03/12/14 13:31, Daniel Baluta wrote:
> Per sensor state (ACTIVE/STANDBY) is saved in driver's
> private data (acc_stby/mag_stby) and restored when
> resume is called.
> 
> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
applied.
> ---
>  drivers/iio/imu/kmx61.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c
> index 7536043..f69ae5a7 100644
> --- a/drivers/iio/imu/kmx61.c
> +++ b/drivers/iio/imu/kmx61.c
> @@ -16,6 +16,7 @@
>  #include <linux/acpi.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/interrupt.h>
> +#include <linux/pm.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -796,6 +797,33 @@ static int kmx61_remove(struct i2c_client *client)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
> +static int kmx61_suspend(struct device *dev)
> +{
> +	int ret;
> +	struct kmx61_data *data = i2c_get_clientdata(to_i2c_client(dev));
> +
> +	mutex_lock(&data->lock);
> +	ret = kmx61_set_mode(data, KMX61_ALL_STBY, KMX61_ACC | KMX61_MAG,
> +			     false);
> +	mutex_unlock(&data->lock);
> +
> +	return ret;
> +}
> +
> +static int kmx61_resume(struct device *dev)
> +{
> +	u8 stby = 0;
> +	struct kmx61_data *data = i2c_get_clientdata(to_i2c_client(dev));
> +
> +	if (data->acc_stby)
> +		stby |= KMX61_ACC_STBY_BIT;
> +	if (data->mag_stby)
> +		stby |= KMX61_MAG_STBY_BIT;
> +
> +	return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true);
> +}
> +#endif
>  
>  #ifdef CONFIG_PM_RUNTIME
>  static int kmx61_runtime_suspend(struct device *dev)
> @@ -825,6 +853,7 @@ static int kmx61_runtime_resume(struct device *dev)
>  #endif
>  
>  static const struct dev_pm_ops kmx61_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume)
>  	SET_RUNTIME_PM_OPS(kmx61_runtime_suspend, kmx61_runtime_resume, NULL)
>  };
>  
> 


  reply	other threads:[~2014-12-12 13:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 13:31 [PATCH v4 0/6] Add support for KMX61 sensor Daniel Baluta
2014-12-03 13:31 ` [PATCH v4 1/6] iio: imu: Add support for Kionix " Daniel Baluta
2014-12-12 13:32   ` Jonathan Cameron
2014-12-14 22:43   ` Hartmut Knaack
2014-12-15 10:50     ` Daniel Baluta
2014-12-03 13:31 ` [PATCH v4 2/6] iio: imu: kmx61: Add acpi support Daniel Baluta
2014-12-12 13:35   ` Jonathan Cameron
2014-12-03 13:31 ` [PATCH v4 3/6] iio: imu: kmx61: Add PM runtime support Daniel Baluta
2014-12-12 13:37   ` Jonathan Cameron
2014-12-14 22:55   ` Hartmut Knaack
2014-12-15 16:11     ` Daniel Baluta
2014-12-03 13:31 ` [PATCH v4 4/6] iio: imu: kmx61: Add PM sleep support Daniel Baluta
2014-12-12 13:45   ` Jonathan Cameron [this message]
2014-12-03 13:31 ` [PATCH v4 5/6] iio: imu: kmx61: Add support for data ready triggers Daniel Baluta
2014-12-12 13:49   ` Jonathan Cameron
2014-12-14 23:04   ` Hartmut Knaack
2014-12-03 13:31 ` [PATCH v4 6/6] iio: imu: kmx61: Add support for any motion trigger Daniel Baluta
2014-12-12 13:54   ` Jonathan Cameron
2014-12-15 23:19   ` Hartmut Knaack
2014-12-16 11:08     ` Daniel Baluta

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=548AF177.9010307@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox