Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 689f89c3 authored by Kavya Nunna's avatar Kavya Nunna Committed by Shilpa Suresh
Browse files

power: qpnp-smb2: Reverse the sign of CURRENT_NOW



Userspace expects CURRENT_NOW to report positive value
when battery is charging and negative during discharge.

Change-Id: I3490ab34699035aea986910683e3244350def73e
Signed-off-by: default avatarKavya Nunna <knunna@codeaurora.org>
parent 8e90d975
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1101,10 +1101,14 @@ static int smb2_batt_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CHARGE_FULL:
	case POWER_SUPPLY_PROP_CYCLE_COUNT:
	case POWER_SUPPLY_PROP_VOLTAGE_NOW:
	case POWER_SUPPLY_PROP_CURRENT_NOW:
	case POWER_SUPPLY_PROP_TEMP:
		rc = smblib_get_prop_from_bms(chg, psp, val);
		break;
	case POWER_SUPPLY_PROP_CURRENT_NOW:
		rc = smblib_get_prop_from_bms(chg, psp, val);
		if (!rc)
			val->intval *= (-1);
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
		return -EINVAL;