* [PATCH] usb: typec: tcpci: add regulator support
@ 2025-04-03 23:17 Michael Grzeschik
2025-04-07 13:52 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2025-04-03 23:17 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, kernel, Michael Grzeschik
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>
---
drivers/usb/typec/tcpm/tcpci.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index 19ab6647af706..a56e31b20c214 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -17,6 +17,7 @@
#include <linux/usb/tcpci.h>
#include <linux/usb/tcpm.h>
#include <linux/usb/typec.h>
+#include <linux/regulator/consumer.h>
#define PD_RETRY_COUNT_DEFAULT 3
#define PD_RETRY_COUNT_3_0_OR_HIGHER 2
@@ -905,6 +906,10 @@ static int tcpci_probe(struct i2c_client *client)
int err;
u16 val = 0;
+ err = devm_regulator_get_enable_optional(&client->dev, "vdd");
+ if (err && err != -ENODEV)
+ return dev_err_probe(&client->dev, err, "Failed to get regulator\n");
+
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
---
base-commit: a1b5bd45d4ee58af4f56e49497b8c3db96d8f8a3
change-id: 20250404-ml-topic-tcpci-524d1d6bfede
Best regards,
--
Michael Grzeschik <m.grzeschik@pengutronix.de>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: typec: tcpci: add regulator support
2025-04-03 23:17 [PATCH] usb: typec: tcpci: add regulator support Michael Grzeschik
@ 2025-04-07 13:52 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2025-04-07 13:52 UTC (permalink / raw)
To: Michael Grzeschik
Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, kernel,
Badhri Jagan Sridharan
+Badhri
On Fri, Apr 04, 2025 at 01:17:20AM +0200, Michael Grzeschik wrote:
> 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>
> ---
> drivers/usb/typec/tcpm/tcpci.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> index 19ab6647af706..a56e31b20c214 100644
> --- a/drivers/usb/typec/tcpm/tcpci.c
> +++ b/drivers/usb/typec/tcpm/tcpci.c
> @@ -17,6 +17,7 @@
> #include <linux/usb/tcpci.h>
> #include <linux/usb/tcpm.h>
> #include <linux/usb/typec.h>
> +#include <linux/regulator/consumer.h>
>
> #define PD_RETRY_COUNT_DEFAULT 3
> #define PD_RETRY_COUNT_3_0_OR_HIGHER 2
> @@ -905,6 +906,10 @@ static int tcpci_probe(struct i2c_client *client)
> int err;
> u16 val = 0;
>
> + err = devm_regulator_get_enable_optional(&client->dev, "vdd");
> + if (err && err != -ENODEV)
> + return dev_err_probe(&client->dev, err, "Failed to get regulator\n");
> +
> chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
> if (!chip)
> return -ENOMEM;
>
> ---
> base-commit: a1b5bd45d4ee58af4f56e49497b8c3db96d8f8a3
> change-id: 20250404-ml-topic-tcpci-524d1d6bfede
>
> Best regards,
> --
> Michael Grzeschik <m.grzeschik@pengutronix.de>
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-07 13:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 23:17 [PATCH] usb: typec: tcpci: add regulator support Michael Grzeschik
2025-04-07 13:52 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).