Skip to content

Commit

Permalink
power: qpnp-smb2: Implement battery charging_enabled node
Browse files Browse the repository at this point in the history
Change-Id: Id08c169f0c507390eab070d1ae77bfb992b50b81
  • Loading branch information
mikeNG authored and npjohnson committed Jun 9, 2023
1 parent 22eb255 commit 224a201
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/power/supply/qcom/qpnp-smb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ static int smb2_init_dc_psy(struct smb2 *chip)
*************************/

static enum power_supply_property smb2_batt_props[] = {
POWER_SUPPLY_PROP_CHARGING_ENABLED,
POWER_SUPPLY_PROP_INPUT_SUSPEND,
POWER_SUPPLY_PROP_STATUS,
POWER_SUPPLY_PROP_HEALTH,
Expand Down Expand Up @@ -1048,6 +1049,9 @@ static int smb2_batt_get_prop(struct power_supply *psy,
case POWER_SUPPLY_PROP_PRESENT:
rc = smblib_get_prop_batt_present(chg, val);
break;
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
val->intval = !get_effective_result(chg->chg_disable_votable);
break;
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
rc = smblib_get_prop_input_suspend(chg, val);
break;
Expand Down Expand Up @@ -1169,6 +1173,9 @@ static int smb2_batt_set_prop(struct power_supply *psy,
struct smb_charger *chg = power_supply_get_drvdata(psy);

switch (prop) {
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
vote(chg->chg_disable_votable, USER_VOTER, !!!val->intval, 0);
break;
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
rc = smblib_set_prop_input_suspend(chg, val);
break;
Expand Down Expand Up @@ -1246,6 +1253,7 @@ static int smb2_batt_prop_is_writeable(struct power_supply *psy,
enum power_supply_property psp)
{
switch (psp) {
case POWER_SUPPLY_PROP_CHARGING_ENABLED:
case POWER_SUPPLY_PROP_INPUT_SUSPEND:
case POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL:
case POWER_SUPPLY_PROP_CAPACITY:
Expand Down

0 comments on commit 224a201

Please sign in to comment.