power: smb135x-charger: report icl status in parallel mode
Report the input current limited status via the power supply in parallel mode in order to better optimize for HVDCP usecases. Change-Id: Ibd3865828ccbfa44b36839f5d11e7a60b7ada77d Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
This commit is contained in:
parent
0dc93b15a8
commit
3ad71a8681
1 changed files with 24 additions and 0 deletions
|
@ -185,6 +185,9 @@
|
|||
#define USING_USB_BIT BIT(1)
|
||||
#define USING_DC_BIT BIT(0)
|
||||
|
||||
#define STATUS_2_REG 0x48
|
||||
#define HARD_LIMIT_STS_BIT BIT(6)
|
||||
|
||||
#define STATUS_4_REG 0x4A
|
||||
#define BATT_NET_CHG_CURRENT_BIT BIT(7)
|
||||
#define BATT_LESS_THAN_2V BIT(4)
|
||||
|
@ -1728,8 +1731,23 @@ static enum power_supply_property smb135x_parallel_properties[] = {
|
|||
POWER_SUPPLY_PROP_CURRENT_MAX,
|
||||
POWER_SUPPLY_PROP_VOLTAGE_MAX,
|
||||
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
|
||||
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED,
|
||||
};
|
||||
|
||||
static bool smb135x_is_input_current_limited(struct smb135x_chg *chip)
|
||||
{
|
||||
int rc;
|
||||
u8 reg;
|
||||
|
||||
rc = smb135x_read(chip, STATUS_2_REG, ®);
|
||||
if (rc) {
|
||||
pr_debug("Couldn't read _REG for ICL status rc = %d\n", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(reg & HARD_LIMIT_STS_BIT);
|
||||
}
|
||||
|
||||
static int smb135x_parallel_set_chg_present(struct smb135x_chg *chip,
|
||||
int present)
|
||||
{
|
||||
|
@ -1967,6 +1985,12 @@ static int smb135x_parallel_get_property(struct power_supply *psy,
|
|||
else
|
||||
val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
|
||||
break;
|
||||
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
|
||||
if (chip->parallel_charger_present)
|
||||
val->intval = smb135x_is_input_current_limited(chip);
|
||||
else
|
||||
val->intval = 0;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue