{
struct musb *musb = hcd_to_musb(hcd);
- if (is_host_active(musb) && musb->is_active)
+ if (is_host_active(musb) && musb->is_active) {
+ WARN("trying to suspend as %s is_active=%i\n",
+ otg_state_string(musb), musb->is_active);
return -EBUSY;
- else
+ } else
return 0;
}
case OTG_STATE_A_HOST:
case OTG_STATE_A_SUSPEND:
musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
+ musb->is_active = 0;
break;
case OTG_STATE_A_WAIT_VFALL:
musb->xceiv.state = OTG_STATE_B_IDLE;
DBG(4, "Nothing connected %s, turning off VBUS\n",
otg_state_string(musb));
tusb_source_power(musb, 0);
- musb->xceiv.state = OTG_STATE_A_IDLE;
+ musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
musb->is_active = 0;
}
break;
if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) {
switch (musb->xceiv.state) {
case OTG_STATE_A_WAIT_VFALL:
- musb->is_active = 1;
break;
case OTG_STATE_A_WAIT_VRISE:
- musb->is_active = 1;
musb->xceiv.state = OTG_STATE_A_WAIT_VFALL;
break;
default:
- musb->is_active = 0;
musb->xceiv.state = OTG_STATE_A_IDLE;
}
+ musb->is_active = 0;
musb->xceiv.default_a = 1;
MUSB_HST_MODE(musb);
} else {
break;
}
musb->xceiv.state = OTG_STATE_A_WAIT_BCON;
- /* CONNECT can wake if a_wait_bcon is set */
- if (musb->a_wait_bcon != 0)
- musb->is_active = 0;
- else
- musb->is_active = 1;
+ musb->is_active = 0;
idle_timeout = jiffies
+ msecs_to_jiffies(musb->a_wait_bcon);
} else {