* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible
2026-08-26 23:38 [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible Rinat Muhamedgaliev
@ 2026-08-27 21:43 ` Krzysztof Kozlowski
2026-08-28 10:05 ` Konrad Dybcio
2026-08-29 20:52 ` [PATCH v2] " Rinat Muhamedgaliev
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-08-27 21:43 UTC (permalink / raw)
To: Rinat Muhamedgaliev, Bjorn Andersson, Konrad Dybcio
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm,
devicetree, linux-kernel, Caleb Connolly, Frederic Laing
On 27/08/2026 01:38, Rinat Muhamedgaliev wrote:
> The fuel gauge at I2C address 0x55 on OnePlus 6T (fajita) reports
> DeviceType 0x0541, identifying it as a TI bq27541 rather than bq27411.
>
> Binding it as bq27411 selects the wrong register map and produces
> invalid voltage, state-of-charge, and temperature readings. Use the
> bq27541 compatible and rename the shared label along with its fajita
> and enchilada consumers.
>
> Tested on OnePlus 6T (fajita): queried DeviceType directly over I2C,
> built the DTB, booted it once with fastboot boot, then installed a
> locally built postmarketOS kernel package. Before the change, readings
> included about 65 V, over 10000% SOC, and -273.1 C. Afterward, the
> bq27xxx driver bound as ti,bq27541 and reported 3.835 V, 42% SOC, and
> 33.3 C.
>
> Fixes: 12dfb002ca01 ("arm64: dts: qcom: sdm845-oneplus-*: add fuel gauge")
> Closes: https://gitlab.com/sdm845-mainline/linux/-/issues/36
This is fine.
> Link: https://gitlab.com/sdm845-mainline/linux/-/merge_requests/148
But link seems irrelevant here. We do not reference downstream PRs in
upstream commits, because it should go the other way.
Please drop it.
> Signed-off-by: Rinat Muhamedgaliev <rinat.muhamedgaliev@gmail.com>
> ---
> arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 4 ++--
> arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts | 2 +-
> arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> index 948a0dd18..0c6203fa8 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
> @@ -790,8 +790,8 @@ &i2c10 {
> status = "okay";
> clock-frequency = <100000>;
>
> - bq27441_fg: bq27441-battery@55 {
> - compatible = "ti,bq27411";
> + bq27541_fg: bq27541-battery@55 {
If renaming it, then node name should be fuel-gauge@.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible
2026-08-26 23:38 [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible Rinat Muhamedgaliev
2026-08-27 21:43 ` Krzysztof Kozlowski
@ 2026-08-28 10:05 ` Konrad Dybcio
2026-08-29 21:03 ` Rinat Muhamedgaliev
2026-08-29 20:52 ` [PATCH v2] " Rinat Muhamedgaliev
2 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2026-08-28 10:05 UTC (permalink / raw)
To: Rinat Muhamedgaliev, Bjorn Andersson, Konrad Dybcio
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm,
devicetree, linux-kernel, Caleb Connolly, Frederic Laing
On 8/27/26 1:38 AM, Rinat Muhamedgaliev wrote:
> The fuel gauge at I2C address 0x55 on OnePlus 6T (fajita) reports
> DeviceType 0x0541, identifying it as a TI bq27541 rather than bq27411.
>
> Binding it as bq27411 selects the wrong register map and produces
> invalid voltage, state-of-charge, and temperature readings. Use the
> bq27541 compatible and rename the shared label along with its fajita
> and enchilada consumers.
>
> Tested on OnePlus 6T (fajita): queried DeviceType directly over I2C,
> built the DTB, booted it once with fastboot boot, then installed a
> locally built postmarketOS kernel package. Before the change, readings
> included about 65 V, over 10000% SOC, and -273.1 C. Afterward, the
> bq27xxx driver bound as ti,bq27541 and reported 3.835 V, 42% SOC, and
> 33.3 C.
>
> Fixes: 12dfb002ca01 ("arm64: dts: qcom: sdm845-oneplus-*: add fuel gauge")
> Closes: https://gitlab.com/sdm845-mainline/linux/-/issues/36
> Link: https://gitlab.com/sdm845-mainline/linux/-/merge_requests/148
If I'm reading that thread right, this IC is on the battery itself (?)
and it seems to differ across different units / suppliers, would that
be a good interpretation?
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible
2026-08-28 10:05 ` Konrad Dybcio
@ 2026-08-29 21:03 ` Rinat Muhamedgaliev
0 siblings, 0 replies; 5+ messages in thread
From: Rinat Muhamedgaliev @ 2026-08-29 21:03 UTC (permalink / raw)
To: Konrad Dybcio
Cc: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-msm, devicetree, linux-kernel,
Caleb Connolly, Frederic Laing
On 29/08/2026, Konrad Dybcio wrote:
> If I'm reading that thread right, this IC is on the battery itself (?)
> and it seems to differ across different units / suppliers, would that
> be a good interpretation?
That matches what I found while looking into this. Both the bq27411-G1
and bq27541-G1 datasheets describe them as pack-side fuel gauges meant
for integration into the battery pack itself, alongside the protection
IC, rather than being placed on the phone's mainboard. So it's
plausible that different battery packs (different suppliers or
production batches) could carry a different chip variant, and DT
can't detect that at boot time - the bq27xxx driver picks its register
map purely from the compatible string, with no runtime DeviceType
probing.
I want to be upfront: I only tested this on my own OnePlus 6T
(fajita), by reading DeviceType directly over I2C on that one unit. I
haven't verified whether other fajita/enchilada units report the same
value, so I can't rule out that some devices out there actually do
have a bq27411 and would regress with this patch.
I'm not sure what the right way to handle this is and would appreciate
guidance. A few options I can think of, roughly in order of effort:
- Ask other sdm845-mainline users to report their DeviceType (a quick
i2cget on 0x55) to get a sense of how common each variant is.
- Leave the fix as-is for now, since it's still strictly correct for
the tested unit and the previous binding was wrong for it, but note
the pack-side/per-battery caveat explicitly in the commit message.
- Longer term, add DeviceType autodetection to bq27xxx_battery.c
itself so the driver picks the right register map at probe time
instead of relying on a static DT compatible - though that's a
separate, larger change to the driver, not this DT patch.
Happy to go whichever direction you and the other reviewers think is
right; just didn't want to claim more certainty than I actually have.
Rinat
пт, 28 авг. 2026 г. в 13:05, Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>:
>
> On 8/27/26 1:38 AM, Rinat Muhamedgaliev wrote:
> > The fuel gauge at I2C address 0x55 on OnePlus 6T (fajita) reports
> > DeviceType 0x0541, identifying it as a TI bq27541 rather than bq27411.
> >
> > Binding it as bq27411 selects the wrong register map and produces
> > invalid voltage, state-of-charge, and temperature readings. Use the
> > bq27541 compatible and rename the shared label along with its fajita
> > and enchilada consumers.
> >
> > Tested on OnePlus 6T (fajita): queried DeviceType directly over I2C,
> > built the DTB, booted it once with fastboot boot, then installed a
> > locally built postmarketOS kernel package. Before the change, readings
> > included about 65 V, over 10000% SOC, and -273.1 C. Afterward, the
> > bq27xxx driver bound as ti,bq27541 and reported 3.835 V, 42% SOC, and
> > 33.3 C.
> >
> > Fixes: 12dfb002ca01 ("arm64: dts: qcom: sdm845-oneplus-*: add fuel gauge")
> > Closes: https://gitlab.com/sdm845-mainline/linux/-/issues/36
> > Link: https://gitlab.com/sdm845-mainline/linux/-/merge_requests/148
>
> If I'm reading that thread right, this IC is on the battery itself (?)
> and it seems to differ across different units / suppliers, would that
> be a good interpretation?
>
> Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible
2026-08-26 23:38 [PATCH] arm64: dts: qcom: sdm845-oneplus: fix fuel gauge compatible Rinat Muhamedgaliev
2026-08-27 21:43 ` Krzysztof Kozlowski
2026-08-28 10:05 ` Konrad Dybcio
@ 2026-08-29 20:52 ` Rinat Muhamedgaliev
2 siblings, 0 replies; 5+ messages in thread
From: Rinat Muhamedgaliev @ 2026-08-29 20:52 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-arm-msm,
devicetree, linux-kernel, Caleb Connolly, Frederic Laing,
Rinat Muhamedgaliev
The fuel gauge at I2C address 0x55 on OnePlus 6T (fajita) reports DeviceType 0x0541, identifying it as a TI bq27541 rather than bq27411.
Binding it as bq27411 selects the wrong register map and produces invalid voltage, state-of-charge, and temperature readings. Use the bq27541 compatible and rename the shared label along with its fajita and enchilada consumers.
Tested on OnePlus 6T (fajita): queried DeviceType directly over I2C, built the DTB, booted it once with fastboot boot, then installed a locally built postmarketOS kernel package. Before the change, readings included about 65 V, over 10000% SOC, and -273.1 C. Afterward, the bq27xxx driver bound as ti,bq27541 and reported 3.835 V, 42% SOC, and 33.3 C.
Fixes: 12dfb002ca01 ("arm64: dts: qcom: sdm845-oneplus-*: add fuel gauge")
Closes: https://gitlab.com/sdm845-mainline/linux/-/issues/36
Signed-off-by: Rinat Muhamedgaliev <rinat.muhamedgaliev@gmail.com>
---
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 4 ++--
arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts | 2 +-
arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 948a0dd18d13..f3459226bf7b 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -790,8 +790,8 @@ &i2c10 {
status = "okay";
clock-frequency = <100000>;
- bq27441_fg: bq27441-battery@55 {
- compatible = "ti,bq27411";
+ bq27541_fg: fuel-gauge@55 {
+ compatible = "ti,bq27541";
status = "okay";
reg = <0x55>;
};
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts b/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
index 5f01115e2322..21ebd3f67155 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dts
@@ -44,7 +44,7 @@ main_cam_ois: main-cam-ois-regulator {
};
};
-&bq27441_fg {
+&bq27541_fg {
monitored-battery = <&battery>;
};
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts b/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
index 7ffcad24d505..d640b38b53f4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-fajita.dts
@@ -67,7 +67,7 @@ tfa9894_codec: tfa9894@34 {
};
-&bq27441_fg {
+&bq27541_fg {
monitored-battery = <&battery>;
};
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread