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]
Date:   Mon, 8 Aug 2022 14:24:12 +0100
From:   Caleb Connolly <caleb.connolly@...aro.org>
To:     Yassine Oudjana <yassine.oudjana@...il.com>,
        Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
Cc:     Sebastian Reichel <sre@...nel.org>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Yassine Oudjana <y.oudjana@...tonmail.com>,
        Alejandro Tafalla <atafalla@...on.com>,
        Konrad Dybcio <konrad.dybcio@...ainline.org>,
        linux-pm@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        devicetree@...r.kernel.org, phone-devel@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/8] power: supply: Add driver for Qualcomm SMBCHG



On 08/08/2022 10:39, Yassine Oudjana wrote:
> 
> On Mon, Aug 8 2022 at 11:41:26 +03:00:00, Krzysztof Kozlowski 
> <krzysztof.kozlowski@...aro.org> wrote:
>> On 08/08/2022 10:34, Yassine Oudjana wrote:
>>>  From: Yassine Oudjana <y.oudjana@...tonmail.com>
>>>
>>>  This series adds a driver for the switch-mode battery charger found on PMICs
>>>  such as PMI8994, and referred to in the vendor kernel[1] as smbcharger or
>>>  SMBCHG. More details on this block can be found in the last patch message.
>>>
>>>  This driver currently supports the charger blocks of PMI8994 and PMI8996.
>>>  PMI8950 was also to be supported, but it was dropped due to some last minute
>>>  issues, to be brought back at a later time once ready.
>>>
>>>  The OTG regulator remains unused on devices where the charger is enabled in
>>>  this series due to lack of a consumer. Applying a patch[2] adding vbus-supply
>>>  to DWC3 allows it to enable the OTG regulator making USB host without
>>>  external power possible.
>>>
>>>  [1] 
>>> https://github.com/android-linux-stable/msm-3.18/blob/kernel.lnx.3.18.r34-rel/drivers/power/qpnp-smbcharger.c 
>>>
>>>  [2] 
>>> https://lore.kernel.org/linux-usb/20200805061744.20404-1-mike.looijmans@topic.nl/ 
>>>
>>
>> How is it different from PMI8998? I expect not that much, so this should
>> be based on existing work:
>> https://lore.kernel.org/linux-arm-msm/20220706194125.1861256-1-caleb.connolly@linaro.org/ 
>>
>>
>> Unless they are different, but then please create common parts and
>> explain the differences.
>>
>> Best regards,
>> Krzysztof
> 
> This driver has been in slow developement for a long time before that one 
> existed, which was why no initial attempt at a common driver was made. With that 
> said however, I've been watching its development even before it was sent for 
> review, and It seems that the hardware is actually quite different. For example, 
> the original charger entirely lacks the type-c functionality that exists on the 
> second gen one. There are a couple of similar registers like CMD_APSD (same 
> address and function) CHGR_CFG2 (same/similar function, different address), but 
> other than that there don't seem to be any major similarities. While I guess it 
> would technically be possible to force them into one driver with multiple 
> register tables and separate functions for most tasks, I think it would just 
> unnecessarily complicate things. One thing that is common however is the secure 
> register unlock sequence, which I have separated in patch 6 to allow for its use 
> in other drivers (the fuel gauge block has secure registers too so it will also 
> be used in an upcoming fuel gauge driver).

Yes, we took the shared approach for the still work in progress fuel gauge 
driver, and whilst there are more similarities in that block for basic 
functionality at least, more complicated components differ quite a lot as far as 
I'm aware.

Even for the fuel gauge, separate handlers are needed for a lot of things still:
https://gitlab.com/sdm845-mainline/linux/-/blob/sdm845/5.19-release/drivers/power/supply/qcom_fg.c#L792
So I don't think trying to create a common driver here is the right approach.

Perhaps some abstraction is possible for the overall similarities like handling 
the APSD, dealing with current limiting, cable detection etc, perhaps some of 
this common code could be pulled out into a shared "helper"?

Maybe this is something worth reconsidering as and when we look at adding 
support for some of the more complicated features this hardware supports.
> 
> 

-- 
Kind Regards,
Caleb (they/he)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ