summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorJonghwa Lee <jonghwa3.lee@samsung.com>2013-05-09 20:29:13 +0900
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:43:05 +0900
commitca4cbe622295bf514142d19d0bb4079fc43c1090 (patch)
treeaf62289d9a5904177fe09541b5b1977d5764642d /drivers/power
parent308fa13f6ae775672a20bac45090b9d4039355f6 (diff)
downloadlinux-3.10-ca4cbe622295bf514142d19d0bb4079fc43c1090.tar.gz
linux-3.10-ca4cbe622295bf514142d19d0bb4079fc43c1090.tar.bz2
linux-3.10-ca4cbe622295bf514142d19d0bb4079fc43c1090.zip
fuelgauge: max1704xx: Fix max17042 driver to work properly.
Fixed : - Read battery capacity from VFG(voltage fuel gauge) for ModelGuage M1. - Fix error of registering alarm irq to generic irq framework. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/max17042_battery.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index d664ef58afa..ab5324b8705 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -126,6 +126,7 @@ static int max17042_get_property(struct power_supply *psy,
struct max17042_chip *chip = container_of(psy,
struct max17042_chip, battery);
int ret;
+ u8 reg;
if (!chip->init_complete)
return -EAGAIN;
@@ -189,7 +190,12 @@ static int max17042_get_property(struct power_supply *psy,
val->intval = ret * 625 / 8;
break;
case POWER_SUPPLY_PROP_CAPACITY:
- ret = max17042_read_reg(chip->client, MAX17042_RepSOC);
+ if (chip->pdata->enable_current_sense)
+ reg = MAX17042_RepSOC;
+ else
+ reg = MAX17042_VFSOC; /* SOC from VFG */
+
+ ret = max17042_read_reg(chip->client, reg);
if (ret < 0)
return ret;
@@ -751,7 +757,7 @@ static int max17042_probe(struct i2c_client *client,
if (client->irq) {
ret = request_threaded_irq(client->irq, NULL,
max17042_thread_handler,
- IRQF_TRIGGER_FALLING,
+ IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
chip->battery.name, chip);
if (!ret) {
reg = max17042_read_reg(client, MAX17042_CONFIG);