diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2009-12-15 16:04:36 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:17:04 -0500 |
commit | a16122bcacf050e7f83015183053cf799713cc37 (patch) | |
tree | ecbeff86882200fc32d787388cd7aa902bf61505 /include | |
parent | 5c42e8c4a9c86ea26ed4ecb732a842dea0dfb6b6 (diff) |
mfd: Append subdev into 88pm860x driver
Append backlight, led & touch subdevs into 88pm860x driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/88pm860x.h | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h index b4d6018ba0d..d7edf11784f 100644 --- a/include/linux/mfd/88pm860x.h +++ b/include/linux/mfd/88pm860x.h | |||
@@ -14,6 +14,8 @@ | |||
14 | 14 | ||
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | 16 | ||
17 | #define MFD_NAME_SIZE (40) | ||
18 | |||
17 | enum { | 19 | enum { |
18 | CHIP_INVALID = 0, | 20 | CHIP_INVALID = 0, |
19 | CHIP_PM8606, | 21 | CHIP_PM8606, |
@@ -22,6 +24,99 @@ enum { | |||
22 | }; | 24 | }; |
23 | 25 | ||
24 | enum { | 26 | enum { |
27 | PM8606_ID_INVALID, | ||
28 | PM8606_ID_BACKLIGHT, | ||
29 | PM8606_ID_LED, | ||
30 | PM8606_ID_VIBRATOR, | ||
31 | PM8606_ID_TOUCH, | ||
32 | PM8606_ID_SOUND, | ||
33 | PM8606_ID_CHARGER, | ||
34 | PM8606_ID_MAX, | ||
35 | }; | ||
36 | |||
37 | enum { | ||
38 | PM8606_BACKLIGHT1 = 0, | ||
39 | PM8606_BACKLIGHT2, | ||
40 | PM8606_BACKLIGHT3, | ||
41 | }; | ||
42 | |||
43 | enum { | ||
44 | PM8606_LED1_RED = 0, | ||
45 | PM8606_LED1_GREEN, | ||
46 | PM8606_LED1_BLUE, | ||
47 | PM8606_LED2_RED, | ||
48 | PM8606_LED2_GREEN, | ||
49 | PM8606_LED2_BLUE, | ||
50 | PM8607_LED_VIBRATOR, | ||
51 | }; | ||
52 | |||
53 | |||
54 | /* 8606 Registers */ | ||
55 | #define PM8606_DCM_BOOST (0x00) | ||
56 | #define PM8606_PWM (0x01) | ||
57 | |||
58 | /* Backlight Registers */ | ||
59 | #define PM8606_WLED1A (0x02) | ||
60 | #define PM8606_WLED1B (0x03) | ||
61 | #define PM8606_WLED2A (0x04) | ||
62 | #define PM8606_WLED2B (0x05) | ||
63 | #define PM8606_WLED3A (0x06) | ||
64 | #define PM8606_WLED3B (0x07) | ||
65 | |||
66 | /* LED Registers */ | ||
67 | #define PM8606_RGB2A (0x08) | ||
68 | #define PM8606_RGB2B (0x09) | ||
69 | #define PM8606_RGB2C (0x0A) | ||
70 | #define PM8606_RGB2D (0x0B) | ||
71 | #define PM8606_RGB1A (0x0C) | ||
72 | #define PM8606_RGB1B (0x0D) | ||
73 | #define PM8606_RGB1C (0x0E) | ||
74 | #define PM8606_RGB1D (0x0F) | ||
75 | |||
76 | #define PM8606_PREREGULATORA (0x10) | ||
77 | #define PM8606_PREREGULATORB (0x11) | ||
78 | #define PM8606_VIBRATORA (0x12) | ||
79 | #define PM8606_VIBRATORB (0x13) | ||
80 | #define PM8606_VCHG (0x14) | ||
81 | #define PM8606_VSYS (0x15) | ||
82 | #define PM8606_MISC (0x16) | ||
83 | #define PM8606_CHIP_ID (0x17) | ||
84 | #define PM8606_STATUS (0x18) | ||
85 | #define PM8606_FLAGS (0x19) | ||
86 | #define PM8606_PROTECTA (0x1A) | ||
87 | #define PM8606_PROTECTB (0x1B) | ||
88 | #define PM8606_PROTECTC (0x1C) | ||
89 | |||
90 | /* Bit definitions of PM8606 registers */ | ||
91 | #define PM8606_DCM_500MA (0x0) /* current limit */ | ||
92 | #define PM8606_DCM_750MA (0x1) | ||
93 | #define PM8606_DCM_1000MA (0x2) | ||
94 | #define PM8606_DCM_1250MA (0x3) | ||
95 | #define PM8606_DCM_250MV (0x0 << 2) | ||
96 | #define PM8606_DCM_300MV (0x1 << 2) | ||
97 | #define PM8606_DCM_350MV (0x2 << 2) | ||
98 | #define PM8606_DCM_400MV (0x3 << 2) | ||
99 | |||
100 | #define PM8606_PWM_31200HZ (0x0) | ||
101 | #define PM8606_PWM_15600HZ (0x1) | ||
102 | #define PM8606_PWM_7800HZ (0x2) | ||
103 | #define PM8606_PWM_3900HZ (0x3) | ||
104 | #define PM8606_PWM_1950HZ (0x4) | ||
105 | #define PM8606_PWM_976HZ (0x5) | ||
106 | #define PM8606_PWM_488HZ (0x6) | ||
107 | #define PM8606_PWM_244HZ (0x7) | ||
108 | #define PM8606_PWM_FREQ_MASK (0x7) | ||
109 | |||
110 | #define PM8606_WLED_ON (1 << 0) | ||
111 | #define PM8606_WLED_CURRENT(x) ((x & 0x1F) << 1) | ||
112 | |||
113 | #define PM8606_LED_CURRENT(x) (((x >> 2) & 0x07) << 5) | ||
114 | |||
115 | #define PM8606_VSYS_EN (1 << 1) | ||
116 | |||
117 | #define PM8606_MISC_OSC_EN (1 << 4) | ||
118 | |||
119 | enum { | ||
25 | PM8607_ID_BUCK1 = 0, | 120 | PM8607_ID_BUCK1 = 0, |
26 | PM8607_ID_BUCK2, | 121 | PM8607_ID_BUCK2, |
27 | PM8607_ID_BUCK3, | 122 | PM8607_ID_BUCK3, |
@@ -91,6 +186,21 @@ enum { | |||
91 | #define PM8607_SUPPLIES_EN21 (0x33) | 186 | #define PM8607_SUPPLIES_EN21 (0x33) |
92 | #define PM8607_SUPPLIES_EN22 (0x34) | 187 | #define PM8607_SUPPLIES_EN22 (0x34) |
93 | 188 | ||
189 | /* Vibrator Control Registers */ | ||
190 | #define PM8607_VIBRATOR_SET (0x28) | ||
191 | #define PM8607_VIBRATOR_PWM (0x29) | ||
192 | |||
193 | /* GPADC Registers */ | ||
194 | #define PM8607_GP_BIAS1 (0x4F) | ||
195 | #define PM8607_MEAS_EN1 (0x50) | ||
196 | #define PM8607_MEAS_EN2 (0x51) | ||
197 | #define PM8607_MEAS_EN3 (0x52) | ||
198 | #define PM8607_MEAS_OFF_TIME1 (0x53) | ||
199 | #define PM8607_MEAS_OFF_TIME2 (0x54) | ||
200 | #define PM8607_TSI_PREBIAS (0x55) /* prebias time */ | ||
201 | #define PM8607_PD_PREBIAS (0x56) /* prebias time */ | ||
202 | #define PM8607_GPADC_MISC1 (0x57) | ||
203 | |||
94 | /* RTC Control Registers */ | 204 | /* RTC Control Registers */ |
95 | #define PM8607_RTC1 (0xA0) | 205 | #define PM8607_RTC1 (0xA0) |
96 | #define PM8607_RTC_COUNTER1 (0xA1) | 206 | #define PM8607_RTC_COUNTER1 (0xA1) |
@@ -140,6 +250,16 @@ enum { | |||
140 | #define PM8607_B0_MISC1_PI2C (1 << 3) | 250 | #define PM8607_B0_MISC1_PI2C (1 << 3) |
141 | #define PM8607_B0_MISC1_RESET (1 << 6) | 251 | #define PM8607_B0_MISC1_RESET (1 << 6) |
142 | 252 | ||
253 | /* bits definitions of GPADC */ | ||
254 | #define PM8607_GPADC_EN (1 << 0) | ||
255 | #define PM8607_GPADC_PREBIAS_MASK (3 << 1) | ||
256 | #define PM8607_GPADC_SLOT_CYCLE_MASK (3 << 3) /* slow mode */ | ||
257 | #define PM8607_GPADC_OFF_SCALE_MASK (3 << 5) /* GP sleep mode */ | ||
258 | #define PM8607_GPADC_SW_CAL_MASK (1 << 7) | ||
259 | |||
260 | #define PM8607_PD_PREBIAS_MASK (0x1F << 0) | ||
261 | #define PM8607_PD_PRECHG_MASK (7 << 5) | ||
262 | |||
143 | /* Interrupt Number in 88PM8607 */ | 263 | /* Interrupt Number in 88PM8607 */ |
144 | enum { | 264 | enum { |
145 | PM8607_IRQ_ONKEY = 0, | 265 | PM8607_IRQ_ONKEY = 0, |
@@ -202,13 +322,44 @@ enum { | |||
202 | PI2C_PORT, | 322 | PI2C_PORT, |
203 | }; | 323 | }; |
204 | 324 | ||
325 | struct pm860x_backlight_pdata { | ||
326 | int id; | ||
327 | int pwm; | ||
328 | int iset; | ||
329 | unsigned long flags; | ||
330 | }; | ||
331 | |||
332 | struct pm860x_led_pdata { | ||
333 | int id; | ||
334 | int iset; | ||
335 | unsigned long flags; | ||
336 | }; | ||
337 | |||
338 | struct pm860x_touch_pdata { | ||
339 | int gpadc_prebias; | ||
340 | int slot_cycle; | ||
341 | int off_scale; | ||
342 | int sw_cal; | ||
343 | int tsi_prebias; /* time, slot */ | ||
344 | int pen_prebias; /* time, slot */ | ||
345 | int pen_prechg; /* time, slot */ | ||
346 | unsigned long flags; | ||
347 | }; | ||
348 | |||
205 | struct pm860x_platform_data { | 349 | struct pm860x_platform_data { |
350 | struct pm860x_backlight_pdata *backlight; | ||
351 | struct pm860x_led_pdata *led; | ||
352 | struct pm860x_touch_pdata *touch; | ||
353 | |||
206 | unsigned short companion_addr; /* I2C address of companion chip */ | 354 | unsigned short companion_addr; /* I2C address of companion chip */ |
207 | int i2c_port; /* Controlled by GI2C or PI2C */ | 355 | int i2c_port; /* Controlled by GI2C or PI2C */ |
208 | int irq_mode; /* Clear interrupt by read/write(0/1) */ | 356 | int irq_mode; /* Clear interrupt by read/write(0/1) */ |
209 | struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; | 357 | struct regulator_init_data *regulator[PM8607_MAX_REGULATOR]; |
210 | }; | 358 | }; |
211 | 359 | ||
360 | extern char pm860x_backlight_name[][MFD_NAME_SIZE]; | ||
361 | extern char pm860x_led_name[][MFD_NAME_SIZE]; | ||
362 | |||
212 | extern int pm860x_reg_read(struct i2c_client *, int); | 363 | extern int pm860x_reg_read(struct i2c_client *, int); |
213 | extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); | 364 | extern int pm860x_reg_write(struct i2c_client *, int, unsigned char); |
214 | extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); | 365 | extern int pm860x_bulk_read(struct i2c_client *, int, int, unsigned char *); |