* [PATCH V3 0/2] Suspend for gpio-vbus
@ 2011-07-03 22:45 Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 1/2] gpio-vbus: support disabling D+ pullup on suspend Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 2/2] mioa701: move gpio-pullup functionality to gpio-vbus Dmitry Eremin-Solenikov
0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-07-03 22:45 UTC (permalink / raw)
To: linux-arm-kernel
V1 version of these patches generated quite a lot of comments.
Now I'd like to present an updated version of this patchset.
Changes since V2:
* Really include all promised features. Blaming git format-patch :(
Changes since V1:
* Switch to using dev_pm_ops instead of platform_driver hooks
* Move suspend/resume to _noirq (LATE) to be sure that otg transceiver
suspends after the main UDC driver.
Dmitry Eremin-Solenikov (2):
gpio-vbus: support disabling D+ pullup on suspend
mioa701: move gpio-pullup functionality to gpio-vbus
arch/arm/mach-pxa/mioa701.c | 8 +-----
drivers/usb/otg/gpio_vbus.c | 42 +++++++++++++++++++++++++++++++++++++++++
include/linux/usb/gpio_vbus.h | 1 +
3 files changed, 45 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH V3 1/2] gpio-vbus: support disabling D+ pullup on suspend
2011-07-03 22:45 [PATCH V3 0/2] Suspend for gpio-vbus Dmitry Eremin-Solenikov
@ 2011-07-03 22:45 ` Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 2/2] mioa701: move gpio-pullup functionality to gpio-vbus Dmitry Eremin-Solenikov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-07-03 22:45 UTC (permalink / raw)
To: linux-arm-kernel
Some platforms would like to disable D+ pullup on suspend, to drain as
low power, as possible. E.g. this was requested by mioa701 board
maintainers.
Suspend/resume is done in _noirq path, to force handling of pullup after
the main UDC driver suspend/before resume.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
drivers/usb/otg/gpio_vbus.c | 42 +++++++++++++++++++++++++++++++++++++++++
include/linux/usb/gpio_vbus.h | 1 +
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 52733d9..0754445 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -327,6 +327,47 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int gpio_vbus_suspend(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
+ struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data;
+
+ if (gpio_vbus->otg.gadget && pdata->disconnect_on_suspend) {
+ /* optionally disable D+ pullup */
+ if (gpio_is_valid(pdata->gpio_pullup))
+ gpio_set_value(pdata->gpio_pullup,
+ pdata->gpio_pullup_inverted);
+
+ set_vbus_draw(gpio_vbus, 0);
+ }
+ return 0;
+}
+
+static int gpio_vbus_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev);
+
+ if (gpio_vbus->otg.gadget)
+ schedule_work(&gpio_vbus->work);
+
+ return 0;
+}
+static const struct dev_pm_ops gpio_vbus_pm_ops = {
+ .suspend_noirq = gpio_vbus_suspend,
+ .resume_noirq = gpio_vbus_resume,
+ .freeze_noirq = gpio_vbus_suspend,
+ .thaw_noirq = gpio_vbus_resume,
+ .poweroff_noirq = gpio_vbus_suspend,
+ .restore_noirq = gpio_vbus_resume,
+};
+#define GPIO_VBUS_PM_OPS &gpio_vbus_pm_ops
+#else
+#define GPIO_VBUS_PM_OPS NULL
+#endif
+
/* NOTE: the gpio-vbus device may *NOT* be hotplugged */
MODULE_ALIAS("platform:gpio-vbus");
@@ -335,6 +376,7 @@ static struct platform_driver gpio_vbus_driver = {
.driver = {
.name = "gpio-vbus",
.owner = THIS_MODULE,
+ .pm = GPIO_VBUS_PM_OPS,
},
.remove = __exit_p(gpio_vbus_remove),
};
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
index d9f03cc..2faa38d 100644
--- a/include/linux/usb/gpio_vbus.h
+++ b/include/linux/usb/gpio_vbus.h
@@ -27,4 +27,5 @@ struct gpio_vbus_mach_info {
int gpio_pullup;
bool gpio_vbus_inverted;
bool gpio_pullup_inverted;
+ bool disconnect_on_suspend;
};
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V3 2/2] mioa701: move gpio-pullup functionality to gpio-vbus
2011-07-03 22:45 [PATCH V3 0/2] Suspend for gpio-vbus Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 1/2] gpio-vbus: support disabling D+ pullup on suspend Dmitry Eremin-Solenikov
@ 2011-07-03 22:45 ` Dmitry Eremin-Solenikov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Eremin-Solenikov @ 2011-07-03 22:45 UTC (permalink / raw)
To: linux-arm-kernel
gpio-vbus can (and should?) handle D+ pullup gpio for us. Move
gpio-pullup handling to gpio-vbus and stop providing udc_info as it's
empty now. Also tell gpio-vbus that it should disable D+ pullup on
suspend, as did pxa27x_udc driver.
Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
---
arch/arm/mach-pxa/mioa701.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index bcbd359..2039a53 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -402,14 +402,11 @@ static void gsm_exit(void)
/*
* USB UDC
*/
-static struct pxa2xx_udc_mach_info mioa701_udc_info = {
- .gpio_pullup = GPIO22_USB_ENABLE,
-};
-
struct gpio_vbus_mach_info gpio_vbus_data = {
.gpio_vbus = GPIO13_nUSB_DETECT,
.gpio_vbus_inverted = 1,
- .gpio_pullup = -1,
+ .gpio_pullup = GPIO22_USB_ENABLE,
+ .disconnect_on_suspend = 1,
};
/*
@@ -770,7 +767,6 @@ static void __init mioa701_machine_init(void)
pxa_set_fb_info(NULL, &mioa701_pxafb_info);
pxa_set_mci_info(&mioa701_mci_info);
pxa_set_keypad_info(&mioa701_keypad_info);
- pxa_set_udc_info(&mioa701_udc_info);
pxa_set_ac97_info(&mioa701_ac97_info);
pm_power_off = mioa701_poweroff;
arm_pm_restart = mioa701_restart;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-07-03 22:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-03 22:45 [PATCH V3 0/2] Suspend for gpio-vbus Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 1/2] gpio-vbus: support disabling D+ pullup on suspend Dmitry Eremin-Solenikov
2011-07-03 22:45 ` [PATCH V3 2/2] mioa701: move gpio-pullup functionality to gpio-vbus Dmitry Eremin-Solenikov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.