Devicetree
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: qcom: sm7125-samsung: add fuel gauge
@ 2026-11-23 13:02 Erikas Bitovtas
  2026-11-30 11:01 ` Konrad Dybcio
  0 siblings, 1 reply; 4+ messages in thread
From: Erikas Bitovtas @ 2026-11-23 13:02 UTC (permalink / raw)
  To: Bjorn Andersson, Konrad Dybcio, Abel Vesa, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-arm-msm, devicetree, ~postmarketos/upstreaming, phone-devel,
	Erikas Bitovtas

Samsung Galaxy A52 and A72 use Silicon Mitus SM5714 interface PMIC,
which includes a fuel gauge as one of its features. Enable GPI DMA and
I2C controllers, add battery bindings and enable the interface PMIC fuel
gauge.

Signed-off-by: Erikas Bitovtas <erikas99876@gmail.com>
---
Samsung Galaxy A52 and A72 use Silicon Mitus SM5714 interface PMIC which
includes a fuel gauge to measure battery state of charge. Add device
tree bindings for their lithium-ion 4,500 and 5,000 mAh batteries
respectfully, enable GPI DMA and I2C controllers and enable the SM5714
fuel gauge.

Tested on Samsung Galaxy A72. The driver reports the same SoC and energy
as on Android.

This patch depends on a currently unmerged series for SC7180 GPI DMA:
https://lore.kernel.org/all/20261112-sc7180-gpi-dma-v1-0-2a8eceb49563@gmail.com/
---
 arch/arm64/boot/dts/qcom/sm7125-samsung-a52q.dts   |  4 +++
 arch/arm64/boot/dts/qcom/sm7125-samsung-a72q.dts   |  4 +++
 .../arm64/boot/dts/qcom/sm7125-samsung-common.dtsi | 38 ++++++++++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm7125-samsung-a52q.dts b/arch/arm64/boot/dts/qcom/sm7125-samsung-a52q.dts
index ecba5be8164e..cd58f1449290 100644
--- a/arch/arm64/boot/dts/qcom/sm7125-samsung-a52q.dts
+++ b/arch/arm64/boot/dts/qcom/sm7125-samsung-a52q.dts
@@ -15,6 +15,10 @@ / {
 	qcom,board-id = <0x22 0x6>;
 };
 
+&battery {
+	charge-full-design-microamp-hours = <4500000>;
+};
+
 &rmtfs_mem {
 	reg = <0x0 0xf4f00000 0x0 0x202000>;
 };
diff --git a/arch/arm64/boot/dts/qcom/sm7125-samsung-a72q.dts b/arch/arm64/boot/dts/qcom/sm7125-samsung-a72q.dts
index f18d03de1585..73a1c3b7facc 100644
--- a/arch/arm64/boot/dts/qcom/sm7125-samsung-a72q.dts
+++ b/arch/arm64/boot/dts/qcom/sm7125-samsung-a72q.dts
@@ -15,6 +15,10 @@ / {
 	qcom,board-id = <0x22 0x5>;
 };
 
+&battery {
+	charge-full-design-microamp-hours = <5000000>;
+};
+
 &rmtfs_mem {
 	reg = <0x0 0xf3700000 0x0 0x202000>;
 };
diff --git a/arch/arm64/boot/dts/qcom/sm7125-samsung-common.dtsi b/arch/arm64/boot/dts/qcom/sm7125-samsung-common.dtsi
index 59ef4921f31e..5d854a76bb21 100644
--- a/arch/arm64/boot/dts/qcom/sm7125-samsung-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm7125-samsung-common.dtsi
@@ -22,6 +22,11 @@ / {
 
 	qcom,msm-id = <QCOM_ID_SM7125 0x0>;
 
+	battery: battery {
+		compatible = "simple-battery";
+		device-chemistry = "lithium-ion";
+	};
+
 	chosen {
 		#address-cells = <2>;
 		#size-cells = <2>;
@@ -379,6 +384,25 @@ &dispcc {
 	status = "disabled";
 };
 
+&gpi_dma0 {
+	status = "okay";
+};
+
+&gpi_dma1 {
+	status = "okay";
+};
+
+&i2c4 {
+	status = "okay";
+
+	fuel-gauge@71 {
+		compatible = "siliconmitus,sm5714-fuel-gauge";
+		reg = <0x71>;
+
+		monitored-battery = <&battery>;
+	};
+};
+
 &pm6150l_gpios {
 	key_vol_up_default: key-vol-up-default-state {
 		pins = "gpio8";
@@ -421,6 +445,20 @@ &qfprom {
 	vcc-supply = <&vreg_l11a_1p8>;
 };
 
+/* External pull-up */
+&qup_i2c4_default {
+	drive-strength = <2>;
+	bias-disable;
+};
+
+&qupv3_id_0 {
+	status = "okay";
+};
+
+&qupv3_id_1 {
+	status = "okay";
+};
+
 &sdhc_2 {
 	vmmc-supply = <&vreg_l9c_2p95>;
 	vqmmc-supply = <&vreg_l6c_3p0>;

---
base-commit: 2c0da72bad5631bda9c70dcfbe3497a0ebd9f936
change-id: 20261121-sm7125-samsung-fuelgauge-a57c6a0c916c
prerequisite-change-id: 20261111-sc7180-gpi-dma-a77963d9e1cc:v1
prerequisite-patch-id: 70dc64e33232cae6744eeb11e8f53e099eb49c1f
prerequisite-patch-id: 1ba00e1d0ffd80fa49f64e8b627ab07ce9478e74

Best regards,
--  
Erikas Bitovtas <erikas99876@gmail.com>


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

end of thread, other threads:[~2026-12-02 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 13:02 [PATCH] arm64: dts: qcom: sm7125-samsung: add fuel gauge Erikas Bitovtas
2026-11-30 11:01 ` Konrad Dybcio
2026-12-02 12:04   ` Erikas Bitovtas
2026-12-02 12:11     ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox