lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 2 Jan 2020 01:01:54 -0600
From:   Samuel Holland <samuel@...lland.org>
To:     Chen-Yu Tsai <wens@...e.org>, Sebastian Reichel <sre@...nel.org>
Cc:     linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-sunxi@...glegroups.com
Subject: Re: [PATCH 1/7] power: supply: axp20x_ac_power: Allow offlining

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@...lland.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;
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ