Skip to content

Commit 614ffb4

Browse files
author
Desnes Nunes
committed
usb: typec: tcpci: add regulator support
JIRA: https://issues.redhat.com/browse/RHEL-116016 Conflicts: * This avoids commit bdd0400 ("usb: typec: tcpm/tcpci: Convert to i2c's .probe_new()") that converts *probe in tcpci_i2c_driver commit a592e06 Author: Michael Grzeschik <m.grzeschik@pengutronix.de> Date: Fri, 4 Apr 2025 01:17:20 +0200 The tcpci chip vbus pin is possibly driven by an regulator. This patch is adding support to enable an optional vdd regulator before probing. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20250404-ml-topic-tcpci-v1-1-4442c7d0ee1e@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Desnes Nunes <desnesn@redhat.com>
1 parent 9ec71a8 commit 614ffb4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/usb/typec/tcpm/tcpci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/usb/tcpci.h>
1818
#include <linux/usb/tcpm.h>
1919
#include <linux/usb/typec.h>
20+
#include <linux/regulator/consumer.h>
2021

2122
#define PD_RETRY_COUNT_DEFAULT 3
2223
#define PD_RETRY_COUNT_3_0_OR_HIGHER 2
@@ -906,6 +907,10 @@ static int tcpci_probe(struct i2c_client *client,
906907
int err;
907908
u16 val = 0;
908909

910+
err = devm_regulator_get_enable_optional(&client->dev, "vdd");
911+
if (err && err != -ENODEV)
912+
return dev_err_probe(&client->dev, err, "Failed to get regulator\n");
913+
909914
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
910915
if (!chip)
911916
return -ENOMEM;

0 commit comments

Comments
 (0)