Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: ab8500-core chip version cut 2.0 support

This patch adds support for chip version 2.0 or cut 2.0.
One new interrupt latch register - latch 12 - is introduced.

Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Mattias Wallin and committed by
Samuel Ortiz
92d50a41 180e4f5f

+55 -34
+25 -11
drivers/mfd/ab8500-core.c
··· 52 52 #define AB8500_IT_LATCH8_REG 0x27 53 53 #define AB8500_IT_LATCH9_REG 0x28 54 54 #define AB8500_IT_LATCH10_REG 0x29 55 + #define AB8500_IT_LATCH12_REG 0x2B 55 56 #define AB8500_IT_LATCH19_REG 0x32 56 57 #define AB8500_IT_LATCH20_REG 0x33 57 58 #define AB8500_IT_LATCH21_REG 0x34 ··· 99 98 * offset 0. 100 99 */ 101 100 static const int ab8500_irq_regoffset[AB8500_NUM_IRQ_REGS] = { 102 - 0, 1, 2, 3, 4, 6, 7, 8, 9, 18, 19, 20, 21, 101 + 0, 1, 2, 3, 4, 6, 7, 8, 9, 11, 18, 19, 20, 21, 103 102 }; 104 103 105 104 static int ab8500_get_chip_id(struct device *dev) ··· 253 252 if (new == old) 254 253 continue; 255 254 255 + /* Interrupt register 12 does'nt exist prior to version 0x20 */ 256 + if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20) 257 + continue; 258 + 256 259 ab8500->oldmask[i] = new; 257 260 258 261 reg = AB8500_IT_MASK1_REG + ab8500_irq_regoffset[i]; ··· 305 300 int regoffset = ab8500_irq_regoffset[i]; 306 301 int status; 307 302 u8 value; 303 + 304 + /* Interrupt register 12 does'nt exist prior to version 0x20 */ 305 + if (regoffset == 11 && ab8500->chip_id < 0x20) 306 + continue; 308 307 309 308 status = get_register_interruptible(ab8500, AB8500_INTERRUPT, 310 309 AB8500_IT_LATCH1_REG + regoffset, &value); ··· 563 554 .end = AB8500_INT_VBUS_DET_R, 564 555 .flags = IORESOURCE_IRQ, 565 556 }, 557 + { 558 + .name = "USB_LINK_STATUS", 559 + .start = AB8500_INT_USB_LINK_STATUS, 560 + .end = AB8500_INT_USB_LINK_STATUS, 561 + .flags = IORESOURCE_IRQ, 562 + }, 566 563 }; 567 564 568 565 static struct resource ab8500_temp_resources[] = { ··· 685 670 * 0x0 - Early Drop 686 671 * 0x10 - Cut 1.0 687 672 * 0x11 - Cut 1.1 673 + * 0x20 - Cut 2.0 688 674 */ 689 - if (value == 0x0 || value == 0x10 || value == 0x11) { 675 + if (value == 0x0 || value == 0x10 || value == 0x11 || value == 0x20) { 690 676 ab8500->revision = value; 691 677 dev_info(ab8500->dev, "detected chip, revision: %#x\n", value); 692 678 } else { ··· 700 684 plat->init(ab8500); 701 685 702 686 /* Clear and mask all interrupts */ 703 - for (i = 0; i < 10; i++) { 704 - get_register_interruptible(ab8500, AB8500_INTERRUPT, 705 - AB8500_IT_LATCH1_REG + i, &value); 706 - set_register_interruptible(ab8500, AB8500_INTERRUPT, 707 - AB8500_IT_MASK1_REG + i, 0xff); 708 - } 687 + for (i = 0; i < AB8500_NUM_IRQ_REGS; i++) { 688 + /* Interrupt register 12 does'nt exist prior to version 0x20 */ 689 + if (ab8500_irq_regoffset[i] == 11 && ab8500->chip_id < 0x20) 690 + continue; 709 691 710 - for (i = 18; i < 24; i++) { 711 692 get_register_interruptible(ab8500, AB8500_INTERRUPT, 712 - AB8500_IT_LATCH1_REG + i, &value); 693 + AB8500_IT_LATCH1_REG + ab8500_irq_regoffset[i], 694 + &value); 713 695 set_register_interruptible(ab8500, AB8500_INTERRUPT, 714 - AB8500_IT_MASK1_REG + i, 0xff); 696 + AB8500_IT_MASK1_REG + ab8500_irq_regoffset[i], 0xff); 715 697 } 716 698 717 699 ret = abx500_register_ops(ab8500->dev, &ab8500_ops);
+30 -23
include/linux/mfd/ab8500.h
··· 74 74 #define AB8500_INT_ACC_DETECT_21DB_F 37 75 75 #define AB8500_INT_ACC_DETECT_21DB_R 38 76 76 #define AB8500_INT_GP_SW_ADC_CONV_END 39 77 - #define AB8500_INT_BTEMP_LOW 72 78 - #define AB8500_INT_BTEMP_LOW_MEDIUM 73 79 - #define AB8500_INT_BTEMP_MEDIUM_HIGH 74 80 - #define AB8500_INT_BTEMP_HIGH 75 81 - #define AB8500_INT_USB_CHARGER_NOT_OK 81 82 - #define AB8500_INT_ID_WAKEUP_R 82 83 - #define AB8500_INT_ID_DET_R1R 84 84 - #define AB8500_INT_ID_DET_R2R 85 85 - #define AB8500_INT_ID_DET_R3R 86 86 - #define AB8500_INT_ID_DET_R4R 87 87 - #define AB8500_INT_ID_WAKEUP_F 88 88 - #define AB8500_INT_ID_DET_R1F 90 89 - #define AB8500_INT_ID_DET_R2F 91 90 - #define AB8500_INT_ID_DET_R3F 92 91 - #define AB8500_INT_ID_DET_R4F 93 92 - #define AB8500_INT_USB_CHG_DET_DONE 94 93 - #define AB8500_INT_USB_CH_TH_PROT_F 96 94 - #define AB8500_INT_USB_CH_TH_PROT_R 97 95 - #define AB8500_INT_MAIN_CH_TH_PROT_F 98 96 - #define AB8500_INT_MAIN_CH_TH_PROT_R 99 97 - #define AB8500_INT_USB_CHARGER_NOT_OKF 103 77 + #define AB8500_INT_ADP_SOURCE_ERROR 72 78 + #define AB8500_INT_ADP_SINK_ERROR 73 79 + #define AB8500_INT_ADP_PROBE_PLUG 74 80 + #define AB8500_INT_ADP_PROBE_UNPLUG 75 81 + #define AB8500_INT_ADP_SENSE_OFF 76 82 + #define AB8500_INT_USB_PHY_POWER_ERR 78 83 + #define AB8500_INT_USB_LINK_STATUS 79 84 + #define AB8500_INT_BTEMP_LOW 80 85 + #define AB8500_INT_BTEMP_LOW_MEDIUM 81 86 + #define AB8500_INT_BTEMP_MEDIUM_HIGH 82 87 + #define AB8500_INT_BTEMP_HIGH 83 88 + #define AB8500_INT_USB_CHARGER_NOT_OK 89 89 + #define AB8500_INT_ID_WAKEUP_R 90 90 + #define AB8500_INT_ID_DET_R1R 92 91 + #define AB8500_INT_ID_DET_R2R 93 92 + #define AB8500_INT_ID_DET_R3R 94 93 + #define AB8500_INT_ID_DET_R4R 95 94 + #define AB8500_INT_ID_WAKEUP_F 96 95 + #define AB8500_INT_ID_DET_R1F 98 96 + #define AB8500_INT_ID_DET_R2F 99 97 + #define AB8500_INT_ID_DET_R3F 100 98 + #define AB8500_INT_ID_DET_R4F 101 99 + #define AB8500_INT_USB_CHG_DET_DONE 102 100 + #define AB8500_INT_USB_CH_TH_PROT_F 104 101 + #define AB8500_INT_USB_CH_TH_PROT_R 105 102 + #define AB8500_INT_MAIN_CH_TH_PROT_F 106 103 + #define AB8500_INT_MAIN_CH_TH_PROT_R 107 104 + #define AB8500_INT_USB_CHARGER_NOT_OKF 111 98 105 99 - #define AB8500_NR_IRQS 104 100 - #define AB8500_NUM_IRQ_REGS 13 106 + #define AB8500_NR_IRQS 112 107 + #define AB8500_NUM_IRQ_REGS 14 101 108 102 109 /** 103 110 * struct ab8500 - ab8500 internal structure