All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Hans de Goede <hdegoede@redhat.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, russianneuromancer@ya.ru
Subject: Re: [PATCH v2 2/2] ACPI / PMIC: xpower: Add support for the GPI1 regulator to the OpRegion handler
Date: Thu, 27 Apr 2017 12:35:46 +0300	[thread overview]
Message-ID: <1493285746.24567.224.camel@linux.intel.com> (raw)
In-Reply-To: <2873076.4YlPq2sVU6@aspire.rjw.lan>

On Thu, 2017-04-27 at 00:01 +0200, Rafael J. Wysocki wrote:
> On Friday, April 21, 2017 01:48:09 PM Hans de Goede wrote:
> > Some Bay Trail devices use a GPI1 regulator field (address 0x4c) in
> > their 0x8d power OpRegion, add support for this.
> > 
> > This fixes AE_BAD_PARAMETER errors getting thrown on these devices
> > and
> > fixes these errors causing these devices to not suspend.
> > 
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Srinivas, Andy, any concerns here?

Nothing major.

It might be useful to introduce

GPI1_LDO_MASK GENMASK(2,0)
GPI1_LDO_ON  (3 << 0)
GPI1_LDO_OFF (4 << 0)

But it's up to you. I'm fine with either.

> > ---
> > Changes in v2:
> > -Simplify reg == 0x92 handling (suggested by Andy Shevchenko)
> > -Add special handling for reg == 0x92 to
> > intel_xpower_pmic_get_power() too
> > ---
> >  drivers/acpi/pmic/intel_pmic_xpower.c | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c
> > b/drivers/acpi/pmic/intel_pmic_xpower.c
> > index 1a76c78..c9be430 100644
> > --- a/drivers/acpi/pmic/intel_pmic_xpower.c
> > +++ b/drivers/acpi/pmic/intel_pmic_xpower.c
> > @@ -118,6 +118,10 @@ static struct pmic_table power_table[] = {
> >  		.reg = 0x10,
> >  		.bit = 0x00
> >  	}, /* BUC6 */
> > +	{
> > +		.address = 0x4c,
> > +		.reg = 0x92,
> > +	}, /* GPI1 */
> >  };
> >  
> >  /* TMP0 - TMP5 are the same, all from GPADC */
> > @@ -156,7 +160,12 @@ static int intel_xpower_pmic_get_power(struct
> > regmap *regmap, int reg,
> >  	if (regmap_read(regmap, reg, &data))
> >  		return -EIO;
> >  
> > -	*value = (data & BIT(bit)) ? 1 : 0;
> > +	/* GPIO1 LDO regulator needs special handling */
> > +	if (reg == 0x92)
> > +		*value = ((data & 0x07) == 0x03);
> > +	else
> > +		*value = (data & BIT(bit)) ? 1 : 0;
> > +
> >  	return 0;
> >  }
> >  
> > @@ -165,6 +174,10 @@ static int
> > intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
> >  {
> >  	int data;
> >  
> > +	/* GPIO1 LDO regulator needs special handling */
> > +	if (reg == 0x92)
> > +		return regmap_update_bits(regmap, reg, 0x07, on ?
> > 0x03 : 0x04);
> > +
> >  	if (regmap_read(regmap, reg, &data))
> >  		return -EIO;
> >  
> > 
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2017-04-27  9:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-21 11:48 [PATCH v2 1/2] ACPI / PMIC: xpower: Fix power_table addresses Hans de Goede
2017-04-21 11:48 ` [PATCH v2 2/2] ACPI / PMIC: xpower: Add support for the GPI1 regulator to the OpRegion handler Hans de Goede
2017-04-26 22:01   ` Rafael J. Wysocki
2017-04-27  9:35     ` Andy Shevchenko [this message]
2017-04-27 22:28       ` Rafael J. Wysocki
2017-04-27 23:20     ` Srinivas Pandruvada

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=1493285746.24567.224.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=russianneuromancer@ya.ru \
    --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 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.