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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150807051309.GA24702@earth>
Date:	Fri, 7 Aug 2015 07:13:09 +0200
From:	Sebastian Reichel <sre@...nel.org>
To:	NeilBrown <neil@...wn.name>
Cc:	Tony Lindgren <tony@...mide.com>,
	Samuel Ortiz <sameo@...ux.intel.com>, linux-pm@...r.kernel.org,
	David Woodhouse <dwmw2@...radead.org>,
	linux-kernel@...r.kernel.org,
	real GTA04 owners <gta04-owner@...delico.com>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	Pavel Machek <pavel@....cz>, linux-omap@...r.kernel.org,
	Lee Jones <lee.jones@...aro.org>
Subject: Re: [PATCH 07/13] twl4030_charger: distinguish between USB current
 and 'AC' current

Hi,

This actually slipped through my review. IMHO madc should be
accessed through IIO, as already done for twl4030-madc-battery
and rx51-battery. That way the custom API can be removed at
some point.

Anyway, I queued the below patch with Tony's ACK to fix the build
issue in next.

On Fri, Aug 07, 2015 at 01:45:25PM +1000, NeilBrown wrote:
> From: NeilBrown <neil@...wn.name>
> Date: Fri, 7 Aug 2015 13:44:37 +1000
> Subject: [PATCH] twl4030_charger: fix compile error when TWL4030_MADC not
>  available.
> 
> We can only use the madc to check for 'ac' availability
> if the madc has been compiled in.
> If not: assume always using USB.
> 
> Reported-by: Tony Lindgren <tony@...mide.com>
> Signed-off-by: NeilBrown <neil@...wn.name>
> 
> diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
> index c7432f532a83..265fd236f4c0 100644
> --- a/drivers/power/twl4030_charger.c
> +++ b/drivers/power/twl4030_charger.c
> @@ -91,6 +91,21 @@
>  #define TWL4030_MSTATEC_COMPLETE1	0x0b
>  #define TWL4030_MSTATEC_COMPLETE4	0x0e
>  
> +#if IS_ENABLED(CONFIG_TWL4030_MADC)
> +/*
> + * If AC (Accessory Charger) voltage exceeds 4.5V (MADC 11)
> + * then AC is available.
> + */
> +static inline int ac_available(void)
> +{
> +	return twl4030_get_madc_conversion(11) > 4500;
> +}
> +#else
> +static inline int ac_available(void)
> +{
> +	return 0;
> +}
> +#endif
>  static bool allow_usb;
>  module_param(allow_usb, bool, 0644);
>  MODULE_PARM_DESC(allow_usb, "Allow USB charge drawing default current");
> @@ -263,7 +278,7 @@ static int twl4030_charger_update_current(struct twl4030_bci *bci)
>  	 * If AC (Accessory Charger) voltage exceeds 4.5V (MADC 11)
>  	 * and AC is enabled, set current for 'ac'
>  	 */
> -	if (twl4030_get_madc_conversion(11) > 4500) {
> +	if (ac_available()) {
>  		cur = bci->ac_cur;
>  		bci->ac_is_active = true;
>  	} else {

-- Sebastian

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ