mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
phy: rockchip-inno-usb2: add SDP detect retry
If detect a SDP charger type, we retry twice more to avoid DCP falsely identified as SDP due to hardware signal error. Change-Id: I1bf7bd076cd7767938f6944f1156daa7e64870e4 Signed-off-by: Feng Mingli <fml@rock-chips.com> Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
@@ -233,6 +233,7 @@ struct rockchip_usb2phy {
|
||||
enum usb_chg_state chg_state;
|
||||
enum power_supply_type chg_type;
|
||||
u8 dcd_retries;
|
||||
u8 primary_retries;
|
||||
struct extcon_dev *edev;
|
||||
const struct rockchip_usb2phy_cfg *phy_cfg;
|
||||
struct rockchip_usb2phy_port ports[USB2PHY_NUM_PORTS];
|
||||
@@ -724,6 +725,7 @@ static void rockchip_chg_detect_work(struct work_struct *work)
|
||||
rockchip_chg_enable_dcd(rphy, true);
|
||||
rphy->chg_state = USB_CHG_STATE_WAIT_FOR_DCD;
|
||||
rphy->dcd_retries = 0;
|
||||
rphy->primary_retries = 0;
|
||||
delay = CHG_DCD_POLL_TIME;
|
||||
break;
|
||||
case USB_CHG_STATE_WAIT_FOR_DCD:
|
||||
@@ -761,6 +763,19 @@ static void rockchip_chg_detect_work(struct work_struct *work)
|
||||
rphy->chg_state = USB_CHG_STATE_DETECTED;
|
||||
delay = 0;
|
||||
} else {
|
||||
if (rphy->primary_retries < 2) {
|
||||
/* Turn off DCD circuitry */
|
||||
rockchip_chg_enable_dcd(rphy, false);
|
||||
/* Voltage Source on DP, Probe on DM */
|
||||
rockchip_chg_enable_primary_det(rphy,
|
||||
true);
|
||||
delay = CHG_PRIMARY_DET_TIME;
|
||||
rphy->chg_state =
|
||||
USB_CHG_STATE_DCD_DONE;
|
||||
rphy->primary_retries++;
|
||||
/* break USB_CHG_STATE_DCD_DONE */
|
||||
break;
|
||||
}
|
||||
rphy->chg_type = POWER_SUPPLY_TYPE_USB;
|
||||
rphy->chg_state = USB_CHG_STATE_DETECTED;
|
||||
delay = 0;
|
||||
|
||||
Reference in New Issue
Block a user