mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
UPSTREAM: usb: dwc3: fix gadget mode suspend interrupt handler issue
[ Upstream commit4e8ef34e36] When work in gadget mode, currently driver doesn't update software level link_state correctly as link state change event is not enabled for most devices, in function dwc3_gadget_suspend_interrupt(), it will only pass suspend event to UDC core when software level link state changes, so when interrupt generated in sequences of suspend -> reset -> conndone -> suspend, link state is not updated during reset and conndone, so second suspend interrupt event will not pass to UDC core. Remove link_state compare in dwc3_gadget_suspend_interrupt() and add a suspended flag to replace the compare function. Fixes:799e9dc829("usb: dwc3: gadget: conditionally disable Link State change events") Cc: stable <stable@kernel.org> Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Change-Id: I05d2c6814aaca6ac9bb61298ca49341dc5b7d155 Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> Link: https://lore.kernel.org/r/20230512004524.31950-1-quic_linyyuan@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commitf191711553) Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
b03d86bd51
commit
bc4e0df357
@@ -1105,6 +1105,7 @@ struct dwc3_scratchpad_array {
|
|||||||
* 3 - Reserved
|
* 3 - Reserved
|
||||||
* @dis_metastability_quirk: set to disable metastability quirk.
|
* @dis_metastability_quirk: set to disable metastability quirk.
|
||||||
* @dis_split_quirk: set to disable split boundary.
|
* @dis_split_quirk: set to disable split boundary.
|
||||||
|
* @suspended: set to track suspend event due to U3/L2.
|
||||||
* @imod_interval: set the interrupt moderation interval in 250ns
|
* @imod_interval: set the interrupt moderation interval in 250ns
|
||||||
* increments or 0 to disable.
|
* increments or 0 to disable.
|
||||||
* @max_cfg_eps: current max number of IN eps used across all USB configs.
|
* @max_cfg_eps: current max number of IN eps used across all USB configs.
|
||||||
@@ -1318,6 +1319,7 @@ struct dwc3 {
|
|||||||
|
|
||||||
unsigned dis_split_quirk:1;
|
unsigned dis_split_quirk:1;
|
||||||
unsigned async_callbacks:1;
|
unsigned async_callbacks:1;
|
||||||
|
unsigned suspended:1;
|
||||||
|
|
||||||
u16 imod_interval;
|
u16 imod_interval;
|
||||||
|
|
||||||
|
|||||||
@@ -3708,6 +3708,8 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
|
|||||||
{
|
{
|
||||||
int reg;
|
int reg;
|
||||||
|
|
||||||
|
dwc->suspended = false;
|
||||||
|
|
||||||
dwc3_gadget_set_link_state(dwc, DWC3_LINK_STATE_RX_DET);
|
dwc3_gadget_set_link_state(dwc, DWC3_LINK_STATE_RX_DET);
|
||||||
|
|
||||||
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
reg = dwc3_readl(dwc->regs, DWC3_DCTL);
|
||||||
@@ -3728,6 +3730,8 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
|
|||||||
{
|
{
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
||||||
|
dwc->suspended = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ideally, dwc3_reset_gadget() would trigger the function
|
* Ideally, dwc3_reset_gadget() would trigger the function
|
||||||
* drivers to stop any active transfers through ep disable.
|
* drivers to stop any active transfers through ep disable.
|
||||||
@@ -3954,6 +3958,8 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
|
|||||||
|
|
||||||
static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc)
|
static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc)
|
||||||
{
|
{
|
||||||
|
dwc->suspended = false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO take core out of low power mode when that's
|
* TODO take core out of low power mode when that's
|
||||||
* implemented.
|
* implemented.
|
||||||
@@ -4069,8 +4075,10 @@ static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc,
|
|||||||
{
|
{
|
||||||
enum dwc3_link_state next = evtinfo & DWC3_LINK_STATE_MASK;
|
enum dwc3_link_state next = evtinfo & DWC3_LINK_STATE_MASK;
|
||||||
|
|
||||||
if (dwc->link_state != next && next == DWC3_LINK_STATE_U3)
|
if (!dwc->suspended && next == DWC3_LINK_STATE_U3) {
|
||||||
|
dwc->suspended = true;
|
||||||
dwc3_suspend_gadget(dwc);
|
dwc3_suspend_gadget(dwc);
|
||||||
|
}
|
||||||
|
|
||||||
dwc->link_state = next;
|
dwc->link_state = next;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user