Skip to content

Commit fbaf3b6

Browse files
krzkchanwoochoi
authored andcommitted
extcon: ptn5150: Make 'vbus-gpios' optional
The PTN5150 chip can be used in hardware designs with only reporting of USB Type-C connection, without the VBUS control. The driver however unconditionally expected 'vbus-gpios'. Since all uses of the VBUS GPIO descriptor are NULL safe, the code can accept missing GPIO and provide only extcon status reporting. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 85256f6 commit fbaf3b6

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎drivers/extcon/extcon-ptn5150.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,14 @@ static int ptn5150_i2c_probe(struct i2c_client *i2c,
238238
info->i2c = i2c;
239239
info->vbus_gpiod = devm_gpiod_get(&i2c->dev, "vbus", GPIOD_OUT_LOW);
240240
if (IS_ERR(info->vbus_gpiod)) {
241-
dev_err(dev, "failed to get VBUS GPIO\n");
242-
return PTR_ERR(info->vbus_gpiod);
241+
ret = PTR_ERR(info->vbus_gpiod);
242+
if (ret == -ENOENT) {
243+
dev_info(dev, "No VBUS GPIO, ignoring VBUS control\n");
244+
info->vbus_gpiod = NULL;
245+
} else {
246+
dev_err(dev, "failed to get VBUS GPIO\n");
247+
return ret;
248+
}
243249
}
244250

245251
mutex_init(&info->mutex);

0 commit comments

Comments
 (0)