Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325820
b: refs/heads/master
c: e4d37ae
h: refs/heads/master
v: v3
  • Loading branch information
Kuninori Morimoto authored and Greg Kroah-Hartman committed Aug 10, 2012
1 parent a6f4bdb commit f86e333
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04216bedafb1b3992a6c2b7f1518281d2ba5fc7b
refs/heads/master: e4d37aeb373a5edceecc1dadc76fabbe8bc18e44
36 changes: 34 additions & 2 deletions trunk/drivers/usb/host/ohci-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ static int __devinit ohci_platform_probe(struct platform_device *dev)
return -ENXIO;
}

if (pdata->power_on) {
err = pdata->power_on(dev);
if (err < 0)
return err;
}

hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,
dev_name(&dev->dev));
if (!hcd)
return -ENOMEM;
if (!hcd) {
err = -ENOMEM;
goto err_power;
}

hcd->rsrc_start = res_mem->start;
hcd->rsrc_len = resource_size(res_mem);
Expand Down Expand Up @@ -138,32 +146,56 @@ static int __devinit ohci_platform_probe(struct platform_device *dev)
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err_put_hcd:
usb_put_hcd(hcd);
err_power:
if (pdata->power_off)
pdata->power_off(dev);

return err;
}

static int __devexit ohci_platform_remove(struct platform_device *dev)
{
struct usb_hcd *hcd = platform_get_drvdata(dev);
struct usb_ohci_pdata *pdata = dev->dev.platform_data;

usb_remove_hcd(hcd);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
platform_set_drvdata(dev, NULL);

if (pdata->power_off)
pdata->power_off(dev);

return 0;
}

#ifdef CONFIG_PM

static int ohci_platform_suspend(struct device *dev)
{
struct usb_ohci_pdata *pdata = dev->platform_data;
struct platform_device *pdev =
container_of(dev, struct platform_device, dev);

if (pdata->power_suspend)
pdata->power_suspend(pdev);

return 0;
}

static int ohci_platform_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct usb_ohci_pdata *pdata = dev->platform_data;
struct platform_device *pdev =
container_of(dev, struct platform_device, dev);

if (pdata->power_on) {
int err = pdata->power_on(pdev);
if (err < 0)
return err;
}

ohci_finish_controller_resume(hcd);
return 0;
Expand Down
8 changes: 8 additions & 0 deletions trunk/include/linux/usb/ohci_pdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ struct usb_ohci_pdata {
unsigned big_endian_desc:1;
unsigned big_endian_mmio:1;
unsigned no_big_frame_no:1;

/* Turn on all power and clocks */
int (*power_on)(struct platform_device *pdev);
/* Turn off all power and clocks */
void (*power_off)(struct platform_device *pdev);
/* Turn on only VBUS suspend power and hotplug detection,
* turn off everything else */
void (*power_suspend)(struct platform_device *pdev);
};

#endif /* __USB_CORE_OHCI_PDRIVER_H */

0 comments on commit f86e333

Please sign in to comment.