Go to the documentation of this file.
28 #include <linux/types.h>
43 #define TWL4030_MODULE_USB 0x00
46 #define TWL4030_MODULE_AUDIO_VOICE 0x01
47 #define TWL4030_MODULE_GPIO 0x02
48 #define TWL4030_MODULE_INTBR 0x03
49 #define TWL4030_MODULE_PIH 0x04
50 #define TWL4030_MODULE_TEST 0x05
53 #define TWL4030_MODULE_KEYPAD 0x06
54 #define TWL4030_MODULE_MADC 0x07
55 #define TWL4030_MODULE_INTERRUPTS 0x08
56 #define TWL4030_MODULE_LED 0x09
57 #define TWL4030_MODULE_MAIN_CHARGE 0x0A
58 #define TWL4030_MODULE_PRECHARGE 0x0B
59 #define TWL4030_MODULE_PWM0 0x0C
60 #define TWL4030_MODULE_PWM1 0x0D
61 #define TWL4030_MODULE_PWMA 0x0E
62 #define TWL4030_MODULE_PWMB 0x0F
64 #define TWL5031_MODULE_ACCESSORY 0x10
65 #define TWL5031_MODULE_INTERRUPTS 0x11
68 #define TWL4030_MODULE_BACKUP 0x12
69 #define TWL4030_MODULE_INT 0x13
70 #define TWL4030_MODULE_PM_MASTER 0x14
71 #define TWL4030_MODULE_PM_RECEIVER 0x15
72 #define TWL4030_MODULE_RTC 0x16
73 #define TWL4030_MODULE_SECURED_REG 0x17
75 #define TWL_MODULE_USB TWL4030_MODULE_USB
76 #define TWL_MODULE_AUDIO_VOICE TWL4030_MODULE_AUDIO_VOICE
77 #define TWL_MODULE_PIH TWL4030_MODULE_PIH
78 #define TWL_MODULE_MADC TWL4030_MODULE_MADC
79 #define TWL_MODULE_MAIN_CHARGE TWL4030_MODULE_MAIN_CHARGE
80 #define TWL_MODULE_PM_MASTER TWL4030_MODULE_PM_MASTER
81 #define TWL_MODULE_PM_RECEIVER TWL4030_MODULE_PM_RECEIVER
82 #define TWL_MODULE_RTC TWL4030_MODULE_RTC
83 #define TWL_MODULE_PWM TWL4030_MODULE_PWM0
85 #define TWL6030_MODULE_ID0 0x0D
86 #define TWL6030_MODULE_ID1 0x0E
87 #define TWL6030_MODULE_ID2 0x0F
89 #define GPIO_INTR_OFFSET 0
90 #define KEYPAD_INTR_OFFSET 1
91 #define BCI_INTR_OFFSET 2
92 #define MADC_INTR_OFFSET 3
93 #define USB_INTR_OFFSET 4
94 #define CHARGERFAULT_INTR_OFFSET 5
95 #define BCI_PRES_INTR_OFFSET 9
96 #define USB_PRES_INTR_OFFSET 10
97 #define RTC_INTR_OFFSET 11
102 #define PWR_INTR_OFFSET 0
103 #define HOTDIE_INTR_OFFSET 12
104 #define SMPSLDO_INTR_OFFSET 13
105 #define BATDETECT_INTR_OFFSET 14
106 #define SIMDETECT_INTR_OFFSET 15
107 #define MMCDETECT_INTR_OFFSET 16
108 #define GASGAUGE_INTR_OFFSET 17
109 #define USBOTG_INTR_OFFSET 4
110 #define CHARGER_INTR_OFFSET 2
111 #define RSV_INTR_OFFSET 0
114 #define REG_INT_STS_A 0x00
115 #define REG_INT_STS_B 0x01
116 #define REG_INT_STS_C 0x02
118 #define REG_INT_MSK_LINE_A 0x03
119 #define REG_INT_MSK_LINE_B 0x04
120 #define REG_INT_MSK_LINE_C 0x05
122 #define REG_INT_MSK_STS_A 0x06
123 #define REG_INT_MSK_STS_B 0x07
124 #define REG_INT_MSK_STS_C 0x08
127 #define TWL6030_PWR_INT_MASK 0x07
128 #define TWL6030_RTC_INT_MASK 0x18
129 #define TWL6030_HOTDIE_INT_MASK 0x20
130 #define TWL6030_SMPSLDOA_INT_MASK 0xC0
133 #define TWL6030_SMPSLDOB_INT_MASK 0x01
134 #define TWL6030_BATDETECT_INT_MASK 0x02
135 #define TWL6030_SIMDETECT_INT_MASK 0x04
136 #define TWL6030_MMCDETECT_INT_MASK 0x08
137 #define TWL6030_GPADC_INT_MASK 0x60
138 #define TWL6030_GASGAUGE_INT_MASK 0x80
141 #define TWL6030_USBOTG_INT_MASK 0x0F
142 #define TWL6030_CHARGER_CTRL_INT_MASK 0x10
143 #define TWL6030_CHARGER_FAULT_INT_MASK 0x60
145 #define TWL6030_MMCCTRL 0xEE
146 #define VMMC_AUTO_OFF (0x1 << 3)
147 #define SW_FC (0x1 << 2)
150 #define TWL6030_CFG_INPUT_PUPD3 0xF2
151 #define MMC_PU (0x1 << 3)
152 #define MMC_PD (0x1 << 2)
154 #define TWL_SIL_TYPE(rev) ((rev) & 0x00FFFFFF)
155 #define TWL_SIL_REV(rev) ((rev) >> 24)
156 #define TWL_SIL_5030 0x09002F
157 #define TWL5030_REV_1_0 0x00
158 #define TWL5030_REV_1_1 0x10
159 #define TWL5030_REV_1_2 0x30
161 #define TWL4030_CLASS_ID 0x4030
162 #define TWL6030_CLASS_ID 0x6030
164 #define GET_TWL_REV (twl_rev())
165 #define TWL_CLASS_IS(class, id) \
166 static inline int twl_class_is_ ##class(void) \
168 return ((id) == (GET_TWL_REV)) ? 1 : 0; \
197 #ifdef CONFIG_TWL4030_CORE
202 pr_debug(
"twl6030_mmc_card_detect_config not supported\n");
208 #ifdef CONFIG_TWL4030_CORE
213 pr_debug(
"Call back twl6030_mmc_card_detect not supported\n");
228 #define TWL4030_SIH_CTRL_EXCLEN_MASK BIT(0)
229 #define TWL4030_SIH_CTRL_PENDDIS_MASK BIT(1)
230 #define TWL4030_SIH_CTRL_COR_MASK BIT(2)
238 #define REG_GPIODATAIN1 0x0
239 #define REG_GPIODATAIN2 0x1
240 #define REG_GPIODATAIN3 0x2
241 #define REG_GPIODATADIR1 0x3
242 #define REG_GPIODATADIR2 0x4
243 #define REG_GPIODATADIR3 0x5
244 #define REG_GPIODATAOUT1 0x6
245 #define REG_GPIODATAOUT2 0x7
246 #define REG_GPIODATAOUT3 0x8
247 #define REG_CLEARGPIODATAOUT1 0x9
248 #define REG_CLEARGPIODATAOUT2 0xA
249 #define REG_CLEARGPIODATAOUT3 0xB
250 #define REG_SETGPIODATAOUT1 0xC
251 #define REG_SETGPIODATAOUT2 0xD
252 #define REG_SETGPIODATAOUT3 0xE
253 #define REG_GPIO_DEBEN1 0xF
254 #define REG_GPIO_DEBEN2 0x10
255 #define REG_GPIO_DEBEN3 0x11
256 #define REG_GPIO_CTRL 0x12
257 #define REG_GPIOPUPDCTR1 0x13
258 #define REG_GPIOPUPDCTR2 0x14
259 #define REG_GPIOPUPDCTR3 0x15
260 #define REG_GPIOPUPDCTR4 0x16
261 #define REG_GPIOPUPDCTR5 0x17
262 #define REG_GPIO_ISR1A 0x19
263 #define REG_GPIO_ISR2A 0x1A
264 #define REG_GPIO_ISR3A 0x1B
265 #define REG_GPIO_IMR1A 0x1C
266 #define REG_GPIO_IMR2A 0x1D
267 #define REG_GPIO_IMR3A 0x1E
268 #define REG_GPIO_ISR1B 0x1F
269 #define REG_GPIO_ISR2B 0x20
270 #define REG_GPIO_ISR3B 0x21
271 #define REG_GPIO_IMR1B 0x22
272 #define REG_GPIO_IMR2B 0x23
273 #define REG_GPIO_IMR3B 0x24
274 #define REG_GPIO_EDR1 0x28
275 #define REG_GPIO_EDR2 0x29
276 #define REG_GPIO_EDR3 0x2A
277 #define REG_GPIO_EDR4 0x2B
278 #define REG_GPIO_EDR5 0x2C
279 #define REG_GPIO_SIH_CTRL 0x2D
284 #define TWL4030_GPIO_MAX 18
292 #define REG_IDCODE_7_0 0x00
293 #define REG_IDCODE_15_8 0x01
294 #define REG_IDCODE_16_23 0x02
295 #define REG_IDCODE_31_24 0x03
296 #define REG_GPPUPDCTR1 0x0F
297 #define REG_UNLOCK_TEST_REG 0x12
301 #define I2C_SCL_CTRL_PU BIT(0)
302 #define I2C_SDA_CTRL_PU BIT(2)
303 #define SR_I2C_SCL_CTRL_PU BIT(4)
304 #define SR_I2C_SDA_CTRL_PU BIT(6)
306 #define TWL_EEPROM_R_UNLOCK 0x49
315 #define TWL4030_KEYPAD_KEYP_ISR1 0x11
316 #define TWL4030_KEYPAD_KEYP_IMR1 0x12
317 #define TWL4030_KEYPAD_KEYP_ISR2 0x13
318 #define TWL4030_KEYPAD_KEYP_IMR2 0x14
319 #define TWL4030_KEYPAD_KEYP_SIR 0x15
320 #define TWL4030_KEYPAD_KEYP_EDR 0x16
321 #define TWL4030_KEYPAD_KEYP_SIH_CTRL 0x17
330 #define TWL4030_MADC_ISR1 0x61
331 #define TWL4030_MADC_IMR1 0x62
332 #define TWL4030_MADC_ISR2 0x63
333 #define TWL4030_MADC_IMR2 0x64
334 #define TWL4030_MADC_SIR 0x65
335 #define TWL4030_MADC_EDR 0x66
336 #define TWL4030_MADC_SIH_CTRL 0x67
344 #define TWL4030_INTERRUPTS_BCIISR1A 0x0
345 #define TWL4030_INTERRUPTS_BCIISR2A 0x1
346 #define TWL4030_INTERRUPTS_BCIIMR1A 0x2
347 #define TWL4030_INTERRUPTS_BCIIMR2A 0x3
348 #define TWL4030_INTERRUPTS_BCIISR1B 0x4
349 #define TWL4030_INTERRUPTS_BCIISR2B 0x5
350 #define TWL4030_INTERRUPTS_BCIIMR1B 0x6
351 #define TWL4030_INTERRUPTS_BCIIMR2B 0x7
352 #define TWL4030_INTERRUPTS_BCISIR1 0x8
353 #define TWL4030_INTERRUPTS_BCISIR2 0x9
354 #define TWL4030_INTERRUPTS_BCIEDR1 0xa
355 #define TWL4030_INTERRUPTS_BCIEDR2 0xb
356 #define TWL4030_INTERRUPTS_BCIEDR3 0xc
357 #define TWL4030_INTERRUPTS_BCISIHCTRL 0xd
365 #define TWL4030_INT_PWR_ISR1 0x0
366 #define TWL4030_INT_PWR_IMR1 0x1
367 #define TWL4030_INT_PWR_ISR2 0x2
368 #define TWL4030_INT_PWR_IMR2 0x3
369 #define TWL4030_INT_PWR_SIR 0x4
370 #define TWL4030_INT_PWR_EDR1 0x5
371 #define TWL4030_INT_PWR_EDR2 0x6
372 #define TWL4030_INT_PWR_SIH_CTRL 0x7
379 #define TWL5031_ACIIMR_LSB 0x05
380 #define TWL5031_ACIIMR_MSB 0x06
381 #define TWL5031_ACIIDR_LSB 0x07
382 #define TWL5031_ACIIDR_MSB 0x08
383 #define TWL5031_ACCISR1 0x0F
384 #define TWL5031_ACCIMR1 0x10
385 #define TWL5031_ACCISR2 0x11
386 #define TWL5031_ACCIMR2 0x12
387 #define TWL5031_ACCSIR 0x13
388 #define TWL5031_ACCEDR1 0x14
389 #define TWL5031_ACCSIHCTRL 0x15
397 #define TWL5031_INTERRUPTS_BCIISR1 0x0
398 #define TWL5031_INTERRUPTS_BCIIMR1 0x1
399 #define TWL5031_INTERRUPTS_BCIISR2 0x2
400 #define TWL5031_INTERRUPTS_BCIIMR2 0x3
401 #define TWL5031_INTERRUPTS_BCISIR 0x4
402 #define TWL5031_INTERRUPTS_BCIEDR1 0x5
403 #define TWL5031_INTERRUPTS_BCIEDR2 0x6
404 #define TWL5031_INTERRUPTS_BCISIHCTRL 0x7
412 #define TWL4030_PM_MASTER_CFG_P1_TRANSITION 0x00
413 #define TWL4030_PM_MASTER_CFG_P2_TRANSITION 0x01
414 #define TWL4030_PM_MASTER_CFG_P3_TRANSITION 0x02
415 #define TWL4030_PM_MASTER_CFG_P123_TRANSITION 0x03
416 #define TWL4030_PM_MASTER_STS_BOOT 0x04
417 #define TWL4030_PM_MASTER_CFG_BOOT 0x05
418 #define TWL4030_PM_MASTER_SHUNDAN 0x06
419 #define TWL4030_PM_MASTER_BOOT_BCI 0x07
420 #define TWL4030_PM_MASTER_CFG_PWRANA1 0x08
421 #define TWL4030_PM_MASTER_CFG_PWRANA2 0x09
422 #define TWL4030_PM_MASTER_BACKUP_MISC_STS 0x0b
423 #define TWL4030_PM_MASTER_BACKUP_MISC_CFG 0x0c
424 #define TWL4030_PM_MASTER_BACKUP_MISC_TST 0x0d
425 #define TWL4030_PM_MASTER_PROTECT_KEY 0x0e
426 #define TWL4030_PM_MASTER_STS_HW_CONDITIONS 0x0f
427 #define TWL4030_PM_MASTER_P1_SW_EVENTS 0x10
428 #define TWL4030_PM_MASTER_P2_SW_EVENTS 0x11
429 #define TWL4030_PM_MASTER_P3_SW_EVENTS 0x12
430 #define TWL4030_PM_MASTER_STS_P123_STATE 0x13
431 #define TWL4030_PM_MASTER_PB_CFG 0x14
432 #define TWL4030_PM_MASTER_PB_WORD_MSB 0x15
433 #define TWL4030_PM_MASTER_PB_WORD_LSB 0x16
434 #define TWL4030_PM_MASTER_SEQ_ADD_W2P 0x1c
435 #define TWL4030_PM_MASTER_SEQ_ADD_P2A 0x1d
436 #define TWL4030_PM_MASTER_SEQ_ADD_A2W 0x1e
437 #define TWL4030_PM_MASTER_SEQ_ADD_A2S 0x1f
438 #define TWL4030_PM_MASTER_SEQ_ADD_S2A12 0x20
439 #define TWL4030_PM_MASTER_SEQ_ADD_S2A3 0x21
440 #define TWL4030_PM_MASTER_SEQ_ADD_WARM 0x22
441 #define TWL4030_PM_MASTER_MEMORY_ADDRESS 0x23
442 #define TWL4030_PM_MASTER_MEMORY_DATA 0x24
444 #define TWL4030_PM_MASTER_KEY_CFG1 0xc0
445 #define TWL4030_PM_MASTER_KEY_CFG2 0x0c
447 #define TWL4030_PM_MASTER_KEY_TST1 0xe0
448 #define TWL4030_PM_MASTER_KEY_TST2 0x0e
450 #define TWL4030_PM_MASTER_GLOBAL_TST 0xb6
464 #define DEV_GRP_NULL 0x0
465 #define DEV_GRP_P1 0x1
466 #define DEV_GRP_P2 0x2
467 #define DEV_GRP_P3 0x4
470 #define RES_GRP_RES 0x0
471 #define RES_GRP_PP 0x1
472 #define RES_GRP_RC 0x2
473 #define RES_GRP_PP_RC 0x3
474 #define RES_GRP_PR 0x4
475 #define RES_GRP_PP_PR 0x5
476 #define RES_GRP_RC_PR 0x6
477 #define RES_GRP_ALL 0x7
479 #define RES_TYPE2_R0 0x0
481 #define RES_TYPE_ALL 0x7
484 #define RES_STATE_WRST 0xF
485 #define RES_STATE_ACTIVE 0xE
486 #define RES_STATE_SLEEP 0x8
487 #define RES_STATE_OFF 0x0
502 #define RES_VINTANA1 11
503 #define RES_VINTANA2 12
504 #define RES_VINTDIG 13
508 #define RES_VUSB_1V5 17
509 #define RES_VUSB_1V8 18
510 #define RES_VUSB_3V1 19
511 #define RES_VUSBCP 20
514 #define RES_NRES_PWRON 22
517 #define RES_HFCLKOUT 25
518 #define RES_32KCLKOUT 26
521 #define RES_MAIN_REF 28
523 #define TOTAL_RESOURCES 28
537 #define MSG_BROADCAST(devgrp, grp, type, type2, state) \
538 ( (devgrp) << 13 | 1 << 12 | (grp) << 9 | (type2) << 7 \
539 | (type) << 4 | (state))
541 #define MSG_SINGULAR(devgrp, id, state) \
542 ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
544 #define MSG_BROADCAST_ALL(devgrp, state) \
545 ((devgrp) << 5 | (state))
547 #define MSG_BROADCAST_REF MSG_BROADCAST_ALL
548 #define MSG_BROADCAST_PROV MSG_BROADCAST_ALL
549 #define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL
583 unsigned gpio,
unsigned ngpio);
585 unsigned gpio,
unsigned ngpio);
596 #define PERSISTENT_KEY(r, c) KEY((r), (c), KEY_RESERVED)
633 #define TWL4030_WRST_SCRIPT (1<<0)
634 #define TWL4030_WAKEUP12_SCRIPT (1<<1)
635 #define TWL4030_WAKEUP3_SCRIPT (1<<2)
636 #define TWL4030_SLEEP_SCRIPT (1<<3)
652 #define TWL4030_RESCONFIG_UNDEF ((u8)-1)
747 #define TWL4030_VAUX2 BIT(0)
748 #define TPS_SUBSET BIT(1)
749 #define TWL5031 BIT(2)
750 #define TWL6030_CLASS BIT(3)
751 #define TWL6025_SUBCLASS BIT(4)
752 #define TWL4030_ALLOW_UNSUPPORTED BIT(5)
763 #define TWL4030_VDAC_DEV_GRP 0x3B
764 #define TWL4030_VDAC_DEDICATED 0x3E
765 #define TWL4030_VAUX1_DEV_GRP 0x17
766 #define TWL4030_VAUX1_DEDICATED 0x1A
767 #define TWL4030_VAUX2_DEV_GRP 0x1B
768 #define TWL4030_VAUX2_DEDICATED 0x1E
769 #define TWL4030_VAUX3_DEV_GRP 0x1F
770 #define TWL4030_VAUX3_DEDICATED 0x22
772 static inline int twl4030charger_usb_en(
int enable) {
return 0; }
784 #define TWL4030_REG_VDD1 0
785 #define TWL4030_REG_VDD2 1
786 #define TWL4030_REG_VIO 2
789 #define TWL4030_REG_VDAC 3
790 #define TWL4030_REG_VPLL1 4
791 #define TWL4030_REG_VPLL2 5
792 #define TWL4030_REG_VMMC1 6
793 #define TWL4030_REG_VMMC2 7
794 #define TWL4030_REG_VSIM 8
795 #define TWL4030_REG_VAUX1 9
796 #define TWL4030_REG_VAUX2_4030 10
797 #define TWL4030_REG_VAUX2 11
798 #define TWL4030_REG_VAUX3 12
799 #define TWL4030_REG_VAUX4 13
802 #define TWL4030_REG_VINTANA1 14
803 #define TWL4030_REG_VINTANA2 15
804 #define TWL4030_REG_VINTDIG 16
805 #define TWL4030_REG_VUSB1V5 17
806 #define TWL4030_REG_VUSB1V8 18
807 #define TWL4030_REG_VUSB3V1 19
811 #define TWL6030_REG_VDD1 30
812 #define TWL6030_REG_VDD2 31
813 #define TWL6030_REG_VDD3 32
816 #define TWL6030_REG_VMEM 33
817 #define TWL6030_REG_V2V1 34
818 #define TWL6030_REG_V1V29 35
819 #define TWL6030_REG_V1V8 36
822 #define TWL6030_REG_VAUX1_6030 37
823 #define TWL6030_REG_VAUX2_6030 38
824 #define TWL6030_REG_VAUX3_6030 39
825 #define TWL6030_REG_VMMC 40
826 #define TWL6030_REG_VPP 41
827 #define TWL6030_REG_VUSIM 42
828 #define TWL6030_REG_VANA 43
829 #define TWL6030_REG_VCXIO 44
830 #define TWL6030_REG_VDAC 45
831 #define TWL6030_REG_VUSB 46
834 #define TWL6030_REG_VRTC 47
835 #define TWL6030_REG_CLK32KG 48
838 #define TWL6025_REG_LDO2 49
839 #define TWL6025_REG_LDO4 50
840 #define TWL6025_REG_LDO3 51
841 #define TWL6025_REG_LDO5 52
842 #define TWL6025_REG_LDO1 53
843 #define TWL6025_REG_LDO7 54
844 #define TWL6025_REG_LDO6 55
845 #define TWL6025_REG_LDOLN 56
846 #define TWL6025_REG_LDOUSB 57
849 #define TWL6025_REG_SMPS3 58
850 #define TWL6025_REG_SMPS4 59
851 #define TWL6025_REG_VIO 60