1 --- kernel-power/drivers/usb/musb/musb_core.h 2012-05-22 23:46:25.063372234 +0200
2 +++ kernel-power/drivers/usb/musb/musb_core.h 2012-05-22 23:58:04.727351773 +0200
3 @@ -431,6 +431,8 @@ struct musb {
5 unsigned power_draw; /* current power draw, gadget only */
7 + const char *hostdevice; /* type of usb host device */
11 int a_wait_bcon; /* VBUS timeout in msecs */
12 --- kernel-power/drivers/usb/musb/musb_core.c 2012-05-22 23:36:45.795389167 +0200
13 +++ kernel-power/drivers/usb/musb/musb_core.c 2012-05-22 23:56:42.415354180 +0200
14 @@ -1978,6 +1978,15 @@ musb_amp_show(struct device *dev, struct
15 static DEVICE_ATTR(mA, 0444, musb_amp_show, NULL);
18 +musb_hostdevice_show(struct device *dev, struct device_attribute *attr, char *buf)
20 + struct musb *musb = dev_to_musb(dev);
22 + return sprintf(buf, "%s\n", musb->hostdevice);
24 +static DEVICE_ATTR(hostdevice, 0444, musb_hostdevice_show, NULL);
27 musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
29 struct musb *musb = dev_to_musb(dev);
30 @@ -2060,6 +2069,8 @@ musb_mode_store(struct device *dev, stru
32 mutex_unlock(&musb->mutex);
34 + musb->hostdevice = "none";
35 + sysfs_notify(&musb->controller->kobj, NULL, "hostdevice");
36 sysfs_notify(&musb->controller->kobj, NULL, "mode");
37 schedule_work(&musb->irq_work);
39 @@ -2154,6 +2165,8 @@ static void musb_irq_work(struct work_st
41 if (musb->xceiv->state != old_state) {
42 old_state = musb->xceiv->state;
43 + musb->hostdevice = "none";
44 + sysfs_notify(&musb->controller->kobj, NULL, "hostdevice");
45 sysfs_notify(&musb->controller->kobj, NULL, "mode");
47 if (musb->power_draw != old_ma) {
48 @@ -2240,6 +2240,7 @@ static void musb_free(struct musb *musb)
49 device_remove_file(musb->controller, &dev_attr_mA);
50 device_remove_file(musb->controller, &dev_attr_connect);
51 device_remove_file(musb->controller, &dev_attr_charger);
52 + device_remove_file(musb->controller, &dev_attr_hostdevice);
53 device_remove_file(musb->controller, &dev_attr_mode);
54 device_remove_file(musb->controller, &dev_attr_vbus);
55 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
56 @@ -2346,6 +2346,7 @@ bad_config:
57 musb->set_clock = plat->set_clock;
58 musb->min_power = plat->min_power;
59 musb->use_dma = use_dma;
60 + musb->hostdevice = "none";
62 /* Clock usage is chip-specific ... functional clock (DaVinci,
63 * OMAP2430), or PHY ref (some TUSB6010 boards). All this core
64 @@ -2486,6 +2487,7 @@ bad_config:
65 status = device_create_file(dev, &dev_attr_mA);
66 status = device_create_file(dev, &dev_attr_connect);
67 status = device_create_file(dev, &dev_attr_charger);
68 + status = device_create_file(dev, &dev_attr_hostdevice);
69 status = device_create_file(dev, &dev_attr_mode);
70 status = device_create_file(dev, &dev_attr_vbus);
71 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
72 @@ -2510,6 +2512,7 @@ fail2:
73 device_remove_file(dev, &dev_attr_mA);
74 device_remove_file(dev, &dev_attr_connect);
75 device_remove_file(dev, &dev_attr_charger);
76 + device_remove_file(dev, &dev_attr_hostdevice);
77 device_remove_file(musb->controller, &dev_attr_mode);
78 device_remove_file(musb->controller, &dev_attr_vbus);
79 #ifdef CONFIG_USB_GADGET_MUSB_HDRC
80 --- kernel-power/drivers/usb/musb/musb_procfs.c 2012-05-22 23:35:43.767390980 +0200
81 +++ kernel-power/drivers/usb/musb/musb_procfs.c 2012-05-22 23:57:28.355352837 +0200
82 @@ -692,13 +692,16 @@ static int musb_proc_write(struct file *
83 case 1: /* pullup indicates a full/high-speed device */
84 if (!(testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS)))
85 pr_err("Forced hostmode error: a full/high-speed device attached but low-speed mode selected\n");
86 + musb->hostdevice = "full/high";
88 case 2: /* pullup indicates a low-speed device */
89 if (testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS))
90 pr_err("Forced hostmode error: a low-speed device attached but full/high-speed mode selected\n");
91 + musb->hostdevice = "low";
94 pr_err("Forced hostmode error: no device attached\n");
95 + musb->hostdevice = "none";
98 if (!(testmode & (MUSB_TEST_FORCE_FS | MUSB_TEST_FORCE_HS)))
99 @@ -721,6 +724,7 @@ static int musb_proc_write(struct file *
100 DBG(1, "CONNECT (%s) devctl %02x\n",
101 otg_state_string(musb), devctl);
103 + sysfs_notify(&musb->controller->kobj, NULL, "hostdevice");
104 sysfs_notify(&musb->controller->kobj, NULL, "mode");
105 schedule_work(&musb->irq_work);
107 --- kernel-power/drivers/usb/musb/musb_virthub.c 2012-05-22 23:53:44.471359383 +0200
108 +++ kernel-power/drivers/usb/musb/musb_virthub.c 2012-05-22 23:57:34.791352649 +0200
109 @@ -169,10 +169,13 @@ static void musb_port_reset(struct musb
110 musb->port1_status |= USB_PORT_STAT_HIGH_SPEED;
111 if (!(testmode & MUSB_TEST_FORCE_HS))
112 pr_err("Forced hostmode error: a high-speed device attached but not high-speed mode selected\n");
113 + musb->hostdevice = "high";
115 if (testmode & MUSB_TEST_FORCE_HS)
116 pr_err("Forced hostmode error: a full/low-speed device attached but high-speed mode selected\n");
117 + musb->hostdevice = "full/low";
119 + sysfs_notify(&musb->controller->kobj, NULL, "hostdevice");
121 musb->port1_status &= ~USB_PORT_STAT_RESET;
122 musb->port1_status |= USB_PORT_STAT_ENABLE