Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 297964
b: refs/heads/master
c: 5cdd4d7
h: refs/heads/master
v: v3
  • Loading branch information
Ramakrishna Pallala authored and Anton Vorontsov committed Mar 26, 2012
1 parent 32ad393 commit c6aae46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6f0b00c0a5f21a54b7f44838f3c3bf73d37b920
refs/heads/master: 5cdd4d7fa5424f2018193a0c2af3bef9036c973e
18 changes: 7 additions & 11 deletions trunk/drivers/power/max17042_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

/* Interrupt mask bits */
#define CONFIG_ALRT_BIT_ENBL (1 << 2)
#define STATUS_INTR_SOC_BIT (1 << 14)
#define STATUS_INTR_LOW_SOC_BIT (1 << 10)
#define STATUS_INTR_SOCMIN_BIT (1 << 10)
#define STATUS_INTR_SOCMAX_BIT (1 << 14)

#define VFSOC0_LOCK 0x0000
#define VFSOC0_UNLOCK 0x0080
Expand Down Expand Up @@ -569,19 +569,14 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)
max17042_write_reg(chip->client, MAX17042_SALRT_Th, soc_tr);
}

static irqreturn_t max17042_intr_handler(int id, void *dev)
{
return IRQ_WAKE_THREAD;
}

static irqreturn_t max17042_thread_handler(int id, void *dev)
{
struct max17042_chip *chip = dev;
u16 val;

val = max17042_read_reg(chip->client, MAX17042_STATUS);
if ((val & STATUS_INTR_SOC_BIT) ||
(val & STATUS_INTR_LOW_SOC_BIT)) {
if ((val & STATUS_INTR_SOCMIN_BIT) ||
(val & STATUS_INTR_SOCMAX_BIT)) {
dev_info(&chip->client->dev, "SOC threshold INTR\n");
max17042_set_soc_threshold(chip, 1);
}
Expand Down Expand Up @@ -689,9 +684,10 @@ static int __devinit max17042_probe(struct i2c_client *client,
}

if (client->irq) {
ret = request_threaded_irq(client->irq, max17042_intr_handler,
ret = request_threaded_irq(client->irq, NULL,
max17042_thread_handler,
0, chip->battery.name, chip);
IRQF_TRIGGER_FALLING,
chip->battery.name, chip);
if (!ret) {
reg = max17042_read_reg(client, MAX17042_CONFIG);
reg |= CONFIG_ALRT_BIT_ENBL;
Expand Down

0 comments on commit c6aae46

Please sign in to comment.