mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
usb: musb: Simplify cable state handling
Simplify cable state handling a bit to leave out duplicated code. We are just scheduling work and showing state info if a recheck is needed. No intended functional changes. Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Andreas Kemnade <andreas@kemnade.info> Cc: Bhushan Shah <bshah@kde.org> Cc: Drew Fustini <drew@beagleboard.org> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20210604080536.12185-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
37fdb7c90f
commit
e2ff8815f3
1 changed files with 20 additions and 20 deletions
|
@ -1984,6 +1984,20 @@ ATTRIBUTE_GROUPS(musb);
|
||||||
#define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \
|
#define MUSB_QUIRK_A_DISCONNECT_19 ((3 << MUSB_DEVCTL_VBUS_SHIFT) | \
|
||||||
MUSB_DEVCTL_SESSION)
|
MUSB_DEVCTL_SESSION)
|
||||||
|
|
||||||
|
static bool musb_state_needs_recheck(struct musb *musb, const char *desc)
|
||||||
|
{
|
||||||
|
if (musb->quirk_retries && !musb->flush_irq_work) {
|
||||||
|
musb_dbg(musb, desc);
|
||||||
|
schedule_delayed_work(&musb->irq_work,
|
||||||
|
msecs_to_jiffies(1000));
|
||||||
|
musb->quirk_retries--;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check the musb devctl session bit to determine if we want to
|
* Check the musb devctl session bit to determine if we want to
|
||||||
* allow PM runtime for the device. In general, we want to keep things
|
* allow PM runtime for the device. In general, we want to keep things
|
||||||
|
@ -2004,32 +2018,18 @@ static void musb_pm_runtime_check_session(struct musb *musb)
|
||||||
MUSB_DEVCTL_HR;
|
MUSB_DEVCTL_HR;
|
||||||
switch (devctl & ~s) {
|
switch (devctl & ~s) {
|
||||||
case MUSB_QUIRK_B_DISCONNECT_99:
|
case MUSB_QUIRK_B_DISCONNECT_99:
|
||||||
if (musb->quirk_retries && !musb->flush_irq_work) {
|
musb_state_needs_recheck(musb,
|
||||||
musb_dbg(musb, "Poll devctl in case of suspend after disconnect\n");
|
"Poll devctl in case of suspend after disconnect\n");
|
||||||
schedule_delayed_work(&musb->irq_work,
|
|
||||||
msecs_to_jiffies(1000));
|
|
||||||
musb->quirk_retries--;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case MUSB_QUIRK_B_INVALID_VBUS_91:
|
case MUSB_QUIRK_B_INVALID_VBUS_91:
|
||||||
if (musb->quirk_retries && !musb->flush_irq_work) {
|
if (musb_state_needs_recheck(musb,
|
||||||
musb_dbg(musb,
|
"Poll devctl on invalid vbus, assume no session"))
|
||||||
"Poll devctl on invalid vbus, assume no session");
|
|
||||||
schedule_delayed_work(&musb->irq_work,
|
|
||||||
msecs_to_jiffies(1000));
|
|
||||||
musb->quirk_retries--;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case MUSB_QUIRK_A_DISCONNECT_19:
|
case MUSB_QUIRK_A_DISCONNECT_19:
|
||||||
if (musb->quirk_retries && !musb->flush_irq_work) {
|
if (musb_state_needs_recheck(musb,
|
||||||
musb_dbg(musb,
|
"Poll devctl on possible host mode disconnect"))
|
||||||
"Poll devctl on possible host mode disconnect");
|
|
||||||
schedule_delayed_work(&musb->irq_work,
|
|
||||||
msecs_to_jiffies(1000));
|
|
||||||
musb->quirk_retries--;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (!musb->session)
|
if (!musb->session)
|
||||||
break;
|
break;
|
||||||
musb_dbg(musb, "Allow PM on possible host mode disconnect");
|
musb_dbg(musb, "Allow PM on possible host mode disconnect");
|
||||||
|
|
Loading…
Reference in a new issue