Unverified Commit de76a763 authored by Alexey Charkov's avatar Alexey Charkov Committed by Mark Brown
Browse files

regulator: bq257xx: Make OTG enable GPIO really optional



The bindings describe the OTG enable GPIO as optional, but the driver
gets upset if it's not provided in the device tree.

Make the driver accept the absence of the GPIO, and just use register
writes to handle OTG mode in that case, skipping the error message for
-ENOENT.

Acked-by: default avatarMark Brown <broonie@kernel.org>
Tested-by: default avatarChris Morgan <macromorgan@hotmail.com>
Signed-off-by: default avatarAlexey Charkov <alchark@flipper.net>
Link: https://patch.msgid.link/20260331-bq25792-v6-4-0278fba33eb9@flipper.net


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent aef4d87f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -127,6 +127,12 @@ static void bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
	of_node_put(subchild);

	if (IS_ERR(pdata->otg_en_gpio)) {
		if (PTR_ERR(pdata->otg_en_gpio) == -ENOENT) {
			/* No GPIO, will only use register writes for OTG */
			pdata->otg_en_gpio = NULL;
			return;
		}

		dev_err(&pdev->dev, "Error getting enable gpio: %ld\n",
			PTR_ERR(pdata->otg_en_gpio));
		return;