mbox series

[v2,0/3] pm8916: Add BMS and charger

Message ID 20231023-pm8916-dtsi-bms-lbc-v2-0-343e3dbf423e@trvn.ru
Headers show
Series pm8916: Add BMS and charger | expand

Message

Nikita Travkin Oct. 23, 2023, 6:20 a.m. UTC
This series enables VM-BMS and LBC blocks in the pm8916 pmic.

The VM-BMS is a simple voltage monitoring block that allows the software
to estimate the battery capacity left.

The LBC is a linear battery charger for lipo batteries.

Add both devices to the pmic dtsi and enable them for Longcheer L8150
which makes use of them.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
Changes in v2:
- No changes - resend with minor commit message edits.
- Link to v1: https://lore.kernel.org/r/20230916-pm8916-dtsi-bms-lbc-v1-0-7db0b42f9fb1@trvn.ru

---
Nikita Travkin (3):
      dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
      arm64: dts: qcom: pm8916: Add BMS and charger
      arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger

 .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml    |  6 +++
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 43 ++++++++++++++++---
 arch/arm64/boot/dts/qcom/pm8916.dtsi               | 48 ++++++++++++++++++++++
 3 files changed, 91 insertions(+), 6 deletions(-)
---
base-commit: 2030579113a1b1b5bfd7ff24c0852847836d8fd1
change-id: 20230916-pm8916-dtsi-bms-lbc-2fb1b99d1eb2

Best regards,

Comments

Lee Jones Oct. 25, 2023, 12:21 p.m. UTC | #1
On Tue, 24 Oct 2023, Nikita Travkin wrote:

> Rob Herring писал(а) 23.10.2023 22:40:
> > On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
> >> PM8916 (and probably some other similar pmics) have hardware blocks for
> >> battery monitoring and charging. Add patterns for respecive nodes so the
> >> devicetree for those blocks can be validated properly.
> >>
> >> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> >> ---
> >>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
> >>  1 file changed, 6 insertions(+)
> >>
> > 
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml:
> > Error in referenced schema matching $id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml
> > 
> > doc reference errors (make refcheckdocs):
> > 
> > See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231023-pm8916-dtsi-bms-lbc-v2-1-343e3dbf423e@trvn.ru
> > 
> > The base for the series is generally the latest rc1. A different dependency
> > should be noted in *this* patch.
> > 
> 
> Somehow I missed the memo and thought it tracks -next...
> 
> This patch depends on 7f590e3831 and 5cee843d56 in linux-next.git
> They were applied in [1].
> 
> I'm wondering if the bot just bails out when the "depend" is present
> or there is some more sophisticated logic to suggest the base to it?

So is this good to go, or not?
Nikita Travkin Oct. 25, 2023, 12:57 p.m. UTC | #2
Lee Jones писал(а) 25.10.2023 17:21:
> On Tue, 24 Oct 2023, Nikita Travkin wrote:
> 
>> Rob Herring писал(а) 23.10.2023 22:40:
>> > On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
>> >> PM8916 (and probably some other similar pmics) have hardware blocks for
>> >> battery monitoring and charging. Add patterns for respecive nodes so the
>> >> devicetree for those blocks can be validated properly.
>> >>
>> >> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> >> ---
>> >>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>> >>  1 file changed, 6 insertions(+)
>> >>
>> >
>> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
>> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
>> >
>> > yamllint warnings/errors:
>> >
>> > dtschema/dtc warnings/errors:
>> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml:
>> > Error in referenced schema matching $id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml
>> >
>> > doc reference errors (make refcheckdocs):
>> >
>> > See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231023-pm8916-dtsi-bms-lbc-v2-1-343e3dbf423e@trvn.ru
>> >
>> > The base for the series is generally the latest rc1. A different dependency
>> > should be noted in *this* patch.
>> >
>>
>> Somehow I missed the memo and thought it tracks -next...
>>
>> This patch depends on 7f590e3831 and 5cee843d56 in linux-next.git
>> They were applied in [1].
>>
>> I'm wondering if the bot just bails out when the "depend" is present
>> or there is some more sophisticated logic to suggest the base to it?
> 
> So is this good to go, or not?

IMO this patch should be good, it passes the check on today's linux-next
on my end.

The only concern might be that if someone runs dt_binding_check on
for-mfd-next, it would skip that file with an error since there is no
dependency yet.

If this is critical to you, I was going to respin this after the -rc1,
but if you can pick the schema now, I can respin the remainder earlier.

Nikita
Lee Jones Oct. 25, 2023, 3:44 p.m. UTC | #3
On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
> PM8916 (and probably some other similar pmics) have hardware blocks for
> battery monitoring and charging. Add patterns for respecive nodes so the
> devicetree for those blocks can be validated properly.
> 
> 

Applied, thanks!

[1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
      commit: e9aec86e211ee493081e8934b8c821d660b417ee

--
Lee Jones [李琼斯]
Konrad Dybcio Oct. 26, 2023, 6:54 p.m. UTC | #4
On 10/24/23 11:29, Nikita Travkin wrote:
> Konrad Dybcio писал(а) 24.10.2023 13:34:
>> On 10/23/23 08:20, Nikita Travkin wrote:
>>> pm8916 contains some hardware blocks for battery powered devices:
>>>
>>> - VM-BMS: Battery voltage monitoring block.
>>> - LBC: Linear battery charger.
>>>
>>> Add them to the pmic dtsi so the devices that make use of those blocks
>>> can enable them.
>>>
>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>> ---
>>>    arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
>>>    1 file changed, 48 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>> index f4de86787743..4b2e8fb47d2d 100644
>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>> @@ -41,6 +41,35 @@ watchdog {
>>>    			};
>>>    		};
>>>    +		pm8916_charger: charger@1000 {
>>> +			compatible = "qcom,pm8916-lbc";
>>> +			reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>;
>>> +			reg-names = "chgr", "bat_if", "usb", "misc";
>>> +
>>> +			interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
>>> +				     <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>;
>>> +			interrupt-names = "vbat_det",
>>> +					  "fast_chg",
>>> +					  "chg_fail",
>>> +					  "chg_done",
>>> +					  "bat_pres",
>>> +					  "temp_ok",
>>> +					  "coarse_det",
>>> +					  "usb_vbus",
>> So, both the charger and the USBIN driver use the same irq? :/
>>
> 
> AFAIU the usbin extcon driver pretty much just tracks the state
> of the IRQ to report extcon. It happens to assume the same part
> of the pmic though, yes, which also means there will be no user
> that would enable both charger and vbus extcon, since charger
> driver provides this functionality as well.
So, should USBIN be removed from PM8916 dt since it's essentially
a part of the charger block?

Konrad
Stephan Gerhold Oct. 26, 2023, 7:17 p.m. UTC | #5
On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote:
> On 10/24/23 11:29, Nikita Travkin wrote:
> > Konrad Dybcio писал(а) 24.10.2023 13:34:
> > > On 10/23/23 08:20, Nikita Travkin wrote:
> > > > pm8916 contains some hardware blocks for battery powered devices:
> > > > 
> > > > - VM-BMS: Battery voltage monitoring block.
> > > > - LBC: Linear battery charger.
> > > > 
> > > > Add them to the pmic dtsi so the devices that make use of those blocks
> > > > can enable them.
> > > > 
> > > > Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> > > > ---
> > > >    arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
> > > >    1 file changed, 48 insertions(+)
> > > > 
> > > > diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
> > > > index f4de86787743..4b2e8fb47d2d 100644
> > > > --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
> > > > +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
> > > > @@ -41,6 +41,35 @@ watchdog {
> > > >    			};
> > > >    		};
> > > >    +		pm8916_charger: charger@1000 {
> > > > +			compatible = "qcom,pm8916-lbc";
> > > > +			reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>;
> > > > +			reg-names = "chgr", "bat_if", "usb", "misc";
> > > > +
> > > > +			interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
> > > > +				     <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>;
> > > > +			interrupt-names = "vbat_det",
> > > > +					  "fast_chg",
> > > > +					  "chg_fail",
> > > > +					  "chg_done",
> > > > +					  "bat_pres",
> > > > +					  "temp_ok",
> > > > +					  "coarse_det",
> > > > +					  "usb_vbus",
> > > So, both the charger and the USBIN driver use the same irq? :/
> > > 
> > 
> > AFAIU the usbin extcon driver pretty much just tracks the state
> > of the IRQ to report extcon. It happens to assume the same part
> > of the pmic though, yes, which also means there will be no user
> > that would enable both charger and vbus extcon, since charger
> > driver provides this functionality as well.
> So, should USBIN be removed from PM8916 dt since it's essentially
> a part of the charger block?
> 

The "USB_IN" pad of the PM8916 seems to be connected on pretty much all
devices, even if they are using external chargers and the charging
functionality of PM8916 is completely disabled. For those devices, the
&pm8916_usbin device provides a convenient way to detect the USB state,
even without a working charger driver.

While we could modify the PM8916 charger driver and DT node to have some
special mode where charging and battery monitoring is completely
disabled and only the USBIN extcon is provided, I'm not sure if that
would provide a significant advantage compared to just keeping the
simple &pm8916_usbin node with the existing driver.

Thanks,
Stephan
Konrad Dybcio Oct. 26, 2023, 8:03 p.m. UTC | #6
On 10/26/23 21:17, Stephan Gerhold wrote:
> On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote:
>> On 10/24/23 11:29, Nikita Travkin wrote:
>>> Konrad Dybcio писал(а) 24.10.2023 13:34:
>>>> On 10/23/23 08:20, Nikita Travkin wrote:
>>>>> pm8916 contains some hardware blocks for battery powered devices:
>>>>>
>>>>> - VM-BMS: Battery voltage monitoring block.
>>>>> - LBC: Linear battery charger.
>>>>>
>>>>> Add them to the pmic dtsi so the devices that make use of those blocks
>>>>> can enable them.
>>>>>
>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>>>> ---
>>>>>     arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
>>>>>     1 file changed, 48 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>> index f4de86787743..4b2e8fb47d2d 100644
>>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>> @@ -41,6 +41,35 @@ watchdog {
>>>>>     			};
>>>>>     		};
>>>>>     +		pm8916_charger: charger@1000 {
>>>>> +			compatible = "qcom,pm8916-lbc";
>>>>> +			reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>;
>>>>> +			reg-names = "chgr", "bat_if", "usb", "misc";
>>>>> +
>>>>> +			interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
>>>>> +				     <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>;
>>>>> +			interrupt-names = "vbat_det",
>>>>> +					  "fast_chg",
>>>>> +					  "chg_fail",
>>>>> +					  "chg_done",
>>>>> +					  "bat_pres",
>>>>> +					  "temp_ok",
>>>>> +					  "coarse_det",
>>>>> +					  "usb_vbus",
>>>> So, both the charger and the USBIN driver use the same irq? :/
>>>>
>>>
>>> AFAIU the usbin extcon driver pretty much just tracks the state
>>> of the IRQ to report extcon. It happens to assume the same part
>>> of the pmic though, yes, which also means there will be no user
>>> that would enable both charger and vbus extcon, since charger
>>> driver provides this functionality as well.
>> So, should USBIN be removed from PM8916 dt since it's essentially
>> a part of the charger block?
>>
> 
> The "USB_IN" pad of the PM8916 seems to be connected on pretty much all
> devices, even if they are using external chargers and the charging
> functionality of PM8916 is completely disabled. For those devices, the
> &pm8916_usbin device provides a convenient way to detect the USB state,
> even without a working charger driver.
> 
> While we could modify the PM8916 charger driver and DT node to have some
> special mode where charging and battery monitoring is completely
> disabled and only the USBIN extcon is provided, I'm not sure if that
> would provide a significant advantage compared to just keeping the
> simple &pm8916_usbin node with the existing driver.
Hmm okay I see..

Generally it's rather "no bueno" to have two DT nodes consuming the
same register space.. What happens when you enable BMS on a device
with a non-PM8916 charger? Does it correctly recognize "no battery"
etc.?

Konrad
Nikita Travkin Oct. 27, 2023, 5:44 a.m. UTC | #7
Konrad Dybcio писал(а) 27.10.2023 01:03:
> On 10/26/23 21:17, Stephan Gerhold wrote:
>> On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote:
>>> On 10/24/23 11:29, Nikita Travkin wrote:
>>>> Konrad Dybcio писал(а) 24.10.2023 13:34:
>>>>> On 10/23/23 08:20, Nikita Travkin wrote:
>>>>>> pm8916 contains some hardware blocks for battery powered devices:
>>>>>>
>>>>>> - VM-BMS: Battery voltage monitoring block.
>>>>>> - LBC: Linear battery charger.
>>>>>>
>>>>>> Add them to the pmic dtsi so the devices that make use of those blocks
>>>>>> can enable them.
>>>>>>
>>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>>>>> ---
>>>>>>     arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
>>>>>>     1 file changed, 48 insertions(+)
>>>>>>
>>>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>> index f4de86787743..4b2e8fb47d2d 100644
>>>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>> @@ -41,6 +41,35 @@ watchdog {
>>>>>>     			};
>>>>>>     		};
>>>>>>     +		pm8916_charger: charger@1000 {
>>>>>> +			compatible = "qcom,pm8916-lbc";
>>>>>> +			reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>;
>>>>>> +			reg-names = "chgr", "bat_if", "usb", "misc";
>>>>>> +
>>>>>> +			interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
>>>>>> +				     <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>;
>>>>>> +			interrupt-names = "vbat_det",
>>>>>> +					  "fast_chg",
>>>>>> +					  "chg_fail",
>>>>>> +					  "chg_done",
>>>>>> +					  "bat_pres",
>>>>>> +					  "temp_ok",
>>>>>> +					  "coarse_det",
>>>>>> +					  "usb_vbus",
>>>>> So, both the charger and the USBIN driver use the same irq? :/
>>>>>
>>>>
>>>> AFAIU the usbin extcon driver pretty much just tracks the state
>>>> of the IRQ to report extcon. It happens to assume the same part
>>>> of the pmic though, yes, which also means there will be no user
>>>> that would enable both charger and vbus extcon, since charger
>>>> driver provides this functionality as well.
>>> So, should USBIN be removed from PM8916 dt since it's essentially
>>> a part of the charger block?
>>>
>>
>> The "USB_IN" pad of the PM8916 seems to be connected on pretty much all
>> devices, even if they are using external chargers and the charging
>> functionality of PM8916 is completely disabled. For those devices, the
>> &pm8916_usbin device provides a convenient way to detect the USB state,
>> even without a working charger driver.
>>
>> While we could modify the PM8916 charger driver and DT node to have some
>> special mode where charging and battery monitoring is completely
>> disabled and only the USBIN extcon is provided, I'm not sure if that
>> would provide a significant advantage compared to just keeping the
>> simple &pm8916_usbin node with the existing driver.
> Hmm okay I see..
> 
> Generally it's rather "no bueno" to have two DT nodes consuming the
> same register space.. What happens when you enable BMS on a device
> with a non-PM8916 charger? Does it correctly recognize "no battery"
> etc.?
> 

The _charger and _bms are separate and communicate in a generic
manner via power-supplies and supply core (see 3/3) so giving
a different charger to _bms can work.

If an external charger is present in the device, qcom mandates
"external charger" optional line of the pmic to be tied, and
_charger is then disabled. The driver bails out in this case,
but _usbin could still be used.

> Konrad
Krzysztof Kozlowski Oct. 27, 2023, 7:14 a.m. UTC | #8
On 25/10/2023 14:57, Nikita Travkin wrote:
> Lee Jones писал(а) 25.10.2023 17:21:
>> On Tue, 24 Oct 2023, Nikita Travkin wrote:
>>
>>> Rob Herring писал(а) 23.10.2023 22:40:
>>>> On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
>>>>> PM8916 (and probably some other similar pmics) have hardware blocks for
>>>>> battery monitoring and charging. Add patterns for respecive nodes so the
>>>>> devicetree for those blocks can be validated properly.
>>>>>
>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>>>> ---
>>>>>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>>>>>  1 file changed, 6 insertions(+)
>>>>>
>>>>
>>>> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
>>>> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>>>>
>>>> yamllint warnings/errors:
>>>>
>>>> dtschema/dtc warnings/errors:
>>>> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml:
>>>> Error in referenced schema matching $id: http://devicetree.org/schemas/power/supply/qcom,pm8916-bms-vm.yaml
>>>>
>>>> doc reference errors (make refcheckdocs):
>>>>
>>>> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231023-pm8916-dtsi-bms-lbc-v2-1-343e3dbf423e@trvn.ru
>>>>
>>>> The base for the series is generally the latest rc1. A different dependency
>>>> should be noted in *this* patch.
>>>>
>>>
>>> Somehow I missed the memo and thought it tracks -next...
>>>
>>> This patch depends on 7f590e3831 and 5cee843d56 in linux-next.git
>>> They were applied in [1].
>>>
>>> I'm wondering if the bot just bails out when the "depend" is present
>>> or there is some more sophisticated logic to suggest the base to it?
>>
>> So is this good to go, or not?
> 
> IMO this patch should be good, it passes the check on today's linux-next
> on my end.

It's not the next which matters, but maintainers tree.

> 
> The only concern might be that if someone runs dt_binding_check on
> for-mfd-next, it would skip that file with an error since there is no
> dependency yet.

Eee, so this has dependency on some other tree? Then no, it is not good
to go.



Best regards,
Krzysztof
Krzysztof Kozlowski Oct. 27, 2023, 7:20 a.m. UTC | #9
On 25/10/2023 17:44, Lee Jones wrote:
> On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
>> PM8916 (and probably some other similar pmics) have hardware blocks for
>> battery monitoring and charging. Add patterns for respecive nodes so the
>> devicetree for those blocks can be validated properly.
>>
>>
> 
> Applied, thanks!
> 
> [1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
>       commit: e9aec86e211ee493081e8934b8c821d660b417ee

Hi Lee,

It seems this patch depends on something not in your tree. This should
have been clearly explained in cover letter or this patch changelog, but
wasn't.

Please drop the patch.

Best regards,
Krzysztof
Lee Jones Oct. 31, 2023, 7:54 a.m. UTC | #10
On Fri, 27 Oct 2023, Krzysztof Kozlowski wrote:

> On 25/10/2023 17:44, Lee Jones wrote:
> > On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
> >> PM8916 (and probably some other similar pmics) have hardware blocks for
> >> battery monitoring and charging. Add patterns for respecive nodes so the
> >> devicetree for those blocks can be validated properly.
> >>
> >>
> > 
> > Applied, thanks!
> > 
> > [1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
> >       commit: e9aec86e211ee493081e8934b8c821d660b417ee
> 
> Hi Lee,
> 
> It seems this patch depends on something not in your tree. This should
> have been clearly explained in cover letter or this patch changelog, but
> wasn't.
> 
> Please drop the patch.

Done.
Konrad Dybcio Oct. 31, 2023, 11:20 a.m. UTC | #11
On 27.10.2023 07:44, Nikita Travkin wrote:
> Konrad Dybcio писал(а) 27.10.2023 01:03:
>> On 10/26/23 21:17, Stephan Gerhold wrote:
>>> On Thu, Oct 26, 2023 at 08:54:00PM +0200, Konrad Dybcio wrote:
>>>> On 10/24/23 11:29, Nikita Travkin wrote:
>>>>> Konrad Dybcio писал(а) 24.10.2023 13:34:
>>>>>> On 10/23/23 08:20, Nikita Travkin wrote:
>>>>>>> pm8916 contains some hardware blocks for battery powered devices:
>>>>>>>
>>>>>>> - VM-BMS: Battery voltage monitoring block.
>>>>>>> - LBC: Linear battery charger.
>>>>>>>
>>>>>>> Add them to the pmic dtsi so the devices that make use of those blocks
>>>>>>> can enable them.
>>>>>>>
>>>>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>>>>>> ---
>>>>>>>     arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++++++++++++++++
>>>>>>>     1 file changed, 48 insertions(+)
>>>>>>>
>>>>>>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>>> index f4de86787743..4b2e8fb47d2d 100644
>>>>>>> --- a/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>>> +++ b/arch/arm64/boot/dts/qcom/pm8916.dtsi
>>>>>>> @@ -41,6 +41,35 @@ watchdog {
>>>>>>>     			};
>>>>>>>     		};
>>>>>>>     +		pm8916_charger: charger@1000 {
>>>>>>> +			compatible = "qcom,pm8916-lbc";
>>>>>>> +			reg = <0x1000>, <0x1200>, <0x1300>, <0x1600>;
>>>>>>> +			reg-names = "chgr", "bat_if", "usb", "misc";
>>>>>>> +
>>>>>>> +			interrupts = <0x0 0x10 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x10 5 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x10 6 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x10 7 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x12 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x12 1 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x13 0 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x13 1 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x13 2 IRQ_TYPE_EDGE_BOTH>,
>>>>>>> +				     <0x0 0x13 4 IRQ_TYPE_EDGE_BOTH>;
>>>>>>> +			interrupt-names = "vbat_det",
>>>>>>> +					  "fast_chg",
>>>>>>> +					  "chg_fail",
>>>>>>> +					  "chg_done",
>>>>>>> +					  "bat_pres",
>>>>>>> +					  "temp_ok",
>>>>>>> +					  "coarse_det",
>>>>>>> +					  "usb_vbus",
>>>>>> So, both the charger and the USBIN driver use the same irq? :/
>>>>>>
>>>>>
>>>>> AFAIU the usbin extcon driver pretty much just tracks the state
>>>>> of the IRQ to report extcon. It happens to assume the same part
>>>>> of the pmic though, yes, which also means there will be no user
>>>>> that would enable both charger and vbus extcon, since charger
>>>>> driver provides this functionality as well.
>>>> So, should USBIN be removed from PM8916 dt since it's essentially
>>>> a part of the charger block?
>>>>
>>>
>>> The "USB_IN" pad of the PM8916 seems to be connected on pretty much all
>>> devices, even if they are using external chargers and the charging
>>> functionality of PM8916 is completely disabled. For those devices, the
>>> &pm8916_usbin device provides a convenient way to detect the USB state,
>>> even without a working charger driver.
>>>
>>> While we could modify the PM8916 charger driver and DT node to have some
>>> special mode where charging and battery monitoring is completely
>>> disabled and only the USBIN extcon is provided, I'm not sure if that
>>> would provide a significant advantage compared to just keeping the
>>> simple &pm8916_usbin node with the existing driver.
>> Hmm okay I see..
>>
>> Generally it's rather "no bueno" to have two DT nodes consuming the
>> same register space.. What happens when you enable BMS on a device
>> with a non-PM8916 charger? Does it correctly recognize "no battery"
>> etc.?
>>
> 
> The _charger and _bms are separate and communicate in a generic
> manner via power-supplies and supply core (see 3/3) so giving
> a different charger to _bms can work.
> 
> If an external charger is present in the device, qcom mandates
> "external charger" optional line of the pmic to be tied, and
> _charger is then disabled. The driver bails out in this case,
> but _usbin could still be used.
Meh..

I guess I'll reluctantly let it slide, unless Bjorn has some objections

Konrad
Nikita Travkin Nov. 14, 2023, 5:24 a.m. UTC | #12
Lee Jones писал(а) 31.10.2023 12:54:
> On Fri, 27 Oct 2023, Krzysztof Kozlowski wrote:
> 
>> On 25/10/2023 17:44, Lee Jones wrote:
>> > On Mon, 23 Oct 2023 11:20:32 +0500, Nikita Travkin wrote:
>> >> PM8916 (and probably some other similar pmics) have hardware blocks for
>> >> battery monitoring and charging. Add patterns for respecive nodes so the
>> >> devicetree for those blocks can be validated properly.
>> >>
>> >>
>> >
>> > Applied, thanks!
>> >
>> > [1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
>> >       commit: e9aec86e211ee493081e8934b8c821d660b417ee
>>
>> Hi Lee,
>>
>> It seems this patch depends on something not in your tree. This should
>> have been clearly explained in cover letter or this patch changelog, but
>> wasn't.
>>
>> Please drop the patch.
> 
> Done.

Hi, v6.7-rc1 now includes the dependencies for this bindings change,
could you pick it up again? Or maybe I should respin the series
with it included back?

Sorry for making this inconvenient for you...

Nikita