Re: [PATCH v5 2/2] usb: typec: hd3ss3220: Enable VBUS based on ID pin state

Dmitry Baryshkov
2025-10-27T13:19:09Z

On Mon, Oct 27, 2025 at 11:47:13AM +0200, Heikki Krogerus wrote:
> Hi Krishna,
>
> > +static int hd3ss3220_get_vbus_supply(struct hd3ss3220 *hd3ss3220)
> > +{
> > + struct device_node *hd3ss3220_node = hd3ss3220->dev->of_node;
> > + struct device_node *np;
> > +
> > + np = of_graph_get_remote_node(hd3ss3220_node, 0, 0);
> > + if (!np) {
> > + dev_err(hd3ss3220->dev, "failed to get device node");
> > + return -ENODEV;
> > + }
>
> So I guess that's the connector node. Why can't you just place the
> regulator reference to the hd3ss3220 controller node instead of the
> connector like the port controllers do?
>
> That would allow us to do a simple devm_regulator_get_optional() call
> that's not tied to DT only.

But we have devm_of_regulator_get_optional(), it was mentioned in the
previous email if I'm not mistaken. If we need, we should add
devm_fwnode_regulator_get(_optional).

vbus supply is described as a part of the usb-c-connector schema, so
it is not that logical to describe it as a part of the Type-C
controller.

--
With best wishes
Dmitry