aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab8500-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 20:17:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-07 20:17:39 -0400
commit54c72d5987ff9f3cf59529d5d4f5cf19eae3f695 (patch)
tree3fee972d54926627895aa07684ddb2e2388e4614 /drivers/mfd/ab8500-core.c
parent66bb0aa077978dbb76e6283531eb3cc7a878de38 (diff)
parent7caa79917ad4c1f91366b11f18e48623554aaa52 (diff)
Merge tag 'mfd-for-linus-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD update from Lee Jones: "Changes to existing drivers: - checkpatch fixes throughout the subsystem - use Regmap to handle IRQs in max77686, extcon-max77693 and mc13xxx-core - use DMA in rtsx_pcr - restrict building on unsupported architectures on timberdale, cs5535 - SPI hardening in cros_ec_spi - more robust error handing in asic3, cros_ec, ab8500-debugfs, max77686 and pcf50633-core - reorder PM runtime and regulator handing during shutdown in arizona - enable wakeup in cros_ec_spi - unused variable/code clean-up in pm8921-core, cros_ec, htc-i2cpld, tps65912-spi, wm5110-tables and ab8500-debugfs - add regulator handing into suspend() in sec-core - remove pointless wrapper functions in extcon-max77693 and i2c-cros-ec-tunnel - use cross-architecture friendly data sizes in stmpe-i2c, arizona, max77686 and tps65910 - devicetree documentation updates throughout - provide power management support in max77686 - few OF clean-ups in max77686 - use manged resources in tps6105x New drivers/supported devices: - add support for s2mpu02 to sec-core - add support for Allwinner A32 to sun6i-prcm - add support for Maxim 77802 in max77686 - add support for DA9063 AD in da9063 - new driver for Intel PMICs (generic) and specifically Crystal Cove (Re-)moved drivers == - move out keyboard functionality cros_ec ==> input/keyboard/cros_ec_keyb" * tag 'mfd-for-linus-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (101 commits) MAINTAINERS: Update MFD repo location mfd: omap-usb-host: Fix improper mask use. mfd: arizona: Only free the CTRLIF_ERR IRQ if we requested it mfd: arizona: Add missing handling for ISRC3 under/overclocked mfd: wm5110: Add new interrupt register definitions mfd: arizona: Rename thermal shutdown interrupt mfd: wm5110: Add in the output done interrupts mfd: wm5110: Remove non-existant interrupts mfd: tps65912-spi: Remove unused variable mfd: htc-i2cpld: Remove unused code mfd: da9063: Add support for AD silicon variant mfd: arizona: Map MICVDD from extcon device to the Arizona core mfd: arizona: Add MICVDD to mapped regulators for wm8997 mfd: max77686: Ensure device type IDs are architecture agnostic mfd: max77686: Add Maxim 77802 PMIC support mfd: tps6105x: Use managed resources when allocating memory mfd: wm8997-tables: Suppress 'line over 80 chars' warnings mfd: kempld-core: Correct a variety of checkpatch warnings mfd: ipaq-micro: Fix coding style errors/warnings reported by checkpatch mfd: si476x-cmd: Remedy checkpatch style complains ...
Diffstat (limited to 'drivers/mfd/ab8500-core.c')
-rw-r--r--drivers/mfd/ab8500-core.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index cf2e6a198c6b..ce48aa72bb42 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -148,8 +148,8 @@ static const int ab9540_irq_regoffset[AB9540_NUM_IRQ_REGS] = {
148 148
149/* AB8540 support */ 149/* AB8540 support */
150static const int ab8540_irq_regoffset[AB8540_NUM_IRQ_REGS] = { 150static const int ab8540_irq_regoffset[AB8540_NUM_IRQ_REGS] = {
151 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22, 23, 151 0, 1, 2, 3, 4, -1, -1, -1, -1, 11, 18, 19, 20, 21, 12, 13, 24, 5, 22,
152 25, 26, 27, 28, 29, 30, 31, 152 23, 25, 26, 27, 28, 29, 30, 31,
153}; 153};
154 154
155static const char ab8500_version_str[][7] = { 155static const char ab8500_version_str[][7] = {
@@ -322,7 +322,7 @@ static int ab8500_mask_and_set_register(struct device *dev,
322 struct ab8500 *ab8500 = dev_get_drvdata(dev->parent); 322 struct ab8500 *ab8500 = dev_get_drvdata(dev->parent);
323 323
324 atomic_inc(&ab8500->transfer_ongoing); 324 atomic_inc(&ab8500->transfer_ongoing);
325 ret= mask_and_set_register_interruptible(ab8500, bank, reg, 325 ret = mask_and_set_register_interruptible(ab8500, bank, reg,
326 bitmask, bitvalues); 326 bitmask, bitvalues);
327 atomic_dec(&ab8500->transfer_ongoing); 327 atomic_dec(&ab8500->transfer_ongoing);
328 return ret; 328 return ret;
@@ -415,9 +415,11 @@ static void ab8500_irq_unmask(struct irq_data *data)
415 if (type & IRQ_TYPE_EDGE_FALLING) { 415 if (type & IRQ_TYPE_EDGE_FALLING) {
416 if (offset >= AB8500_INT_GPIO6R && offset <= AB8500_INT_GPIO41R) 416 if (offset >= AB8500_INT_GPIO6R && offset <= AB8500_INT_GPIO41R)
417 ab8500->mask[index + 2] &= ~mask; 417 ab8500->mask[index + 2] &= ~mask;
418 else if (offset >= AB9540_INT_GPIO50R && offset <= AB9540_INT_GPIO54R) 418 else if (offset >= AB9540_INT_GPIO50R &&
419 offset <= AB9540_INT_GPIO54R)
419 ab8500->mask[index + 1] &= ~mask; 420 ab8500->mask[index + 1] &= ~mask;
420 else if (offset == AB8540_INT_GPIO43R || offset == AB8540_INT_GPIO44R) 421 else if (offset == AB8540_INT_GPIO43R ||
422 offset == AB8540_INT_GPIO44R)
421 /* Here the falling IRQ is one bit lower */ 423 /* Here the falling IRQ is one bit lower */
422 ab8500->mask[index] &= ~(mask << 1); 424 ab8500->mask[index] &= ~(mask << 1);
423 else 425 else
@@ -451,7 +453,7 @@ static void update_latch_offset(u8 *offset, int i)
451 /* Fix inconsistent ab8540 bit mapping... */ 453 /* Fix inconsistent ab8540 bit mapping... */
452 if (unlikely(*offset == 16)) 454 if (unlikely(*offset == 16))
453 *offset = 25; 455 *offset = 25;
454 if ((i==3) && (*offset >= 24)) 456 if ((i == 3) && (*offset >= 24))
455 *offset += 2; 457 *offset += 2;
456} 458}
457 459
@@ -573,8 +575,8 @@ static int ab8500_irq_map(struct irq_domain *d, unsigned int virq,
573} 575}
574 576
575static struct irq_domain_ops ab8500_irq_ops = { 577static struct irq_domain_ops ab8500_irq_ops = {
576 .map = ab8500_irq_map, 578 .map = ab8500_irq_map,
577 .xlate = irq_domain_xlate_twocell, 579 .xlate = irq_domain_xlate_twocell,
578}; 580};
579 581
580static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np) 582static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np)
@@ -607,8 +609,8 @@ int ab8500_suspend(struct ab8500 *ab8500)
607{ 609{
608 if (atomic_read(&ab8500->transfer_ongoing)) 610 if (atomic_read(&ab8500->transfer_ongoing))
609 return -EINVAL; 611 return -EINVAL;
610 else 612
611 return 0; 613 return 0;
612} 614}
613 615
614static struct resource ab8500_gpadc_resources[] = { 616static struct resource ab8500_gpadc_resources[] = {
@@ -1551,7 +1553,7 @@ static struct attribute_group ab9540_attr_group = {
1551 1553
1552static int ab8500_probe(struct platform_device *pdev) 1554static int ab8500_probe(struct platform_device *pdev)
1553{ 1555{
1554 static char *switch_off_status[] = { 1556 static const char *switch_off_status[] = {
1555 "Swoff bit programming", 1557 "Swoff bit programming",
1556 "Thermal protection activation", 1558 "Thermal protection activation",
1557 "Vbat lower then BattOk falling threshold", 1559 "Vbat lower then BattOk falling threshold",
@@ -1560,7 +1562,7 @@ static int ab8500_probe(struct platform_device *pdev)
1560 "Battery level lower than power on reset threshold", 1562 "Battery level lower than power on reset threshold",
1561 "Power on key 1 pressed longer than 10 seconds", 1563 "Power on key 1 pressed longer than 10 seconds",
1562 "DB8500 thermal shutdown"}; 1564 "DB8500 thermal shutdown"};
1563 static char *turn_on_status[] = { 1565 static const char *turn_on_status[] = {
1564 "Battery rising (Vbat)", 1566 "Battery rising (Vbat)",
1565 "Power On Key 1 dbF", 1567 "Power On Key 1 dbF",
1566 "Power On Key 2 dbF", 1568 "Power On Key 2 dbF",
@@ -1579,7 +1581,7 @@ static int ab8500_probe(struct platform_device *pdev)
1579 int i; 1581 int i;
1580 u8 value; 1582 u8 value;
1581 1583
1582 ab8500 = devm_kzalloc(&pdev->dev, sizeof *ab8500, GFP_KERNEL); 1584 ab8500 = devm_kzalloc(&pdev->dev, sizeof(*ab8500), GFP_KERNEL);
1583 if (!ab8500) 1585 if (!ab8500)
1584 return -ENOMEM; 1586 return -ENOMEM;
1585 1587
@@ -1636,7 +1638,7 @@ static int ab8500_probe(struct platform_device *pdev)
1636 ab8500->mask_size = AB8540_NUM_IRQ_REGS; 1638 ab8500->mask_size = AB8540_NUM_IRQ_REGS;
1637 ab8500->irq_reg_offset = ab8540_irq_regoffset; 1639 ab8500->irq_reg_offset = ab8540_irq_regoffset;
1638 ab8500->it_latchhier_num = AB8540_IT_LATCHHIER_NUM; 1640 ab8500->it_latchhier_num = AB8540_IT_LATCHHIER_NUM;
1639 }/* Configure AB8500 or AB9540 IRQ */ 1641 } /* Configure AB8500 or AB9540 IRQ */
1640 else if (is_ab9540(ab8500) || is_ab8505(ab8500)) { 1642 else if (is_ab9540(ab8500) || is_ab8505(ab8500)) {
1641 ab8500->mask_size = AB9540_NUM_IRQ_REGS; 1643 ab8500->mask_size = AB9540_NUM_IRQ_REGS;
1642 ab8500->irq_reg_offset = ab9540_irq_regoffset; 1644 ab8500->irq_reg_offset = ab9540_irq_regoffset;
@@ -1646,10 +1648,12 @@ static int ab8500_probe(struct platform_device *pdev)
1646 ab8500->irq_reg_offset = ab8500_irq_regoffset; 1648 ab8500->irq_reg_offset = ab8500_irq_regoffset;
1647 ab8500->it_latchhier_num = AB8500_IT_LATCHHIER_NUM; 1649 ab8500->it_latchhier_num = AB8500_IT_LATCHHIER_NUM;
1648 } 1650 }
1649 ab8500->mask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL); 1651 ab8500->mask = devm_kzalloc(&pdev->dev, ab8500->mask_size,
1652 GFP_KERNEL);
1650 if (!ab8500->mask) 1653 if (!ab8500->mask)
1651 return -ENOMEM; 1654 return -ENOMEM;
1652 ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size, GFP_KERNEL); 1655 ab8500->oldmask = devm_kzalloc(&pdev->dev, ab8500->mask_size,
1656 GFP_KERNEL);
1653 if (!ab8500->oldmask) 1657 if (!ab8500->oldmask)
1654 return -ENOMEM; 1658 return -ENOMEM;
1655 1659
@@ -1674,14 +1678,13 @@ static int ab8500_probe(struct platform_device *pdev)
1674 if (value) { 1678 if (value) {
1675 for (i = 0; i < ARRAY_SIZE(switch_off_status); i++) { 1679 for (i = 0; i < ARRAY_SIZE(switch_off_status); i++) {
1676 if (value & 1) 1680 if (value & 1)
1677 printk(KERN_CONT " \"%s\"", 1681 pr_cont(" \"%s\"", switch_off_status[i]);
1678 switch_off_status[i]);
1679 value = value >> 1; 1682 value = value >> 1;
1680 1683
1681 } 1684 }
1682 printk(KERN_CONT "\n"); 1685 pr_cont("\n");
1683 } else { 1686 } else {
1684 printk(KERN_CONT " None\n"); 1687 pr_cont(" None\n");
1685 } 1688 }
1686 ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK, 1689 ret = get_register_interruptible(ab8500, AB8500_SYS_CTRL1_BLOCK,
1687 AB8500_TURN_ON_STATUS, &value); 1690 AB8500_TURN_ON_STATUS, &value);
@@ -1692,12 +1695,12 @@ static int ab8500_probe(struct platform_device *pdev)
1692 if (value) { 1695 if (value) {
1693 for (i = 0; i < ARRAY_SIZE(turn_on_status); i++) { 1696 for (i = 0; i < ARRAY_SIZE(turn_on_status); i++) {
1694 if (value & 1) 1697 if (value & 1)
1695 printk("\"%s\" ", turn_on_status[i]); 1698 pr_cont("\"%s\" ", turn_on_status[i]);
1696 value = value >> 1; 1699 value = value >> 1;
1697 } 1700 }
1698 printk("\n"); 1701 pr_cont("\n");
1699 } else { 1702 } else {
1700 printk("None\n"); 1703 pr_cont("None\n");
1701 } 1704 }
1702 1705
1703 if (plat && plat->init) 1706 if (plat && plat->init)