[v4,2/3] arm64: dts: qcom: pm8916: Add BMS and charger

Message ID 20231120-pm8916-dtsi-bms-lbc-v4-2-4f91056c8252@trvn.ru
State New
Headers
Series pm8916: Add BMS and charger |

Commit Message

Nikita Travkin Nov. 20, 2023, 2:03 p.m. UTC
  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(+)
  

Comments

Konrad Dybcio Nov. 22, 2023, 7:31 p.m. UTC | #1
On 11/20/23 15:03, 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>
> ---
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
  
Bjorn Andersson Dec. 8, 2023, 2:48 a.m. UTC | #2
On Mon, Nov 20, 2023 at 07:03:04PM +0500, Nikita Travkin wrote:
> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
[..]
>  
> +		pm8916_bms: battery@4000 {

"battery" is not a valid child of the pmic according to
mfd/qcom,spmi-pmic.yaml, so please update the binding to remove the
warnings that this introduces.

Thanks,
Bjorn
  
Nikita Travkin Dec. 8, 2023, 9:19 a.m. UTC | #3
Bjorn Andersson писал(а) 08.12.2023 07:48:
> On Mon, Nov 20, 2023 at 07:03:04PM +0500, Nikita Travkin wrote:
>> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
> [..]
>>
>> +		pm8916_bms: battery@4000 {
> 
> "battery" is not a valid child of the pmic according to
> mfd/qcom,spmi-pmic.yaml, so please update the binding to remove the
> warnings that this introduces.
> 

This should be done in 1/3 which is already accepted to mfd,
so the warning should be gone when the stuff is pulled together.

Sorry for not making sure it's in earlier
Nikita

> Thanks,
> Bjorn
  
Bjorn Andersson Dec. 9, 2023, 3:01 a.m. UTC | #4
On Fri, Dec 08, 2023 at 02:19:11PM +0500, Nikita Travkin wrote:
> Bjorn Andersson писал(а) 08.12.2023 07:48:
> > On Mon, Nov 20, 2023 at 07:03:04PM +0500, Nikita Travkin wrote:
> >> diff --git a/arch/arm64/boot/dts/qcom/pm8916.dtsi b/arch/arm64/boot/dts/qcom/pm8916.dtsi
> > [..]
> >>
> >> +		pm8916_bms: battery@4000 {
> > 
> > "battery" is not a valid child of the pmic according to
> > mfd/qcom,spmi-pmic.yaml, so please update the binding to remove the
> > warnings that this introduces.
> > 
> 
> This should be done in 1/3 which is already accepted to mfd,
> so the warning should be gone when the stuff is pulled together.
> 

Very good. I just didn't spot that for some reason.

> Sorry for not making sure it's in earlier

No fault on your part, I should have spotted it. Sending binding updates
and DT updates in the same series is preferred way, and as I don't apply
the binding through my tree these warnings show up there.

Thank you,
Bjorn

> Nikita
> 
> > Thanks,
> > Bjorn
  

Patch

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