power: smb350: Fix dc-online report
When DC jack is plugged in it provides power to the system,
regardless if charging a battery or not.
The device will not shutdown when the battery is empty but dc is online.
Change-Id: If037c2979f95cc4be2bfa28e486bc2af42a67015
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
diff --git a/drivers/power/smb350_charger.c b/drivers/power/smb350_charger.c
index dc0c4bd..21d7aea 100644
--- a/drivers/power/smb350_charger.c
+++ b/drivers/power/smb350_charger.c
@@ -229,20 +229,18 @@
return power_ok;
}
-static bool smb350_is_charging(struct i2c_client *client)
+static bool smb350_is_charger_present(struct i2c_client *client)
{
int val;
- bool is_charging;
+ /* Normally the device is non-removable and embedded on the board.
+ * Verify that charger is present by getting I2C response.
+ */
val = smb350_read_reg(client, STATUS_B_REG);
if (val < 0)
return false;
- val = (val >> 1) & 0x3;
-
- is_charging = (val != 0);
-
- return is_charging;
+ return true;
}
static int smb350_get_prop_charge_type(struct smb350_device *dev)
@@ -408,10 +406,10 @@
switch (psp) {
case POWER_SUPPLY_PROP_PRESENT:
- val->intval = smb350_is_dc_present(client);
+ val->intval = smb350_is_charger_present(client);
break;
case POWER_SUPPLY_PROP_ONLINE:
- val->intval = smb350_is_charging(client);
+ val->intval = smb350_is_dc_present(client);
break;
case POWER_SUPPLY_PROP_CHARGE_TYPE:
val->intval = smb350_get_prop_charge_type(dev);