Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364527
b: refs/heads/master
c: 58f735f
h: refs/heads/master
i:
  364525: 1cc2671
  364523: 8c274ce
  364519: d6bc68f
  364511: c67b125
v: v3
  • Loading branch information
Roger Quadros authored and Felipe Balbi committed Mar 18, 2013
1 parent 8a18755 commit a609434
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2319fb88e16e56c64d4f3ab50af69ed6dadbc7b5
refs/heads/master: 58f735fe4778d34d9d1e37bcdd59325d66a8793e
18 changes: 18 additions & 0 deletions trunk/drivers/usb/otg/nop-usb-xceiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@
#include <linux/usb/nop-usb-xceiv.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>

struct nop_usb_xceiv {
struct usb_phy phy;
struct device *dev;
struct clk *clk;
struct regulator *vcc;
};

static struct platform_device *pd;
Expand Down Expand Up @@ -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);

Expand All @@ -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)
Expand Down Expand Up @@ -154,6 +166,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";
Expand Down

0 comments on commit a609434

Please sign in to comment.