Skip to content

Commit 8a93d90

Browse files
mikeNGbgcngm
authored andcommitted
power: qpnp-smb2: Implement battery charging_enabled node
Change-Id: Id08c169f0c507390eab070d1ae77bfb992b50b81
1 parent c59ed95 commit 8a93d90

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/power/supply/qcom/qpnp-smb2.c

+8
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,7 @@ static int smb2_init_wireless_psy(struct smb2 *chip)
13231323
*************************/
13241324

13251325
static enum power_supply_property smb2_batt_props[] = {
1326+
POWER_SUPPLY_PROP_CHARGING_ENABLED,
13261327
POWER_SUPPLY_PROP_INPUT_SUSPEND,
13271328
POWER_SUPPLY_PROP_STATUS,
13281329
POWER_SUPPLY_PROP_HEALTH,
@@ -1380,6 +1381,9 @@ static int smb2_batt_get_prop(struct power_supply *psy,
13801381
case POWER_SUPPLY_PROP_PRESENT:
13811382
rc = smblib_get_prop_batt_present(chg, val);
13821383
break;
1384+
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
1385+
val->intval = !get_effective_result(chg->chg_disable_votable);
1386+
break;
13831387
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
13841388
rc = smblib_get_prop_input_suspend(chg, val);
13851389
break;
@@ -1516,6 +1520,9 @@ static int smb2_batt_set_prop(struct power_supply *psy,
15161520
case POWER_SUPPLY_PROP_STATUS:
15171521
rc = smblib_set_prop_batt_status(chg, val);
15181522
break;
1523+
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
1524+
vote(chg->chg_disable_votable, USER_VOTER, !!!val->intval, 0);
1525+
break;
15191526
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
15201527
rc = smblib_set_prop_input_suspend(chg, val);
15211528
break;
@@ -1611,6 +1618,7 @@ static int smb2_batt_prop_is_writeable(struct power_supply *psy,
16111618
{
16121619
switch (psp) {
16131620
case POWER_SUPPLY_PROP_STATUS:
1621+
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
16141622
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
16151623
case POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL:
16161624
case POWER_SUPPLY_PROP_CAPACITY:

0 commit comments

Comments
 (0)