devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] pm8916: Add BMS and charger
@ 2023-09-16 13:57 Nikita Travkin
  2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Nikita Travkin @ 2023-09-16 13:57 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming, Nikita Travkin

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>
---
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: b74e981ad267d71d7ffcc085b3b9b5de736fa279
change-id: 20230916-pm8916-dtsi-bms-lbc-2fb1b99d1eb2

Best regards,
-- 
Nikita Travkin <nikita@trvn.ru>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-16 13:57 [PATCH 0/3] pm8916: Add BMS and charger Nikita Travkin
@ 2023-09-16 13:57 ` Nikita Travkin
  2023-09-16 14:18   ` Rob Herring
  2023-09-17  7:58   ` Krzysztof Kozlowski
  2023-09-16 13:57 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add BMS and charger Nikita Travkin
  2023-09-16 13:57 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery " Nikita Travkin
  2 siblings, 2 replies; 12+ messages in thread
From: Nikita Travkin @ 2023-09-16 13:57 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming, Nikita Travkin

PM8916 (and probably some other similar pmics) have hardware blocks for
battery monitoring and charging. Add patterns for respecive nodes so the
dt for those blocks can be validated properly.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
Schemas for those devices were added in [1].

[1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@trvn.ru
---
 Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
index 9f03436b1cdc..8bcd76748faa 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
+++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
@@ -133,9 +133,15 @@ patternProperties:
     type: object
     $ref: /schemas/sound/qcom,pm8916-wcd-analog-codec.yaml#
 
+  "^battery@[0-9a-f]+$":
+    type: object
+    oneOf:
+      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#
+
   "^charger@[0-9a-f]+$":
     type: object
     oneOf:
+      - $ref: /schemas/power/supply/qcom,pm8916-lbc.yaml#
       - $ref: /schemas/power/supply/qcom,pm8941-charger.yaml#
       - $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml#
       - $ref: /schemas/power/supply/qcom,pmi8998-charger.yaml#

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] arm64: dts: qcom: pm8916: Add BMS and charger
  2023-09-16 13:57 [PATCH 0/3] pm8916: Add BMS and charger Nikita Travkin
  2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
@ 2023-09-16 13:57 ` Nikita Travkin
  2023-09-16 13:57 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery " Nikita Travkin
  2 siblings, 0 replies; 12+ messages in thread
From: Nikita Travkin @ 2023-09-16 13:57 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming, Nikita Travkin

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 223442f909f1..24690cfdabb6 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",
+					  "chg_gone",
+					  "overtemp";
+
+			status = "disabled";
+		};
+
 		pm8916_usbin: usb-detect@1300 {
 			compatible = "qcom,pm8941-misc";
 			reg = <0x1300>;
@@ -91,6 +120,25 @@ channel@f {
 			};
 		};
 
+		pm8916_bms: battery@4000 {
+			compatible = "qcom,pm8916-bms-vm";
+			reg = <0x4000>;
+			interrupts = <0x0 0x40 0 IRQ_TYPE_EDGE_RISING>,
+				     <0x0 0x40 1 IRQ_TYPE_EDGE_RISING>,
+				     <0x0 0x40 2 IRQ_TYPE_EDGE_RISING>,
+				     <0x0 0x40 3 IRQ_TYPE_EDGE_RISING>,
+				     <0x0 0x40 4 IRQ_TYPE_EDGE_RISING>,
+				     <0x0 0x40 5 IRQ_TYPE_EDGE_RISING>;
+			interrupt-names = "cv_leave",
+					  "cv_enter",
+					  "ocv_good",
+					  "ocv_thr",
+					  "fifo",
+					  "state_chg";
+
+			status = "disabled";
+		};
+
 		rtc@6000 {
 			compatible = "qcom,pm8941-rtc";
 			reg = <0x6000>, <0x6100>;

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger
  2023-09-16 13:57 [PATCH 0/3] pm8916: Add BMS and charger Nikita Travkin
  2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
  2023-09-16 13:57 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add BMS and charger Nikita Travkin
@ 2023-09-16 13:57 ` Nikita Travkin
  2023-09-20 14:50   ` Konrad Dybcio
  2 siblings, 1 reply; 12+ messages in thread
From: Nikita Travkin @ 2023-09-16 13:57 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming, Nikita Travkin

Longcheer L8150 doesn't have any dedicated fuel-gauge or charger,
instead making use of the pmic hardware blocks for those purposes.

Add pm8916 bms and charger, as well as the battery cell description
that those devices rely on.

Signed-off-by: Nikita Travkin <nikita@trvn.ru>
---
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 43 +++++++++++++++++++---
 1 file changed, 37 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
index 3892ad4f639a..95dddf3b3880 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
@@ -33,6 +33,25 @@ wcnss_mem: wcnss@8b600000 {
 		};
 	};
 
+	battery: battery {
+		compatible = "simple-battery";
+		voltage-min-design-microvolt = <3400000>;
+		voltage-max-design-microvolt = <4350000>;
+		energy-full-design-microwatt-hours = <9500000>;
+		charge-full-design-microamp-hours = <2500000>;
+
+		ocv-capacity-celsius = <25>;
+		ocv-capacity-table-0 = <4330000 100>, <4265000 95>,
+			<4208000 90>, <4153000 85>, <4100000 80>, <4049000 75>,
+			<4001000 70>, <3962000 65>, <3919000 60>, <3872000 55>,
+			<3839000 50>, <3817000 45>, <3798000 40>, <3783000 35>,
+			<3767000 30>, <3747000 25>, <3729000 20>, <3709000 16>,
+			<3688000 13>, <3681000 11>, <3680000 10>, <3679000 9>,
+			<3677000 8>, <3674000 7>, <3666000 6>, <3641000 5>,
+			<3597000 4>, <3537000 3>, <3457000 2>, <3336000 1>,
+			<3000000 0>;
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 
@@ -220,6 +239,22 @@ &blsp_uart2 {
 	status = "okay";
 };
 
+&pm8916_bms {
+	status = "okay";
+
+	monitored-battery = <&battery>;
+	power-supplies = <&pm8916_charger>;
+};
+
+&pm8916_charger {
+	status = "okay";
+
+	monitored-battery = <&battery>;
+
+	qcom,fast-charge-safe-current = <900000>;
+	qcom,fast-charge-safe-voltage = <4300000>;
+};
+
 &pm8916_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
@@ -232,10 +267,6 @@ pm8916_l17: l17 {
 	};
 };
 
-&pm8916_usbin {
-	status = "okay";
-};
-
 &pm8916_vib {
 	status = "okay";
 };
@@ -252,11 +283,11 @@ &sdhc_2 {
 &usb {
 	status = "okay";
 	dr_mode = "peripheral";
-	extcon = <&pm8916_usbin>;
+	extcon = <&pm8916_charger>;
 };
 
 &usb_hs_phy {
-	extcon = <&pm8916_usbin>;
+	extcon = <&pm8916_charger>;
 };
 
 &wcnss {

-- 
2.41.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
@ 2023-09-16 14:18   ` Rob Herring
  2023-09-17  7:58   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 12+ messages in thread
From: Rob Herring @ 2023-09-16 14:18 UTC (permalink / raw)
  To: Nikita Travkin
  Cc: Andy Gross, Bjorn Andersson, Conor Dooley, Konrad Dybcio,
	Rob Herring, linux-arm-msm, devicetree, linux-kernel,
	Krzysztof Kozlowski, ~postmarketos/upstreaming


On Sat, 16 Sep 2023 18:57:04 +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
> dt for those blocks can be validated properly.
> 
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
> Schemas for those devices were added in [1].
> 
> [1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@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/20230916-pm8916-dtsi-bms-lbc-v1-1-7db0b42f9fb1@trvn.ru

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
  2023-09-16 14:18   ` Rob Herring
@ 2023-09-17  7:58   ` Krzysztof Kozlowski
  2023-09-17  8:26     ` Nikita Travkin
  1 sibling, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-17  7:58 UTC (permalink / raw)
  To: Nikita Travkin, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming

On 16/09/2023 15:57, 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

typo: respective

> dt for those blocks can be validated properly.
> 
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
> Schemas for those devices were added in [1].

"Dependency"

> 
> [1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@trvn.ru
> ---
>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
> index 9f03436b1cdc..8bcd76748faa 100644
> --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
> +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
> @@ -133,9 +133,15 @@ patternProperties:
>      type: object
>      $ref: /schemas/sound/qcom,pm8916-wcd-analog-codec.yaml#
>  
> +  "^battery@[0-9a-f]+$":
> +    type: object
> +    oneOf:
> +      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#

That's just ref, so no need for oneOf... unless you already think this
will grow with different schemas like the charger below?

> +
>    "^charger@[0-9a-f]+$":
>      type: object
>      oneOf:
> +      - $ref: /schemas/power/supply/qcom,pm8916-lbc.yaml#
>        - $ref: /schemas/power/supply/qcom,pm8941-charger.yaml#
>        - $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml#
>        - $ref: /schemas/power/supply/qcom,pmi8998-charger.yaml#
> 

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-17  7:58   ` Krzysztof Kozlowski
@ 2023-09-17  8:26     ` Nikita Travkin
  2023-09-17  8:32       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 12+ messages in thread
From: Nikita Travkin @ 2023-09-17  8:26 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, devicetree,
	linux-kernel, ~postmarketos/upstreaming

Krzysztof Kozlowski писал(а) 17.09.2023 12:58:
> On 16/09/2023 15:57, 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
> 
> typo: respective
> 

Oops, will fix if we get to v2.

>> dt for those blocks can be validated properly.
>>
>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> ---
>> Schemas for those devices were added in [1].
> 
> "Dependency"
> 

You are right, will try to word it better next time.

>>
>> [1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@trvn.ru
>> ---
>>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>> index 9f03436b1cdc..8bcd76748faa 100644
>> --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>> +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>> @@ -133,9 +133,15 @@ patternProperties:
>>      type: object
>>      $ref: /schemas/sound/qcom,pm8916-wcd-analog-codec.yaml#
>>
>> +  "^battery@[0-9a-f]+$":
>> +    type: object
>> +    oneOf:
>> +      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#
> 
> That's just ref, so no need for oneOf... unless you already think this
> will grow with different schemas like the charger below?
> 

Yes, I think some other PMICs have different battery/fuel-gauge
blocks too so I'd like to have some room for expansion here.

Thanks for the review!
Nikita

>> +
>>    "^charger@[0-9a-f]+$":
>>      type: object
>>      oneOf:
>> +      - $ref: /schemas/power/supply/qcom,pm8916-lbc.yaml#
>>        - $ref: /schemas/power/supply/qcom,pm8941-charger.yaml#
>>        - $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml#
>>        - $ref: /schemas/power/supply/qcom,pmi8998-charger.yaml#
>>
> 
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-17  8:26     ` Nikita Travkin
@ 2023-09-17  8:32       ` Krzysztof Kozlowski
  2023-09-17  8:54         ` Nikita Travkin
  0 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-17  8:32 UTC (permalink / raw)
  To: Nikita Travkin
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, devicetree,
	linux-kernel, ~postmarketos/upstreaming

On 17/09/2023 10:26, Nikita Travkin wrote:
> Krzysztof Kozlowski писал(а) 17.09.2023 12:58:
>> On 16/09/2023 15:57, 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
>>
>> typo: respective
>>
> 
> Oops, will fix if we get to v2.
> 
>>> dt for those blocks can be validated properly.
>>>
>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>> ---
>>> Schemas for those devices were added in [1].
>>
>> "Dependency"
>>
> 
> You are right, will try to word it better next time.
> 
>>>
>>> [1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@trvn.ru
>>> ---
>>>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>> index 9f03436b1cdc..8bcd76748faa 100644
>>> --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>> +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>> @@ -133,9 +133,15 @@ patternProperties:
>>>      type: object
>>>      $ref: /schemas/sound/qcom,pm8916-wcd-analog-codec.yaml#
>>>
>>> +  "^battery@[0-9a-f]+$":
>>> +    type: object
>>> +    oneOf:
>>> +      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#
>>
>> That's just ref, so no need for oneOf... unless you already think this
>> will grow with different schemas like the charger below?
>>
> 
> Yes, I think some other PMICs have different battery/fuel-gauge
> blocks too so I'd like to have some room for expansion here.

There is always room. Which other device will have different battery
charger?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-17  8:32       ` Krzysztof Kozlowski
@ 2023-09-17  8:54         ` Nikita Travkin
  2023-09-17  9:13           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 12+ messages in thread
From: Nikita Travkin @ 2023-09-17  8:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, devicetree,
	linux-kernel, ~postmarketos/upstreaming

Krzysztof Kozlowski писал(а) 17.09.2023 13:32:
> On 17/09/2023 10:26, Nikita Travkin wrote:
>> Krzysztof Kozlowski писал(а) 17.09.2023 12:58:
>>> On 16/09/2023 15:57, 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
>>>
>>> typo: respective
>>>
>>
>> Oops, will fix if we get to v2.
>>
>>>> dt for those blocks can be validated properly.
>>>>
>>>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>>>> ---
>>>> Schemas for those devices were added in [1].
>>>
>>> "Dependency"
>>>
>>
>> You are right, will try to word it better next time.
>>
>>>>
>>>> [1] https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-0-f30881e951a0@trvn.ru
>>>> ---
>>>>  Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>>> index 9f03436b1cdc..8bcd76748faa 100644
>>>> --- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>>> +++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
>>>> @@ -133,9 +133,15 @@ patternProperties:
>>>>      type: object
>>>>      $ref: /schemas/sound/qcom,pm8916-wcd-analog-codec.yaml#
>>>>
>>>> +  "^battery@[0-9a-f]+$":
>>>> +    type: object
>>>> +    oneOf:
>>>> +      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#
>>>
>>> That's just ref, so no need for oneOf... unless you already think this
>>> will grow with different schemas like the charger below?
>>>
>>
>> Yes, I think some other PMICs have different battery/fuel-gauge
>> blocks too so I'd like to have some room for expansion here.
> 
> There is always room. Which other device will have different battery
> charger?
> 

I know of non-"VM" BMS block in PM8226. It's used on some Nokia
devices that people were working on so I expect it to appear in
the future.

There is also some BMS block in more modern PM6150 that I've
seen being looked at by people interested in bringing sm7125
phones upstream.

Both of those, to my knowledge, are completely different from
this VM-BMS block, which I believe was present in the generation
of pm8916, pm8909 and was abandoned again shortly after...

Nikita

> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc
  2023-09-17  8:54         ` Nikita Travkin
@ 2023-09-17  9:13           ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-17  9:13 UTC (permalink / raw)
  To: Nikita Travkin
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-arm-msm, devicetree,
	linux-kernel, ~postmarketos/upstreaming

On 17/09/2023 10:54, Nikita Travkin wrote:

>>>>> +  "^battery@[0-9a-f]+$":
>>>>> +    type: object
>>>>> +    oneOf:
>>>>> +      - $ref: /schemas/power/supply/qcom,pm8916-bms-vm.yaml#
>>>>
>>>> That's just ref, so no need for oneOf... unless you already think this
>>>> will grow with different schemas like the charger below?
>>>>
>>>
>>> Yes, I think some other PMICs have different battery/fuel-gauge
>>> blocks too so I'd like to have some room for expansion here.
>>
>> There is always room. Which other device will have different battery
>> charger?
>>
> 
> I know of non-"VM" BMS block in PM8226. It's used on some Nokia
> devices that people were working on so I expect it to appear in
> the future.
> 
> There is also some BMS block in more modern PM6150 that I've
> seen being looked at by people interested in bringing sm7125
> phones upstream.
> 
> Both of those, to my knowledge, are completely different from
> this VM-BMS block, which I believe was present in the generation
> of pm8916, pm8909 and was abandoned again shortly after...

OK, sounds good.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger
  2023-09-16 13:57 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery " Nikita Travkin
@ 2023-09-20 14:50   ` Konrad Dybcio
  2023-09-20 15:01     ` Nikita Travkin
  0 siblings, 1 reply; 12+ messages in thread
From: Konrad Dybcio @ 2023-09-20 14:50 UTC (permalink / raw)
  To: Nikita Travkin, Andy Gross, Bjorn Andersson, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming



On 9/16/23 15:57, Nikita Travkin wrote:
> Longcheer L8150 doesn't have any dedicated fuel-gauge or charger,
> instead making use of the pmic hardware blocks for those purposes.
> 
> Add pm8916 bms and charger, as well as the battery cell description
> that those devices rely on.
> 
> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
> ---
>   .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 43 +++++++++++++++++++---
>   1 file changed, 37 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
> index 3892ad4f639a..95dddf3b3880 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
> @@ -33,6 +33,25 @@ wcnss_mem: wcnss@8b600000 {
>   		};
>   	};
>   
> +	battery: battery {
> +		compatible = "simple-battery";
> +		voltage-min-design-microvolt = <3400000>;
> +		voltage-max-design-microvolt = <4350000>;
> +		energy-full-design-microwatt-hours = <9500000>;
> +		charge-full-design-microamp-hours = <2500000>;
> +
> +		ocv-capacity-celsius = <25>;
> +		ocv-capacity-table-0 = <4330000 100>, <4265000 95>,
> +			<4208000 90>, <4153000 85>, <4100000 80>, <4049000 75>,
> +			<4001000 70>, <3962000 65>, <3919000 60>, <3872000 55>,
> +			<3839000 50>, <3817000 45>, <3798000 40>, <3783000 35>,
> +			<3767000 30>, <3747000 25>, <3729000 20>, <3709000 16>,
> +			<3688000 13>, <3681000 11>, <3680000 10>, <3679000 9>,
> +			<3677000 8>, <3674000 7>, <3666000 6>, <3641000 5>,
> +			<3597000 4>, <3537000 3>, <3457000 2>, <3336000 1>,
> +			<3000000 0>;
> +	};
> +
>   	gpio-keys {
>   		compatible = "gpio-keys";
>   
> @@ -220,6 +239,22 @@ &blsp_uart2 {
>   	status = "okay";
>   };
>   
> +&pm8916_bms {
> +	status = "okay";
status last

Konrad

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger
  2023-09-20 14:50   ` Konrad Dybcio
@ 2023-09-20 15:01     ` Nikita Travkin
  0 siblings, 0 replies; 12+ messages in thread
From: Nikita Travkin @ 2023-09-20 15:01 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Andy Gross, Bjorn Andersson, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-arm-msm, devicetree, linux-kernel,
	~postmarketos/upstreaming

Konrad Dybcio писал(а) 20.09.2023 19:50:
> On 9/16/23 15:57, Nikita Travkin wrote:
>> Longcheer L8150 doesn't have any dedicated fuel-gauge or charger,
>> instead making use of the pmic hardware blocks for those purposes.
>>
>> Add pm8916 bms and charger, as well as the battery cell description
>> that those devices rely on.
>>
>> Signed-off-by: Nikita Travkin <nikita@trvn.ru>
>> ---
>>   .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 43 +++++++++++++++++++---
>>   1 file changed, 37 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
>> index 3892ad4f639a..95dddf3b3880 100644
>> --- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
>> +++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
>> @@ -33,6 +33,25 @@ wcnss_mem: wcnss@8b600000 {
>>   		};
>>   	};
>>   +	battery: battery {
>> +		compatible = "simple-battery";
>> +		voltage-min-design-microvolt = <3400000>;
>> +		voltage-max-design-microvolt = <4350000>;
>> +		energy-full-design-microwatt-hours = <9500000>;
>> +		charge-full-design-microamp-hours = <2500000>;
>> +
>> +		ocv-capacity-celsius = <25>;
>> +		ocv-capacity-table-0 = <4330000 100>, <4265000 95>,
>> +			<4208000 90>, <4153000 85>, <4100000 80>, <4049000 75>,
>> +			<4001000 70>, <3962000 65>, <3919000 60>, <3872000 55>,
>> +			<3839000 50>, <3817000 45>, <3798000 40>, <3783000 35>,
>> +			<3767000 30>, <3747000 25>, <3729000 20>, <3709000 16>,
>> +			<3688000 13>, <3681000 11>, <3680000 10>, <3679000 9>,
>> +			<3677000 8>, <3674000 7>, <3666000 6>, <3641000 5>,
>> +			<3597000 4>, <3537000 3>, <3457000 2>, <3336000 1>,
>> +			<3000000 0>;
>> +	};
>> +
>>   	gpio-keys {
>>   		compatible = "gpio-keys";
>>   @@ -220,6 +239,22 @@ &blsp_uart2 {
>>   	status = "okay";
>>   };
>>   +&pm8916_bms {
>> +	status = "okay";
> status last
> 

Would be inconsistent for this file then and resorting those in
bulk was nacked already.

https://lore.kernel.org/all/20230119033428.ga6sbu42jaueac5o@builder.lan/

Nikita

> Konrad

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-09-20 15:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-16 13:57 [PATCH 0/3] pm8916: Add BMS and charger Nikita Travkin
2023-09-16 13:57 ` [PATCH 1/3] dt-bindings: mfd: qcom,spmi-pmic: Add pm8916 vm-bms and lbc Nikita Travkin
2023-09-16 14:18   ` Rob Herring
2023-09-17  7:58   ` Krzysztof Kozlowski
2023-09-17  8:26     ` Nikita Travkin
2023-09-17  8:32       ` Krzysztof Kozlowski
2023-09-17  8:54         ` Nikita Travkin
2023-09-17  9:13           ` Krzysztof Kozlowski
2023-09-16 13:57 ` [PATCH 2/3] arm64: dts: qcom: pm8916: Add BMS and charger Nikita Travkin
2023-09-16 13:57 ` [PATCH 3/3] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery " Nikita Travkin
2023-09-20 14:50   ` Konrad Dybcio
2023-09-20 15:01     ` Nikita Travkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).