phy: phy-rockchip-inno-usb2: fix the wrong charger type

The wrong type of charger was reported when there was not usb-cable
plugged in. This change adds USB-Vbus status checking before do charge
detection to fix it.

Change-Id: I5e35414d40fdfe8d07ab2aa0771490e86a97e248
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
Frank Wang 2018-02-28 09:23:00 +08:00 committed by Kever Yang
parent 57ab23a62c
commit bebadd87fb
1 changed files with 6 additions and 0 deletions

View File

@ -265,6 +265,12 @@ int rockchip_chg_get_type(void)
base = get_reg_base(rphy);
port_cfg = &rphy->phy_cfg->port_cfgs[USB2PHY_PORT_OTG];
/* Check USB-Vbus status first */
if (!property_enabled(base, &port_cfg->utmi_bvalid)) {
pr_info("%s: no charger found\n", __func__);
return POWER_SUPPLY_TYPE_UNKNOWN;
}
/* Suspend USB-PHY and put the controller in non-driving mode */
property_enable(base, &port_cfg->phy_sus, true);
property_enable(base, &rphy->phy_cfg->chg_det.opmode, false);