aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-04-28 03:41:02 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-29 20:24:34 -0400
commit6e267da8f10b1a6551b6c4dee3779f6f56e2644d (patch)
treefeade70626460e60bad6db5dd11bc82a06d83964 /drivers/usb/renesas_usbhs
parent206dcc2cfe15b6174f15293ae15a097ee03eb386 (diff)
usb: renesas_usbhs: add power control function
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/common.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 53be4443b5ed..db13cef9effe 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -148,7 +148,31 @@ static u32 usbhsc_default_pipe_type[] = {
148}; 148};
149 149
150/* 150/*
151 * driver callback functions 151 * power control
152 */
153static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
154{
155 struct device *dev = usbhs_priv_to_dev(priv);
156
157 if (enable) {
158 /* enable PM */
159 pm_runtime_get_sync(dev);
160
161 /* USB on */
162 usbhs_sys_clock_ctrl(priv, enable);
163 usbhsc_bus_ctrl(priv, enable);
164 } else {
165 /* USB off */
166 usbhsc_bus_ctrl(priv, enable);
167 usbhs_sys_clock_ctrl(priv, enable);
168
169 /* disable PM */
170 pm_runtime_put_sync(dev);
171 }
172}
173
174/*
175 * notify hotplug
152 */ 176 */
153static void usbhsc_notify_hotplug(struct work_struct *work) 177static void usbhsc_notify_hotplug(struct work_struct *work)
154{ 178{
@@ -178,12 +202,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
178 202
179 dev_dbg(&pdev->dev, "%s enable\n", __func__); 203 dev_dbg(&pdev->dev, "%s enable\n", __func__);
180 204
181 /* enable PM */ 205 /* power on */
182 pm_runtime_get_sync(&pdev->dev); 206 usbhsc_power_ctrl(priv, enable);
183
184 /* USB on */
185 usbhs_sys_clock_ctrl(priv, enable);
186 usbhsc_bus_ctrl(priv, enable);
187 207
188 /* module start */ 208 /* module start */
189 usbhs_mod_call(priv, start, priv); 209 usbhs_mod_call(priv, start, priv);
@@ -194,12 +214,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
194 /* module stop */ 214 /* module stop */
195 usbhs_mod_call(priv, stop, priv); 215 usbhs_mod_call(priv, stop, priv);
196 216
197 /* USB off */ 217 /* power off */
198 usbhsc_bus_ctrl(priv, enable); 218 usbhsc_power_ctrl(priv, enable);
199 usbhs_sys_clock_ctrl(priv, enable);
200
201 /* disable PM */
202 pm_runtime_put_sync(&pdev->dev);
203 219
204 usbhs_mod_change(priv, -1); 220 usbhs_mod_change(priv, -1);
205 221