diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-12 19:27:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-12 19:27:24 -0500 |
commit | b743791639d8142277df1c2814c282e3ad752f06 (patch) | |
tree | 27e09f48e6c28b8695c343dbd3d8dedb0a92b3a4 /include | |
parent | 9219a3b9889dbc7dae68e472f239672ff48860b0 (diff) | |
parent | b29c06ae96acc47e866f29d19075707f91df69c8 (diff) |
Merge branch 'for-next' of git://git.o-hand.com/linux-mfd
* 'for-next' of git://git.o-hand.com/linux-mfd:
mfd: Fix twl4030-core build
mfd: Ensure sm501 GPIO pin mode is GPIO when configured
mfd: dm355 evm MMC/SD card detection
regulator: PCF50633 pmic driver
input: PCF50633 input driver
power_supply: PCF50633 battery charger driver
rtc: PCF50633 rtc driver
mfd: PCF50633 gpio support
mfd: PCF50633 adc driver
mfd: PCF50633 core driver
Diffstat (limited to 'include')
-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 |
5 files changed, 543 insertions, 0 deletions
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 | |||