aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 21:55:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-16 21:55:20 -0500
commit2dfea3803dcf70983d14ce1dcbb3e97a7459a28b (patch)
tree59bffc7389ff554585f79d7cc06021790dc2b317 /drivers/power
parentaed606e3bc1f10753254db308d3fd8c053c41328 (diff)
parent1881b68b8961a86d40c3c5c205e533515a2dc9c6 (diff)
Merge tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFS update from Samuel Ortiz: "This is the MFD patch set for the 3.8 merge window. We have several new drivers, most of the time coming with their sub devices drivers: - Austria Microsystem's AS3711 - Nano River's viperboard - TI's TPS80031, AM335x TS/ADC, - Realtek's MMC/memstick card reader - Nokia's retu We also got some notable cleanups and improvements: - tps6586x got converted to IRQ domains. - tps65910 and tps65090 moved to the regmap IRQ API. - STMPE is now Device Tree aware. - A general twl6040 and twl-core cleanup, with moves to the regmap I/O and IRQ APIs and a conversion to the recently added PWM framework. - sta2x11 gained regmap support. Then the rest is mostly tiny cleanups and fixes, among which we have Mark's wm5xxx and wm8xxx patchset." Far amount of annoying but largely trivial conflicts. Many due to __devinit/exit removal, others due to one or two of the new drivers also having come in through another tree. * tag 'mfd-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (119 commits) mfd: tps6507x: Convert to devm_kzalloc mfd: stmpe: Update DT support for stmpe driver mfd: wm5102: Add readback of DSP status 3 register mfd: arizona: Log if we fail to create the primary IRQ domain mfd: tps80031: MFD_TPS80031 needs to select REGMAP_IRQ mfd: tps80031: Add terminating entry for tps80031_id_table mfd: sta2x11: Fix potential NULL pointer dereference in __sta2x11_mfd_mask() mfd: wm5102: Add tuning for revision B mfd: arizona: Defer patch initialistation until after first device boot mfd: tps65910: Fix wrong ack_base register mfd: tps65910: Remove unused data mfd: stmpe: Get rid of irq_invert_polarity mfd: ab8500-core: Fix invalid free of devm_ allocated data mfd: wm5102: Mark DSP memory regions as volatile mfd: wm5102: Correct default for LDO1_CONTROL_2 mfd: arizona: Register haptics devices mfd: wm8994: Make current device behaviour the default mfd: tps65090: MFD_TPS65090 needs to select REGMAP_IRQ mfd: Fix stmpe.c build when OF is not enabled mfd: jz4740-adc: Use devm_kzalloc ...
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/da9052-battery.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index bb0df8917adc..3c5c2e459d73 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -440,8 +440,10 @@ static int da9052_bat_check_health(struct da9052_battery *bat, int *health)
440static irqreturn_t da9052_bat_irq(int irq, void *data) 440static irqreturn_t da9052_bat_irq(int irq, void *data)
441{ 441{
442 struct da9052_battery *bat = data; 442 struct da9052_battery *bat = data;
443 int virq;
443 444
444 irq -= bat->da9052->irq_base; 445 virq = regmap_irq_get_virq(bat->da9052->irq_data, irq);
446 irq -= virq;
445 447
446 if (irq == DA9052_IRQ_CHGEND) 448 if (irq == DA9052_IRQ_CHGEND)
447 bat->status = POWER_SUPPLY_STATUS_FULL; 449 bat->status = POWER_SUPPLY_STATUS_FULL;
@@ -567,7 +569,7 @@ static struct power_supply template_battery = {
567 .get_property = da9052_bat_get_property, 569 .get_property = da9052_bat_get_property,
568}; 570};
569 571
570static const char *const da9052_bat_irqs[] = { 572static char *da9052_bat_irqs[] = {
571 "BATT TEMP", 573 "BATT TEMP",
572 "DCIN DET", 574 "DCIN DET",
573 "DCIN REM", 575 "DCIN REM",
@@ -576,12 +578,20 @@ static const char *const da9052_bat_irqs[] = {
576 "CHG END", 578 "CHG END",
577}; 579};
578 580
581static int da9052_bat_irq_bits[] = {
582 DA9052_IRQ_TBAT,
583 DA9052_IRQ_DCIN,
584 DA9052_IRQ_DCINREM,
585 DA9052_IRQ_VBUS,
586 DA9052_IRQ_VBUSREM,
587 DA9052_IRQ_CHGEND,
588};
589
579static s32 da9052_bat_probe(struct platform_device *pdev) 590static s32 da9052_bat_probe(struct platform_device *pdev)
580{ 591{
581 struct da9052_pdata *pdata; 592 struct da9052_pdata *pdata;
582 struct da9052_battery *bat; 593 struct da9052_battery *bat;
583 int ret; 594 int ret;
584 int irq;
585 int i; 595 int i;
586 596
587 bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL); 597 bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL);
@@ -602,15 +612,14 @@ static s32 da9052_bat_probe(struct platform_device *pdev)
602 bat->psy.use_for_apm = 1; 612 bat->psy.use_for_apm = 1;
603 613
604 for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) { 614 for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) {
605 irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]); 615 ret = da9052_request_irq(bat->da9052,
606 ret = request_threaded_irq(bat->da9052->irq_base + irq, 616 da9052_bat_irq_bits[i], da9052_bat_irqs[i],
607 NULL, da9052_bat_irq, 617 da9052_bat_irq, bat);
608 IRQF_TRIGGER_LOW | IRQF_ONESHOT, 618
609 da9052_bat_irqs[i], bat);
610 if (ret != 0) { 619 if (ret != 0) {
611 dev_err(bat->da9052->dev, 620 dev_err(bat->da9052->dev,
612 "DA9052 failed to request %s IRQ %d: %d\n", 621 "DA9052 failed to request %s IRQ: %d\n",
613 da9052_bat_irqs[i], irq, ret); 622 da9052_bat_irqs[i], ret);
614 goto err; 623 goto err;
615 } 624 }
616 } 625 }
@@ -623,23 +632,20 @@ static s32 da9052_bat_probe(struct platform_device *pdev)
623 return 0; 632 return 0;
624 633
625err: 634err:
626 while (--i >= 0) { 635 while (--i >= 0)
627 irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]); 636 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
628 free_irq(bat->da9052->irq_base + irq, bat); 637
629 }
630 kfree(bat); 638 kfree(bat);
631 return ret; 639 return ret;
632} 640}
633static int da9052_bat_remove(struct platform_device *pdev) 641static int da9052_bat_remove(struct platform_device *pdev)
634{ 642{
635 int i; 643 int i;
636 int irq;
637 struct da9052_battery *bat = platform_get_drvdata(pdev); 644 struct da9052_battery *bat = platform_get_drvdata(pdev);
638 645
639 for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++) { 646 for (i = 0; i < ARRAY_SIZE(da9052_bat_irqs); i++)
640 irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]); 647 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
641 free_irq(bat->da9052->irq_base + irq, bat); 648
642 }
643 power_supply_unregister(&bat->psy); 649 power_supply_unregister(&bat->psy);
644 kfree(bat); 650 kfree(bat);
645 651