From: balbi@ti.com (Felipe Balbi) Date: Tue, 5 Feb 2013 11:20:01 +0200 Subject: [PATCH v2 04/30] usb: phy: nop: Handle power supply regulator for the PHY In-Reply-To: <1359372631-8180-5-git-send-email-rogerq@ti.com> References: <1359372631-8180-1-git-send-email-rogerq@ti.com> <1359372631-8180-5-git-send-email-rogerq@ti.com> Message-ID: <20130205092001.GM32118@arwen.pp.htv.fi> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, Jan 28, 2013 at 01:30:05PM +0200, Roger Quadros wrote: > We use "vcc" as the supply name for the PHY's power supply. > The power supply will be enabled during .init() and disabled > during .shutdown() > > Signed-off-by: Roger Quadros Acked-by: Felipe Balbi > --- > drivers/usb/otg/nop-usb-xceiv.c | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c > index 849eb9d..0a9628c 100644 > --- a/drivers/usb/otg/nop-usb-xceiv.c > +++ b/drivers/usb/otg/nop-usb-xceiv.c > @@ -33,11 +33,13 @@ > #include > #include > #include > +#include > > struct nop_usb_xceiv { > struct usb_phy phy; > struct device *dev; > struct clk *clk; > + struct regulator *vcc; > }; > > static struct platform_device *pd; > @@ -70,6 +72,11 @@ static int nop_init(struct usb_phy *phy) > { > struct nop_usb_xceiv *nop = dev_get_drvdata(phy->dev); > > + if (!IS_ERR(nop->vcc)) { > + if (regulator_enable(nop->vcc)) > + dev_err(phy->dev, "Failed to enable power\n"); > + } > + > if (!IS_ERR(nop->clk)) > clk_enable(nop->clk); > > @@ -82,6 +89,11 @@ static void nop_shutdown(struct usb_phy *phy) > > if (!IS_ERR(nop->clk)) > clk_disable(nop->clk); > + > + if (!IS_ERR(nop->vcc)) { > + if (regulator_disable(nop->vcc)) > + dev_err(phy->dev, "Failed to disable power\n"); > + } > } > > static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) > @@ -153,6 +165,12 @@ static int nop_usb_xceiv_probe(struct platform_device *pdev) > } > } > > + nop->vcc = devm_regulator_get(&pdev->dev, "vcc"); > + if (IS_ERR(nop->vcc)) { > + dev_dbg(&pdev->dev, "Error getting vcc regulator: %ld\n", > + PTR_ERR(nop->vcc)); > + } > + > nop->dev = &pdev->dev; > nop->phy.dev = nop->dev; > nop->phy.label = "nop-xceiv"; > -- > 1.7.4.1 > -- balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: