MLK-10132-3 usb: chipidea: udc: do not enter low power mode if vbus on
authorLi Jun <jun.li@freescale.com>
Fri, 23 Jan 2015 10:35:35 +0000 (18:35 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:00 +0000 (14:47 -0500)
commite0a8a7d78c0cd9cde24e460395ebf420c45d796d
tree30d38e9c08059bc54f60e0089279ec3a8baa96b4
parentce261ef6d084408121a82b65cbbed35fe4687101
MLK-10132-3 usb: chipidea: udc: do not enter low power mode if vbus on

This patch is to prevent usb entering low power mode if vbus is on even gadget
driver is not binded, by holding the PM count of ci->dev.
So, there are 3 pm usage_count status:
- ci->dev: 1 ci->gadget.dev: 1
  Device mode with gadget driver binded and vbus on.
- ci->dev: 1 ci->gadget.dev: 0
  USB vbus on but gadget driver not binded.
- ci->dev: 0 ci->gadget.dev: 1
  USB OTG FSM is in a_peripheral mode.
Above 2 device's pm usage_count hold by ci otg(ci->dev) and usb gadget
(ci->gadget.dev).

Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 673c6bf1b3aa0b1b698569b9259712b0e765be32)
drivers/usb/chipidea/udc.c