diff options
Diffstat (limited to 'drivers/mfd/ab8500-core.c')
| -rw-r--r-- | drivers/mfd/ab8500-core.c | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index cf2e6a198c6b..bde2fc072410 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 */ |
| 150 | static const int ab8540_irq_regoffset[AB8540_NUM_IRQ_REGS] = { | 150 | static 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 | ||
| 155 | static const char ab8500_version_str[][7] = { | 155 | static 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 | ||
| 575 | static struct irq_domain_ops ab8500_irq_ops = { | 577 | static 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 | ||
| 580 | static int ab8500_irq_init(struct ab8500 *ab8500, struct device_node *np) | 582 | static 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 | ||
| 614 | static struct resource ab8500_gpadc_resources[] = { | 616 | static struct resource ab8500_gpadc_resources[] = { |
| @@ -1551,7 +1553,7 @@ static struct attribute_group ab9540_attr_group = { | |||
| 1551 | 1553 | ||
| 1552 | static int ab8500_probe(struct platform_device *pdev) | 1554 | static 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) |
| @@ -1751,7 +1754,7 @@ static int ab8500_probe(struct platform_device *pdev) | |||
| 1751 | if (ret) | 1754 | if (ret) |
| 1752 | return ret; | 1755 | return ret; |
| 1753 | 1756 | ||
| 1754 | #if CONFIG_DEBUG_FS | 1757 | #ifdef CONFIG_DEBUG_FS |
| 1755 | /* Pass to debugfs */ | 1758 | /* Pass to debugfs */ |
| 1756 | ab8500_debug_resources[0].start = ab8500->irq; | 1759 | ab8500_debug_resources[0].start = ab8500->irq; |
| 1757 | ab8500_debug_resources[0].end = ab8500->irq; | 1760 | ab8500_debug_resources[0].end = ab8500->irq; |
