Skip to content

Commit de76a76

Browse files
alcharkbroonie
authored andcommitted
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: Mark Brown <broonie@kernel.org> Tested-by: Chris Morgan <macromorgan@hotmail.com> Signed-off-by: Alexey Charkov <alchark@flipper.net> Link: https://patch.msgid.link/20260331-bq25792-v6-4-0278fba33eb9@flipper.net Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent aef4d87 commit de76a76

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/regulator/bq257xx-regulator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ static void bq257xx_reg_dt_parse_gpio(struct platform_device *pdev)
127127
of_node_put(subchild);
128128

129129
if (IS_ERR(pdata->otg_en_gpio)) {
130+
if (PTR_ERR(pdata->otg_en_gpio) == -ENOENT) {
131+
/* No GPIO, will only use register writes for OTG */
132+
pdata->otg_en_gpio = NULL;
133+
return;
134+
}
135+
130136
dev_err(&pdev->dev, "Error getting enable gpio: %ld\n",
131137
PTR_ERR(pdata->otg_en_gpio));
132138
return;

0 commit comments

Comments
 (0)