diff options
Diffstat (limited to 'drivers/power/wm8350_power.c')
-rw-r--r-- | drivers/power/wm8350_power.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c index 28b0299c0043..6e634cf7fc14 100644 --- a/drivers/power/wm8350_power.c +++ b/drivers/power/wm8350_power.c | |||
@@ -184,8 +184,9 @@ static ssize_t charger_state_show(struct device *dev, | |||
184 | 184 | ||
185 | static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); | 185 | static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); |
186 | 186 | ||
187 | static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) | 187 | static irqreturn_t wm8350_charger_handler(int irq, void *data) |
188 | { | 188 | { |
189 | struct wm8350 *wm8350 = data; | ||
189 | struct wm8350_power *power = &wm8350->power; | 190 | struct wm8350_power *power = &wm8350->power; |
190 | struct wm8350_charger_policy *policy = power->policy; | 191 | struct wm8350_charger_policy *policy = power->policy; |
191 | 192 | ||
@@ -238,6 +239,8 @@ static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) | |||
238 | default: | 239 | default: |
239 | dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); | 240 | dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); |
240 | } | 241 | } |
242 | |||
243 | return IRQ_HANDLED; | ||
241 | } | 244 | } |
242 | 245 | ||
243 | /********************************************************************* | 246 | /********************************************************************* |
@@ -387,45 +390,53 @@ static void wm8350_init_charger(struct wm8350 *wm8350) | |||
387 | { | 390 | { |
388 | /* register our interest in charger events */ | 391 | /* register our interest in charger events */ |
389 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, | 392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, |
390 | wm8350_charger_handler, NULL); | 393 | wm8350_charger_handler, 0, "Battery hot", wm8350); |
391 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); | 394 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); |
392 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, | 395 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, |
393 | wm8350_charger_handler, NULL); | 396 | wm8350_charger_handler, 0, "Battery cold", wm8350); |
394 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); | 397 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); |
395 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, | 398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, |
396 | wm8350_charger_handler, NULL); | 399 | wm8350_charger_handler, 0, "Battery fail", wm8350); |
397 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); | 400 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); |
398 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, | 401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, |
399 | wm8350_charger_handler, NULL); | 402 | wm8350_charger_handler, 0, |
403 | "Charger timeout", wm8350); | ||
400 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); | 404 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); |
401 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, | 405 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, |
402 | wm8350_charger_handler, NULL); | 406 | wm8350_charger_handler, 0, |
407 | "Charge end", wm8350); | ||
403 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); | 408 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); |
404 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, | 409 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, |
405 | wm8350_charger_handler, NULL); | 410 | wm8350_charger_handler, 0, |
411 | "Charge start", wm8350); | ||
406 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); | 412 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); |
407 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, | 413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, |
408 | wm8350_charger_handler, NULL); | 414 | wm8350_charger_handler, 0, |
415 | "Fast charge ready", wm8350); | ||
409 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); | 416 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); |
410 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, | 417 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, |
411 | wm8350_charger_handler, NULL); | 418 | wm8350_charger_handler, 0, |
419 | "Battery <3.9V", wm8350); | ||
412 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); | 420 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); |
413 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, | 421 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, |
414 | wm8350_charger_handler, NULL); | 422 | wm8350_charger_handler, 0, |
423 | "Battery <3.1V", wm8350); | ||
415 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); | 424 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); |
416 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, | 425 | wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, |
417 | wm8350_charger_handler, NULL); | 426 | wm8350_charger_handler, 0, |
427 | "Battery <2.85V", wm8350); | ||
428 | |||
418 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); | 429 | wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); |
419 | 430 | ||
420 | /* and supply change events */ | 431 | /* and supply change events */ |
421 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, | 432 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, |
422 | wm8350_charger_handler, NULL); | 433 | wm8350_charger_handler, 0, "USB", wm8350); |
423 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); | 434 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); |
424 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, | 435 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, |
425 | wm8350_charger_handler, NULL); | 436 | wm8350_charger_handler, 0, "Wall", wm8350); |
426 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); | 437 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); |
427 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, | 438 | wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, |
428 | wm8350_charger_handler, NULL); | 439 | wm8350_charger_handler, 0, "Battery", wm8350); |
429 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); | 440 | wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); |
430 | } | 441 | } |
431 | 442 | ||