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: <20210806211359.lq765pzmgvviffhg@earth.universe>
Date:   Fri, 6 Aug 2021 23:13:59 +0200
From:   Sebastian Reichel <sre@...nel.org>
To:     Dmitry Osipenko <digetx@...il.com>
Cc:     Thierry Reding <treding@...dia.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Mark Brown <broonie@...nel.org>,
        Peter Chen <peter.chen@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Felipe Balbi <balbi@...nel.org>,
        David Heidelberg <david@...t.cz>, devicetree@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org
Subject: Re: [PATCH v6 08/12] power: supply: smb347-charger: Add missing pin
 control activation

Hi,

On Sat, Jul 31, 2021 at 08:38:38PM +0300, Dmitry Osipenko wrote:
> Pin control needs to be activated by setting the enable bit, otherwise
> hardware rejects all pin changes. Previously this stayed unnoticed on
> Nexus 7 because pin control was enabled by default after rebooting from
> downstream kernel, which uses driver that enables the bit and charger
> registers are non-volatile until power supply (battery) is disconnected.
> Configure the pin control enable bit. This fixes the potentially
> never-enabled charging on devices that use pin control.
> 
> Signed-off-by: Dmitry Osipenko <digetx@...il.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@...labora.com>

-- Sebastian

>  drivers/power/supply/smb347-charger.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/power/supply/smb347-charger.c b/drivers/power/supply/smb347-charger.c
> index 27254e6efdde..1c9205ca0993 100644
> --- a/drivers/power/supply/smb347-charger.c
> +++ b/drivers/power/supply/smb347-charger.c
> @@ -55,6 +55,7 @@
>  #define CFG_PIN_EN_CTRL_ACTIVE_LOW		0x60
>  #define CFG_PIN_EN_APSD_IRQ			BIT(1)
>  #define CFG_PIN_EN_CHARGER_ERROR		BIT(2)
> +#define CFG_PIN_EN_CTRL				BIT(4)
>  #define CFG_THERM				0x07
>  #define CFG_THERM_SOFT_HOT_COMPENSATION_MASK	0x03
>  #define CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT	0
> @@ -726,6 +727,15 @@ static int smb347_hw_init(struct smb347_charger *smb)
>  	if (ret < 0)
>  		goto fail;
>  
> +	/* Activate pin control, making it writable. */
> +	switch (smb->enable_control) {
> +	case SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW:
> +	case SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH:
> +		ret = regmap_set_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CTRL);
> +		if (ret < 0)
> +			goto fail;
> +	}
> +
>  	/*
>  	 * Make the charging functionality controllable by a write to the
>  	 * command register unless pin control is specified in the platform
> -- 
> 2.32.0
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ