usb:langwell_udc: fix pullup issue
BZ: 32720
Pullup shouldn't be connected/disconnected if dev->stopped is set which indicates interrupt
is not enabled and the controller maybe in a low power state.
Pullup should be connected if and only if the condition
dev->driver && dev->softconnected && dev->vbus_active && !dev->stopped is true.
dev->driver && dev->softconnected indicates the gadget want to connect pullup and
dev->vbus_active && !dev->stopped indicates uB is plugged in, in which state
vbus is active and controller is powered in device mode.
One related issue is in intel_mid_start_peripheral, pullup can be connected even
dev->softconnected is 0.
Solution:
1. add langwell_udc_pullup() to manage pullup connection/disconnection.
2. Check dev->stopped in langwell_udc_pullup(). If it's set, do nothing.
3. Check condition "dev->driver && dev->softconnected && dev->vbus_active && !dev->stopped"
in langwell_udc_pullup() before connecting pullup.
4. Every time when dev->driver/dev->softconnected/dev->vbus_active/dev->stopped changes,
langwell_udc_pullup should be called to connect pullup whenever is possible or disconnect
if necessary.
Signed-off-by: jzhuan5 <jin.can.zhuang@intel.com>
Change-Id: Idf4ba0a6ab200c66484146c0047073dbb98896bd
Reviewed-on: http://android.intel.com:8080/43514
Reviewed-by: Zhuang, Jin Can <jin.can.zhuang@intel.com>
Reviewed-by: Meng, Zhe <zhe.meng@intel.com>
Tested-by: Meng, Zhe <zhe.meng@intel.com>
Reviewed-by: Tang, Richard <richard.tang@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>