sc27xx-fuel-gauge: fix battery detect
Subsystems (3)
v2 cover sc27xx-fuel-gauge: fix battery detect
Marked this as V2, since the DTS (last) patch is a continuation of the 2nd patch from [1].
[1] https://lore.kernel.org/lkml/[email protected]/
Stanislav Jakubek (3):
dt-bindings: power: supply: sc27xx-fg: document deprecated
bat-detect-gpio
power: supply: sc27xx: Fix battery detect GPIO probe
arm64: dts: sprd: Fix battery-detect-gpios property
.../devicetree/bindings/power/supply/sc27xx-fg.yaml | 5 +++++ arch/arm64/boot/dts/sprd/sc2731.dtsi | 2 +- drivers/power/supply/sc27xx_fuel_gauge.c | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
PATCH v2 1/3 dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
While the bindings have always used the correct 'battery-detect-gpios' property, the DTS and the Linux driver have been using the incorrect 'bat-detect-gpio' property. Document this property and mark it as deprecated.
---
Changes in V2:
- new patch
.../devicetree/bindings/power/supply/sc27xx-fg.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml +5 -0
@@ -27,6 +27,11 @@ properties: battery-detect-gpios: maxItems: 1 + bat-detect-gpio: + maxItems: 1 + deprecated: true + description: use battery-detect-gpios instead + interrupts: maxItems: 1
Signature · 1 line
2.43.0
Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
Quoted 4 lines · Stanislav Jakubek
While the bindings have always used the correct 'battery-detect-gpios' property, the DTS and the Linux driver have been using the incorrect 'bat-detect-gpio' property. Document this property and mark it as deprecated.
Well, I would just correct bindings instead - much less changes needed. Document 'bat-detect-gpios' (note the 's') and drop 'battery-detect-gpios'.
Best regards,
Krzysztof
Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
Quoted 9 lines · Krzysztof Kozlowski
Quoted 4 lines · Stanislav Jakubek
While the bindings have always used the correct 'battery-detect-gpios' property, the DTS and the Linux driver have been using the incorrect 'bat-detect-gpio' property. Document this property and mark it as deprecated.
Well, I would just correct bindings instead - much less changes needed. Document 'bat-detect-gpios' (note the 's') and drop 'battery-detect-gpios'.
Hi Krzysztof,
this approach was preferred by one of the Spreadtrum maintainers [1], so I did it this way.
[1] https://lore.kernel.org/lkml/CAAfSe-uC+G8iEk_37vBr3+dQsv4a4tTTsz11hUguVRnU=r+4qQ@mail.gmail.com/
Regards,
Stanislav
Quoted 4 lines
Best regards,
Krzysztof
Krzysztof Kozlowski
Acked-byRe: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
Quoted 11 lines · Stanislav Jakubek
Quoted 9 lines · Krzysztof Kozlowski
Quoted 4 lines · Stanislav Jakubek
While the bindings have always used the correct 'battery-detect-gpios' property, the DTS and the Linux driver have been using the incorrect 'bat-detect-gpio' property. Document this property and mark it as deprecated.
Well, I would just correct bindings instead - much less changes needed. Document 'bat-detect-gpios' (note the 's') and drop 'battery-detect-gpios'.
Quoted 6 lines
Hi Krzysztof,
this approach was preferred by one of the Spreadtrum maintainers [1], so I did it this way.
[1] https://lore.kernel.org/lkml/CAAfSe-uC+G8iEk_37vBr3+dQsv4a4tTTsz11hUguVRnU=r+4qQ@mail.gmail.com/
Wow, really? But that advice affects users of DTS... OK, I don't want to stop your fix for that, so let's get this done:
(But I am not happy so I don;t want above ack to be used against me in the future :) )
Best regards,
Krzysztof
Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
In reply to Stanislav JakubekQuoted 7 lines · Stanislav Jakubek
While the bindings have always used the correct 'battery-detect-gpios' property, the DTS and the Linux driver have been using the incorrect 'bat-detect-gpio' property. Document this property and mark it as deprecated.
Signed-off-by Stanislav Jakubek <[email protected]>
Thanks,
Chunyan
Quoted 26 lines
---
Changes in V2:
- new patch.../devicetree/bindings/power/supply/sc27xx-fg.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml +5
-1@@ -27,6 +27,11 @@ properties: battery-detect-gpios: maxItems: 1 + bat-detect-gpio: + maxItems: 1 + deprecated: true + description: use battery-detect-gpios instead + interrupts: maxItems: 1 --2.43.0
PATCH v2 2/3 power: supply: sc27xx: Fix battery detect GPIO probe
In reply to Stanislav JakubekThe DT bindings specify the property as 'battery-detect-gpios', add handling for it. Keep fallback to the deprecated 'bat-detect-gpio' property to keep compatibility with older DTS.
---
Changes in V2:
- new patch
drivers/power/supply/sc27xx_fuel_gauge.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/power/supply/sc27xx_fuel_gauge.c +7 -3
@@ -1183,10 +1183,14 @@ static int sc27xx_fgu_probe(struct platform_device *pdev)return PTR_ERR (data->charge_chan); } - data->gpiod =devm_gpiod_get (dev,"bat-detect" ,GPIOD_IN ); + data->gpiod =devm_gpiod_get (dev,"battery-detect" ,GPIOD_IN );if (IS_ERR (data->gpiod)) { -dev_err (dev,"failed to get battery detection GPIO\n" ); -return PTR_ERR (data->gpiod); + data->gpiod =devm_gpiod_get (dev,"bat-detect" ,GPIOD_IN ); +if (IS_ERR (data->gpiod)) { +dev_err (dev,"failed to get battery detection GPIO\n" ); +return PTR_ERR (data->gpiod); + } +dev_warn (dev,"bat-detect is deprecated, please use battery-detect\n" ); } ret =gpiod_get_value_cansleep (data->gpiod);
Signature · 1 line
2.43.0
PATCH v2 3/3 arm64: dts: sprd: Fix battery-detect-gpios property
In reply to Stanislav JakubekAccording to DT bindings, the property is called 'battery-detect-gpios', not 'bat-detect-gpio'. Update the property as such.
---
Changes in V2:
- actually fix the property, as per bindings
- drop Baolin's R-b as the original patch was incorrect
arch/arm64/boot/dts/sprd/sc2731.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/sprd/sc2731.dtsi +1 -1
@@ -97,7 +97,7 @@ pmic_adc: adc@480 { fuel-gauge@a00 { compatible = "sprd,sc2731-fgu"; reg = <0xa00>; - bat-detect-gpio = <&pmic_eic 9 GPIO_ACTIVE_HIGH>; + battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>; io-channels = <&pmic_adc 3>, <&pmic_adc 6>; io-channel-names = "bat-temp", "charge-vol"; monitored-battery = <&bat>;
Signature · 1 line
2.43.0
Sebastian Reichel
AppliedRe: (subset) [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect
In reply to Stanislav JakubekQuoted 5 lines · Stanislav Jakubek
Marked this as V2, since the DTS (last) patch is a continuation of the 2nd patch from [1].
Quoted 7 lines
Stanislav Jakubek (3):
dt-bindings: power: supply: sc27xx-fg: document deprecated
bat-detect-gpio
power: supply: sc27xx: Fix battery detect GPIO probe
arm64: dts: sprd: Fix battery-detect-gpios property[...]
Applied, thanks!
[1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
commit: 2da0cb9f03bd9b726fa1b4accb210ef2ab439925
[2/3] power: supply: sc27xx: Fix battery detect GPIO probe
commit: f29cc6d9a3917f98f1fb109f0c8841dd095f3fb0Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>