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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <fbc88a7a-317f-9b81-fc76-2ceefcf6c7f5@redhat.com>
Date:   Sun, 28 Nov 2021 16:02:06 +0100
From:   Hans de Goede <hdegoede@...hat.com>
To:     Yauhen Kharuzhy <jekhor@...il.com>
Cc:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        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>, Len Brown <lenb@...nel.org>,
        linux-acpi@...r.kernel.org, Tsuchiya Yuto <kitakar@...il.com>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        linux-i2c@...r.kernel.org, linux-pm@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-efi@...r.kernel.org
Subject: Re: [PATCH v2 10/20] power: supply: bq25890: Add
 bq25890_set_otg_cfg() helper

Hi,

On 11/16/21 12:07, Yauhen Kharuzhy wrote:
> 
> 
> аў, 16 ліс 2021, 12:33 карыстальнік Hans de Goede <hdegoede@...hat.com <mailto:hdegoede@...hat.com>> напісаў:
> 
>     Hi Yauhen,
> 
>     On 11/15/21 11:11, Yauhen Kharuzhy wrote:
>     > On Sun, Nov 14, 2021 at 06:03:25PM +0100, Hans de Goede wrote:
>     >> Add a bq25890_set_otg_cfg() helper function, this is a preparation
>     >> patch for adding regulator support.
>     >>
>     >> Signed-off-by: Hans de Goede <hdegoede@...hat.com <mailto:hdegoede@...hat.com>>
>     >> ---
>     >>  drivers/power/supply/bq25890_charger.c | 28 ++++++++++++++------------
>     >>  1 file changed, 15 insertions(+), 13 deletions(-)
>     >>
>     >> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
>     >> index 2bdfb58cda75..3c41fe86b3d3 100644
>     >> --- a/drivers/power/supply/bq25890_charger.c
>     >> +++ b/drivers/power/supply/bq25890_charger.c
>     >> @@ -801,6 +801,17 @@ static int bq25890_power_supply_init(struct bq25890_device *bq)
>     >>      return PTR_ERR_OR_ZERO(bq->charger);
>     >>  }
>     >> 
>     >> +static int bq25890_set_otg_cfg(struct bq25890_device *bq, u8 val)
>     >> +{
>     >> +    int ret;
>     >> +
>     >> +    ret = bq25890_field_write(bq, F_OTG_CFG, val);
>     >> +    if (ret < 0)
>     >> +            dev_err(bq->dev, "Error switching to boost/charger mode: %d\n", ret);
>     >
>     > Just a note: if a connected USB device has relative big capacitor
>     > at power wires inside, then a starting current pulse may be enough to
>     > overload the boost reguator and VBUS will not be powered. I met this
>     > at Yoga Book: the firmware set boost current limit to 1.4 A (default
>     > value for bq25892) but when USB hub connected, the BOOST_FAULT event
>     > appeared.
>     >
>     > To avoid this, Lenovo uses following trick in its kernel: set a boost
>     > current limit to big value (2.1 A), wait some time (500 ms) and set
>     > the current limit to right value (1.4A). This provides enough current to
>     > charge capacitors in the connected device but saves desired long-time limit
>     > to prevent overloading if the device consumes too much power itself.
> 
>     Right I saw this in your git repo, but I cannot reproduce the issue (1)
>     I was hoping that since you can reproduce this, that you can rebase
>     your fix on top of my patch-set ?
> 
>     Also I'm wondering if this behavior should be the default, I believe
>     that the max. boost current may also be dependent on some external
>     factors, so maybe we should make this behavior conditional on a
>     new device-property ?
> 
> Yes, defining of max VBUS current may be a good idea. Another possible approach may be to use some empirical multiplier, like 150% of max 'long time' current limit setting. I almost sure that all hardware will work with short impulse of such current, its usual condition at device connection.
> 
> 
>     Regards,
> 
>     Hans
> 
> 
> 
>     1) I must admit I did not try really hard, I guess I could try an
>     USB powered hdd enclosure with a spinning disk
> 
>     What device are you seeing this with?
> 
> I cannot remember exactly device but this was a USB hub, possible with keyboard, mouse receiver and USB dongle inserted. I can recheck this issue but one week after, when will return home.

So as I mentioned before I've just tried to reproduce this problem, but
I cannot reproduce it with an 2.5" USB disk enclosure with a spinning
disk, which typically will cause a nice current-peak when spinning up.

I think this might also require an almost empty battery to reproduce ?

Regards,

Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ