diff mbox series

[v3,2/4] usb: phy: generic: Get the vbus supply

Message ID 20240123225111.1629405-3-sean.anderson@seco.com (mailing list archive)
State Accepted
Commit 75fd6485cccef269ac9eb3b71cf56753341195ef
Headers show
Series usb: phy: generic: Support enabling/disabling VBUS | expand

Commit Message

Sean Anderson Jan. 23, 2024, 10:51 p.m. UTC
While support for working with a vbus was added, the regulator was never
actually gotten (despite what was documented). Fix this by actually
getting the supply from the device tree.

Fixes: 7acc9973e3c4 ("usb: phy: generic: add vbus support")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---

(no changes since v1)

 drivers/usb/phy/phy-generic.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Sean Anderson Jan. 29, 2024, 4:18 p.m. UTC | #1
On 1/23/24 17:51, Sean Anderson wrote:
> While support for working with a vbus was added, the regulator was never
> actually gotten (despite what was documented). Fix this by actually
> getting the supply from the device tree.
> 
> Fixes: 7acc9973e3c4 ("usb: phy: generic: add vbus support")
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
> 
> (no changes since v1)
> 
>  drivers/usb/phy/phy-generic.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> index 9ab50f26db60..16494030209e 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -274,6 +274,13 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
>  		return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
>  				     "could not get vbus regulator\n");
>  
> +	nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
> +	if (PTR_ERR(nop->vbus_draw) == -ENODEV)
> +		nop->vbus_draw = NULL;
> +	if (IS_ERR(nop->vbus_draw))
> +		return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
> +				     "could not get vbus regulator\n");
> +
>  	nop->dev		= dev;
>  	nop->phy.dev		= nop->dev;
>  	nop->phy.label		= "nop-xceiv";

OK, so as it turns out, this patch (and only this one) got applied as
03e607cbb293 ("usb: phy: generic: Get the vbus supply"). Which of course
messes with the premise of this series that no one was using the vbus
supply (so we can repurpose it), by adding the possibility that someone
was using the vbus supply. However, the only in-tree user is in
arch/arm/boot/dts/armada-388-helios4.dts, which was added before this
patch (so presumably they don't care).

At the very least, this patch should get dropped (and hopefully no one
complains about the next patch).

--Sean
diff mbox series

Patch

diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 9ab50f26db60..16494030209e 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -274,6 +274,13 @@  int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
 		return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
 				     "could not get vbus regulator\n");
 
+	nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
+	if (PTR_ERR(nop->vbus_draw) == -ENODEV)
+		nop->vbus_draw = NULL;
+	if (IS_ERR(nop->vbus_draw))
+		return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
+				     "could not get vbus regulator\n");
+
 	nop->dev		= dev;
 	nop->phy.dev		= nop->dev;
 	nop->phy.label		= "nop-xceiv";