fuel gauge: rk817: set different input current when different charger is detected
The four power source types that are detected are: Standard downstream port (SDP) – This is a computer USB port capable of 500mA. Charging downstream port (CDP) - This is typically a powered USB hub capable of 1500mA. Dedicated charging port (DCP) - This is a standard wall charger capable of at least 1500mA. DCP without shorting D+/D-(FLOATING) - This is a non-standard wall charger capable of at least 1500mA. Change-Id: Icb3d3c02d9ef5dfbcabf0232743ad057c578dcf4 Signed-off-by: shengfei Xu <xsf@rock-chips.com>
This commit is contained in:
parent
de440615aa
commit
8a7ae883f7
|
|
@ -198,6 +198,14 @@ enum charger_type {
|
|||
UNDEF_CHARGER,
|
||||
};
|
||||
|
||||
enum power_supply_type {
|
||||
POWER_SUPPLY_TYPE_UNKNOWN = 0,
|
||||
POWER_SUPPLY_TYPE_USB, /* Standard Downstream Port */
|
||||
POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */
|
||||
POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */
|
||||
POWER_SUPPLY_TYPE_USB_FLOATING, /* DCP without shorting D+/D- */
|
||||
};
|
||||
|
||||
struct rk817_battery_device {
|
||||
struct udevice *dev;
|
||||
int res_div;
|
||||
|
|
@ -924,17 +932,18 @@ static int rk817_bat_get_usb_state(struct rk817_battery_device *battery)
|
|||
int charger_type;
|
||||
|
||||
switch (rk817_bat_dwc_otg_check_dpdm()) {
|
||||
case 0:
|
||||
case POWER_SUPPLY_TYPE_UNKNOWN:
|
||||
if ((rk817_bat_read(battery, PMIC_SYS_STS) & PLUG_IN_STS) != 0)
|
||||
charger_type = DC_CHARGER;
|
||||
else
|
||||
charger_type = NO_CHARGER;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case POWER_SUPPLY_TYPE_USB:
|
||||
charger_type = USB_CHARGER;
|
||||
break;
|
||||
case 2:
|
||||
case POWER_SUPPLY_TYPE_USB_DCP:
|
||||
case POWER_SUPPLY_TYPE_USB_CDP:
|
||||
case POWER_SUPPLY_TYPE_USB_FLOATING:
|
||||
charger_type = AC_CHARGER;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue