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: <YYgbo0wySBbUZSmx@jeknote.loshitsa1.net>
Date:   Sun, 7 Nov 2021 21:32:03 +0300
From:   Yauhen Kharuzhy <jekhor@...il.com>
To:     Hans de Goede <hdegoede@...hat.com>
Cc:     Mark Gross <markgross@...nel.org>,
        Andy Shevchenko <andy@...radead.org>,
        Wolfram Sang <wsa@...-dreams.de>,
        Sebastian Reichel <sre@...nel.org>,
        MyungJoo Ham <myungjoo.ham@...sung.com>,
        Chanwoo Choi <cw00.choi@...sung.com>,
        Ard Biesheuvel <ardb@...nel.org>,
        Tsuchiya Yuto <kitakar@...il.com>,
        platform-driver-x86@...r.kernel.org, linux-i2c@...r.kernel.org,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-efi@...r.kernel.org
Subject: Re: [PATCH 07/13] power: supply: bq25890: Enable charging on boards
 where we skip reset

On Sat, Oct 30, 2021 at 08:28:07PM +0200, Hans de Goede wrote:
> On boards where the "ti,skip-init" boolean property is set we don't reset
> the charger; and on some boards where the fw takes care of initalizition
> F_CHG_CFG is set to 0 before handing control over to the OS.
> 
> Explicitly set F_CHG_CFG to 1 on boards where we don't reset the charger,
> so that charging is always enabled on these boards, like it is always
> enabled on boards where we do reset the charger.

We should check if an OTG host mode with powering of bus by bq25890 is
not enabled before enable charging. If we boot with OTG device
connected, this can cause troubles.

> 
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> ---
>  drivers/power/supply/bq25890_charger.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index 280821a6a6c6..aa4d04d20cdc 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -689,6 +689,17 @@ static int bq25890_hw_init(struct bq25890_device *bq)
>  			dev_dbg(bq->dev, "Reset failed %d\n", ret);
>  			return ret;
>  		}
> +	} else {
> +		/*
> +		 * Ensure charging is enabled, on some boards where the fw
> +		 * takes care of initalizition F_CHG_CFG is set to 0 before
> +		 * handing control over to the OS.
> +		 */
> +		ret = bq25890_field_write(bq, F_CHG_CFG, 1);
> +		if (ret < 0) {
> +			dev_dbg(bq->dev, "Enabling charging failed %d\n", ret);
> +			return ret;
> +		}
>  	}
>  
>  	/* disable watchdog */
> -- 
> 2.31.1
> 

-- 
Yauhen Kharuzhy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ