* [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c
@ 2009-02-25 11:55 Kim Kyuwon
2009-02-25 11:44 ` Felipe Balbi
[not found] ` <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 2 replies; 5+ messages in thread
From: Kim Kyuwon @ 2009-02-25 11:55 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA
Cc: OMAP, David Brownell, me-uiRdBs8odbtmTBlB0Cgj/Q,
q1.kim-Sze3O3UU22JBDgjK7y7TUQ, Minkyu Kang
From: Minkyu Kang <mk7.kang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
The MPU module can be waked up by the unexpected USB
interrupt(HSUSB_MC_NINT). For instance, if the MUSB is working as
peripheral mode and connected to a host PC, it can never enter the low
power mode due to interrupts from the host PC. This patch added the
feature that a board specific file can determines that TWL4030
supplies the USB power or not in the low power mode. Disabling the USB
power may save the power consumption.
Signed-off-by: Minkyu Kang <mk7.kang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Kim Kyuwon <chammoru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/usb/otg/twl4030-usb.c | 25 +++++++++++++++++++++++++
include/linux/i2c/twl4030.h | 1 +
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 416e441..0d65a8d 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -256,6 +256,7 @@ struct twl4030_usb {
u8 linkstat;
u8 asleep;
bool irq_enabled;
+ bool suspend_enabled;
};
/* internal define on top of container_of */
@@ -618,6 +619,7 @@ static int __init twl4030_usb_probe(struct
platform_device *pdev)
twl->otg.set_suspend = twl4030_set_suspend;
twl->usb_mode = pdata->usb_mode;
twl->asleep = 1;
+ twl->suspend_enabled = pdata->suspend_enabled;
/* init spinlock for workqueue */
spin_lock_init(&twl->lock);
@@ -694,9 +696,32 @@ static int __exit twl4030_usb_remove(struct
platform_device *pdev)
return 0;
}
+int twl4030_usb_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ if (!twl->suspend_enabled)
+ return 0;
+
+ twl->otg.set_suspend(&twl->otg, 1);
+
+ return 0;
+}
+
+int twl4030_usb_resume(struct platform_device *pdev)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ twl->otg.set_suspend(&twl->otg, 0);
+
+ return 0;
+}
+
static struct platform_driver twl4030_usb_driver = {
.probe = twl4030_usb_probe,
.remove = __exit_p(twl4030_usb_remove),
+ .suspend = twl4030_usb_suspend,
+ .resume = twl4030_usb_resume,
.driver = {
.name = "twl4030_usb",
.owner = THIS_MODULE,
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index c89d33b..0b12509 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -325,6 +325,7 @@ enum twl4030_usb_mode {
struct twl4030_usb_data {
enum twl4030_usb_mode usb_mode;
+ bool suspend_enabled;
};
struct twl4030_ins {
--
1.5.2.5
--
Kyuwon
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c
2009-02-25 11:55 [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c Kim Kyuwon
@ 2009-02-25 11:44 ` Felipe Balbi
[not found] ` <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2009-02-25 11:44 UTC (permalink / raw)
To: ext Kim Kyuwon
Cc: linux-usb@vger.kernel.org, OMAP, David Brownell,
me@felipebalbi.com, q1.kim@samsung.com, Minkyu Kang
On Wed, Feb 25, 2009 at 12:55:41PM +0100, ext Kim Kyuwon wrote:
> +int twl4030_usb_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> + struct twl4030_usb *twl = platform_get_drvdata(pdev);
> +
> + if (!twl->suspend_enabled)
> + return 0;
> +
> + twl->otg.set_suspend(&twl->otg, 1);
otg_set_suspend(otg, 1);
> +
> + return 0;
> +}
> +
> +int twl4030_usb_resume(struct platform_device *pdev)
> +{
> + struct twl4030_usb *twl = platform_get_drvdata(pdev);
> +
> + twl->otg.set_suspend(&twl->otg, 0);
otg_set_suspend(otg, 0);
--
balbi
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c (re)
[not found] ` <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-02-25 23:54 ` Minkyu Kang
[not found] ` <49A5DA3E.6040608-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Minkyu Kang @ 2009-02-25 23:54 UTC (permalink / raw)
To: Kim Kyuwon, me-uiRdBs8odbtmTBlB0Cgj/Q
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, OMAP, David Brownell,
q1.kim-Sze3O3UU22JBDgjK7y7TUQ
The MPU module can be waked up by the unexpected USB
interrupt(HSUSB_MC_NINT). For instance, if the MUSB is working as
peripheral mode and connected to a host PC, it can never enter the low
power mode due to interrupts from the host PC. This patch added the
feature that a board specific file can determines that TWL4030
supplies the USB power or not in the low power mode. Disabling the USB
power may save the power consumption.
Signed-off-by: Minkyu Kang <mk7.kang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Kim Kyuwon <chammoru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/usb/otg/twl4030-usb.c | 25 +++++++++++++++++++++++++
include/linux/i2c/twl4030.h | 1 +
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 416e441..b725be2 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -256,6 +256,7 @@ struct twl4030_usb {
u8 linkstat;
u8 asleep;
bool irq_enabled;
+ bool suspend_enabled;
};
/* internal define on top of container_of */
@@ -618,6 +619,7 @@ static int __init twl4030_usb_probe(struct platform_device *pdev)
twl->otg.set_suspend = twl4030_set_suspend;
twl->usb_mode = pdata->usb_mode;
twl->asleep = 1;
+ twl->suspend_enabled = pdata->suspend_enabled;
/* init spinlock for workqueue */
spin_lock_init(&twl->lock);
@@ -694,9 +696,32 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev)
return 0;
}
+int twl4030_usb_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ if (!twl->suspend_enabled)
+ return 0;
+
+ otg_set_suspend(&twl->otg, 1);
+
+ return 0;
+}
+
+int twl4030_usb_resume(struct platform_device *pdev)
+{
+ struct twl4030_usb *twl = platform_get_drvdata(pdev);
+
+ otg_set_suspend(&twl->otg, 0);
+
+ return 0;
+}
+
static struct platform_driver twl4030_usb_driver = {
.probe = twl4030_usb_probe,
.remove = __exit_p(twl4030_usb_remove),
+ .suspend = twl4030_usb_suspend,
+ .resume = twl4030_usb_resume,
.driver = {
.name = "twl4030_usb",
.owner = THIS_MODULE,
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index c89d33b..0b12509 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -325,6 +325,7 @@ enum twl4030_usb_mode {
struct twl4030_usb_data {
enum twl4030_usb_mode usb_mode;
+ bool suspend_enabled;
};
struct twl4030_ins {
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-26 1:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-25 11:55 [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c Kim Kyuwon
2009-02-25 11:44 ` Felipe Balbi
[not found] ` <4d34a0a70902250355q4b8c54e4rc9bbc1f40539e486-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-02-25 23:54 ` [PATCH 2/2] twl: usb: Add the resume() and suspend() methods to twl4030-usb.c (re) Minkyu Kang
[not found] ` <49A5DA3E.6040608-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2009-02-26 0:12 ` Felipe Balbi
2009-02-26 1:33 ` Kang, Minkyu
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.