aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/ab8500-core.c32
-rw-r--r--include/linux/mfd/abx500/ab8500.h99
2 files changed, 72 insertions, 59 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index f134a6cd4b8a..c637c8d2e7de 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -360,6 +360,8 @@ static int ab8500_irq_init(struct ab8500 *ab8500)
360 360
361 if (is_ab9540(ab8500)) 361 if (is_ab9540(ab8500))
362 num_irqs = AB9540_NR_IRQS; 362 num_irqs = AB9540_NR_IRQS;
363 else if (is_ab8505(ab8500))
364 num_irqs = AB8505_NR_IRQS;
363 else 365 else
364 num_irqs = AB8500_NR_IRQS; 366 num_irqs = AB8500_NR_IRQS;
365 367
@@ -386,6 +388,8 @@ static void ab8500_irq_remove(struct ab8500 *ab8500)
386 388
387 if (is_ab9540(ab8500)) 389 if (is_ab9540(ab8500))
388 num_irqs = AB9540_NR_IRQS; 390 num_irqs = AB9540_NR_IRQS;
391 else if (is_ab8505(ab8500))
392 num_irqs = AB8505_NR_IRQS;
389 else 393 else
390 num_irqs = AB8500_NR_IRQS; 394 num_irqs = AB8500_NR_IRQS;
391 395
@@ -546,12 +550,6 @@ static struct resource __devinitdata ab8500_charger_resources[] = {
546 .flags = IORESOURCE_IRQ, 550 .flags = IORESOURCE_IRQ,
547 }, 551 },
548 { 552 {
549 .name = "USB_CHARGE_DET_DONE",
550 .start = AB8500_INT_USB_CHG_DET_DONE,
551 .end = AB8500_INT_USB_CHG_DET_DONE,
552 .flags = IORESOURCE_IRQ,
553 },
554 {
555 .name = "VBUS_OVV", 553 .name = "VBUS_OVV",
556 .start = AB8500_INT_VBUS_OVV, 554 .start = AB8500_INT_VBUS_OVV,
557 .end = AB8500_INT_VBUS_OVV, 555 .end = AB8500_INT_VBUS_OVV,
@@ -589,14 +587,8 @@ static struct resource __devinitdata ab8500_charger_resources[] = {
589 }, 587 },
590 { 588 {
591 .name = "USB_CHARGER_NOT_OKR", 589 .name = "USB_CHARGER_NOT_OKR",
592 .start = AB8500_INT_USB_CHARGER_NOT_OK, 590 .start = AB8500_INT_USB_CHARGER_NOT_OKR,
593 .end = AB8500_INT_USB_CHARGER_NOT_OK, 591 .end = AB8500_INT_USB_CHARGER_NOT_OKR,
594 .flags = IORESOURCE_IRQ,
595 },
596 {
597 .name = "USB_CHARGER_NOT_OKF",
598 .start = AB8500_INT_USB_CHARGER_NOT_OKF,
599 .end = AB8500_INT_USB_CHARGER_NOT_OKF,
600 .flags = IORESOURCE_IRQ, 592 .flags = IORESOURCE_IRQ,
601 }, 593 },
602 { 594 {
@@ -671,6 +663,12 @@ static struct resource __devinitdata ab8500_fg_resources[] = {
671 .end = AB8500_INT_CC_INT_CALIB, 663 .end = AB8500_INT_CC_INT_CALIB,
672 .flags = IORESOURCE_IRQ, 664 .flags = IORESOURCE_IRQ,
673 }, 665 },
666 {
667 .name = "CCEOC",
668 .start = AB8500_INT_CCEOC,
669 .end = AB8500_INT_CCEOC,
670 .flags = IORESOURCE_IRQ,
671 },
674}; 672};
675 673
676static struct resource __devinitdata ab8500_chargalg_resources[] = {}; 674static struct resource __devinitdata ab8500_chargalg_resources[] = {};
@@ -685,8 +683,8 @@ static struct resource __devinitdata ab8500_debug_resources[] = {
685 }, 683 },
686 { 684 {
687 .name = "IRQ_LAST", 685 .name = "IRQ_LAST",
688 .start = AB8500_INT_USB_CHARGER_NOT_OKF, 686 .start = AB8500_INT_XTAL32K_KO,
689 .end = AB8500_INT_USB_CHARGER_NOT_OKF, 687 .end = AB8500_INT_XTAL32K_KO,
690 .flags = IORESOURCE_IRQ, 688 .flags = IORESOURCE_IRQ,
691 }, 689 },
692}; 690};
@@ -1033,7 +1031,7 @@ int __devinit ab8500_init(struct ab8500 *ab8500, enum ab8500_version version)
1033 ab8500->chip_id & 0x0F); 1031 ab8500->chip_id & 0x0F);
1034 1032
1035 /* Configure AB8500 or AB9540 IRQ */ 1033 /* Configure AB8500 or AB9540 IRQ */
1036 if (is_ab9540(ab8500)) { 1034 if (is_ab9540(ab8500) || is_ab8505(ab8500)) {
1037 ab8500->mask_size = AB9540_NUM_IRQ_REGS; 1035 ab8500->mask_size = AB9540_NUM_IRQ_REGS;
1038 ab8500->irq_reg_offset = ab9540_irq_regoffset; 1036 ab8500->irq_reg_offset = ab9540_irq_regoffset;
1039 } else { 1037 } else {
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 4b2df29fb858..78ed95bb47c3 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -62,9 +62,9 @@ enum ab8500_version {
62 */ 62 */
63/* Definitions for AB8500 and AB9540 */ 63/* Definitions for AB8500 and AB9540 */
64/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */ 64/* ab8500_irq_regoffset[0] -> IT[Source|Latch|Mask]1 */
65#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 65#define AB8500_INT_MAIN_EXT_CH_NOT_OK 0 /* not 8505/9540 */
66#define AB8500_INT_UN_PLUG_TV_DET 1 66#define AB8500_INT_UN_PLUG_TV_DET 1 /* not 8505/9540 */
67#define AB8500_INT_PLUG_TV_DET 2 67#define AB8500_INT_PLUG_TV_DET 2 /* not 8505/9540 */
68#define AB8500_INT_TEMP_WARM 3 68#define AB8500_INT_TEMP_WARM 3
69#define AB8500_INT_PON_KEY2DB_F 4 69#define AB8500_INT_PON_KEY2DB_F 4
70#define AB8500_INT_PON_KEY2DB_R 5 70#define AB8500_INT_PON_KEY2DB_R 5
@@ -72,10 +72,8 @@ enum ab8500_version {
72#define AB8500_INT_PON_KEY1DB_R 7 72#define AB8500_INT_PON_KEY1DB_R 7
73/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */ 73/* ab8500_irq_regoffset[1] -> IT[Source|Latch|Mask]2 */
74#define AB8500_INT_BATT_OVV 8 74#define AB8500_INT_BATT_OVV 8
75#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 75#define AB8500_INT_MAIN_CH_UNPLUG_DET 10 /* not 8505 */
76#define AB8500_INT_MAIN_CH_PLUG_DET 11 76#define AB8500_INT_MAIN_CH_PLUG_DET 11 /* not 8505 */
77#define AB8500_INT_USB_ID_DET_F 12
78#define AB8500_INT_USB_ID_DET_R 13
79#define AB8500_INT_VBUS_DET_F 14 77#define AB8500_INT_VBUS_DET_F 14
80#define AB8500_INT_VBUS_DET_R 15 78#define AB8500_INT_VBUS_DET_R 15
81/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */ 79/* ab8500_irq_regoffset[2] -> IT[Source|Latch|Mask]3 */
@@ -85,7 +83,7 @@ enum ab8500_version {
85#define AB8500_INT_BAT_CTRL_INDB 20 83#define AB8500_INT_BAT_CTRL_INDB 20
86#define AB8500_INT_CH_WD_EXP 21 84#define AB8500_INT_CH_WD_EXP 21
87#define AB8500_INT_VBUS_OVV 22 85#define AB8500_INT_VBUS_OVV 22
88#define AB8500_INT_MAIN_CH_DROP_END 23 86#define AB8500_INT_MAIN_CH_DROP_END 23 /* not 8505/9540 */
89/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */ 87/* ab8500_irq_regoffset[3] -> IT[Source|Latch|Mask]4 */
90#define AB8500_INT_CCN_CONV_ACC 24 88#define AB8500_INT_CCN_CONV_ACC 24
91#define AB8500_INT_INT_AUD 25 89#define AB8500_INT_INT_AUD 25
@@ -96,7 +94,7 @@ enum ab8500_version {
96#define AB8500_INT_BUP_CHG_NOT_OK 30 94#define AB8500_INT_BUP_CHG_NOT_OK 30
97#define AB8500_INT_BUP_CHG_OK 31 95#define AB8500_INT_BUP_CHG_OK 31
98/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */ 96/* ab8500_irq_regoffset[4] -> IT[Source|Latch|Mask]5 */
99#define AB8500_INT_GP_HW_ADC_CONV_END 32 97#define AB8500_INT_GP_HW_ADC_CONV_END 32 /* not 8505 */
100#define AB8500_INT_ACC_DETECT_1DB_F 33 98#define AB8500_INT_ACC_DETECT_1DB_F 33
101#define AB8500_INT_ACC_DETECT_1DB_R 34 99#define AB8500_INT_ACC_DETECT_1DB_R 34
102#define AB8500_INT_ACC_DETECT_22DB_F 35 100#define AB8500_INT_ACC_DETECT_22DB_F 35
@@ -105,39 +103,39 @@ enum ab8500_version {
105#define AB8500_INT_ACC_DETECT_21DB_R 38 103#define AB8500_INT_ACC_DETECT_21DB_R 38
106#define AB8500_INT_GP_SW_ADC_CONV_END 39 104#define AB8500_INT_GP_SW_ADC_CONV_END 39
107/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */ 105/* ab8500_irq_regoffset[5] -> IT[Source|Latch|Mask]7 */
108#define AB8500_INT_GPIO6R 40 106#define AB8500_INT_GPIO6R 40 /* not 8505/9540 */
109#define AB8500_INT_GPIO7R 41 107#define AB8500_INT_GPIO7R 41 /* not 8505/9540 */
110#define AB8500_INT_GPIO8R 42 108#define AB8500_INT_GPIO8R 42 /* not 8505/9540 */
111#define AB8500_INT_GPIO9R 43 109#define AB8500_INT_GPIO9R 43 /* not 8505/9540 */
112#define AB8500_INT_GPIO10R 44 110#define AB8500_INT_GPIO10R 44
113#define AB8500_INT_GPIO11R 45 111#define AB8500_INT_GPIO11R 45
114#define AB8500_INT_GPIO12R 46 112#define AB8500_INT_GPIO12R 46 /* not 8505 */
115#define AB8500_INT_GPIO13R 47 113#define AB8500_INT_GPIO13R 47
116/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */ 114/* ab8500_irq_regoffset[6] -> IT[Source|Latch|Mask]8 */
117#define AB8500_INT_GPIO24R 48 115#define AB8500_INT_GPIO24R 48 /* not 8505 */
118#define AB8500_INT_GPIO25R 49 116#define AB8500_INT_GPIO25R 49 /* not 8505 */
119#define AB8500_INT_GPIO36R 50 117#define AB8500_INT_GPIO36R 50 /* not 8505/9540 */
120#define AB8500_INT_GPIO37R 51 118#define AB8500_INT_GPIO37R 51 /* not 8505/9540 */
121#define AB8500_INT_GPIO38R 52 119#define AB8500_INT_GPIO38R 52 /* not 8505/9540 */
122#define AB8500_INT_GPIO39R 53 120#define AB8500_INT_GPIO39R 53 /* not 8505/9540 */
123#define AB8500_INT_GPIO40R 54 121#define AB8500_INT_GPIO40R 54
124#define AB8500_INT_GPIO41R 55 122#define AB8500_INT_GPIO41R 55
125/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */ 123/* ab8500_irq_regoffset[7] -> IT[Source|Latch|Mask]9 */
126#define AB8500_INT_GPIO6F 56 124#define AB8500_INT_GPIO6F 56 /* not 8505/9540 */
127#define AB8500_INT_GPIO7F 57 125#define AB8500_INT_GPIO7F 57 /* not 8505/9540 */
128#define AB8500_INT_GPIO8F 58 126#define AB8500_INT_GPIO8F 58 /* not 8505/9540 */
129#define AB8500_INT_GPIO9F 59 127#define AB8500_INT_GPIO9F 59 /* not 8505/9540 */
130#define AB8500_INT_GPIO10F 60 128#define AB8500_INT_GPIO10F 60
131#define AB8500_INT_GPIO11F 61 129#define AB8500_INT_GPIO11F 61
132#define AB8500_INT_GPIO12F 62 130#define AB8500_INT_GPIO12F 62 /* not 8505 */
133#define AB8500_INT_GPIO13F 63 131#define AB8500_INT_GPIO13F 63
134/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */ 132/* ab8500_irq_regoffset[8] -> IT[Source|Latch|Mask]10 */
135#define AB8500_INT_GPIO24F 64 133#define AB8500_INT_GPIO24F 64 /* not 8505 */
136#define AB8500_INT_GPIO25F 65 134#define AB8500_INT_GPIO25F 65 /* not 8505 */
137#define AB8500_INT_GPIO36F 66 135#define AB8500_INT_GPIO36F 66 /* not 8505/9540 */
138#define AB8500_INT_GPIO37F 67 136#define AB8500_INT_GPIO37F 67 /* not 8505/9540 */
139#define AB8500_INT_GPIO38F 68 137#define AB8500_INT_GPIO38F 68 /* not 8505/9540 */
140#define AB8500_INT_GPIO39F 69 138#define AB8500_INT_GPIO39F 69 /* not 8505/9540 */
141#define AB8500_INT_GPIO40F 70 139#define AB8500_INT_GPIO40F 70
142#define AB8500_INT_GPIO41F 71 140#define AB8500_INT_GPIO41F 71
143/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */ 141/* ab8500_irq_regoffset[9] -> IT[Source|Latch|Mask]12 */
@@ -154,7 +152,8 @@ enum ab8500_version {
154#define AB8500_INT_BTEMP_MEDIUM_HIGH 82 152#define AB8500_INT_BTEMP_MEDIUM_HIGH 82
155#define AB8500_INT_BTEMP_HIGH 83 153#define AB8500_INT_BTEMP_HIGH 83
156/* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */ 154/* ab8500_irq_regoffset[11] -> IT[Source|Latch|Mask]20 */
157#define AB8500_INT_USB_CHARGER_NOT_OK 89 155#define AB8500_INT_SRP_DETECT 88
156#define AB8500_INT_USB_CHARGER_NOT_OKR 89
158#define AB8500_INT_ID_WAKEUP_R 90 157#define AB8500_INT_ID_WAKEUP_R 90
159#define AB8500_INT_ID_DET_R1R 92 158#define AB8500_INT_ID_DET_R1R 92
160#define AB8500_INT_ID_DET_R2R 93 159#define AB8500_INT_ID_DET_R2R 93
@@ -166,29 +165,32 @@ enum ab8500_version {
166#define AB8500_INT_ID_DET_R2F 99 165#define AB8500_INT_ID_DET_R2F 99
167#define AB8500_INT_ID_DET_R3F 100 166#define AB8500_INT_ID_DET_R3F 100
168#define AB8500_INT_ID_DET_R4F 101 167#define AB8500_INT_ID_DET_R4F 101
169#define AB8500_INT_USB_CHG_DET_DONE 102 168#define AB8500_INT_CHAUTORESTARTAFTSEC 102
169#define AB8500_INT_CHSTOPBYSEC 103
170/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */ 170/* ab8500_irq_regoffset[13] -> IT[Source|Latch|Mask]22 */
171#define AB8500_INT_USB_CH_TH_PROT_F 104 171#define AB8500_INT_USB_CH_TH_PROT_F 104
172#define AB8500_INT_USB_CH_TH_PROT_R 105 172#define AB8500_INT_USB_CH_TH_PROT_R 105
173#define AB8500_INT_MAIN_CH_TH_PROT_F 106 173#define AB8500_INT_MAIN_CH_TH_PROT_F 106 /* not 8505/9540 */
174#define AB8500_INT_MAIN_CH_TH_PROT_R 107 174#define AB8500_INT_MAIN_CH_TH_PROT_R 107 /* not 8505/9540 */
175#define AB8500_INT_USB_CHARGER_NOT_OKF 111 175#define AB8500_INT_CHCURLIMNOHSCHIRP 109
176#define AB8500_INT_CHCURLIMHSCHIRP 110
177#define AB8500_INT_XTAL32K_KO 111
176 178
177/* Definitions for AB9540 */ 179/* Definitions for AB9540 */
178/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */ 180/* ab8500_irq_regoffset[14] -> IT[Source|Latch|Mask]13 */
179#define AB9540_INT_GPIO50R 113 181#define AB9540_INT_GPIO50R 113
180#define AB9540_INT_GPIO51R 114 182#define AB9540_INT_GPIO51R 114 /* not 8505 */
181#define AB9540_INT_GPIO52R 115 183#define AB9540_INT_GPIO52R 115
182#define AB9540_INT_GPIO53R 116 184#define AB9540_INT_GPIO53R 116
183#define AB9540_INT_GPIO54R 117 185#define AB9540_INT_GPIO54R 117 /* not 8505 */
184#define AB9540_INT_IEXT_CH_RF_BFN_R 118 186#define AB9540_INT_IEXT_CH_RF_BFN_R 118
185#define AB9540_INT_IEXT_CH_RF_BFN_F 119 187#define AB9540_INT_IEXT_CH_RF_BFN_F 119
186/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */ 188/* ab8500_irq_regoffset[15] -> IT[Source|Latch|Mask]14 */
187#define AB9540_INT_GPIO50F 121 189#define AB9540_INT_GPIO50F 121
188#define AB9540_INT_GPIO51F 122 190#define AB9540_INT_GPIO51F 122 /* not 8505 */
189#define AB9540_INT_GPIO52F 123 191#define AB9540_INT_GPIO52F 123
190#define AB9540_INT_GPIO53F 124 192#define AB9540_INT_GPIO53F 124
191#define AB9540_INT_GPIO54F 125 193#define AB9540_INT_GPIO54F 125 /* not 8505 */
192 194
193/* 195/*
194 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 196 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the
@@ -198,6 +200,7 @@ enum ab8500_version {
198 * which is larger. 200 * which is larger.
199 */ 201 */
200#define AB8500_NR_IRQS 112 202#define AB8500_NR_IRQS 112
203#define AB8505_NR_IRQS 128
201#define AB9540_NR_IRQS 128 204#define AB9540_NR_IRQS 128
202/* This is set to the roof of any AB8500 chip variant IRQ counts */ 205/* This is set to the roof of any AB8500 chip variant IRQ counts */
203#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS 206#define AB8500_MAX_NR_IRQS AB9540_NR_IRQS
@@ -292,16 +295,28 @@ static inline int is_ab8540(struct ab8500 *ab)
292 return ab->version == AB8500_VERSION_AB8540; 295 return ab->version == AB8500_VERSION_AB8540;
293} 296}
294 297
295/* include also ab8505, ab9540... */ 298/* exclude also ab8505, ab9540... */
299static inline int is_ab8500_1p0_or_earlier(struct ab8500 *ab)
300{
301 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P0));
302}
303
304/* exclude also ab8505, ab9540... */
296static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab) 305static inline int is_ab8500_1p1_or_earlier(struct ab8500 *ab)
297{ 306{
298 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1)); 307 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT1P1));
299} 308}
300 309
301/* include also ab8505, ab9540... */ 310/* exclude also ab8505, ab9540... */
302static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab) 311static inline int is_ab8500_2p0_or_earlier(struct ab8500 *ab)
303{ 312{
304 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0)); 313 return (is_ab8500(ab) && (ab->chip_id <= AB8500_CUT2P0));
305} 314}
306 315
316/* exclude also ab8505, ab9540... */
317static inline int is_ab8500_2p0(struct ab8500 *ab)
318{
319 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
320}
321
307#endif /* MFD_AB8500_H */ 322#endif /* MFD_AB8500_H */