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 | |
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>
-rw-r--r-- | drivers/mfd/88pm860x-core.c | 217 | ||||
-rw-r--r-- | include/linux/mfd/88pm860x.h | 151 |
2 files changed, 356 insertions, 12 deletions
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 9185f0d945f4..16f0dca707a7 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c | |||
@@ -17,6 +17,100 @@ | |||
17 | #include <linux/mfd/core.h> | 17 | #include <linux/mfd/core.h> |
18 | #include <linux/mfd/88pm860x.h> | 18 | #include <linux/mfd/88pm860x.h> |
19 | 19 | ||
20 | char pm860x_backlight_name[][MFD_NAME_SIZE] = { | ||
21 | "backlight-0", | ||
22 | "backlight-1", | ||
23 | "backlight-2", | ||
24 | }; | ||
25 | EXPORT_SYMBOL(pm860x_backlight_name); | ||
26 | |||
27 | char pm860x_led_name[][MFD_NAME_SIZE] = { | ||
28 | "led0-red", | ||
29 | "led0-green", | ||
30 | "led0-blue", | ||
31 | "led1-red", | ||
32 | "led1-green", | ||
33 | "led1-blue", | ||
34 | }; | ||
35 | EXPORT_SYMBOL(pm860x_led_name); | ||
36 | |||
37 | #define PM8606_BACKLIGHT_RESOURCE(_i, _x) \ | ||
38 | { \ | ||
39 | .name = pm860x_backlight_name[_i], \ | ||
40 | .start = PM8606_##_x, \ | ||
41 | .end = PM8606_##_x, \ | ||
42 | .flags = IORESOURCE_IO, \ | ||
43 | } | ||
44 | |||
45 | static struct resource backlight_resources[] = { | ||
46 | PM8606_BACKLIGHT_RESOURCE(PM8606_BACKLIGHT1, WLED1A), | ||
47 | PM8606_BACKLIGHT_RESOURCE(PM8606_BACKLIGHT2, WLED2A), | ||
48 | PM8606_BACKLIGHT_RESOURCE(PM8606_BACKLIGHT3, WLED3A), | ||
49 | }; | ||
50 | |||
51 | #define PM8606_BACKLIGHT_DEVS(_i) \ | ||
52 | { \ | ||
53 | .name = "88pm860x-backlight", \ | ||
54 | .num_resources = 1, \ | ||
55 | .resources = &backlight_resources[_i], \ | ||
56 | .id = _i, \ | ||
57 | } | ||
58 | |||
59 | static struct mfd_cell backlight_devs[] = { | ||
60 | PM8606_BACKLIGHT_DEVS(PM8606_BACKLIGHT1), | ||
61 | PM8606_BACKLIGHT_DEVS(PM8606_BACKLIGHT2), | ||
62 | PM8606_BACKLIGHT_DEVS(PM8606_BACKLIGHT3), | ||
63 | }; | ||
64 | |||
65 | #define PM8606_LED_RESOURCE(_i, _x) \ | ||
66 | { \ | ||
67 | .name = pm860x_led_name[_i], \ | ||
68 | .start = PM8606_##_x, \ | ||
69 | .end = PM8606_##_x, \ | ||
70 | .flags = IORESOURCE_IO, \ | ||
71 | } | ||
72 | |||
73 | static struct resource led_resources[] = { | ||
74 | PM8606_LED_RESOURCE(PM8606_LED1_RED, RGB2B), | ||
75 | PM8606_LED_RESOURCE(PM8606_LED1_GREEN, RGB2C), | ||
76 | PM8606_LED_RESOURCE(PM8606_LED1_BLUE, RGB2D), | ||
77 | PM8606_LED_RESOURCE(PM8606_LED2_RED, RGB1B), | ||
78 | PM8606_LED_RESOURCE(PM8606_LED2_GREEN, RGB1C), | ||
79 | PM8606_LED_RESOURCE(PM8606_LED2_BLUE, RGB1D), | ||
80 | }; | ||
81 | |||
82 | #define PM8606_LED_DEVS(_i) \ | ||
83 | { \ | ||
84 | .name = "88pm860x-led", \ | ||
85 | .num_resources = 1, \ | ||
86 | .resources = &led_resources[_i], \ | ||
87 | .id = _i, \ | ||
88 | } | ||
89 | |||
90 | static struct mfd_cell led_devs[] = { | ||
91 | PM8606_LED_DEVS(PM8606_LED1_RED), | ||
92 | PM8606_LED_DEVS(PM8606_LED1_GREEN), | ||
93 | PM8606_LED_DEVS(PM8606_LED1_BLUE), | ||
94 | PM8606_LED_DEVS(PM8606_LED2_RED), | ||
95 | PM8606_LED_DEVS(PM8606_LED2_GREEN), | ||
96 | PM8606_LED_DEVS(PM8606_LED2_BLUE), | ||
97 | }; | ||
98 | |||
99 | static struct resource touch_resources[] = { | ||
100 | { | ||
101 | .start = PM8607_IRQ_PEN, | ||
102 | .end = PM8607_IRQ_PEN, | ||
103 | .flags = IORESOURCE_IRQ, | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static struct mfd_cell touch_devs[] = { | ||
108 | { | ||
109 | .name = "88pm860x-touch", | ||
110 | .num_resources = 1, | ||
111 | .resources = &touch_resources[0], | ||
112 | }, | ||
113 | }; | ||
20 | 114 | ||
21 | #define PM8607_REG_RESOURCE(_start, _end) \ | 115 | #define PM8607_REG_RESOURCE(_start, _end) \ |
22 | { \ | 116 | { \ |
@@ -25,7 +119,7 @@ | |||
25 | .flags = IORESOURCE_IO, \ | 119 | .flags = IORESOURCE_IO, \ |
26 | } | 120 | } |
27 | 121 | ||
28 | static struct resource pm8607_regulator_resources[] = { | 122 | static struct resource regulator_resources[] = { |
29 | PM8607_REG_RESOURCE(BUCK1, BUCK1), | 123 | PM8607_REG_RESOURCE(BUCK1, BUCK1), |
30 | PM8607_REG_RESOURCE(BUCK2, BUCK2), | 124 | PM8607_REG_RESOURCE(BUCK2, BUCK2), |
31 | PM8607_REG_RESOURCE(BUCK3, BUCK3), | 125 | PM8607_REG_RESOURCE(BUCK3, BUCK3), |
@@ -47,10 +141,11 @@ static struct resource pm8607_regulator_resources[] = { | |||
47 | { \ | 141 | { \ |
48 | .name = "88pm8607-" #_name, \ | 142 | .name = "88pm8607-" #_name, \ |
49 | .num_resources = 1, \ | 143 | .num_resources = 1, \ |
50 | .resources = &pm8607_regulator_resources[PM8607_ID_##_id], \ | 144 | .resources = ®ulator_resources[PM8607_ID_##_id], \ |
145 | .id = PM8607_ID_##_id, \ | ||
51 | } | 146 | } |
52 | 147 | ||
53 | static struct mfd_cell pm8607_devs[] = { | 148 | static struct mfd_cell regulator_devs[] = { |
54 | PM8607_REG_DEVS(buck1, BUCK1), | 149 | PM8607_REG_DEVS(buck1, BUCK1), |
55 | PM8607_REG_DEVS(buck2, BUCK2), | 150 | PM8607_REG_DEVS(buck2, BUCK2), |
56 | PM8607_REG_DEVS(buck3, BUCK3), | 151 | PM8607_REG_DEVS(buck3, BUCK3), |
@@ -192,6 +287,61 @@ int pm860x_free_irq(struct pm860x_chip *chip, int irq) | |||
192 | } | 287 | } |
193 | EXPORT_SYMBOL(pm860x_free_irq); | 288 | EXPORT_SYMBOL(pm860x_free_irq); |
194 | 289 | ||
290 | static int __devinit device_gpadc_init(struct pm860x_chip *chip, | ||
291 | struct pm860x_platform_data *pdata) | ||
292 | { | ||
293 | struct i2c_client *i2c = (chip->id == CHIP_PM8607) ? chip->client \ | ||
294 | : chip->companion; | ||
295 | int use_gpadc = 0, data, ret; | ||
296 | |||
297 | /* initialize GPADC without activating it */ | ||
298 | |||
299 | if (pdata && pdata->touch) { | ||
300 | /* set GPADC MISC1 register */ | ||
301 | data = 0; | ||
302 | data |= (pdata->touch->gpadc_prebias << 1) | ||
303 | & PM8607_GPADC_PREBIAS_MASK; | ||
304 | data |= (pdata->touch->slot_cycle << 3) | ||
305 | & PM8607_GPADC_SLOT_CYCLE_MASK; | ||
306 | data |= (pdata->touch->off_scale << 5) | ||
307 | & PM8607_GPADC_OFF_SCALE_MASK; | ||
308 | data |= (pdata->touch->sw_cal << 7) | ||
309 | & PM8607_GPADC_SW_CAL_MASK; | ||
310 | if (data) { | ||
311 | ret = pm860x_reg_write(i2c, PM8607_GPADC_MISC1, data); | ||
312 | if (ret < 0) | ||
313 | goto out; | ||
314 | } | ||
315 | /* set tsi prebias time */ | ||
316 | if (pdata->touch->tsi_prebias) { | ||
317 | data = pdata->touch->tsi_prebias; | ||
318 | ret = pm860x_reg_write(i2c, PM8607_TSI_PREBIAS, data); | ||
319 | if (ret < 0) | ||
320 | goto out; | ||
321 | } | ||
322 | /* set prebias & prechg time of pen detect */ | ||
323 | data = 0; | ||
324 | data |= pdata->touch->pen_prebias & PM8607_PD_PREBIAS_MASK; | ||
325 | data |= (pdata->touch->pen_prechg << 5) | ||
326 | & PM8607_PD_PRECHG_MASK; | ||
327 | if (data) { | ||
328 | ret = pm860x_reg_write(i2c, PM8607_PD_PREBIAS, data); | ||
329 | if (ret < 0) | ||
330 | goto out; | ||
331 | } | ||
332 | |||
333 | use_gpadc = 1; | ||
334 | } | ||
335 | |||
336 | /* turn on GPADC */ | ||
337 | if (use_gpadc) { | ||
338 | ret = pm860x_set_bits(i2c, PM8607_GPADC_MISC1, | ||
339 | PM8607_GPADC_EN, PM8607_GPADC_EN); | ||
340 | } | ||
341 | out: | ||
342 | return ret; | ||
343 | } | ||
344 | |||
195 | static int __devinit device_irq_init(struct pm860x_chip *chip, | 345 | static int __devinit device_irq_init(struct pm860x_chip *chip, |
196 | struct pm860x_platform_data *pdata) | 346 | struct pm860x_platform_data *pdata) |
197 | { | 347 | { |
@@ -264,14 +414,40 @@ static void __devinit device_8606_init(struct pm860x_chip *chip, | |||
264 | struct i2c_client *i2c, | 414 | struct i2c_client *i2c, |
265 | struct pm860x_platform_data *pdata) | 415 | struct pm860x_platform_data *pdata) |
266 | { | 416 | { |
417 | int ret; | ||
418 | |||
419 | if (pdata && pdata->backlight) { | ||
420 | ret = mfd_add_devices(chip->dev, 0, &backlight_devs[0], | ||
421 | ARRAY_SIZE(backlight_devs), | ||
422 | &backlight_resources[0], 0); | ||
423 | if (ret < 0) { | ||
424 | dev_err(chip->dev, "Failed to add backlight " | ||
425 | "subdev\n"); | ||
426 | goto out_dev; | ||
427 | } | ||
428 | } | ||
429 | |||
430 | if (pdata && pdata->led) { | ||
431 | ret = mfd_add_devices(chip->dev, 0, &led_devs[0], | ||
432 | ARRAY_SIZE(led_devs), | ||
433 | &led_resources[0], 0); | ||
434 | if (ret < 0) { | ||
435 | dev_err(chip->dev, "Failed to add led " | ||
436 | "subdev\n"); | ||
437 | goto out_dev; | ||
438 | } | ||
439 | } | ||
440 | return; | ||
441 | out_dev: | ||
442 | mfd_remove_devices(chip->dev); | ||
443 | device_irq_exit(chip); | ||
267 | } | 444 | } |
268 | 445 | ||
269 | static void __devinit device_8607_init(struct pm860x_chip *chip, | 446 | static void __devinit device_8607_init(struct pm860x_chip *chip, |
270 | struct i2c_client *i2c, | 447 | struct i2c_client *i2c, |
271 | struct pm860x_platform_data *pdata) | 448 | struct pm860x_platform_data *pdata) |
272 | { | 449 | { |
273 | int i, count, data; | 450 | int data, ret; |
274 | int ret; | ||
275 | 451 | ||
276 | ret = pm860x_reg_read(i2c, PM8607_CHIP_ID); | 452 | ret = pm860x_reg_read(i2c, PM8607_CHIP_ID); |
277 | if (ret < 0) { | 453 | if (ret < 0) { |
@@ -311,19 +487,36 @@ static void __devinit device_8607_init(struct pm860x_chip *chip, | |||
311 | goto out; | 487 | goto out; |
312 | } | 488 | } |
313 | 489 | ||
490 | ret = device_gpadc_init(chip, pdata); | ||
491 | if (ret < 0) | ||
492 | goto out; | ||
493 | |||
314 | ret = device_irq_init(chip, pdata); | 494 | ret = device_irq_init(chip, pdata); |
315 | if (ret < 0) | 495 | if (ret < 0) |
316 | goto out; | 496 | goto out; |
317 | 497 | ||
318 | count = ARRAY_SIZE(pm8607_devs); | 498 | ret = mfd_add_devices(chip->dev, 0, ®ulator_devs[0], |
319 | for (i = 0; i < count; i++) { | 499 | ARRAY_SIZE(regulator_devs), |
320 | ret = mfd_add_devices(chip->dev, i, &pm8607_devs[i], | 500 | ®ulator_resources[0], 0); |
321 | 1, NULL, 0); | 501 | if (ret < 0) { |
322 | if (ret != 0) { | 502 | dev_err(chip->dev, "Failed to add regulator subdev\n"); |
323 | dev_err(chip->dev, "Failed to add subdevs\n"); | 503 | goto out_dev; |
324 | goto out; | 504 | } |
505 | |||
506 | if (pdata && pdata->touch) { | ||
507 | ret = mfd_add_devices(chip->dev, 0, &touch_devs[0], | ||
508 | ARRAY_SIZE(touch_devs), | ||
509 | &touch_resources[0], 0); | ||
510 | if (ret < 0) { | ||
511 | dev_err(chip->dev, "Failed to add touch " | ||
512 | "subdev\n"); | ||
513 | goto out_dev; | ||
325 | } | 514 | } |
326 | } | 515 | } |
516 | return; | ||
517 | out_dev: | ||
518 | mfd_remove_devices(chip->dev); | ||
519 | device_irq_exit(chip); | ||
327 | out: | 520 | out: |
328 | return; | 521 | return; |
329 | } | 522 | } |
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h index b4d6018ba0d6..d7edf11784f5 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 *); |