Commit f29cc6d9 authored by Stanislav Jakubek's avatar Stanislav Jakubek Committed by Sebastian Reichel
Browse files

power: supply: sc27xx: Fix battery detect GPIO probe



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: default avatarStanislav Jakubek <stano.jakubek@gmail.com>
Link: https://lore.kernel.org/r/ca28b2f2037929c0011fc5c779c332c1d1ad5308.1730720720.git.stano.jakubek@gmail.com


Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 2da0cb9f
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -1183,11 +1183,15 @@ static int sc27xx_fgu_probe(struct platform_device *pdev)
		return PTR_ERR(data->charge_chan);
	}

	data->gpiod = devm_gpiod_get(dev, "battery-detect", GPIOD_IN);
	if (IS_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);
	if (ret < 0) {