devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect
@ 2024-11-04 13:03 Stanislav Jakubek
  2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Stanislav Jakubek @ 2024-11-04 13:03 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, devicetree, linux-kernel

Marked this as V2, since the DTS (last) patch is a continuation of
the 2nd patch from [1].

[1] https://lore.kernel.org/lkml/cover.1723716331.git.stano.jakubek@gmail.com/

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(-)

-- 
2.43.0


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

* [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  2024-11-04 13:03 [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Stanislav Jakubek
@ 2024-11-04 13:03 ` Stanislav Jakubek
  2024-11-05  9:03   ` Krzysztof Kozlowski
  2024-11-07  2:50   ` Chunyan Zhang
  2024-11-04 13:04 ` [PATCH v2 2/3] power: supply: sc27xx: Fix battery detect GPIO probe Stanislav Jakubek
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Stanislav Jakubek @ 2024-11-04 13:03 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, devicetree, linux-kernel

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 <stano.jakubek@gmail.com>
---
Changes in V2:
- new patch

 .../devicetree/bindings/power/supply/sc27xx-fg.yaml          | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
index 9108a2841caf..b10f155afe68 100644
--- a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
+++ b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
@@ -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


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

* [PATCH v2 2/3] power: supply: sc27xx: Fix battery detect GPIO probe
  2024-11-04 13:03 [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Stanislav Jakubek
  2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
@ 2024-11-04 13:04 ` Stanislav Jakubek
  2024-11-04 13:04 ` [PATCH v2 3/3] arm64: dts: sprd: Fix battery-detect-gpios property Stanislav Jakubek
  2024-11-11 22:13 ` (subset) [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Sebastian Reichel
  3 siblings, 0 replies; 9+ messages in thread
From: Stanislav Jakubek @ 2024-11-04 13:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, devicetree, linux-kernel

The 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.

Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
---
Changes in V2:
- new patch

 drivers/power/supply/sc27xx_fuel_gauge.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/power/supply/sc27xx_fuel_gauge.c b/drivers/power/supply/sc27xx_fuel_gauge.c
index 426d423b935b..f36edc2ba708 100644
--- a/drivers/power/supply/sc27xx_fuel_gauge.c
+++ b/drivers/power/supply/sc27xx_fuel_gauge.c
@@ -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);
-- 
2.43.0


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

* [PATCH v2 3/3] arm64: dts: sprd: Fix battery-detect-gpios property
  2024-11-04 13:03 [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Stanislav Jakubek
  2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
  2024-11-04 13:04 ` [PATCH v2 2/3] power: supply: sc27xx: Fix battery detect GPIO probe Stanislav Jakubek
@ 2024-11-04 13:04 ` Stanislav Jakubek
  2024-11-11 22:13 ` (subset) [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Sebastian Reichel
  3 siblings, 0 replies; 9+ messages in thread
From: Stanislav Jakubek @ 2024-11-04 13:04 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-pm, devicetree, linux-kernel

According to DT bindings, the property is called 'battery-detect-gpios',
not 'bat-detect-gpio'. Update the property as such.

Signed-off-by: Stanislav Jakubek <stano.jakubek@gmail.com>
---
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(-)

diff --git a/arch/arm64/boot/dts/sprd/sc2731.dtsi b/arch/arm64/boot/dts/sprd/sc2731.dtsi
index 12136e68dada..b8e70c337d40 100644
--- a/arch/arm64/boot/dts/sprd/sc2731.dtsi
+++ b/arch/arm64/boot/dts/sprd/sc2731.dtsi
@@ -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>;
-- 
2.43.0


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

* Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
@ 2024-11-05  9:03   ` Krzysztof Kozlowski
  2024-11-06  7:19     ` Stanislav Jakubek
  2024-11-07  2:50   ` Chunyan Zhang
  1 sibling, 1 reply; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-11-05  9:03 UTC (permalink / raw)
  To: Stanislav Jakubek
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, linux-pm, devicetree,
	linux-kernel

On Mon, Nov 04, 2024 at 02:03:58PM +0100, Stanislav Jakubek wrote:
> 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


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

* Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  2024-11-05  9:03   ` Krzysztof Kozlowski
@ 2024-11-06  7:19     ` Stanislav Jakubek
  2024-11-06 11:10       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 9+ messages in thread
From: Stanislav Jakubek @ 2024-11-06  7:19 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, linux-pm, devicetree,
	linux-kernel

On Tue, Nov 05, 2024 at 10:03:16AM +0100, Krzysztof Kozlowski wrote:
> On Mon, Nov 04, 2024 at 02:03:58PM +0100, Stanislav Jakubek wrote:
> > 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

> 
> Best regards,
> Krzysztof
> 

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

* Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  2024-11-06  7:19     ` Stanislav Jakubek
@ 2024-11-06 11:10       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-11-06 11:10 UTC (permalink / raw)
  To: Stanislav Jakubek
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, linux-pm, devicetree,
	linux-kernel

On 06/11/2024 08:19, Stanislav Jakubek wrote:
> On Tue, Nov 05, 2024 at 10:03:16AM +0100, Krzysztof Kozlowski wrote:
>> On Mon, Nov 04, 2024 at 02:03:58PM +0100, Stanislav Jakubek wrote:
>>> 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/

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:

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

(But I am not happy so I don;t want above ack to be used against me in
the future :) )

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
  2024-11-05  9:03   ` Krzysztof Kozlowski
@ 2024-11-07  2:50   ` Chunyan Zhang
  1 sibling, 0 replies; 9+ messages in thread
From: Chunyan Zhang @ 2024-11-07  2:50 UTC (permalink / raw)
  To: Stanislav Jakubek
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, linux-pm, devicetree, linux-kernel

On Mon, 4 Nov 2024 at 21:04, Stanislav Jakubek <stano.jakubek@gmail.com> wrote:
>
> 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 <stano.jakubek@gmail.com>

Reviewed-by: Chunyan Zhang <zhang.lyra@gmail.com>

Thanks,
Chunyan

> ---
> Changes in V2:
> - new patch
>
>  .../devicetree/bindings/power/supply/sc27xx-fg.yaml          | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
> index 9108a2841caf..b10f155afe68 100644
> --- a/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
> @@ -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
>

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

* Re: (subset) [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect
  2024-11-04 13:03 [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Stanislav Jakubek
                   ` (2 preceding siblings ...)
  2024-11-04 13:04 ` [PATCH v2 3/3] arm64: dts: sprd: Fix battery-detect-gpios property Stanislav Jakubek
@ 2024-11-11 22:13 ` Sebastian Reichel
  3 siblings, 0 replies; 9+ messages in thread
From: Sebastian Reichel @ 2024-11-11 22:13 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Orson Zhai, Baolin Wang, Chunyan Zhang, Stanislav Jakubek
  Cc: linux-pm, devicetree, linux-kernel


On Mon, 04 Nov 2024 14:03:27 +0100, Stanislav Jakubek wrote:
> Marked this as V2, since the DTS (last) patch is a continuation of
> the 2nd patch from [1].
> 
> [1] https://lore.kernel.org/lkml/cover.1723716331.git.stano.jakubek@gmail.com/
> 
> 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: f29cc6d9a3917f98f1fb109f0c8841dd095f3fb0

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>


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

end of thread, other threads:[~2024-11-11 22:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 13:03 [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Stanislav Jakubek
2024-11-04 13:03 ` [PATCH v2 1/3] dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio Stanislav Jakubek
2024-11-05  9:03   ` Krzysztof Kozlowski
2024-11-06  7:19     ` Stanislav Jakubek
2024-11-06 11:10       ` Krzysztof Kozlowski
2024-11-07  2:50   ` Chunyan Zhang
2024-11-04 13:04 ` [PATCH v2 2/3] power: supply: sc27xx: Fix battery detect GPIO probe Stanislav Jakubek
2024-11-04 13:04 ` [PATCH v2 3/3] arm64: dts: sprd: Fix battery-detect-gpios property Stanislav Jakubek
2024-11-11 22:13 ` (subset) [PATCH v2 0/3] sc27xx-fuel-gauge: fix battery detect Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).