public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Hennerich <michael.hennerich@analog.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
	"device-drivers-devel@blackfin.uclinux.org" 
	<device-drivers-devel@blackfin.uclinux.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mfd:adp5520: Restore mode bits on resume
Date: Tue, 19 Feb 2013 14:10:04 +0100	[thread overview]
Message-ID: <512379AC.6010304@analog.com> (raw)
In-Reply-To: <1361271082-29905-1-git-send-email-lars@metafoo.de>

On 02/19/2013 11:51 AM, Lars-Peter Clausen wrote:
> The adp5520 unfortunately also clears the BL_EN bit when the nSTNDBY bit is
> cleared. So we need to make sure to restore it during resume if it was set
> before suspend.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> ---
>   drivers/mfd/adp5520.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
> index 210dd03..6b40e0c 100644
> --- a/drivers/mfd/adp5520.c
> +++ b/drivers/mfd/adp5520.c
> @@ -36,6 +36,7 @@ struct adp5520_chip {
>   	struct blocking_notifier_head notifier_list;
>   	int irq;
>   	unsigned long id;
> +	uint8_t mode;
>   };
>   
>   static int __adp5520_read(struct i2c_client *client,
> @@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)
>   	struct i2c_client *client = to_i2c_client(dev);
>   	struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
>   
> -	adp5520_clr_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
> +	adp5520_read(chip->dev, ADP5520_MODE_STATUS, &chip->mode);
> +	/* All other bits are W1C */
> +	chip->mode &= ADP5520_BL_EN | ADP5520_DIM_EN | ADP5520_nSTNBY;
> +	adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
>   	return 0;
>   }
>   
> @@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)
>   	struct i2c_client *client = to_i2c_client(dev);
>   	struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
>   
> -	adp5520_set_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
> +	adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode);
>   	return 0;
>   }
>   #endif


-- 
Greetings,
Michael

--
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368;
Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin,
Margaret Seif



  reply	other threads:[~2013-02-19 13:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19 10:51 [PATCH] mfd:adp5520: Restore mode bits on resume Lars-Peter Clausen
2013-02-19 13:10 ` Michael Hennerich [this message]
2013-04-08 14:49   ` Samuel Ortiz

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=512379AC.6010304@analog.com \
    --to=michael.hennerich@analog.com \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@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