2023-10-26 05:54:21

by Nikita Travkin

[permalink] [raw]
Subject: [PATCH v3 0/2] pm8916: Add BMS and charger

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 <[email protected]>
---
Changes in v3:
- Drop 1/3 (dt-bindings) as it was applied.
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- No changes - resend with minor commit message edits.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Nikita Travkin (2):
arm64: dts: qcom: pm8916: Add BMS and charger
arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger

.../boot/dts/qcom/msm8916-longcheer-l8150.dts | 43 ++++++++++++++++---
arch/arm64/boot/dts/qcom/pm8916.dtsi | 48 ++++++++++++++++++++++
2 files changed, 85 insertions(+), 6 deletions(-)
---
base-commit: 2ef7141596eed0b4b45ef18b3626f428a6b0a822
change-id: 20230916-pm8916-dtsi-bms-lbc-2fb1b99d1eb2

Best regards,
--
Nikita Travkin <[email protected]>


2023-10-26 05:54:26

by Nikita Travkin

[permalink] [raw]
Subject: [PATCH v3 2/2] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger

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 blocks rely on.

Signed-off-by: Nikita Travkin <[email protected]>
---
.../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 37fa55166918..8e4c77003109 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8150.dts
@@ -49,6 +49,25 @@ mpss_mem: mpss@8e800000 {
};
};

+ 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";

@@ -236,6 +255,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_codec {
qcom,micbias-lvl = <2800>;
qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
@@ -255,10 +290,6 @@ pm8916_l17: l17 {
};
};

-&pm8916_usbin {
- status = "okay";
-};
-
&pm8916_vib {
status = "okay";
};
@@ -282,11 +313,11 @@ &sound {
&usb {
status = "okay";
dr_mode = "peripheral";
- extcon = <&pm8916_usbin>;
+ extcon = <&pm8916_charger>;
};

&usb_hs_phy {
- extcon = <&pm8916_usbin>;
+ extcon = <&pm8916_charger>;
};

&venus {

--
2.41.0

2023-10-31 11:19:59

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH v3 2/2] arm64: dts: qcom: msm8916-longcheer-l8150: Add battery and charger

On 26.10.2023 07:53, 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 blocks rely on.
>
> Signed-off-by: Nikita Travkin <[email protected]>
> ---
Reviewed-by: Konrad Dybcio <[email protected]>

Konrad