diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2017-04-11 20:43:37 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-04-11 20:43:36 -0700 |
| commit | 49426a3a2ca36c7a210dc19393f8ef44e7b39501 (patch) | |
| tree | 86e596c1960652c1329c775959ac846affdba243 | |
| parent | 054789c42fe0d04691e768c80f7d0b6cfeec65ff (diff) | |
| parent | 950030a3cff21516d777eac189c13f21aa336b82 (diff) | |
Merge "qcom: smblib: Show correct charging status"
| -rw-r--r-- | drivers/power/supply/qcom/smb-lib.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/power/supply/qcom/smb-lib.c b/drivers/power/supply/qcom/smb-lib.c index bd96703579f6..14e9c3a2254d 100644 --- a/drivers/power/supply/qcom/smb-lib.c +++ b/drivers/power/supply/qcom/smb-lib.c @@ -1532,6 +1532,19 @@ int smblib_get_prop_batt_status(struct smb_charger *chg, break; } + if (val->intval != POWER_SUPPLY_STATUS_CHARGING) + return 0; + + rc = smblib_read(chg, BATTERY_CHARGER_STATUS_2_REG, &stat); + if (rc < 0) { + smblib_err(chg, "Couldn't read BATTERY_CHARGER_STATUS_2 rc=%d\n", + rc); + return rc; + } + + if (stat & (BAT_TEMP_STATUS_TOO_HOT_BIT | BAT_TEMP_STATUS_TOO_COLD_BIT)) + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; + return 0; } |
