mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
phy: phy-rockchip-inno-usb2: add force IRQ wakeup control
Some chips like rk3328 not support wakeup-config in dts, So we should set wakeup IRQ enable in driver if we need new wakeup source. Change-Id: I735eee54bb4943b8c85a9a477f1cf9d255fc4312 Signed-off-by: Zain Wang <wzz@rock-chips.com>
This commit is contained in:
@@ -1895,6 +1895,11 @@ next_child:
|
||||
goto put_child;
|
||||
}
|
||||
|
||||
if (of_property_read_bool(np, "wakeup-source"))
|
||||
device_init_wakeup(rphy->dev, true);
|
||||
else
|
||||
device_init_wakeup(rphy->dev, false);
|
||||
|
||||
return 0;
|
||||
|
||||
put_child:
|
||||
@@ -2114,6 +2119,10 @@ static int rockchip_usb2phy_pm_suspend(struct device *dev)
|
||||
struct rockchip_usb2phy_port *rport;
|
||||
unsigned int index;
|
||||
int ret = 0;
|
||||
bool wakeup_enable = false;
|
||||
|
||||
if (device_may_wakeup(rphy->dev))
|
||||
wakeup_enable = true;
|
||||
|
||||
for (index = 0; index < rphy->phy_cfg->num_ports; index++) {
|
||||
rport = &rphy->ports[index];
|
||||
@@ -2135,6 +2144,10 @@ static int rockchip_usb2phy_pm_suspend(struct device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (rport->port_id == USB2PHY_PORT_OTG && wakeup_enable &&
|
||||
rport->bvalid_irq > 0)
|
||||
enable_irq_wake(rport->bvalid_irq);
|
||||
|
||||
/* activate the linestate to detect the next interrupt. */
|
||||
mutex_lock(&rport->mutex);
|
||||
ret = rockchip_usb2phy_enable_line_irq(rphy, rport, true);
|
||||
@@ -2144,6 +2157,9 @@ static int rockchip_usb2phy_pm_suspend(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (wakeup_enable && rport->ls_irq > 0)
|
||||
enable_irq_wake(rport->ls_irq);
|
||||
|
||||
/* enter low power state */
|
||||
rockchip_usb2phy_low_power_enable(rphy, rport, true);
|
||||
}
|
||||
@@ -2158,6 +2174,10 @@ static int rockchip_usb2phy_pm_resume(struct device *dev)
|
||||
unsigned int index;
|
||||
bool iddig;
|
||||
int ret = 0;
|
||||
bool wakeup_enable = false;
|
||||
|
||||
if (device_may_wakeup(rphy->dev))
|
||||
wakeup_enable = true;
|
||||
|
||||
if (rphy->phy_cfg->phy_tuning)
|
||||
ret = rphy->phy_cfg->phy_tuning(rphy);
|
||||
@@ -2197,6 +2217,13 @@ static int rockchip_usb2phy_pm_resume(struct device *dev)
|
||||
}
|
||||
}
|
||||
|
||||
if (rport->port_id == USB2PHY_PORT_OTG && wakeup_enable &&
|
||||
rport->bvalid_irq > 0)
|
||||
disable_irq_wake(rport->bvalid_irq);
|
||||
|
||||
if (wakeup_enable && rport->ls_irq > 0)
|
||||
disable_irq_wake(rport->ls_irq);
|
||||
|
||||
/* exit low power state */
|
||||
rockchip_usb2phy_low_power_enable(rphy, rport, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user