]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
power: supply: sc27xx: Fix battery detect GPIO probe
authorStanislav Jakubek <stano.jakubek@gmail.com>
Mon, 4 Nov 2024 13:04:27 +0000 (14:04 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Mon, 11 Nov 2024 22:05:19 +0000 (23:05 +0100)
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>
Link: https://lore.kernel.org/r/ca28b2f2037929c0011fc5c779c332c1d1ad5308.1730720720.git.stano.jakubek@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/sc27xx_fuel_gauge.c

index 426d423b935b581a7673be076ae71b8899f17e2e..f36edc2ba708748d0ceb61298056f8c905aca012 100644 (file)
@@ -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);