Search
SailfishOS Open Build Service
>
Projects
>
home:dcthang:branches:nemo:devel:hw:ti:omap3:n900
>
kernel-adaptation-n900
> linux-2.6-usb-musb-add-suspend-sysfs-entry.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File linux-2.6-usb-musb-add-suspend-sysfs-entry.patch of Package kernel-adaptation-n900
From b5f866b4991a0bd6f3ef2e237930c4e69cdee943 Mon Sep 17 00:00:00 2001 From: Ameya Palande <ameya.palande@nokia.com> Date: Fri, 9 Apr 2010 19:00:02 +0300 Subject: [PATCH 02/42] usb: musb: add suspend sysfs entry This patch is combination of following patches: 1. usb: musb: suspend notification only when needed 2. usb: musb: Notify sysfs on suspend 3. usb: musb: fix build with MUSB Host only mode Signed-off-by: Niilo Minkkinen <ext-niilo.1.minkkinen@nokia.com> Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@nokia.com> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com> Signed-off-by: Jouni Hogander <jouni.hogander@nokia.com> Signed-off-by: Ameya Palande <ameya.palande@nokia.com> --- drivers/usb/musb/musb_core.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 6ee2ba1..16ce100 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1824,6 +1824,15 @@ static DEVICE_ATTR(charger, 0444, musb_charger_show, NULL); #ifdef CONFIG_USB_GADGET_MUSB_HDRC +static ssize_t +musb_suspend_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct musb *musb = dev_to_musb(dev); + + return sprintf(buf, "%d\n", musb->is_suspended); +} +static DEVICE_ATTR(suspend, 0444, musb_suspend_show, NULL); + /* Gadget drivers can't know that a host is connected so they might want * to start SRP, but users can. This allows userspace to trigger SRP. */ @@ -1855,6 +1864,7 @@ static struct attribute *musb_attributes[] = { &dev_attr_mA.attr, &dev_attr_charger.attr, #ifdef CONFIG_USB_GADGET_MUSB_HDRC + &dev_attr_suspend.attr, &dev_attr_srp.attr, #endif NULL @@ -1870,7 +1880,7 @@ static const struct attribute_group musb_attr_group = { static void musb_irq_work(struct work_struct *data) { struct musb *musb = container_of(data, struct musb, irq_work); - static int old_state; + static int old_state, old_suspend; static int old_power_draw; if (musb->xceiv->state != old_state) { @@ -1882,6 +1892,12 @@ static void musb_irq_work(struct work_struct *data) old_power_draw = musb->power_draw; sysfs_notify(&musb->controller->kobj, NULL, "mA"); } +#ifdef CONFIG_USB_GADGET_MUSB_HDRC + if (old_suspend != musb->is_suspended) { + old_suspend = musb->is_suspended; + sysfs_notify(&musb->controller->kobj, NULL, "suspend"); + } +#endif } /* -------------------------------------------------------------------------- -- 1.7.0.4