diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-01-15 12:27:20 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-01-15 12:27:20 -0500 |
commit | c0106d72b8d71696dbe9dc80e2c77d4ac63f7531 (patch) | |
tree | ca96d2baecb0555e36219ed6968dc8e306e530ca /include/linux/mfd | |
parent | 5852973c129cf7c7e6c229abb7250673fc2a50c9 (diff) | |
parent | eff317d0834ad1ff03f747f6bc2d76b9a9c95160 (diff) |
Merge branch 'topic/asoc' into next/asoc
Diffstat (limited to 'include/linux/mfd')
-rw-r--r-- | include/linux/mfd/da903x.h | 44 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/adc.h | 72 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/core.h | 218 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/gpio.h | 52 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/mbc.h | 134 | ||||
-rw-r--r-- | include/linux/mfd/pcf50633/pmic.h | 67 | ||||
-rw-r--r-- | include/linux/mfd/wm8350/comparator.h | 8 | ||||
-rw-r--r-- | include/linux/mfd/wm8350/core.h | 52 | ||||
-rw-r--r-- | include/linux/mfd/wm8350/pmic.h | 40 | ||||
-rw-r--r-- | include/linux/mfd/wm8350/supply.h | 25 |
10 files changed, 707 insertions, 5 deletions
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h index cad314c12439..115dbe965082 100644 --- a/include/linux/mfd/da903x.h +++ b/include/linux/mfd/da903x.h | |||
@@ -32,6 +32,7 @@ enum { | |||
32 | DA9030_ID_LDO18, | 32 | DA9030_ID_LDO18, |
33 | DA9030_ID_LDO19, | 33 | DA9030_ID_LDO19, |
34 | DA9030_ID_LDO_INT, /* LDO Internal */ | 34 | DA9030_ID_LDO_INT, /* LDO Internal */ |
35 | DA9030_ID_BAT, /* battery charger */ | ||
35 | 36 | ||
36 | DA9034_ID_LED_1, | 37 | DA9034_ID_LED_1, |
37 | DA9034_ID_LED_2, | 38 | DA9034_ID_LED_2, |
@@ -93,6 +94,43 @@ struct da9034_touch_pdata { | |||
93 | int y_inverted; | 94 | int y_inverted; |
94 | }; | 95 | }; |
95 | 96 | ||
97 | /* DA9030 battery charger data */ | ||
98 | struct power_supply_info; | ||
99 | |||
100 | struct da9030_battery_info { | ||
101 | /* battery parameters */ | ||
102 | struct power_supply_info *battery_info; | ||
103 | |||
104 | /* current and voltage to use for battery charging */ | ||
105 | unsigned int charge_milliamp; | ||
106 | unsigned int charge_millivolt; | ||
107 | |||
108 | /* voltage thresholds (in millivolts) */ | ||
109 | int vbat_low; | ||
110 | int vbat_crit; | ||
111 | int vbat_charge_start; | ||
112 | int vbat_charge_stop; | ||
113 | int vbat_charge_restart; | ||
114 | |||
115 | /* battery nominal minimal and maximal voltages in millivolts */ | ||
116 | int vcharge_min; | ||
117 | int vcharge_max; | ||
118 | |||
119 | /* Temperature thresholds. These are DA9030 register values | ||
120 | "as is" and should be measured for each battery type */ | ||
121 | int tbat_low; | ||
122 | int tbat_high; | ||
123 | int tbat_restart; | ||
124 | |||
125 | |||
126 | /* battery monitor interval (seconds) */ | ||
127 | unsigned int batmon_interval; | ||
128 | |||
129 | /* platform callbacks for battery low and critical events */ | ||
130 | void (*battery_low)(void); | ||
131 | void (*battery_critical)(void); | ||
132 | }; | ||
133 | |||
96 | struct da903x_subdev_info { | 134 | struct da903x_subdev_info { |
97 | int id; | 135 | int id; |
98 | const char *name; | 136 | const char *name; |
@@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev, | |||
190 | extern int da903x_query_status(struct device *dev, unsigned int status); | 228 | extern int da903x_query_status(struct device *dev, unsigned int status); |
191 | 229 | ||
192 | 230 | ||
193 | /* NOTE: the two functions below are not intended for use outside | 231 | /* NOTE: the functions below are not intended for use outside |
194 | * of the DA9034 sub-device drivers | 232 | * of the DA903x sub-device drivers |
195 | */ | 233 | */ |
196 | extern int da903x_write(struct device *dev, int reg, uint8_t val); | 234 | extern int da903x_write(struct device *dev, int reg, uint8_t val); |
235 | extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val); | ||
197 | extern int da903x_read(struct device *dev, int reg, uint8_t *val); | 236 | extern int da903x_read(struct device *dev, int reg, uint8_t *val); |
237 | extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val); | ||
198 | extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); | 238 | extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); |
199 | extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); | 239 | extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); |
200 | extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | 240 | extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); |
diff --git a/include/linux/mfd/pcf50633/adc.h b/include/linux/mfd/pcf50633/adc.h new file mode 100644 index 000000000000..56669b4183ad --- /dev/null +++ b/include/linux/mfd/pcf50633/adc.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * adc.h -- Driver for NXP PCF50633 ADC | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_ADC_H | ||
14 | #define __LINUX_MFD_PCF50633_ADC_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | /* ADC Registers */ | ||
20 | #define PCF50633_REG_ADCC3 0x52 | ||
21 | #define PCF50633_REG_ADCC2 0x53 | ||
22 | #define PCF50633_REG_ADCC1 0x54 | ||
23 | #define PCF50633_REG_ADCS1 0x55 | ||
24 | #define PCF50633_REG_ADCS2 0x56 | ||
25 | #define PCF50633_REG_ADCS3 0x57 | ||
26 | |||
27 | #define PCF50633_ADCC1_ADCSTART 0x01 | ||
28 | #define PCF50633_ADCC1_RES_10BIT 0x02 | ||
29 | #define PCF50633_ADCC1_AVERAGE_NO 0x00 | ||
30 | #define PCF50633_ADCC1_AVERAGE_4 0x04 | ||
31 | #define PCF50633_ADCC1_AVERAGE_8 0x08 | ||
32 | #define PCF50633_ADCC1_AVERAGE_16 0x0c | ||
33 | #define PCF50633_ADCC1_MUX_BATSNS_RES 0x00 | ||
34 | #define PCF50633_ADCC1_MUX_BATSNS_SUBTR 0x10 | ||
35 | #define PCF50633_ADCC1_MUX_ADCIN2_RES 0x20 | ||
36 | #define PCF50633_ADCC1_MUX_ADCIN2_SUBTR 0x30 | ||
37 | #define PCF50633_ADCC1_MUX_BATTEMP 0x60 | ||
38 | #define PCF50633_ADCC1_MUX_ADCIN1 0x70 | ||
39 | #define PCF50633_ADCC1_AVERAGE_MASK 0x0c | ||
40 | #define PCF50633_ADCC1_ADCMUX_MASK 0xf0 | ||
41 | |||
42 | #define PCF50633_ADCC2_RATIO_NONE 0x00 | ||
43 | #define PCF50633_ADCC2_RATIO_BATTEMP 0x01 | ||
44 | #define PCF50633_ADCC2_RATIO_ADCIN1 0x02 | ||
45 | #define PCF50633_ADCC2_RATIO_BOTH 0x03 | ||
46 | #define PCF50633_ADCC2_RATIOSETTL_100US 0x04 | ||
47 | |||
48 | #define PCF50633_ADCC3_ACCSW_EN 0x01 | ||
49 | #define PCF50633_ADCC3_NTCSW_EN 0x04 | ||
50 | #define PCF50633_ADCC3_RES_DIV_TWO 0x10 | ||
51 | #define PCF50633_ADCC3_RES_DIV_THREE 0x00 | ||
52 | |||
53 | #define PCF50633_ADCS3_REF_NTCSW 0x00 | ||
54 | #define PCF50633_ADCS3_REF_ACCSW 0x10 | ||
55 | #define PCF50633_ADCS3_REF_2V0 0x20 | ||
56 | #define PCF50633_ADCS3_REF_VISA 0x30 | ||
57 | #define PCF50633_ADCS3_REF_2V0_2 0x70 | ||
58 | #define PCF50633_ADCS3_ADCRDY 0x80 | ||
59 | |||
60 | #define PCF50633_ADCS3_ADCDAT1L_MASK 0x03 | ||
61 | #define PCF50633_ADCS3_ADCDAT2L_MASK 0x0c | ||
62 | #define PCF50633_ADCS3_ADCDAT2L_SHIFT 2 | ||
63 | #define PCF50633_ASCS3_REF_MASK 0x70 | ||
64 | |||
65 | extern int | ||
66 | pcf50633_adc_async_read(struct pcf50633 *pcf, int mux, int avg, | ||
67 | void (*callback)(struct pcf50633 *, void *, int), | ||
68 | void *callback_param); | ||
69 | extern int | ||
70 | pcf50633_adc_sync_read(struct pcf50633 *pcf, int mux, int avg); | ||
71 | |||
72 | #endif /* __LINUX_PCF50633_ADC_H */ | ||
diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h new file mode 100644 index 000000000000..4455b212d75a --- /dev/null +++ b/include/linux/mfd/pcf50633/core.h | |||
@@ -0,0 +1,218 @@ | |||
1 | /* | ||
2 | * core.h -- Core driver for NXP PCF50633 | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_CORE_H | ||
14 | #define __LINUX_MFD_PCF50633_CORE_H | ||
15 | |||
16 | #include <linux/i2c.h> | ||
17 | #include <linux/workqueue.h> | ||
18 | #include <linux/regulator/driver.h> | ||
19 | #include <linux/regulator/machine.h> | ||
20 | #include <linux/power_supply.h> | ||
21 | |||
22 | struct pcf50633; | ||
23 | |||
24 | #define PCF50633_NUM_REGULATORS 11 | ||
25 | |||
26 | struct pcf50633_platform_data { | ||
27 | struct regulator_init_data reg_init_data[PCF50633_NUM_REGULATORS]; | ||
28 | |||
29 | char **batteries; | ||
30 | int num_batteries; | ||
31 | |||
32 | /* Callbacks */ | ||
33 | void (*probe_done)(struct pcf50633 *); | ||
34 | void (*mbc_event_callback)(struct pcf50633 *, int); | ||
35 | void (*regulator_registered)(struct pcf50633 *, int); | ||
36 | void (*force_shutdown)(struct pcf50633 *); | ||
37 | |||
38 | u8 resumers[5]; | ||
39 | }; | ||
40 | |||
41 | struct pcf50633_subdev_pdata { | ||
42 | struct pcf50633 *pcf; | ||
43 | }; | ||
44 | |||
45 | struct pcf50633_irq { | ||
46 | void (*handler) (int, void *); | ||
47 | void *data; | ||
48 | }; | ||
49 | |||
50 | int pcf50633_register_irq(struct pcf50633 *pcf, int irq, | ||
51 | void (*handler) (int, void *), void *data); | ||
52 | int pcf50633_free_irq(struct pcf50633 *pcf, int irq); | ||
53 | |||
54 | int pcf50633_irq_mask(struct pcf50633 *pcf, int irq); | ||
55 | int pcf50633_irq_unmask(struct pcf50633 *pcf, int irq); | ||
56 | int pcf50633_irq_mask_get(struct pcf50633 *pcf, int irq); | ||
57 | |||
58 | int pcf50633_read_block(struct pcf50633 *, u8 reg, | ||
59 | int nr_regs, u8 *data); | ||
60 | int pcf50633_write_block(struct pcf50633 *pcf, u8 reg, | ||
61 | int nr_regs, u8 *data); | ||
62 | u8 pcf50633_reg_read(struct pcf50633 *, u8 reg); | ||
63 | int pcf50633_reg_write(struct pcf50633 *pcf, u8 reg, u8 val); | ||
64 | |||
65 | int pcf50633_reg_set_bit_mask(struct pcf50633 *pcf, u8 reg, u8 mask, u8 val); | ||
66 | int pcf50633_reg_clear_bits(struct pcf50633 *pcf, u8 reg, u8 bits); | ||
67 | |||
68 | /* Interrupt registers */ | ||
69 | |||
70 | #define PCF50633_REG_INT1 0x02 | ||
71 | #define PCF50633_REG_INT2 0x03 | ||
72 | #define PCF50633_REG_INT3 0x04 | ||
73 | #define PCF50633_REG_INT4 0x05 | ||
74 | #define PCF50633_REG_INT5 0x06 | ||
75 | |||
76 | #define PCF50633_REG_INT1M 0x07 | ||
77 | #define PCF50633_REG_INT2M 0x08 | ||
78 | #define PCF50633_REG_INT3M 0x09 | ||
79 | #define PCF50633_REG_INT4M 0x0a | ||
80 | #define PCF50633_REG_INT5M 0x0b | ||
81 | |||
82 | enum { | ||
83 | /* Chip IRQs */ | ||
84 | PCF50633_IRQ_ADPINS, | ||
85 | PCF50633_IRQ_ADPREM, | ||
86 | PCF50633_IRQ_USBINS, | ||
87 | PCF50633_IRQ_USBREM, | ||
88 | PCF50633_IRQ_RESERVED1, | ||
89 | PCF50633_IRQ_RESERVED2, | ||
90 | PCF50633_IRQ_ALARM, | ||
91 | PCF50633_IRQ_SECOND, | ||
92 | PCF50633_IRQ_ONKEYR, | ||
93 | PCF50633_IRQ_ONKEYF, | ||
94 | PCF50633_IRQ_EXTON1R, | ||
95 | PCF50633_IRQ_EXTON1F, | ||
96 | PCF50633_IRQ_EXTON2R, | ||
97 | PCF50633_IRQ_EXTON2F, | ||
98 | PCF50633_IRQ_EXTON3R, | ||
99 | PCF50633_IRQ_EXTON3F, | ||
100 | PCF50633_IRQ_BATFULL, | ||
101 | PCF50633_IRQ_CHGHALT, | ||
102 | PCF50633_IRQ_THLIMON, | ||
103 | PCF50633_IRQ_THLIMOFF, | ||
104 | PCF50633_IRQ_USBLIMON, | ||
105 | PCF50633_IRQ_USBLIMOFF, | ||
106 | PCF50633_IRQ_ADCRDY, | ||
107 | PCF50633_IRQ_ONKEY1S, | ||
108 | PCF50633_IRQ_LOWSYS, | ||
109 | PCF50633_IRQ_LOWBAT, | ||
110 | PCF50633_IRQ_HIGHTMP, | ||
111 | PCF50633_IRQ_AUTOPWRFAIL, | ||
112 | PCF50633_IRQ_DWN1PWRFAIL, | ||
113 | PCF50633_IRQ_DWN2PWRFAIL, | ||
114 | PCF50633_IRQ_LEDPWRFAIL, | ||
115 | PCF50633_IRQ_LEDOVP, | ||
116 | PCF50633_IRQ_LDO1PWRFAIL, | ||
117 | PCF50633_IRQ_LDO2PWRFAIL, | ||
118 | PCF50633_IRQ_LDO3PWRFAIL, | ||
119 | PCF50633_IRQ_LDO4PWRFAIL, | ||
120 | PCF50633_IRQ_LDO5PWRFAIL, | ||
121 | PCF50633_IRQ_LDO6PWRFAIL, | ||
122 | PCF50633_IRQ_HCLDOPWRFAIL, | ||
123 | PCF50633_IRQ_HCLDOOVL, | ||
124 | |||
125 | /* Always last */ | ||
126 | PCF50633_NUM_IRQ, | ||
127 | }; | ||
128 | |||
129 | struct pcf50633 { | ||
130 | struct device *dev; | ||
131 | struct i2c_client *i2c_client; | ||
132 | |||
133 | struct pcf50633_platform_data *pdata; | ||
134 | int irq; | ||
135 | struct pcf50633_irq irq_handler[PCF50633_NUM_IRQ]; | ||
136 | struct work_struct irq_work; | ||
137 | struct mutex lock; | ||
138 | |||
139 | u8 mask_regs[5]; | ||
140 | |||
141 | u8 suspend_irq_masks[5]; | ||
142 | u8 resume_reason[5]; | ||
143 | int is_suspended; | ||
144 | |||
145 | int onkey1s_held; | ||
146 | |||
147 | struct platform_device *rtc_pdev; | ||
148 | struct platform_device *mbc_pdev; | ||
149 | struct platform_device *adc_pdev; | ||
150 | struct platform_device *input_pdev; | ||
151 | struct platform_device *regulator_pdev[PCF50633_NUM_REGULATORS]; | ||
152 | }; | ||
153 | |||
154 | enum pcf50633_reg_int1 { | ||
155 | PCF50633_INT1_ADPINS = 0x01, /* Adapter inserted */ | ||
156 | PCF50633_INT1_ADPREM = 0x02, /* Adapter removed */ | ||
157 | PCF50633_INT1_USBINS = 0x04, /* USB inserted */ | ||
158 | PCF50633_INT1_USBREM = 0x08, /* USB removed */ | ||
159 | /* reserved */ | ||
160 | PCF50633_INT1_ALARM = 0x40, /* RTC alarm time is reached */ | ||
161 | PCF50633_INT1_SECOND = 0x80, /* RTC periodic second interrupt */ | ||
162 | }; | ||
163 | |||
164 | enum pcf50633_reg_int2 { | ||
165 | PCF50633_INT2_ONKEYR = 0x01, /* ONKEY rising edge */ | ||
166 | PCF50633_INT2_ONKEYF = 0x02, /* ONKEY falling edge */ | ||
167 | PCF50633_INT2_EXTON1R = 0x04, /* EXTON1 rising edge */ | ||
168 | PCF50633_INT2_EXTON1F = 0x08, /* EXTON1 falling edge */ | ||
169 | PCF50633_INT2_EXTON2R = 0x10, /* EXTON2 rising edge */ | ||
170 | PCF50633_INT2_EXTON2F = 0x20, /* EXTON2 falling edge */ | ||
171 | PCF50633_INT2_EXTON3R = 0x40, /* EXTON3 rising edge */ | ||
172 | PCF50633_INT2_EXTON3F = 0x80, /* EXTON3 falling edge */ | ||
173 | }; | ||
174 | |||
175 | enum pcf50633_reg_int3 { | ||
176 | PCF50633_INT3_BATFULL = 0x01, /* Battery full */ | ||
177 | PCF50633_INT3_CHGHALT = 0x02, /* Charger halt */ | ||
178 | PCF50633_INT3_THLIMON = 0x04, | ||
179 | PCF50633_INT3_THLIMOFF = 0x08, | ||
180 | PCF50633_INT3_USBLIMON = 0x10, | ||
181 | PCF50633_INT3_USBLIMOFF = 0x20, | ||
182 | PCF50633_INT3_ADCRDY = 0x40, /* ADC result ready */ | ||
183 | PCF50633_INT3_ONKEY1S = 0x80, /* ONKEY pressed 1 second */ | ||
184 | }; | ||
185 | |||
186 | enum pcf50633_reg_int4 { | ||
187 | PCF50633_INT4_LOWSYS = 0x01, | ||
188 | PCF50633_INT4_LOWBAT = 0x02, | ||
189 | PCF50633_INT4_HIGHTMP = 0x04, | ||
190 | PCF50633_INT4_AUTOPWRFAIL = 0x08, | ||
191 | PCF50633_INT4_DWN1PWRFAIL = 0x10, | ||
192 | PCF50633_INT4_DWN2PWRFAIL = 0x20, | ||
193 | PCF50633_INT4_LEDPWRFAIL = 0x40, | ||
194 | PCF50633_INT4_LEDOVP = 0x80, | ||
195 | }; | ||
196 | |||
197 | enum pcf50633_reg_int5 { | ||
198 | PCF50633_INT5_LDO1PWRFAIL = 0x01, | ||
199 | PCF50633_INT5_LDO2PWRFAIL = 0x02, | ||
200 | PCF50633_INT5_LDO3PWRFAIL = 0x04, | ||
201 | PCF50633_INT5_LDO4PWRFAIL = 0x08, | ||
202 | PCF50633_INT5_LDO5PWRFAIL = 0x10, | ||
203 | PCF50633_INT5_LDO6PWRFAIL = 0x20, | ||
204 | PCF50633_INT5_HCLDOPWRFAIL = 0x40, | ||
205 | PCF50633_INT5_HCLDOOVL = 0x80, | ||
206 | }; | ||
207 | |||
208 | /* misc. registers */ | ||
209 | #define PCF50633_REG_OOCSHDWN 0x0c | ||
210 | |||
211 | /* LED registers */ | ||
212 | #define PCF50633_REG_LEDOUT 0x28 | ||
213 | #define PCF50633_REG_LEDENA 0x29 | ||
214 | #define PCF50633_REG_LEDCTL 0x2a | ||
215 | #define PCF50633_REG_LEDDIM 0x2b | ||
216 | |||
217 | #endif | ||
218 | |||
diff --git a/include/linux/mfd/pcf50633/gpio.h b/include/linux/mfd/pcf50633/gpio.h new file mode 100644 index 000000000000..a42b845efc54 --- /dev/null +++ b/include/linux/mfd/pcf50633/gpio.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * gpio.h -- GPIO driver for NXP PCF50633 | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_GPIO_H | ||
14 | #define __LINUX_MFD_PCF50633_GPIO_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | |||
18 | #define PCF50633_GPIO1 1 | ||
19 | #define PCF50633_GPIO2 2 | ||
20 | #define PCF50633_GPIO3 3 | ||
21 | #define PCF50633_GPO 4 | ||
22 | |||
23 | #define PCF50633_REG_GPIO1CFG 0x14 | ||
24 | #define PCF50633_REG_GPIO2CFG 0x15 | ||
25 | #define PCF50633_REG_GPIO3CFG 0x16 | ||
26 | #define PCF50633_REG_GPOCFG 0x17 | ||
27 | |||
28 | #define PCF50633_GPOCFG_GPOSEL_MASK 0x07 | ||
29 | |||
30 | enum pcf50633_reg_gpocfg { | ||
31 | PCF50633_GPOCFG_GPOSEL_0 = 0x00, | ||
32 | PCF50633_GPOCFG_GPOSEL_LED_NFET = 0x01, | ||
33 | PCF50633_GPOCFG_GPOSEL_SYSxOK = 0x02, | ||
34 | PCF50633_GPOCFG_GPOSEL_CLK32K = 0x03, | ||
35 | PCF50633_GPOCFG_GPOSEL_ADAPUSB = 0x04, | ||
36 | PCF50633_GPOCFG_GPOSEL_USBxOK = 0x05, | ||
37 | PCF50633_GPOCFG_GPOSEL_ACTPH4 = 0x06, | ||
38 | PCF50633_GPOCFG_GPOSEL_1 = 0x07, | ||
39 | PCF50633_GPOCFG_GPOSEL_INVERSE = 0x08, | ||
40 | }; | ||
41 | |||
42 | int pcf50633_gpio_set(struct pcf50633 *pcf, int gpio, u8 val); | ||
43 | u8 pcf50633_gpio_get(struct pcf50633 *pcf, int gpio); | ||
44 | |||
45 | int pcf50633_gpio_invert_set(struct pcf50633 *, int gpio, int invert); | ||
46 | int pcf50633_gpio_invert_get(struct pcf50633 *pcf, int gpio); | ||
47 | |||
48 | int pcf50633_gpio_power_supply_set(struct pcf50633 *, | ||
49 | int gpio, int regulator, int on); | ||
50 | #endif /* __LINUX_MFD_PCF50633_GPIO_H */ | ||
51 | |||
52 | |||
diff --git a/include/linux/mfd/pcf50633/mbc.h b/include/linux/mfd/pcf50633/mbc.h new file mode 100644 index 000000000000..6e17619b773a --- /dev/null +++ b/include/linux/mfd/pcf50633/mbc.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* | ||
2 | * mbc.h -- Driver for NXP PCF50633 Main Battery Charger | ||
3 | * | ||
4 | * (C) 2006-2008 by Openmoko, Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #ifndef __LINUX_MFD_PCF50633_MBC_H | ||
14 | #define __LINUX_MFD_PCF50633_MBC_H | ||
15 | |||
16 | #include <linux/mfd/pcf50633/core.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #define PCF50633_REG_MBCC1 0x43 | ||
20 | #define PCF50633_REG_MBCC2 0x44 | ||
21 | #define PCF50633_REG_MBCC3 0x45 | ||
22 | #define PCF50633_REG_MBCC4 0x46 | ||
23 | #define PCF50633_REG_MBCC5 0x47 | ||
24 | #define PCF50633_REG_MBCC6 0x48 | ||
25 | #define PCF50633_REG_MBCC7 0x49 | ||
26 | #define PCF50633_REG_MBCC8 0x4a | ||
27 | #define PCF50633_REG_MBCS1 0x4b | ||
28 | #define PCF50633_REG_MBCS2 0x4c | ||
29 | #define PCF50633_REG_MBCS3 0x4d | ||
30 | |||
31 | enum pcf50633_reg_mbcc1 { | ||
32 | PCF50633_MBCC1_CHGENA = 0x01, /* Charger enable */ | ||
33 | PCF50633_MBCC1_AUTOSTOP = 0x02, | ||
34 | PCF50633_MBCC1_AUTORES = 0x04, /* automatic resume */ | ||
35 | PCF50633_MBCC1_RESUME = 0x08, /* explicit resume cmd */ | ||
36 | PCF50633_MBCC1_RESTART = 0x10, /* restart charging */ | ||
37 | PCF50633_MBCC1_PREWDTIME_60M = 0x20, /* max. precharging time */ | ||
38 | PCF50633_MBCC1_WDTIME_1H = 0x00, | ||
39 | PCF50633_MBCC1_WDTIME_2H = 0x40, | ||
40 | PCF50633_MBCC1_WDTIME_4H = 0x80, | ||
41 | PCF50633_MBCC1_WDTIME_6H = 0xc0, | ||
42 | }; | ||
43 | #define PCF50633_MBCC1_WDTIME_MASK 0xc0 | ||
44 | |||
45 | enum pcf50633_reg_mbcc2 { | ||
46 | PCF50633_MBCC2_VBATCOND_2V7 = 0x00, | ||
47 | PCF50633_MBCC2_VBATCOND_2V85 = 0x01, | ||
48 | PCF50633_MBCC2_VBATCOND_3V0 = 0x02, | ||
49 | PCF50633_MBCC2_VBATCOND_3V15 = 0x03, | ||
50 | PCF50633_MBCC2_VMAX_4V = 0x00, | ||
51 | PCF50633_MBCC2_VMAX_4V20 = 0x28, | ||
52 | PCF50633_MBCC2_VRESDEBTIME_64S = 0x80, /* debounce time (32/64sec) */ | ||
53 | }; | ||
54 | |||
55 | enum pcf50633_reg_mbcc7 { | ||
56 | PCF50633_MBCC7_USB_100mA = 0x00, | ||
57 | PCF50633_MBCC7_USB_500mA = 0x01, | ||
58 | PCF50633_MBCC7_USB_1000mA = 0x02, | ||
59 | PCF50633_MBCC7_USB_SUSPEND = 0x03, | ||
60 | PCF50633_MBCC7_BATTEMP_EN = 0x04, | ||
61 | PCF50633_MBCC7_BATSYSIMAX_1A6 = 0x00, | ||
62 | PCF50633_MBCC7_BATSYSIMAX_1A8 = 0x40, | ||
63 | PCF50633_MBCC7_BATSYSIMAX_2A0 = 0x80, | ||
64 | PCF50633_MBCC7_BATSYSIMAX_2A2 = 0xc0, | ||
65 | }; | ||
66 | #define PCF50633_MBCC7_USB_MASK 0x03 | ||
67 | |||
68 | enum pcf50633_reg_mbcc8 { | ||
69 | PCF50633_MBCC8_USBENASUS = 0x10, | ||
70 | }; | ||
71 | |||
72 | enum pcf50633_reg_mbcs1 { | ||
73 | PCF50633_MBCS1_USBPRES = 0x01, | ||
74 | PCF50633_MBCS1_USBOK = 0x02, | ||
75 | PCF50633_MBCS1_ADAPTPRES = 0x04, | ||
76 | PCF50633_MBCS1_ADAPTOK = 0x08, | ||
77 | PCF50633_MBCS1_TBAT_OK = 0x00, | ||
78 | PCF50633_MBCS1_TBAT_ABOVE = 0x10, | ||
79 | PCF50633_MBCS1_TBAT_BELOW = 0x20, | ||
80 | PCF50633_MBCS1_TBAT_UNDEF = 0x30, | ||
81 | PCF50633_MBCS1_PREWDTEXP = 0x40, | ||
82 | PCF50633_MBCS1_WDTEXP = 0x80, | ||
83 | }; | ||
84 | |||
85 | enum pcf50633_reg_mbcs2_mbcmod { | ||
86 | PCF50633_MBCS2_MBC_PLAY = 0x00, | ||
87 | PCF50633_MBCS2_MBC_USB_PRE = 0x01, | ||
88 | PCF50633_MBCS2_MBC_USB_PRE_WAIT = 0x02, | ||
89 | PCF50633_MBCS2_MBC_USB_FAST = 0x03, | ||
90 | PCF50633_MBCS2_MBC_USB_FAST_WAIT = 0x04, | ||
91 | PCF50633_MBCS2_MBC_USB_SUSPEND = 0x05, | ||
92 | PCF50633_MBCS2_MBC_ADP_PRE = 0x06, | ||
93 | PCF50633_MBCS2_MBC_ADP_PRE_WAIT = 0x07, | ||
94 | PCF50633_MBCS2_MBC_ADP_FAST = 0x08, | ||
95 | PCF50633_MBCS2_MBC_ADP_FAST_WAIT = 0x09, | ||
96 | PCF50633_MBCS2_MBC_BAT_FULL = 0x0a, | ||
97 | PCF50633_MBCS2_MBC_HALT = 0x0b, | ||
98 | }; | ||
99 | #define PCF50633_MBCS2_MBC_MASK 0x0f | ||
100 | enum pcf50633_reg_mbcs2_chgstat { | ||
101 | PCF50633_MBCS2_CHGS_NONE = 0x00, | ||
102 | PCF50633_MBCS2_CHGS_ADAPTER = 0x10, | ||
103 | PCF50633_MBCS2_CHGS_USB = 0x20, | ||
104 | PCF50633_MBCS2_CHGS_BOTH = 0x30, | ||
105 | }; | ||
106 | #define PCF50633_MBCS2_RESSTAT_AUTO 0x40 | ||
107 | |||
108 | enum pcf50633_reg_mbcs3 { | ||
109 | PCF50633_MBCS3_USBLIM_PLAY = 0x01, | ||
110 | PCF50633_MBCS3_USBLIM_CGH = 0x02, | ||
111 | PCF50633_MBCS3_TLIM_PLAY = 0x04, | ||
112 | PCF50633_MBCS3_TLIM_CHG = 0x08, | ||
113 | PCF50633_MBCS3_ILIM = 0x10, /* 1: Ibat > Icutoff */ | ||
114 | PCF50633_MBCS3_VLIM = 0x20, /* 1: Vbat == Vmax */ | ||
115 | PCF50633_MBCS3_VBATSTAT = 0x40, /* 1: Vbat > Vbatcond */ | ||
116 | PCF50633_MBCS3_VRES = 0x80, /* 1: Vbat > Vth(RES) */ | ||
117 | }; | ||
118 | |||
119 | #define PCF50633_MBCC2_VBATCOND_MASK 0x03 | ||
120 | #define PCF50633_MBCC2_VMAX_MASK 0x3c | ||
121 | |||
122 | /* Charger status */ | ||
123 | #define PCF50633_MBC_USB_ONLINE 0x01 | ||
124 | #define PCF50633_MBC_USB_ACTIVE 0x02 | ||
125 | #define PCF50633_MBC_ADAPTER_ONLINE 0x04 | ||
126 | #define PCF50633_MBC_ADAPTER_ACTIVE 0x08 | ||
127 | |||
128 | int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma); | ||
129 | |||
130 | int pcf50633_mbc_get_status(struct pcf50633 *); | ||
131 | void pcf50633_mbc_set_status(struct pcf50633 *, int what, int status); | ||
132 | |||
133 | #endif | ||
134 | |||
diff --git a/include/linux/mfd/pcf50633/pmic.h b/include/linux/mfd/pcf50633/pmic.h new file mode 100644 index 000000000000..2d3dbe53b235 --- /dev/null +++ b/include/linux/mfd/pcf50633/pmic.h | |||
@@ -0,0 +1,67 @@ | |||
1 | #ifndef __LINUX_MFD_PCF50633_PMIC_H | ||
2 | #define __LINUX_MFD_PCF50633_PMIC_H | ||
3 | |||
4 | #include <linux/mfd/pcf50633/core.h> | ||
5 | #include <linux/platform_device.h> | ||
6 | |||
7 | #define PCF50633_REG_AUTOOUT 0x1a | ||
8 | #define PCF50633_REG_AUTOENA 0x1b | ||
9 | #define PCF50633_REG_AUTOCTL 0x1c | ||
10 | #define PCF50633_REG_AUTOMXC 0x1d | ||
11 | #define PCF50633_REG_DOWN1OUT 0x1e | ||
12 | #define PCF50633_REG_DOWN1ENA 0x1f | ||
13 | #define PCF50633_REG_DOWN1CTL 0x20 | ||
14 | #define PCF50633_REG_DOWN1MXC 0x21 | ||
15 | #define PCF50633_REG_DOWN2OUT 0x22 | ||
16 | #define PCF50633_REG_DOWN2ENA 0x23 | ||
17 | #define PCF50633_REG_DOWN2CTL 0x24 | ||
18 | #define PCF50633_REG_DOWN2MXC 0x25 | ||
19 | #define PCF50633_REG_MEMLDOOUT 0x26 | ||
20 | #define PCF50633_REG_MEMLDOENA 0x27 | ||
21 | #define PCF50633_REG_LDO1OUT 0x2d | ||
22 | #define PCF50633_REG_LDO1ENA 0x2e | ||
23 | #define PCF50633_REG_LDO2OUT 0x2f | ||
24 | #define PCF50633_REG_LDO2ENA 0x30 | ||
25 | #define PCF50633_REG_LDO3OUT 0x31 | ||
26 | #define PCF50633_REG_LDO3ENA 0x32 | ||
27 | #define PCF50633_REG_LDO4OUT 0x33 | ||
28 | #define PCF50633_REG_LDO4ENA 0x34 | ||
29 | #define PCF50633_REG_LDO5OUT 0x35 | ||
30 | #define PCF50633_REG_LDO5ENA 0x36 | ||
31 | #define PCF50633_REG_LDO6OUT 0x37 | ||
32 | #define PCF50633_REG_LDO6ENA 0x38 | ||
33 | #define PCF50633_REG_HCLDOOUT 0x39 | ||
34 | #define PCF50633_REG_HCLDOENA 0x3a | ||
35 | #define PCF50633_REG_HCLDOOVL 0x40 | ||
36 | |||
37 | enum pcf50633_regulator_enable { | ||
38 | PCF50633_REGULATOR_ON = 0x01, | ||
39 | PCF50633_REGULATOR_ON_GPIO1 = 0x02, | ||
40 | PCF50633_REGULATOR_ON_GPIO2 = 0x04, | ||
41 | PCF50633_REGULATOR_ON_GPIO3 = 0x08, | ||
42 | }; | ||
43 | #define PCF50633_REGULATOR_ON_MASK 0x0f | ||
44 | |||
45 | enum pcf50633_regulator_phase { | ||
46 | PCF50633_REGULATOR_ACTPH1 = 0x00, | ||
47 | PCF50633_REGULATOR_ACTPH2 = 0x10, | ||
48 | PCF50633_REGULATOR_ACTPH3 = 0x20, | ||
49 | PCF50633_REGULATOR_ACTPH4 = 0x30, | ||
50 | }; | ||
51 | #define PCF50633_REGULATOR_ACTPH_MASK 0x30 | ||
52 | |||
53 | enum pcf50633_regulator_id { | ||
54 | PCF50633_REGULATOR_AUTO, | ||
55 | PCF50633_REGULATOR_DOWN1, | ||
56 | PCF50633_REGULATOR_DOWN2, | ||
57 | PCF50633_REGULATOR_LDO1, | ||
58 | PCF50633_REGULATOR_LDO2, | ||
59 | PCF50633_REGULATOR_LDO3, | ||
60 | PCF50633_REGULATOR_LDO4, | ||
61 | PCF50633_REGULATOR_LDO5, | ||
62 | PCF50633_REGULATOR_LDO6, | ||
63 | PCF50633_REGULATOR_HCLDO, | ||
64 | PCF50633_REGULATOR_MEMLDO, | ||
65 | }; | ||
66 | #endif | ||
67 | |||
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h index 053788649452..54bc5d0fd502 100644 --- a/include/linux/mfd/wm8350/comparator.h +++ b/include/linux/mfd/wm8350/comparator.h | |||
@@ -164,4 +164,12 @@ | |||
164 | #define WM8350_AUXADC_BATT 6 | 164 | #define WM8350_AUXADC_BATT 6 |
165 | #define WM8350_AUXADC_TEMP 7 | 165 | #define WM8350_AUXADC_TEMP 7 |
166 | 166 | ||
167 | struct wm8350; | ||
168 | |||
169 | /* | ||
170 | * AUX ADC Readback | ||
171 | */ | ||
172 | int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, | ||
173 | int vref); | ||
174 | |||
167 | #endif | 175 | #endif |
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 6ebf97f2a475..980669d50dca 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | #define WM8350_RESET_ID 0x00 | 30 | #define WM8350_RESET_ID 0x00 |
31 | #define WM8350_ID 0x01 | 31 | #define WM8350_ID 0x01 |
32 | #define WM8350_REVISION 0x02 | ||
32 | #define WM8350_SYSTEM_CONTROL_1 0x03 | 33 | #define WM8350_SYSTEM_CONTROL_1 0x03 |
33 | #define WM8350_SYSTEM_CONTROL_2 0x04 | 34 | #define WM8350_SYSTEM_CONTROL_2 0x04 |
34 | #define WM8350_SYSTEM_HIBERNATE 0x05 | 35 | #define WM8350_SYSTEM_HIBERNATE 0x05 |
@@ -57,6 +58,10 @@ | |||
57 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 | 58 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 |
58 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 | 59 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 |
59 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 | 60 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 |
61 | #define WM8350_CHARGER_OVERRIDES 0xE2 | ||
62 | #define WM8350_MISC_OVERRIDES 0xE3 | ||
63 | #define WM8350_COMPARATOR_OVERRIDES 0xE7 | ||
64 | #define WM8350_STATE_MACHINE_STATUS 0xE9 | ||
60 | 65 | ||
61 | #define WM8350_MAX_REGISTER 0xFF | 66 | #define WM8350_MAX_REGISTER 0xFF |
62 | 67 | ||
@@ -77,6 +82,11 @@ | |||
77 | #define WM8350_CUST_ID_MASK 0x00FF | 82 | #define WM8350_CUST_ID_MASK 0x00FF |
78 | 83 | ||
79 | /* | 84 | /* |
85 | * R2 (0x02) - Revision | ||
86 | */ | ||
87 | #define WM8350_MASK_REV_MASK 0x00FF | ||
88 | |||
89 | /* | ||
80 | * R3 (0x03) - System Control 1 | 90 | * R3 (0x03) - System Control 1 |
81 | */ | 91 | */ |
82 | #define WM8350_CHIP_ON 0x8000 | 92 | #define WM8350_CHIP_ON 0x8000 |
@@ -523,6 +533,35 @@ | |||
523 | #define WM8350_DC2_STS 0x0002 | 533 | #define WM8350_DC2_STS 0x0002 |
524 | #define WM8350_DC1_STS 0x0001 | 534 | #define WM8350_DC1_STS 0x0001 |
525 | 535 | ||
536 | /* | ||
537 | * R226 (0xE2) - Charger status | ||
538 | */ | ||
539 | #define WM8350_CHG_BATT_HOT_OVRDE 0x8000 | ||
540 | #define WM8350_CHG_BATT_COLD_OVRDE 0x4000 | ||
541 | |||
542 | /* | ||
543 | * R227 (0xE3) - Misc Overrides | ||
544 | */ | ||
545 | #define WM8350_USB_LIMIT_OVRDE 0x0400 | ||
546 | |||
547 | /* | ||
548 | * R227 (0xE7) - Comparator Overrides | ||
549 | */ | ||
550 | #define WM8350_USB_FB_OVRDE 0x8000 | ||
551 | #define WM8350_WALL_FB_OVRDE 0x4000 | ||
552 | #define WM8350_BATT_FB_OVRDE 0x2000 | ||
553 | |||
554 | |||
555 | /* | ||
556 | * R233 (0xE9) - State Machinine Status | ||
557 | */ | ||
558 | #define WM8350_USB_SM_MASK 0x0700 | ||
559 | #define WM8350_USB_SM_SHIFT 8 | ||
560 | |||
561 | #define WM8350_USB_SM_100_SLV 1 | ||
562 | #define WM8350_USB_SM_500_SLV 5 | ||
563 | #define WM8350_USB_SM_STDBY_SLV 7 | ||
564 | |||
526 | /* WM8350 wake up conditions */ | 565 | /* WM8350 wake up conditions */ |
527 | #define WM8350_IRQ_WKUP_OFF_STATE 43 | 566 | #define WM8350_IRQ_WKUP_OFF_STATE 43 |
528 | #define WM8350_IRQ_WKUP_HIB_STATE 44 | 567 | #define WM8350_IRQ_WKUP_HIB_STATE 44 |
@@ -536,6 +575,7 @@ | |||
536 | #define WM8350_REV_E 0x4 | 575 | #define WM8350_REV_E 0x4 |
537 | #define WM8350_REV_F 0x5 | 576 | #define WM8350_REV_F 0x5 |
538 | #define WM8350_REV_G 0x6 | 577 | #define WM8350_REV_G 0x6 |
578 | #define WM8350_REV_H 0x7 | ||
539 | 579 | ||
540 | #define WM8350_NUM_IRQ 63 | 580 | #define WM8350_NUM_IRQ 63 |
541 | 581 | ||
@@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[]; | |||
549 | extern const u16 wm8350_mode1_defaults[]; | 589 | extern const u16 wm8350_mode1_defaults[]; |
550 | extern const u16 wm8350_mode2_defaults[]; | 590 | extern const u16 wm8350_mode2_defaults[]; |
551 | extern const u16 wm8350_mode3_defaults[]; | 591 | extern const u16 wm8350_mode3_defaults[]; |
592 | extern const u16 wm8351_mode0_defaults[]; | ||
593 | extern const u16 wm8351_mode1_defaults[]; | ||
594 | extern const u16 wm8351_mode2_defaults[]; | ||
595 | extern const u16 wm8351_mode3_defaults[]; | ||
596 | extern const u16 wm8352_mode0_defaults[]; | ||
597 | extern const u16 wm8352_mode1_defaults[]; | ||
598 | extern const u16 wm8352_mode2_defaults[]; | ||
599 | extern const u16 wm8352_mode3_defaults[]; | ||
552 | 600 | ||
553 | struct wm8350; | 601 | struct wm8350; |
554 | 602 | ||
@@ -558,8 +606,6 @@ struct wm8350_irq { | |||
558 | }; | 606 | }; |
559 | 607 | ||
560 | struct wm8350 { | 608 | struct wm8350 { |
561 | int rev; /* chip revision */ | ||
562 | |||
563 | struct device *dev; | 609 | struct device *dev; |
564 | 610 | ||
565 | /* device IO */ | 611 | /* device IO */ |
@@ -572,6 +618,8 @@ struct wm8350 { | |||
572 | void *src); | 618 | void *src); |
573 | u16 *reg_cache; | 619 | u16 *reg_cache; |
574 | 620 | ||
621 | struct mutex auxadc_mutex; | ||
622 | |||
575 | /* Interrupt handling */ | 623 | /* Interrupt handling */ |
576 | struct work_struct irq_work; | 624 | struct work_struct irq_work; |
577 | struct mutex irq_mutex; /* IRQ table mutex */ | 625 | struct mutex irq_mutex; /* IRQ table mutex */ |
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index 69b69e07f62f..be3264e286e0 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
@@ -13,6 +13,10 @@ | |||
13 | #ifndef __LINUX_MFD_WM8350_PMIC_H | 13 | #ifndef __LINUX_MFD_WM8350_PMIC_H |
14 | #define __LINUX_MFD_WM8350_PMIC_H | 14 | #define __LINUX_MFD_WM8350_PMIC_H |
15 | 15 | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/leds.h> | ||
18 | #include <linux/regulator/machine.h> | ||
19 | |||
16 | /* | 20 | /* |
17 | * Register values. | 21 | * Register values. |
18 | */ | 22 | */ |
@@ -700,7 +704,38 @@ struct wm8350; | |||
700 | struct platform_device; | 704 | struct platform_device; |
701 | struct regulator_init_data; | 705 | struct regulator_init_data; |
702 | 706 | ||
707 | /* | ||
708 | * WM8350 LED platform data | ||
709 | */ | ||
710 | struct wm8350_led_platform_data { | ||
711 | const char *name; | ||
712 | const char *default_trigger; | ||
713 | int max_uA; | ||
714 | }; | ||
715 | |||
716 | struct wm8350_led { | ||
717 | struct platform_device *pdev; | ||
718 | struct mutex mutex; | ||
719 | struct work_struct work; | ||
720 | spinlock_t value_lock; | ||
721 | enum led_brightness value; | ||
722 | struct led_classdev cdev; | ||
723 | int max_uA_index; | ||
724 | int enabled; | ||
725 | |||
726 | struct regulator *isink; | ||
727 | struct regulator_consumer_supply isink_consumer; | ||
728 | struct regulator_init_data isink_init; | ||
729 | struct regulator *dcdc; | ||
730 | struct regulator_consumer_supply dcdc_consumer; | ||
731 | struct regulator_init_data dcdc_init; | ||
732 | }; | ||
733 | |||
703 | struct wm8350_pmic { | 734 | struct wm8350_pmic { |
735 | /* Number of regulators of each type on this device */ | ||
736 | int max_dcdc; | ||
737 | int max_isink; | ||
738 | |||
704 | /* ISINK to DCDC mapping */ | 739 | /* ISINK to DCDC mapping */ |
705 | int isink_A_dcdc; | 740 | int isink_A_dcdc; |
706 | int isink_B_dcdc; | 741 | int isink_B_dcdc; |
@@ -713,10 +748,15 @@ struct wm8350_pmic { | |||
713 | 748 | ||
714 | /* regulator devices */ | 749 | /* regulator devices */ |
715 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; | 750 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; |
751 | |||
752 | /* LED devices */ | ||
753 | struct wm8350_led led[2]; | ||
716 | }; | 754 | }; |
717 | 755 | ||
718 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | 756 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, |
719 | struct regulator_init_data *initdata); | 757 | struct regulator_init_data *initdata); |
758 | int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink, | ||
759 | struct wm8350_led_platform_data *pdata); | ||
720 | 760 | ||
721 | /* | 761 | /* |
722 | * Additional DCDC control not supported via regulator API | 762 | * Additional DCDC control not supported via regulator API |
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h index 1c8f3cde79b0..2b9479310bbd 100644 --- a/include/linux/mfd/wm8350/supply.h +++ b/include/linux/mfd/wm8350/supply.h | |||
@@ -13,7 +13,8 @@ | |||
13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ | 13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ |
14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ | 14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ |
15 | 15 | ||
16 | #include <linux/platform_device.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/power_supply.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * Charger registers | 20 | * Charger registers |
@@ -104,8 +105,30 @@ | |||
104 | #define WM8350_IRQ_EXT_WALL_FB 37 | 105 | #define WM8350_IRQ_EXT_WALL_FB 37 |
105 | #define WM8350_IRQ_EXT_BAT_FB 38 | 106 | #define WM8350_IRQ_EXT_BAT_FB 38 |
106 | 107 | ||
108 | /* | ||
109 | * Policy to control charger state machine. | ||
110 | */ | ||
111 | struct wm8350_charger_policy { | ||
112 | |||
113 | /* charger state machine policy - set in machine driver */ | ||
114 | int eoc_mA; /* end of charge current (mA) */ | ||
115 | int charge_mV; /* charge voltage */ | ||
116 | int fast_limit_mA; /* fast charge current limit */ | ||
117 | int fast_limit_USB_mA; /* USB fast charge current limit */ | ||
118 | int charge_timeout; /* charge timeout (mins) */ | ||
119 | int trickle_start_mV; /* trickle charge starts at mV */ | ||
120 | int trickle_charge_mA; /* trickle charge current */ | ||
121 | int trickle_charge_USB_mA; /* USB trickle charge current */ | ||
122 | }; | ||
123 | |||
107 | struct wm8350_power { | 124 | struct wm8350_power { |
108 | struct platform_device *pdev; | 125 | struct platform_device *pdev; |
126 | struct power_supply battery; | ||
127 | struct power_supply usb; | ||
128 | struct power_supply ac; | ||
129 | struct wm8350_charger_policy *policy; | ||
130 | |||
131 | int rev_g_coeff; | ||
109 | }; | 132 | }; |
110 | 133 | ||
111 | #endif | 134 | #endif |