Commit 6e267da8 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Greg Kroah-Hartman

usb: renesas_usbhs: add power control function

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 206dcc2c
...@@ -148,7 +148,31 @@ static u32 usbhsc_default_pipe_type[] = { ...@@ -148,7 +148,31 @@ static u32 usbhsc_default_pipe_type[] = {
}; };
/* /*
* driver callback functions * power control
*/
static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
{
struct device *dev = usbhs_priv_to_dev(priv);
if (enable) {
/* enable PM */
pm_runtime_get_sync(dev);
/* USB on */
usbhs_sys_clock_ctrl(priv, enable);
usbhsc_bus_ctrl(priv, enable);
} else {
/* USB off */
usbhsc_bus_ctrl(priv, enable);
usbhs_sys_clock_ctrl(priv, enable);
/* disable PM */
pm_runtime_put_sync(dev);
}
}
/*
* notify hotplug
*/ */
static void usbhsc_notify_hotplug(struct work_struct *work) static void usbhsc_notify_hotplug(struct work_struct *work)
{ {
...@@ -178,12 +202,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work) ...@@ -178,12 +202,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
dev_dbg(&pdev->dev, "%s enable\n", __func__); dev_dbg(&pdev->dev, "%s enable\n", __func__);
/* enable PM */ /* power on */
pm_runtime_get_sync(&pdev->dev); usbhsc_power_ctrl(priv, enable);
/* USB on */
usbhs_sys_clock_ctrl(priv, enable);
usbhsc_bus_ctrl(priv, enable);
/* module start */ /* module start */
usbhs_mod_call(priv, start, priv); usbhs_mod_call(priv, start, priv);
...@@ -194,12 +214,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work) ...@@ -194,12 +214,8 @@ static void usbhsc_notify_hotplug(struct work_struct *work)
/* module stop */ /* module stop */
usbhs_mod_call(priv, stop, priv); usbhs_mod_call(priv, stop, priv);
/* USB off */ /* power off */
usbhsc_bus_ctrl(priv, enable); usbhsc_power_ctrl(priv, enable);
usbhs_sys_clock_ctrl(priv, enable);
/* disable PM */
pm_runtime_put_sync(&pdev->dev);
usbhs_mod_change(priv, -1); usbhs_mod_change(priv, -1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment