USB: OTG: msm: Fix ACA implementation
Synopsis 28nm PHY has two different circuits for detecting changes on ID line. ID_DIG is designed for detecting ID_float vs ID_gnd. ID_ACA is designed for detecting RID_A, RID_B, RID_C states. These are mutually exclusive and enabling both circuits has undefined behavior. Enable ID_ACA upon VBUS high or ID_gnd events to detect further ACA states. ACA ID_GND threshold range is overlapped with OTG ID_FLOAT threshold range. Hence PHY ID_DIG circuit can not be used for detecting ACA ID_GND. Use PMIC ID circuit for detecting both OTG and ACA ID_GND. Link controller can not generate PHY_ALT interrupt in host mode. But the corresponding PHY register reflects the actual ID state. Hence implement polling to read PHY register to detect ID_GND --> ID_A, ID_A --> ID_B transitions. That means low power mode can not be allowed in host mode. Also disallow suspending the device attached on the root hub. Otherwise PHY is put into suspend state automatically upon setting SUSP bit in PORTSC register. Link controller can not generate asynchronous interrupt for ID_ACA changes in low power mode. Hence disallow low power mode in ID_B and ID_C states. USB_MSM_ACA is not selected by default. If it selected, ACA states can be detected and low power mode is not allowed in host mode. Writing "enable" to <debugfs>/msm_otg/aca enables ACA irrespective of USB_MSM_ACA selection. This is meant for debugging only. Change-Id: I51e80d803a583c5bdffc8111696943c04958f604 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
This commit is contained in:
@@ -72,6 +72,9 @@ enum msm_usb_phy_type {
|
||||
#define IDEV_CHG_MIN 500
|
||||
#define IUNIT 100
|
||||
|
||||
#define IDEV_ACA_CHG_MAX 1500
|
||||
#define IDEV_ACA_CHG_LIMIT 500
|
||||
|
||||
/**
|
||||
* Different states involved in USB charger detection.
|
||||
*
|
||||
@@ -185,6 +188,7 @@ struct msm_otg_platform_data {
|
||||
* connected. Useful only when ACA_A charger is
|
||||
* connected.
|
||||
* @mA_port: The amount of current drawn by the attached B-device.
|
||||
* @id_timer: The timer used for polling ID line to detect ACA states.
|
||||
*/
|
||||
struct msm_otg {
|
||||
struct otg_transceiver otg;
|
||||
@@ -214,6 +218,7 @@ struct msm_otg {
|
||||
struct wake_lock wlock;
|
||||
struct notifier_block usbdev_nb;
|
||||
unsigned mA_port;
|
||||
struct timer_list id_timer;
|
||||
unsigned long caps;
|
||||
/*
|
||||
* Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v
|
||||
|
||||
Reference in New Issue
Block a user