power: ds2781: Report charging correctly
Previously, charging was being reporting whenever a charger was present. While true most of the time, there are cases where that won't be the case. This patch updates the driver to only report charging if charging is actually occurring. Change-Id: Ibc5881fed5d11f89d87d0c7adcd7ac1c2b273688 Signed-off-by: Greg Meiste <w30289@motorola.com>
This commit is contained in:
parent
ed28235171
commit
c4f99cbeb9
1 changed files with 2 additions and 1 deletions
|
|
@ -37,6 +37,7 @@
|
|||
#include "../w1/w1.h"
|
||||
#include "../w1/slaves/w1_ds2781.h"
|
||||
|
||||
extern int is_ac_charging(void);
|
||||
extern int is_ac_charge_complete(void);
|
||||
|
||||
struct battery_status {
|
||||
|
|
@ -248,7 +249,7 @@ static int battery_get_property(struct power_supply *psy,
|
|||
|
||||
switch (psp) {
|
||||
case POWER_SUPPLY_PROP_STATUS:
|
||||
if (di->status.charge_source) {
|
||||
if (is_ac_charging()) {
|
||||
if ((di->status.battery_full) ||
|
||||
(di->status.percentage >= 100))
|
||||
val->intval = POWER_SUPPLY_STATUS_FULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue