aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/i2c')
-rw-r--r--include/linux/i2c/adp5588.h12
-rw-r--r--include/linux/i2c/pca953x.h11
-rw-r--r--include/linux/i2c/tps65010.h19
-rw-r--r--include/linux/i2c/twl.h (renamed from include/linux/i2c/twl4030.h)260
4 files changed, 277 insertions, 25 deletions
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h
index fc5db826b48e..02c9af374741 100644
--- a/include/linux/i2c/adp5588.h
+++ b/include/linux/i2c/adp5588.h
@@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data {
89 unsigned short unlock_key2; /* Unlock Key 2 */ 89 unsigned short unlock_key2; /* Unlock Key 2 */
90}; 90};
91 91
92struct adp5588_gpio_platform_data {
93 unsigned gpio_start; /* GPIO Chip base # */
94 unsigned pullup_dis_mask; /* Pull-Up Disable Mask */
95 int (*setup)(struct i2c_client *client,
96 int gpio, unsigned ngpio,
97 void *context);
98 int (*teardown)(struct i2c_client *client,
99 int gpio, unsigned ngpio,
100 void *context);
101 void *context;
102};
103
92#endif 104#endif
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 81736d6a8db7..d5c5a60c8a0b 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -1,3 +1,9 @@
1#ifndef _LINUX_PCA953X_H
2#define _LINUX_PCA953X_H
3
4#include <linux/types.h>
5#include <linux/i2c.h>
6
1/* platform data for the PCA9539 16-bit I/O expander driver */ 7/* platform data for the PCA9539 16-bit I/O expander driver */
2 8
3struct pca953x_platform_data { 9struct pca953x_platform_data {
@@ -7,6 +13,9 @@ struct pca953x_platform_data {
7 /* initial polarity inversion setting */ 13 /* initial polarity inversion setting */
8 uint16_t invert; 14 uint16_t invert;
9 15
16 /* interrupt base */
17 int irq_base;
18
10 void *context; /* param to setup/teardown */ 19 void *context; /* param to setup/teardown */
11 20
12 int (*setup)(struct i2c_client *client, 21 int (*setup)(struct i2c_client *client,
@@ -17,3 +26,5 @@ struct pca953x_platform_data {
17 void *context); 26 void *context);
18 char **names; 27 char **names;
19}; 28};
29
30#endif /* _LINUX_PCA953X_H */
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h
index 918c5354d9b8..08aa92278d71 100644
--- a/include/linux/i2c/tps65010.h
+++ b/include/linux/i2c/tps65010.h
@@ -72,6 +72,21 @@
72#define TPS_VDCDC1 0x0c 72#define TPS_VDCDC1 0x0c
73# define TPS_ENABLE_LP (1 << 3) 73# define TPS_ENABLE_LP (1 << 3)
74#define TPS_VDCDC2 0x0d 74#define TPS_VDCDC2 0x0d
75# define TPS_LP_COREOFF (1 << 7)
76# define TPS_VCORE_1_8V (7<<4)
77# define TPS_VCORE_1_5V (6 << 4)
78# define TPS_VCORE_1_4V (5 << 4)
79# define TPS_VCORE_1_3V (4 << 4)
80# define TPS_VCORE_1_2V (3 << 4)
81# define TPS_VCORE_1_1V (2 << 4)
82# define TPS_VCORE_1_0V (1 << 4)
83# define TPS_VCORE_0_85V (0 << 4)
84# define TPS_VCORE_LP_1_2V (3 << 2)
85# define TPS_VCORE_LP_1_1V (2 << 2)
86# define TPS_VCORE_LP_1_0V (1 << 2)
87# define TPS_VCORE_LP_0_85V (0 << 2)
88# define TPS_VIB (1 << 1)
89# define TPS_VCORE_DISCH (1 << 0)
75#define TPS_VREGS1 0x0e 90#define TPS_VREGS1 0x0e
76# define TPS_LDO2_ENABLE (1 << 7) 91# define TPS_LDO2_ENABLE (1 << 7)
77# define TPS_LDO2_OFF (1 << 6) 92# define TPS_LDO2_OFF (1 << 6)
@@ -152,6 +167,10 @@ extern int tps65010_config_vregs1(unsigned value);
152 */ 167 */
153extern int tps65013_set_low_pwr(unsigned mode); 168extern int tps65013_set_low_pwr(unsigned mode);
154 169
170/* tps65010_set_vdcdc2
171 * value to be written to VDCDC2
172 */
173extern int tps65010_config_vdcdc2(unsigned value);
155 174
156struct i2c_client; 175struct i2c_client;
157 176
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl.h
index 508824ee35e6..fb6784e86d5f 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl.h
@@ -22,8 +22,8 @@
22 * 22 *
23 */ 23 */
24 24
25#ifndef __TWL4030_H_ 25#ifndef __TWL_H_
26#define __TWL4030_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/input/matrix_keypad.h> 29#include <linux/input/matrix_keypad.h>
@@ -61,28 +61,117 @@
61#define TWL4030_MODULE_PWMA 0x0E 61#define TWL4030_MODULE_PWMA 0x0E
62#define TWL4030_MODULE_PWMB 0x0F 62#define TWL4030_MODULE_PWMB 0x0F
63 63
64#define TWL5031_MODULE_ACCESSORY 0x10
65#define TWL5031_MODULE_INTERRUPTS 0x11
66
64/* Slave 3 (i2c address 0x4b) */ 67/* Slave 3 (i2c address 0x4b) */
65#define TWL4030_MODULE_BACKUP 0x10 68#define TWL4030_MODULE_BACKUP 0x12
66#define TWL4030_MODULE_INT 0x11 69#define TWL4030_MODULE_INT 0x13
67#define TWL4030_MODULE_PM_MASTER 0x12 70#define TWL4030_MODULE_PM_MASTER 0x14
68#define TWL4030_MODULE_PM_RECEIVER 0x13 71#define TWL4030_MODULE_PM_RECEIVER 0x15
69#define TWL4030_MODULE_RTC 0x14 72#define TWL4030_MODULE_RTC 0x16
70#define TWL4030_MODULE_SECURED_REG 0x15 73#define TWL4030_MODULE_SECURED_REG 0x17
74
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
84
85#define TWL6030_MODULE_ID0 0x0D
86#define TWL6030_MODULE_ID1 0x0E
87#define TWL6030_MODULE_ID2 0x0F
88
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 BCI_PRES_INTR_OFFSET 9
95#define USB_PRES_INTR_OFFSET 10
96#define RTC_INTR_OFFSET 11
97
98/*
99 * Offset from TWL6030_IRQ_BASE / pdata->irq_base
100 */
101#define PWR_INTR_OFFSET 0
102#define HOTDIE_INTR_OFFSET 12
103#define SMPSLDO_INTR_OFFSET 13
104#define BATDETECT_INTR_OFFSET 14
105#define SIMDETECT_INTR_OFFSET 15
106#define MMCDETECT_INTR_OFFSET 16
107#define GASGAUGE_INTR_OFFSET 17
108#define USBOTG_INTR_OFFSET 4
109#define CHARGER_INTR_OFFSET 2
110#define RSV_INTR_OFFSET 0
111
112/* INT register offsets */
113#define REG_INT_STS_A 0x00
114#define REG_INT_STS_B 0x01
115#define REG_INT_STS_C 0x02
116
117#define REG_INT_MSK_LINE_A 0x03
118#define REG_INT_MSK_LINE_B 0x04
119#define REG_INT_MSK_LINE_C 0x05
120
121#define REG_INT_MSK_STS_A 0x06
122#define REG_INT_MSK_STS_B 0x07
123#define REG_INT_MSK_STS_C 0x08
124
125/* MASK INT REG GROUP A */
126#define TWL6030_PWR_INT_MASK 0x07
127#define TWL6030_RTC_INT_MASK 0x18
128#define TWL6030_HOTDIE_INT_MASK 0x20
129#define TWL6030_SMPSLDOA_INT_MASK 0xC0
130
131/* MASK INT REG GROUP B */
132#define TWL6030_SMPSLDOB_INT_MASK 0x01
133#define TWL6030_BATDETECT_INT_MASK 0x02
134#define TWL6030_SIMDETECT_INT_MASK 0x04
135#define TWL6030_MMCDETECT_INT_MASK 0x08
136#define TWL6030_GPADC_INT_MASK 0x60
137#define TWL6030_GASGAUGE_INT_MASK 0x80
138
139/* MASK INT REG GROUP C */
140#define TWL6030_USBOTG_INT_MASK 0x0F
141#define TWL6030_CHARGER_CTRL_INT_MASK 0x10
142#define TWL6030_CHARGER_FAULT_INT_MASK 0x60
143
144
145#define TWL4030_CLASS_ID 0x4030
146#define TWL6030_CLASS_ID 0x6030
147unsigned int twl_rev(void);
148#define GET_TWL_REV (twl_rev())
149#define TWL_CLASS_IS(class, id) \
150static inline int twl_class_is_ ##class(void) \
151{ \
152 return ((id) == (GET_TWL_REV)) ? 1 : 0; \
153}
154
155TWL_CLASS_IS(4030, TWL4030_CLASS_ID)
156TWL_CLASS_IS(6030, TWL6030_CLASS_ID)
71 157
72/* 158/*
73 * Read and write single 8-bit registers 159 * Read and write single 8-bit registers
74 */ 160 */
75int twl4030_i2c_write_u8(u8 mod_no, u8 val, u8 reg); 161int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg);
76int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); 162int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
77 163
78/* 164/*
79 * Read and write several 8-bit registers at once. 165 * Read and write several 8-bit registers at once.
80 * 166 *
81 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 167 * IMPORTANT: For twl_i2c_write(), allocate num_bytes + 1
82 * for the value, and populate your data starting at offset 1. 168 * for the value, and populate your data starting at offset 1.
83 */ 169 */
84int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 170int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
85int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); 171int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
172
173int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
174int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
86 175
87/*----------------------------------------------------------------------*/ 176/*----------------------------------------------------------------------*/
88 177
@@ -155,6 +244,21 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
155 244
156/*----------------------------------------------------------------------*/ 245/*----------------------------------------------------------------------*/
157 246
247/*Interface Bit Register (INTBR) offsets
248 *(Use TWL_4030_MODULE_INTBR)
249 */
250
251#define REG_GPPUPDCTR1 0x0F
252
253/*I2C1 and I2C4(SR) SDA/SCL pull-up control bits */
254
255#define I2C_SCL_CTRL_PU BIT(0)
256#define I2C_SDA_CTRL_PU BIT(2)
257#define SR_I2C_SCL_CTRL_PU BIT(4)
258#define SR_I2C_SDA_CTRL_PU BIT(6)
259
260/*----------------------------------------------------------------------*/
261
158/* 262/*
159 * Keypad register offsets (use TWL4030_MODULE_KEYPAD) 263 * Keypad register offsets (use TWL4030_MODULE_KEYPAD)
160 * ... SIH/interrupt only 264 * ... SIH/interrupt only
@@ -221,6 +325,38 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
221 325
222/*----------------------------------------------------------------------*/ 326/*----------------------------------------------------------------------*/
223 327
328/*
329 * Accessory Interrupts
330 */
331#define TWL5031_ACIIMR_LSB 0x05
332#define TWL5031_ACIIMR_MSB 0x06
333#define TWL5031_ACIIDR_LSB 0x07
334#define TWL5031_ACIIDR_MSB 0x08
335#define TWL5031_ACCISR1 0x0F
336#define TWL5031_ACCIMR1 0x10
337#define TWL5031_ACCISR2 0x11
338#define TWL5031_ACCIMR2 0x12
339#define TWL5031_ACCSIR 0x13
340#define TWL5031_ACCEDR1 0x14
341#define TWL5031_ACCSIHCTRL 0x15
342
343/*----------------------------------------------------------------------*/
344
345/*
346 * Battery Charger Controller
347 */
348
349#define TWL5031_INTERRUPTS_BCIISR1 0x0
350#define TWL5031_INTERRUPTS_BCIIMR1 0x1
351#define TWL5031_INTERRUPTS_BCIISR2 0x2
352#define TWL5031_INTERRUPTS_BCIIMR2 0x3
353#define TWL5031_INTERRUPTS_BCISIR 0x4
354#define TWL5031_INTERRUPTS_BCIEDR1 0x5
355#define TWL5031_INTERRUPTS_BCIEDR2 0x6
356#define TWL5031_INTERRUPTS_BCISIHCTRL 0x7
357
358/*----------------------------------------------------------------------*/
359
224/* Power bus message definitions */ 360/* Power bus message definitions */
225 361
226/* The TWL4030/5030 splits its power-management resources (the various 362/* The TWL4030/5030 splits its power-management resources (the various
@@ -250,6 +386,7 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
250 386
251#define RES_TYPE_ALL 0x7 387#define RES_TYPE_ALL 0x7
252 388
389/* Resource states */
253#define RES_STATE_WRST 0xF 390#define RES_STATE_WRST 0xF
254#define RES_STATE_ACTIVE 0xE 391#define RES_STATE_ACTIVE 0xE
255#define RES_STATE_SLEEP 0x8 392#define RES_STATE_SLEEP 0x8
@@ -310,8 +447,18 @@ int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
310#define MSG_SINGULAR(devgrp, id, state) \ 447#define MSG_SINGULAR(devgrp, id, state) \
311 ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state)) 448 ((devgrp) << 13 | 0 << 12 | (id) << 4 | (state))
312 449
450#define MSG_BROADCAST_ALL(devgrp, state) \
451 ((devgrp) << 5 | (state))
452
453#define MSG_BROADCAST_REF MSG_BROADCAST_ALL
454#define MSG_BROADCAST_PROV MSG_BROADCAST_ALL
455#define MSG_BROADCAST__CLK_RST MSG_BROADCAST_ALL
313/*----------------------------------------------------------------------*/ 456/*----------------------------------------------------------------------*/
314 457
458struct twl4030_clock_init_data {
459 bool ck32k_lowpwr_enable;
460};
461
315struct twl4030_bci_platform_data { 462struct twl4030_bci_platform_data {
316 int *battery_tmp_tbl; 463 int *battery_tmp_tbl;
317 unsigned int tblsize; 464 unsigned int tblsize;
@@ -391,38 +538,78 @@ struct twl4030_resconfig {
391 u8 devgroup; /* Processor group that Power resource belongs to */ 538 u8 devgroup; /* Processor group that Power resource belongs to */
392 u8 type; /* Power resource addressed, 6 / broadcast message */ 539 u8 type; /* Power resource addressed, 6 / broadcast message */
393 u8 type2; /* Power resource addressed, 3 / broadcast message */ 540 u8 type2; /* Power resource addressed, 3 / broadcast message */
541 u8 remap_off; /* off state remapping */
542 u8 remap_sleep; /* sleep state remapping */
394}; 543};
395 544
396struct twl4030_power_data { 545struct twl4030_power_data {
397 struct twl4030_script **scripts; 546 struct twl4030_script **scripts;
398 unsigned num; 547 unsigned num;
399 struct twl4030_resconfig *resource_config; 548 struct twl4030_resconfig *resource_config;
549#define TWL4030_RESCONFIG_UNDEF ((u8)-1)
400}; 550};
401 551
402extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); 552extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts);
553extern int twl4030_remove_script(u8 flags);
554
555struct twl4030_codec_audio_data {
556 unsigned int audio_mclk;
557 unsigned int ramp_delay_value;
558 unsigned int hs_extmute:1;
559 void (*set_hs_extmute)(int mute);
560};
561
562struct twl4030_codec_vibra_data {
563 unsigned int audio_mclk;
564 unsigned int coexist;
565};
566
567struct twl4030_codec_data {
568 unsigned int audio_mclk;
569 struct twl4030_codec_audio_data *audio;
570 struct twl4030_codec_vibra_data *vibra;
571
572 /* twl6030 */
573 int audpwron_gpio; /* audio power-on gpio */
574 int naudint_irq; /* audio interrupt */
575};
403 576
404struct twl4030_platform_data { 577struct twl4030_platform_data {
405 unsigned irq_base, irq_end; 578 unsigned irq_base, irq_end;
579 struct twl4030_clock_init_data *clock;
406 struct twl4030_bci_platform_data *bci; 580 struct twl4030_bci_platform_data *bci;
407 struct twl4030_gpio_platform_data *gpio; 581 struct twl4030_gpio_platform_data *gpio;
408 struct twl4030_madc_platform_data *madc; 582 struct twl4030_madc_platform_data *madc;
409 struct twl4030_keypad_data *keypad; 583 struct twl4030_keypad_data *keypad;
410 struct twl4030_usb_data *usb; 584 struct twl4030_usb_data *usb;
411 struct twl4030_power_data *power; 585 struct twl4030_power_data *power;
586 struct twl4030_codec_data *codec;
412 587
413 /* LDO regulators */ 588 /* Common LDO regulators for TWL4030/TWL6030 */
414 struct regulator_init_data *vdac; 589 struct regulator_init_data *vdac;
590 struct regulator_init_data *vaux1;
591 struct regulator_init_data *vaux2;
592 struct regulator_init_data *vaux3;
593 /* TWL4030 LDO regulators */
415 struct regulator_init_data *vpll1; 594 struct regulator_init_data *vpll1;
416 struct regulator_init_data *vpll2; 595 struct regulator_init_data *vpll2;
417 struct regulator_init_data *vmmc1; 596 struct regulator_init_data *vmmc1;
418 struct regulator_init_data *vmmc2; 597 struct regulator_init_data *vmmc2;
419 struct regulator_init_data *vsim; 598 struct regulator_init_data *vsim;
420 struct regulator_init_data *vaux1;
421 struct regulator_init_data *vaux2;
422 struct regulator_init_data *vaux3;
423 struct regulator_init_data *vaux4; 599 struct regulator_init_data *vaux4;
424 600 struct regulator_init_data *vio;
425 /* REVISIT more to come ... _nothing_ should be hard-wired */ 601 struct regulator_init_data *vdd1;
602 struct regulator_init_data *vdd2;
603 struct regulator_init_data *vintana1;
604 struct regulator_init_data *vintana2;
605 struct regulator_init_data *vintdig;
606 /* TWL6030 LDO regulators */
607 struct regulator_init_data *vmmc;
608 struct regulator_init_data *vpp;
609 struct regulator_init_data *vusim;
610 struct regulator_init_data *vana;
611 struct regulator_init_data *vcxio;
612 struct regulator_init_data *vusb;
426}; 613};
427 614
428/*----------------------------------------------------------------------*/ 615/*----------------------------------------------------------------------*/
@@ -439,12 +626,7 @@ int twl4030_sih_setup(int module);
439#define TWL4030_VAUX3_DEV_GRP 0x1F 626#define TWL4030_VAUX3_DEV_GRP 0x1F
440#define TWL4030_VAUX3_DEDICATED 0x22 627#define TWL4030_VAUX3_DEDICATED 0x22
441 628
442#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 629static inline int twl4030charger_usb_en(int enable) { return 0; }
443 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
444 extern int twl4030charger_usb_en(int enable);
445#else
446 static inline int twl4030charger_usb_en(int enable) { return 0; }
447#endif
448 630
449/*----------------------------------------------------------------------*/ 631/*----------------------------------------------------------------------*/
450 632
@@ -454,6 +636,7 @@ int twl4030_sih_setup(int module);
454 * VIO is generally fixed. 636 * VIO is generally fixed.
455 */ 637 */
456 638
639/* TWL4030 SMPS/LDO's */
457/* EXTERNAL dc-to-dc buck converters */ 640/* EXTERNAL dc-to-dc buck converters */
458#define TWL4030_REG_VDD1 0 641#define TWL4030_REG_VDD1 0
459#define TWL4030_REG_VDD2 1 642#define TWL4030_REG_VDD2 1
@@ -480,4 +663,31 @@ int twl4030_sih_setup(int module);
480#define TWL4030_REG_VUSB1V8 18 663#define TWL4030_REG_VUSB1V8 18
481#define TWL4030_REG_VUSB3V1 19 664#define TWL4030_REG_VUSB3V1 19
482 665
666/* TWL6030 SMPS/LDO's */
667/* EXTERNAL dc-to-dc buck convertor contollable via SR */
668#define TWL6030_REG_VDD1 30
669#define TWL6030_REG_VDD2 31
670#define TWL6030_REG_VDD3 32
671
672/* Non SR compliant dc-to-dc buck convertors */
673#define TWL6030_REG_VMEM 33
674#define TWL6030_REG_V2V1 34
675#define TWL6030_REG_V1V29 35
676#define TWL6030_REG_V1V8 36
677
678/* EXTERNAL LDOs */
679#define TWL6030_REG_VAUX1_6030 37
680#define TWL6030_REG_VAUX2_6030 38
681#define TWL6030_REG_VAUX3_6030 39
682#define TWL6030_REG_VMMC 40
683#define TWL6030_REG_VPP 41
684#define TWL6030_REG_VUSIM 42
685#define TWL6030_REG_VANA 43
686#define TWL6030_REG_VCXIO 44
687#define TWL6030_REG_VDAC 45
688#define TWL6030_REG_VUSB 46
689
690/* INTERNAL LDOs */
691#define TWL6030_REG_VRTC 47
692
483#endif /* End of __TWL4030_H */ 693#endif /* End of __TWL4030_H */