linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: Chen-Yu Tsai <wens@csie.org>, Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-sunxi@googlegroups.com
Subject: Re: [PATCH 1/7] power: supply: axp20x_ac_power: Allow offlining
Date: Thu, 2 Jan 2020 01:01:54 -0600	[thread overview]
Message-ID: <0118a2f5-bd7b-e719-06f9-8665912aa553@sholland.org> (raw)
In-Reply-To: <20200102063633.65388-1-samuel@sholland.org>

On 1/2/20 12:36 AM, Samuel Holland wrote:
> AXP803/AXP813 have a flag that enables/disables the AC power supply
> input. Allow control of this flag via the ONLINE property on those
> variants.
> 
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
>  drivers/power/supply/axp20x_ac_power.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/axp20x_ac_power.c b/drivers/power/supply/axp20x_ac_power.c
> index 0d34a932b6d5..4410e7b89383 100644
> --- a/drivers/power/supply/axp20x_ac_power.c
> +++ b/drivers/power/supply/axp20x_ac_power.c
> @@ -23,6 +23,8 @@
>  #define AXP20X_PWR_STATUS_ACIN_PRESENT	BIT(7)
>  #define AXP20X_PWR_STATUS_ACIN_AVAIL	BIT(6)
>  
> +#define AXP813_ACIN_PATH_SELECT		BIT(7)
> +
>  #define AXP813_VHOLD_MASK		GENMASK(5, 3)
>  #define AXP813_VHOLD_UV_TO_BIT(x)	((((x) / 100000) - 40) << 3)
>  #define AXP813_VHOLD_REG_TO_UV(x)	\
> @@ -143,6 +145,11 @@ static int axp813_ac_power_set_property(struct power_supply *psy,
>  	struct axp20x_ac_power *power = power_supply_get_drvdata(psy);
>  
>  	switch (psp) {
> +	case POWER_SUPPLY_PROP_ONLINE:
> +		return regmap_update_bits(power->regmap, AXP813_ACIN_PATH_CTRL,
> +					  AXP813_ACIN_PATH_SELECT,
> +					  !!val->intval);
> +

Sorry, I failed to use regmap_update_bits properly here and in
patch 5. I'll send a v2 with the value shifted properly.

>  	case POWER_SUPPLY_PROP_VOLTAGE_MIN:
>  		if (val->intval < 4000000 || val->intval > 4700000)
>  			return -EINVAL;
> @@ -169,7 +176,8 @@ static int axp813_ac_power_set_property(struct power_supply *psy,
>  static int axp813_ac_power_prop_writeable(struct power_supply *psy,
>  					  enum power_supply_property psp)
>  {
> -	return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN ||
> +	return psp == POWER_SUPPLY_PROP_ONLINE ||
> +	       psp == POWER_SUPPLY_PROP_VOLTAGE_MIN ||
>  	       psp == POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT;
>  }
>  
> 


      parent reply	other threads:[~2020-01-02  7:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02  6:36 [PATCH 1/7] power: supply: axp20x_ac_power: Allow offlining Samuel Holland
2020-01-02  6:36 ` [PATCH 2/7] power: supply: axp20x_ac_power: Add wakeup control Samuel Holland
2020-01-02  6:36 ` [PATCH 3/7] power: supply: axp20x_usb_power: Remove unused device_node Samuel Holland
2020-01-02  6:36 ` [PATCH 4/7] power: supply: axp20x_usb_power: Use a match structure Samuel Holland
2020-01-02  6:36 ` [PATCH 5/7] power: supply: axp20x_usb_power: Allow offlining Samuel Holland
2020-01-02  6:36 ` [PATCH 6/7] power: supply: axp20x_usb_power: Add wakeup control Samuel Holland
2020-01-02  6:36 ` [PATCH 7/7] power: supply: axp20x_usb_power: Only poll while offline Samuel Holland
2020-01-02  7:01 ` Samuel Holland [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=0118a2f5-bd7b-e719-06f9-8665912aa553@sholland.org \
    --to=samuel@sholland.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=sre@kernel.org \
    --cc=wens@csie.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).