aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSundar Iyer <sundar.iyer@stericsson.com>2010-12-12 23:03:14 -0500
committerLinus Walleij <linus.walleij@stericsson.com>2010-12-19 13:27:46 -0500
commit20406ebff4a298e6e3abbc1717a90bb3e55dc820 (patch)
tree7a9c79f4e1310e3a2ef3f50fd98c41e453999414
parentf4e8afdc7ab1b5a0962be02a9dd15d29a81f4c53 (diff)
mfd/tc3589x: rename tc35892 structs/registers to tc359x
Most of the register layout, client IRQ numbers on the TC35892 is shared also by other variants. Make this generic as tc3589x Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/board-mop500.c12
-rw-r--r--drivers/gpio/tc3589x-gpio.c268
-rw-r--r--drivers/mfd/tc3589x.c222
-rw-r--r--include/linux/mfd/tc3589x.h202
4 files changed, 351 insertions, 353 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index a8220c5a6a69..5c950261968e 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -19,8 +19,7 @@
19#include <linux/amba/pl022.h> 19#include <linux/amba/pl022.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/mfd/ab8500.h> 21#include <linux/mfd/ab8500.h>
22#include <linux/mfd/tc35892.h> 22#include <linux/mfd/tc3589x.h>
23#include <linux/input/matrix_keypad.h>
24 23
25#include <asm/mach-types.h> 24#include <asm/mach-types.h>
26#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
@@ -112,24 +111,24 @@ static struct pl022_ssp_controller ssp0_platform_data = {
112 * TC35892 111 * TC35892
113 */ 112 */
114 113
115static void mop500_tc35892_init(struct tc35892 *tc35892, unsigned int base) 114static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
116{ 115{
117 mop500_sdi_tc35892_init(); 116 mop500_sdi_tc35892_init();
118} 117}
119 118
120static struct tc35892_gpio_platform_data mop500_tc35892_gpio_data = { 119static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
121 .gpio_base = MOP500_EGPIO(0), 120 .gpio_base = MOP500_EGPIO(0),
122 .setup = mop500_tc35892_init, 121 .setup = mop500_tc35892_init,
123}; 122};
124 123
125static struct tc35892_platform_data mop500_tc35892_data = { 124static struct tc3589x_platform_data mop500_tc35892_data = {
126 .gpio = &mop500_tc35892_gpio_data, 125 .gpio = &mop500_tc35892_gpio_data,
127 .irq_base = MOP500_EGPIO_IRQ_BASE, 126 .irq_base = MOP500_EGPIO_IRQ_BASE,
128}; 127};
129 128
130static struct i2c_board_info mop500_i2c0_devices[] = { 129static struct i2c_board_info mop500_i2c0_devices[] = {
131 { 130 {
132 I2C_BOARD_INFO("tc35892", 0x42), 131 I2C_BOARD_INFO("tc3589x", 0x42),
133 .irq = NOMADIK_GPIO_TO_IRQ(217), 132 .irq = NOMADIK_GPIO_TO_IRQ(217),
134 .platform_data = &mop500_tc35892_data, 133 .platform_data = &mop500_tc35892_data,
135 }, 134 },
@@ -302,7 +301,6 @@ static void __init u8500_init_machine(void)
302 301
303 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins)); 302 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
304 303
305 ux500_ske_keypad_device.dev.platform_data = &ske_keypad_board;
306 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 304 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
307 305
308 mop500_i2c_init(); 306 mop500_i2c_init();
diff --git a/drivers/gpio/tc3589x-gpio.c b/drivers/gpio/tc3589x-gpio.c
index 027b857c18ff..180d584454fb 100644
--- a/drivers/gpio/tc3589x-gpio.c
+++ b/drivers/gpio/tc3589x-gpio.c
@@ -24,9 +24,9 @@ enum { REG_IBE, REG_IEV, REG_IS, REG_IE };
24#define CACHE_NR_REGS 4 24#define CACHE_NR_REGS 4
25#define CACHE_NR_BANKS 3 25#define CACHE_NR_BANKS 3
26 26
27struct tc35892_gpio { 27struct tc3589x_gpio {
28 struct gpio_chip chip; 28 struct gpio_chip chip;
29 struct tc35892 *tc35892; 29 struct tc3589x *tc3589x;
30 struct device *dev; 30 struct device *dev;
31 struct mutex irq_lock; 31 struct mutex irq_lock;
32 32
@@ -37,179 +37,179 @@ struct tc35892_gpio {
37 u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS]; 37 u8 oldregs[CACHE_NR_REGS][CACHE_NR_BANKS];
38}; 38};
39 39
40static inline struct tc35892_gpio *to_tc35892_gpio(struct gpio_chip *chip) 40static inline struct tc3589x_gpio *to_tc3589x_gpio(struct gpio_chip *chip)
41{ 41{
42 return container_of(chip, struct tc35892_gpio, chip); 42 return container_of(chip, struct tc3589x_gpio, chip);
43} 43}
44 44
45static int tc35892_gpio_get(struct gpio_chip *chip, unsigned offset) 45static int tc3589x_gpio_get(struct gpio_chip *chip, unsigned offset)
46{ 46{
47 struct tc35892_gpio *tc35892_gpio = to_tc35892_gpio(chip); 47 struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(chip);
48 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 48 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
49 u8 reg = TC35892_GPIODATA0 + (offset / 8) * 2; 49 u8 reg = TC3589x_GPIODATA0 + (offset / 8) * 2;
50 u8 mask = 1 << (offset % 8); 50 u8 mask = 1 << (offset % 8);
51 int ret; 51 int ret;
52 52
53 ret = tc35892_reg_read(tc35892, reg); 53 ret = tc3589x_reg_read(tc3589x, reg);
54 if (ret < 0) 54 if (ret < 0)
55 return ret; 55 return ret;
56 56
57 return ret & mask; 57 return ret & mask;
58} 58}
59 59
60static void tc35892_gpio_set(struct gpio_chip *chip, unsigned offset, int val) 60static void tc3589x_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
61{ 61{
62 struct tc35892_gpio *tc35892_gpio = to_tc35892_gpio(chip); 62 struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(chip);
63 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 63 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
64 u8 reg = TC35892_GPIODATA0 + (offset / 8) * 2; 64 u8 reg = TC3589x_GPIODATA0 + (offset / 8) * 2;
65 unsigned pos = offset % 8; 65 unsigned pos = offset % 8;
66 u8 data[] = {!!val << pos, 1 << pos}; 66 u8 data[] = {!!val << pos, 1 << pos};
67 67
68 tc35892_block_write(tc35892, reg, ARRAY_SIZE(data), data); 68 tc3589x_block_write(tc3589x, reg, ARRAY_SIZE(data), data);
69} 69}
70 70
71static int tc35892_gpio_direction_output(struct gpio_chip *chip, 71static int tc3589x_gpio_direction_output(struct gpio_chip *chip,
72 unsigned offset, int val) 72 unsigned offset, int val)
73{ 73{
74 struct tc35892_gpio *tc35892_gpio = to_tc35892_gpio(chip); 74 struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(chip);
75 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 75 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
76 u8 reg = TC35892_GPIODIR0 + offset / 8; 76 u8 reg = TC3589x_GPIODIR0 + offset / 8;
77 unsigned pos = offset % 8; 77 unsigned pos = offset % 8;
78 78
79 tc35892_gpio_set(chip, offset, val); 79 tc3589x_gpio_set(chip, offset, val);
80 80
81 return tc35892_set_bits(tc35892, reg, 1 << pos, 1 << pos); 81 return tc3589x_set_bits(tc3589x, reg, 1 << pos, 1 << pos);
82} 82}
83 83
84static int tc35892_gpio_direction_input(struct gpio_chip *chip, 84static int tc3589x_gpio_direction_input(struct gpio_chip *chip,
85 unsigned offset) 85 unsigned offset)
86{ 86{
87 struct tc35892_gpio *tc35892_gpio = to_tc35892_gpio(chip); 87 struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(chip);
88 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 88 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
89 u8 reg = TC35892_GPIODIR0 + offset / 8; 89 u8 reg = TC3589x_GPIODIR0 + offset / 8;
90 unsigned pos = offset % 8; 90 unsigned pos = offset % 8;
91 91
92 return tc35892_set_bits(tc35892, reg, 1 << pos, 0); 92 return tc3589x_set_bits(tc3589x, reg, 1 << pos, 0);
93} 93}
94 94
95static int tc35892_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 95static int tc3589x_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
96{ 96{
97 struct tc35892_gpio *tc35892_gpio = to_tc35892_gpio(chip); 97 struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(chip);
98 98
99 return tc35892_gpio->irq_base + offset; 99 return tc3589x_gpio->irq_base + offset;
100} 100}
101 101
102static struct gpio_chip template_chip = { 102static struct gpio_chip template_chip = {
103 .label = "tc35892", 103 .label = "tc3589x",
104 .owner = THIS_MODULE, 104 .owner = THIS_MODULE,
105 .direction_input = tc35892_gpio_direction_input, 105 .direction_input = tc3589x_gpio_direction_input,
106 .get = tc35892_gpio_get, 106 .get = tc3589x_gpio_get,
107 .direction_output = tc35892_gpio_direction_output, 107 .direction_output = tc3589x_gpio_direction_output,
108 .set = tc35892_gpio_set, 108 .set = tc3589x_gpio_set,
109 .to_irq = tc35892_gpio_to_irq, 109 .to_irq = tc3589x_gpio_to_irq,
110 .can_sleep = 1, 110 .can_sleep = 1,
111}; 111};
112 112
113static int tc35892_gpio_irq_set_type(unsigned int irq, unsigned int type) 113static int tc3589x_gpio_irq_set_type(unsigned int irq, unsigned int type)
114{ 114{
115 struct tc35892_gpio *tc35892_gpio = get_irq_chip_data(irq); 115 struct tc3589x_gpio *tc3589x_gpio = get_irq_chip_data(irq);
116 int offset = irq - tc35892_gpio->irq_base; 116 int offset = irq - tc3589x_gpio->irq_base;
117 int regoffset = offset / 8; 117 int regoffset = offset / 8;
118 int mask = 1 << (offset % 8); 118 int mask = 1 << (offset % 8);
119 119
120 if (type == IRQ_TYPE_EDGE_BOTH) { 120 if (type == IRQ_TYPE_EDGE_BOTH) {
121 tc35892_gpio->regs[REG_IBE][regoffset] |= mask; 121 tc3589x_gpio->regs[REG_IBE][regoffset] |= mask;
122 return 0; 122 return 0;
123 } 123 }
124 124
125 tc35892_gpio->regs[REG_IBE][regoffset] &= ~mask; 125 tc3589x_gpio->regs[REG_IBE][regoffset] &= ~mask;
126 126
127 if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_LEVEL_HIGH) 127 if (type == IRQ_TYPE_LEVEL_LOW || type == IRQ_TYPE_LEVEL_HIGH)
128 tc35892_gpio->regs[REG_IS][regoffset] |= mask; 128 tc3589x_gpio->regs[REG_IS][regoffset] |= mask;
129 else 129 else
130 tc35892_gpio->regs[REG_IS][regoffset] &= ~mask; 130 tc3589x_gpio->regs[REG_IS][regoffset] &= ~mask;
131 131
132 if (type == IRQ_TYPE_EDGE_RISING || type == IRQ_TYPE_LEVEL_HIGH) 132 if (type == IRQ_TYPE_EDGE_RISING || type == IRQ_TYPE_LEVEL_HIGH)
133 tc35892_gpio->regs[REG_IEV][regoffset] |= mask; 133 tc3589x_gpio->regs[REG_IEV][regoffset] |= mask;
134 else 134 else
135 tc35892_gpio->regs[REG_IEV][regoffset] &= ~mask; 135 tc3589x_gpio->regs[REG_IEV][regoffset] &= ~mask;
136 136
137 return 0; 137 return 0;
138} 138}
139 139
140static void tc35892_gpio_irq_lock(unsigned int irq) 140static void tc3589x_gpio_irq_lock(unsigned int irq)
141{ 141{
142 struct tc35892_gpio *tc35892_gpio = get_irq_chip_data(irq); 142 struct tc3589x_gpio *tc3589x_gpio = get_irq_chip_data(irq);
143 143
144 mutex_lock(&tc35892_gpio->irq_lock); 144 mutex_lock(&tc3589x_gpio->irq_lock);
145} 145}
146 146
147static void tc35892_gpio_irq_sync_unlock(unsigned int irq) 147static void tc3589x_gpio_irq_sync_unlock(unsigned int irq)
148{ 148{
149 struct tc35892_gpio *tc35892_gpio = get_irq_chip_data(irq); 149 struct tc3589x_gpio *tc3589x_gpio = get_irq_chip_data(irq);
150 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 150 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
151 static const u8 regmap[] = { 151 static const u8 regmap[] = {
152 [REG_IBE] = TC35892_GPIOIBE0, 152 [REG_IBE] = TC3589x_GPIOIBE0,
153 [REG_IEV] = TC35892_GPIOIEV0, 153 [REG_IEV] = TC3589x_GPIOIEV0,
154 [REG_IS] = TC35892_GPIOIS0, 154 [REG_IS] = TC3589x_GPIOIS0,
155 [REG_IE] = TC35892_GPIOIE0, 155 [REG_IE] = TC3589x_GPIOIE0,
156 }; 156 };
157 int i, j; 157 int i, j;
158 158
159 for (i = 0; i < CACHE_NR_REGS; i++) { 159 for (i = 0; i < CACHE_NR_REGS; i++) {
160 for (j = 0; j < CACHE_NR_BANKS; j++) { 160 for (j = 0; j < CACHE_NR_BANKS; j++) {
161 u8 old = tc35892_gpio->oldregs[i][j]; 161 u8 old = tc3589x_gpio->oldregs[i][j];
162 u8 new = tc35892_gpio->regs[i][j]; 162 u8 new = tc3589x_gpio->regs[i][j];
163 163
164 if (new == old) 164 if (new == old)
165 continue; 165 continue;
166 166
167 tc35892_gpio->oldregs[i][j] = new; 167 tc3589x_gpio->oldregs[i][j] = new;
168 tc35892_reg_write(tc35892, regmap[i] + j * 8, new); 168 tc3589x_reg_write(tc3589x, regmap[i] + j * 8, new);
169 } 169 }
170 } 170 }
171 171
172 mutex_unlock(&tc35892_gpio->irq_lock); 172 mutex_unlock(&tc3589x_gpio->irq_lock);
173} 173}
174 174
175static void tc35892_gpio_irq_mask(unsigned int irq) 175static void tc3589x_gpio_irq_mask(unsigned int irq)
176{ 176{
177 struct tc35892_gpio *tc35892_gpio = get_irq_chip_data(irq); 177 struct tc3589x_gpio *tc3589x_gpio = get_irq_chip_data(irq);
178 int offset = irq - tc35892_gpio->irq_base; 178 int offset = irq - tc3589x_gpio->irq_base;
179 int regoffset = offset / 8; 179 int regoffset = offset / 8;
180 int mask = 1 << (offset % 8); 180 int mask = 1 << (offset % 8);
181 181
182 tc35892_gpio->regs[REG_IE][regoffset] &= ~mask; 182 tc3589x_gpio->regs[REG_IE][regoffset] &= ~mask;
183} 183}
184 184
185static void tc35892_gpio_irq_unmask(unsigned int irq) 185static void tc3589x_gpio_irq_unmask(unsigned int irq)
186{ 186{
187 struct tc35892_gpio *tc35892_gpio = get_irq_chip_data(irq); 187 struct tc3589x_gpio *tc3589x_gpio = get_irq_chip_data(irq);
188 int offset = irq - tc35892_gpio->irq_base; 188 int offset = irq - tc3589x_gpio->irq_base;
189 int regoffset = offset / 8; 189 int regoffset = offset / 8;
190 int mask = 1 << (offset % 8); 190 int mask = 1 << (offset % 8);
191 191
192 tc35892_gpio->regs[REG_IE][regoffset] |= mask; 192 tc3589x_gpio->regs[REG_IE][regoffset] |= mask;
193} 193}
194 194
195static struct irq_chip tc35892_gpio_irq_chip = { 195static struct irq_chip tc3589x_gpio_irq_chip = {
196 .name = "tc35892-gpio", 196 .name = "tc3589x-gpio",
197 .bus_lock = tc35892_gpio_irq_lock, 197 .bus_lock = tc3589x_gpio_irq_lock,
198 .bus_sync_unlock = tc35892_gpio_irq_sync_unlock, 198 .bus_sync_unlock = tc3589x_gpio_irq_sync_unlock,
199 .mask = tc35892_gpio_irq_mask, 199 .mask = tc3589x_gpio_irq_mask,
200 .unmask = tc35892_gpio_irq_unmask, 200 .unmask = tc3589x_gpio_irq_unmask,
201 .set_type = tc35892_gpio_irq_set_type, 201 .set_type = tc3589x_gpio_irq_set_type,
202}; 202};
203 203
204static irqreturn_t tc35892_gpio_irq(int irq, void *dev) 204static irqreturn_t tc3589x_gpio_irq(int irq, void *dev)
205{ 205{
206 struct tc35892_gpio *tc35892_gpio = dev; 206 struct tc3589x_gpio *tc3589x_gpio = dev;
207 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 207 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
208 u8 status[CACHE_NR_BANKS]; 208 u8 status[CACHE_NR_BANKS];
209 int ret; 209 int ret;
210 int i; 210 int i;
211 211
212 ret = tc35892_block_read(tc35892, TC35892_GPIOMIS0, 212 ret = tc3589x_block_read(tc3589x, TC3589x_GPIOMIS0,
213 ARRAY_SIZE(status), status); 213 ARRAY_SIZE(status), status);
214 if (ret < 0) 214 if (ret < 0)
215 return IRQ_NONE; 215 return IRQ_NONE;
@@ -223,24 +223,24 @@ static irqreturn_t tc35892_gpio_irq(int irq, void *dev)
223 int bit = __ffs(stat); 223 int bit = __ffs(stat);
224 int line = i * 8 + bit; 224 int line = i * 8 + bit;
225 225
226 handle_nested_irq(tc35892_gpio->irq_base + line); 226 handle_nested_irq(tc3589x_gpio->irq_base + line);
227 stat &= ~(1 << bit); 227 stat &= ~(1 << bit);
228 } 228 }
229 229
230 tc35892_reg_write(tc35892, TC35892_GPIOIC0 + i, status[i]); 230 tc3589x_reg_write(tc3589x, TC3589x_GPIOIC0 + i, status[i]);
231 } 231 }
232 232
233 return IRQ_HANDLED; 233 return IRQ_HANDLED;
234} 234}
235 235
236static int tc35892_gpio_irq_init(struct tc35892_gpio *tc35892_gpio) 236static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio)
237{ 237{
238 int base = tc35892_gpio->irq_base; 238 int base = tc3589x_gpio->irq_base;
239 int irq; 239 int irq;
240 240
241 for (irq = base; irq < base + tc35892_gpio->chip.ngpio; irq++) { 241 for (irq = base; irq < base + tc3589x_gpio->chip.ngpio; irq++) {
242 set_irq_chip_data(irq, tc35892_gpio); 242 set_irq_chip_data(irq, tc3589x_gpio);
243 set_irq_chip_and_handler(irq, &tc35892_gpio_irq_chip, 243 set_irq_chip_and_handler(irq, &tc3589x_gpio_irq_chip,
244 handle_simple_irq); 244 handle_simple_irq);
245 set_irq_nested_thread(irq, 1); 245 set_irq_nested_thread(irq, 1);
246#ifdef CONFIG_ARM 246#ifdef CONFIG_ARM
@@ -253,12 +253,12 @@ static int tc35892_gpio_irq_init(struct tc35892_gpio *tc35892_gpio)
253 return 0; 253 return 0;
254} 254}
255 255
256static void tc35892_gpio_irq_remove(struct tc35892_gpio *tc35892_gpio) 256static void tc3589x_gpio_irq_remove(struct tc3589x_gpio *tc3589x_gpio)
257{ 257{
258 int base = tc35892_gpio->irq_base; 258 int base = tc3589x_gpio->irq_base;
259 int irq; 259 int irq;
260 260
261 for (irq = base; irq < base + tc35892_gpio->chip.ngpio; irq++) { 261 for (irq = base; irq < base + tc3589x_gpio->chip.ngpio; irq++) {
262#ifdef CONFIG_ARM 262#ifdef CONFIG_ARM
263 set_irq_flags(irq, 0); 263 set_irq_flags(irq, 0);
264#endif 264#endif
@@ -267,15 +267,15 @@ static void tc35892_gpio_irq_remove(struct tc35892_gpio *tc35892_gpio)
267 } 267 }
268} 268}
269 269
270static int __devinit tc35892_gpio_probe(struct platform_device *pdev) 270static int __devinit tc3589x_gpio_probe(struct platform_device *pdev)
271{ 271{
272 struct tc35892 *tc35892 = dev_get_drvdata(pdev->dev.parent); 272 struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent);
273 struct tc35892_gpio_platform_data *pdata; 273 struct tc3589x_gpio_platform_data *pdata;
274 struct tc35892_gpio *tc35892_gpio; 274 struct tc3589x_gpio *tc3589x_gpio;
275 int ret; 275 int ret;
276 int irq; 276 int irq;
277 277
278 pdata = tc35892->pdata->gpio; 278 pdata = tc3589x->pdata->gpio;
279 if (!pdata) 279 if (!pdata)
280 return -ENODEV; 280 return -ENODEV;
281 281
@@ -283,107 +283,107 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev)
283 if (irq < 0) 283 if (irq < 0)
284 return irq; 284 return irq;
285 285
286 tc35892_gpio = kzalloc(sizeof(struct tc35892_gpio), GFP_KERNEL); 286 tc3589x_gpio = kzalloc(sizeof(struct tc3589x_gpio), GFP_KERNEL);
287 if (!tc35892_gpio) 287 if (!tc3589x_gpio)
288 return -ENOMEM; 288 return -ENOMEM;
289 289
290 mutex_init(&tc35892_gpio->irq_lock); 290 mutex_init(&tc3589x_gpio->irq_lock);
291 291
292 tc35892_gpio->dev = &pdev->dev; 292 tc3589x_gpio->dev = &pdev->dev;
293 tc35892_gpio->tc35892 = tc35892; 293 tc3589x_gpio->tc3589x = tc3589x;
294 294
295 tc35892_gpio->chip = template_chip; 295 tc3589x_gpio->chip = template_chip;
296 tc35892_gpio->chip.ngpio = tc35892->num_gpio; 296 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
297 tc35892_gpio->chip.dev = &pdev->dev; 297 tc3589x_gpio->chip.dev = &pdev->dev;
298 tc35892_gpio->chip.base = pdata->gpio_base; 298 tc3589x_gpio->chip.base = pdata->gpio_base;
299 299
300 tc35892_gpio->irq_base = tc35892->irq_base + TC35892_INT_GPIO(0); 300 tc3589x_gpio->irq_base = tc3589x->irq_base + TC3589x_INT_GPIO(0);
301 301
302 /* Bring the GPIO module out of reset */ 302 /* Bring the GPIO module out of reset */
303 ret = tc35892_set_bits(tc35892, TC35892_RSTCTRL, 303 ret = tc3589x_set_bits(tc3589x, TC3589x_RSTCTRL,
304 TC35892_RSTCTRL_GPIRST, 0); 304 TC3589x_RSTCTRL_GPIRST, 0);
305 if (ret < 0) 305 if (ret < 0)
306 goto out_free; 306 goto out_free;
307 307
308 ret = tc35892_gpio_irq_init(tc35892_gpio); 308 ret = tc3589x_gpio_irq_init(tc3589x_gpio);
309 if (ret) 309 if (ret)
310 goto out_free; 310 goto out_free;
311 311
312 ret = request_threaded_irq(irq, NULL, tc35892_gpio_irq, IRQF_ONESHOT, 312 ret = request_threaded_irq(irq, NULL, tc3589x_gpio_irq, IRQF_ONESHOT,
313 "tc35892-gpio", tc35892_gpio); 313 "tc3589x-gpio", tc3589x_gpio);
314 if (ret) { 314 if (ret) {
315 dev_err(&pdev->dev, "unable to get irq: %d\n", ret); 315 dev_err(&pdev->dev, "unable to get irq: %d\n", ret);
316 goto out_removeirq; 316 goto out_removeirq;
317 } 317 }
318 318
319 ret = gpiochip_add(&tc35892_gpio->chip); 319 ret = gpiochip_add(&tc3589x_gpio->chip);
320 if (ret) { 320 if (ret) {
321 dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret); 321 dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
322 goto out_freeirq; 322 goto out_freeirq;
323 } 323 }
324 324
325 if (pdata->setup) 325 if (pdata->setup)
326 pdata->setup(tc35892, tc35892_gpio->chip.base); 326 pdata->setup(tc3589x, tc3589x_gpio->chip.base);
327 327
328 platform_set_drvdata(pdev, tc35892_gpio); 328 platform_set_drvdata(pdev, tc3589x_gpio);
329 329
330 return 0; 330 return 0;
331 331
332out_freeirq: 332out_freeirq:
333 free_irq(irq, tc35892_gpio); 333 free_irq(irq, tc3589x_gpio);
334out_removeirq: 334out_removeirq:
335 tc35892_gpio_irq_remove(tc35892_gpio); 335 tc3589x_gpio_irq_remove(tc3589x_gpio);
336out_free: 336out_free:
337 kfree(tc35892_gpio); 337 kfree(tc3589x_gpio);
338 return ret; 338 return ret;
339} 339}
340 340
341static int __devexit tc35892_gpio_remove(struct platform_device *pdev) 341static int __devexit tc3589x_gpio_remove(struct platform_device *pdev)
342{ 342{
343 struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev); 343 struct tc3589x_gpio *tc3589x_gpio = platform_get_drvdata(pdev);
344 struct tc35892 *tc35892 = tc35892_gpio->tc35892; 344 struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
345 struct tc35892_gpio_platform_data *pdata = tc35892->pdata->gpio; 345 struct tc3589x_gpio_platform_data *pdata = tc3589x->pdata->gpio;
346 int irq = platform_get_irq(pdev, 0); 346 int irq = platform_get_irq(pdev, 0);
347 int ret; 347 int ret;
348 348
349 if (pdata->remove) 349 if (pdata->remove)
350 pdata->remove(tc35892, tc35892_gpio->chip.base); 350 pdata->remove(tc3589x, tc3589x_gpio->chip.base);
351 351
352 ret = gpiochip_remove(&tc35892_gpio->chip); 352 ret = gpiochip_remove(&tc3589x_gpio->chip);
353 if (ret < 0) { 353 if (ret < 0) {
354 dev_err(tc35892_gpio->dev, 354 dev_err(tc3589x_gpio->dev,
355 "unable to remove gpiochip: %d\n", ret); 355 "unable to remove gpiochip: %d\n", ret);
356 return ret; 356 return ret;
357 } 357 }
358 358
359 free_irq(irq, tc35892_gpio); 359 free_irq(irq, tc3589x_gpio);
360 tc35892_gpio_irq_remove(tc35892_gpio); 360 tc3589x_gpio_irq_remove(tc3589x_gpio);
361 361
362 platform_set_drvdata(pdev, NULL); 362 platform_set_drvdata(pdev, NULL);
363 kfree(tc35892_gpio); 363 kfree(tc3589x_gpio);
364 364
365 return 0; 365 return 0;
366} 366}
367 367
368static struct platform_driver tc35892_gpio_driver = { 368static struct platform_driver tc3589x_gpio_driver = {
369 .driver.name = "tc35892-gpio", 369 .driver.name = "tc3589x-gpio",
370 .driver.owner = THIS_MODULE, 370 .driver.owner = THIS_MODULE,
371 .probe = tc35892_gpio_probe, 371 .probe = tc3589x_gpio_probe,
372 .remove = __devexit_p(tc35892_gpio_remove), 372 .remove = __devexit_p(tc3589x_gpio_remove),
373}; 373};
374 374
375static int __init tc35892_gpio_init(void) 375static int __init tc3589x_gpio_init(void)
376{ 376{
377 return platform_driver_register(&tc35892_gpio_driver); 377 return platform_driver_register(&tc3589x_gpio_driver);
378} 378}
379subsys_initcall(tc35892_gpio_init); 379subsys_initcall(tc3589x_gpio_init);
380 380
381static void __exit tc35892_gpio_exit(void) 381static void __exit tc3589x_gpio_exit(void)
382{ 382{
383 platform_driver_unregister(&tc35892_gpio_driver); 383 platform_driver_unregister(&tc3589x_gpio_driver);
384} 384}
385module_exit(tc35892_gpio_exit); 385module_exit(tc3589x_gpio_exit);
386 386
387MODULE_LICENSE("GPL v2"); 387MODULE_LICENSE("GPL v2");
388MODULE_DESCRIPTION("TC35892 GPIO driver"); 388MODULE_DESCRIPTION("TC3589x GPIO driver");
389MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent"); 389MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent");
diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c
index f230235c3765..7deff53181d1 100644
--- a/drivers/mfd/tc3589x.c
+++ b/drivers/mfd/tc3589x.c
@@ -15,141 +15,141 @@
15#include <linux/mfd/tc3589x.h> 15#include <linux/mfd/tc3589x.h>
16 16
17/** 17/**
18 * tc35892_reg_read() - read a single TC35892 register 18 * tc3589x_reg_read() - read a single TC3589x register
19 * @tc35892: Device to read from 19 * @tc3589x: Device to read from
20 * @reg: Register to read 20 * @reg: Register to read
21 */ 21 */
22int tc35892_reg_read(struct tc35892 *tc35892, u8 reg) 22int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg)
23{ 23{
24 int ret; 24 int ret;
25 25
26 ret = i2c_smbus_read_byte_data(tc35892->i2c, reg); 26 ret = i2c_smbus_read_byte_data(tc3589x->i2c, reg);
27 if (ret < 0) 27 if (ret < 0)
28 dev_err(tc35892->dev, "failed to read reg %#x: %d\n", 28 dev_err(tc3589x->dev, "failed to read reg %#x: %d\n",
29 reg, ret); 29 reg, ret);
30 30
31 return ret; 31 return ret;
32} 32}
33EXPORT_SYMBOL_GPL(tc35892_reg_read); 33EXPORT_SYMBOL_GPL(tc3589x_reg_read);
34 34
35/** 35/**
36 * tc35892_reg_read() - write a single TC35892 register 36 * tc3589x_reg_read() - write a single TC3589x register
37 * @tc35892: Device to write to 37 * @tc3589x: Device to write to
38 * @reg: Register to read 38 * @reg: Register to read
39 * @data: Value to write 39 * @data: Value to write
40 */ 40 */
41int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data) 41int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data)
42{ 42{
43 int ret; 43 int ret;
44 44
45 ret = i2c_smbus_write_byte_data(tc35892->i2c, reg, data); 45 ret = i2c_smbus_write_byte_data(tc3589x->i2c, reg, data);
46 if (ret < 0) 46 if (ret < 0)
47 dev_err(tc35892->dev, "failed to write reg %#x: %d\n", 47 dev_err(tc3589x->dev, "failed to write reg %#x: %d\n",
48 reg, ret); 48 reg, ret);
49 49
50 return ret; 50 return ret;
51} 51}
52EXPORT_SYMBOL_GPL(tc35892_reg_write); 52EXPORT_SYMBOL_GPL(tc3589x_reg_write);
53 53
54/** 54/**
55 * tc35892_block_read() - read multiple TC35892 registers 55 * tc3589x_block_read() - read multiple TC3589x registers
56 * @tc35892: Device to read from 56 * @tc3589x: Device to read from
57 * @reg: First register 57 * @reg: First register
58 * @length: Number of registers 58 * @length: Number of registers
59 * @values: Buffer to write to 59 * @values: Buffer to write to
60 */ 60 */
61int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length, u8 *values) 61int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length, u8 *values)
62{ 62{
63 int ret; 63 int ret;
64 64
65 ret = i2c_smbus_read_i2c_block_data(tc35892->i2c, reg, length, values); 65 ret = i2c_smbus_read_i2c_block_data(tc3589x->i2c, reg, length, values);
66 if (ret < 0) 66 if (ret < 0)
67 dev_err(tc35892->dev, "failed to read regs %#x: %d\n", 67 dev_err(tc3589x->dev, "failed to read regs %#x: %d\n",
68 reg, ret); 68 reg, ret);
69 69
70 return ret; 70 return ret;
71} 71}
72EXPORT_SYMBOL_GPL(tc35892_block_read); 72EXPORT_SYMBOL_GPL(tc3589x_block_read);
73 73
74/** 74/**
75 * tc35892_block_write() - write multiple TC35892 registers 75 * tc3589x_block_write() - write multiple TC3589x registers
76 * @tc35892: Device to write to 76 * @tc3589x: Device to write to
77 * @reg: First register 77 * @reg: First register
78 * @length: Number of registers 78 * @length: Number of registers
79 * @values: Values to write 79 * @values: Values to write
80 */ 80 */
81int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length, 81int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length,
82 const u8 *values) 82 const u8 *values)
83{ 83{
84 int ret; 84 int ret;
85 85
86 ret = i2c_smbus_write_i2c_block_data(tc35892->i2c, reg, length, 86 ret = i2c_smbus_write_i2c_block_data(tc3589x->i2c, reg, length,
87 values); 87 values);
88 if (ret < 0) 88 if (ret < 0)
89 dev_err(tc35892->dev, "failed to write regs %#x: %d\n", 89 dev_err(tc3589x->dev, "failed to write regs %#x: %d\n",
90 reg, ret); 90 reg, ret);
91 91
92 return ret; 92 return ret;
93} 93}
94EXPORT_SYMBOL_GPL(tc35892_block_write); 94EXPORT_SYMBOL_GPL(tc3589x_block_write);
95 95
96/** 96/**
97 * tc35892_set_bits() - set the value of a bitfield in a TC35892 register 97 * tc3589x_set_bits() - set the value of a bitfield in a TC3589x register
98 * @tc35892: Device to write to 98 * @tc3589x: Device to write to
99 * @reg: Register to write 99 * @reg: Register to write
100 * @mask: Mask of bits to set 100 * @mask: Mask of bits to set
101 * @values: Value to set 101 * @values: Value to set
102 */ 102 */
103int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val) 103int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val)
104{ 104{
105 int ret; 105 int ret;
106 106
107 mutex_lock(&tc35892->lock); 107 mutex_lock(&tc3589x->lock);
108 108
109 ret = tc35892_reg_read(tc35892, reg); 109 ret = tc3589x_reg_read(tc3589x, reg);
110 if (ret < 0) 110 if (ret < 0)
111 goto out; 111 goto out;
112 112
113 ret &= ~mask; 113 ret &= ~mask;
114 ret |= val; 114 ret |= val;
115 115
116 ret = tc35892_reg_write(tc35892, reg, ret); 116 ret = tc3589x_reg_write(tc3589x, reg, ret);
117 117
118out: 118out:
119 mutex_unlock(&tc35892->lock); 119 mutex_unlock(&tc3589x->lock);
120 return ret; 120 return ret;
121} 121}
122EXPORT_SYMBOL_GPL(tc35892_set_bits); 122EXPORT_SYMBOL_GPL(tc3589x_set_bits);
123 123
124static struct resource gpio_resources[] = { 124static struct resource gpio_resources[] = {
125 { 125 {
126 .start = TC35892_INT_GPIIRQ, 126 .start = TC3589x_INT_GPIIRQ,
127 .end = TC35892_INT_GPIIRQ, 127 .end = TC3589x_INT_GPIIRQ,
128 .flags = IORESOURCE_IRQ, 128 .flags = IORESOURCE_IRQ,
129 }, 129 },
130}; 130};
131 131
132static struct mfd_cell tc35892_devs[] = { 132static struct mfd_cell tc3589x_devs[] = {
133 { 133 {
134 .name = "tc35892-gpio", 134 .name = "tc3589x-gpio",
135 .num_resources = ARRAY_SIZE(gpio_resources), 135 .num_resources = ARRAY_SIZE(gpio_resources),
136 .resources = &gpio_resources[0], 136 .resources = &gpio_resources[0],
137 }, 137 },
138}; 138};
139 139
140static irqreturn_t tc35892_irq(int irq, void *data) 140static irqreturn_t tc3589x_irq(int irq, void *data)
141{ 141{
142 struct tc35892 *tc35892 = data; 142 struct tc3589x *tc3589x = data;
143 int status; 143 int status;
144 144
145 status = tc35892_reg_read(tc35892, TC35892_IRQST); 145 status = tc3589x_reg_read(tc3589x, TC3589x_IRQST);
146 if (status < 0) 146 if (status < 0)
147 return IRQ_NONE; 147 return IRQ_NONE;
148 148
149 while (status) { 149 while (status) {
150 int bit = __ffs(status); 150 int bit = __ffs(status);
151 151
152 handle_nested_irq(tc35892->irq_base + bit); 152 handle_nested_irq(tc3589x->irq_base + bit);
153 status &= ~(1 << bit); 153 status &= ~(1 << bit);
154 } 154 }
155 155
@@ -158,30 +158,30 @@ static irqreturn_t tc35892_irq(int irq, void *data)
158 * have the last interrupt clear (for example, GPIO IC write) take 158 * have the last interrupt clear (for example, GPIO IC write) take
159 * effect. 159 * effect.
160 */ 160 */
161 tc35892_reg_read(tc35892, TC35892_IRQST); 161 tc3589x_reg_read(tc3589x, TC3589x_IRQST);
162 162
163 return IRQ_HANDLED; 163 return IRQ_HANDLED;
164} 164}
165 165
166static void tc35892_irq_dummy(unsigned int irq) 166static void tc3589x_irq_dummy(unsigned int irq)
167{ 167{
168 /* No mask/unmask at this level */ 168 /* No mask/unmask at this level */
169} 169}
170 170
171static struct irq_chip tc35892_irq_chip = { 171static struct irq_chip tc3589x_irq_chip = {
172 .name = "tc35892", 172 .name = "tc3589x",
173 .mask = tc35892_irq_dummy, 173 .mask = tc3589x_irq_dummy,
174 .unmask = tc35892_irq_dummy, 174 .unmask = tc3589x_irq_dummy,
175}; 175};
176 176
177static int tc35892_irq_init(struct tc35892 *tc35892) 177static int tc3589x_irq_init(struct tc3589x *tc3589x)
178{ 178{
179 int base = tc35892->irq_base; 179 int base = tc3589x->irq_base;
180 int irq; 180 int irq;
181 181
182 for (irq = base; irq < base + TC35892_NR_INTERNAL_IRQS; irq++) { 182 for (irq = base; irq < base + TC3589x_NR_INTERNAL_IRQS; irq++) {
183 set_irq_chip_data(irq, tc35892); 183 set_irq_chip_data(irq, tc3589x);
184 set_irq_chip_and_handler(irq, &tc35892_irq_chip, 184 set_irq_chip_and_handler(irq, &tc3589x_irq_chip,
185 handle_edge_irq); 185 handle_edge_irq);
186 set_irq_nested_thread(irq, 1); 186 set_irq_nested_thread(irq, 1);
187#ifdef CONFIG_ARM 187#ifdef CONFIG_ARM
@@ -194,12 +194,12 @@ static int tc35892_irq_init(struct tc35892 *tc35892)
194 return 0; 194 return 0;
195} 195}
196 196
197static void tc35892_irq_remove(struct tc35892 *tc35892) 197static void tc3589x_irq_remove(struct tc3589x *tc3589x)
198{ 198{
199 int base = tc35892->irq_base; 199 int base = tc3589x->irq_base;
200 int irq; 200 int irq;
201 201
202 for (irq = base; irq < base + TC35892_NR_INTERNAL_IRQS; irq++) { 202 for (irq = base; irq < base + TC3589x_NR_INTERNAL_IRQS; irq++) {
203#ifdef CONFIG_ARM 203#ifdef CONFIG_ARM
204 set_irq_flags(irq, 0); 204 set_irq_flags(irq, 0);
205#endif 205#endif
@@ -208,138 +208,138 @@ static void tc35892_irq_remove(struct tc35892 *tc35892)
208 } 208 }
209} 209}
210 210
211static int tc35892_chip_init(struct tc35892 *tc35892) 211static int tc3589x_chip_init(struct tc3589x *tc3589x)
212{ 212{
213 int manf, ver, ret; 213 int manf, ver, ret;
214 214
215 manf = tc35892_reg_read(tc35892, TC35892_MANFCODE); 215 manf = tc3589x_reg_read(tc3589x, TC3589x_MANFCODE);
216 if (manf < 0) 216 if (manf < 0)
217 return manf; 217 return manf;
218 218
219 ver = tc35892_reg_read(tc35892, TC35892_VERSION); 219 ver = tc3589x_reg_read(tc3589x, TC3589x_VERSION);
220 if (ver < 0) 220 if (ver < 0)
221 return ver; 221 return ver;
222 222
223 if (manf != TC35892_MANFCODE_MAGIC) { 223 if (manf != TC3589x_MANFCODE_MAGIC) {
224 dev_err(tc35892->dev, "unknown manufacturer: %#x\n", manf); 224 dev_err(tc3589x->dev, "unknown manufacturer: %#x\n", manf);
225 return -EINVAL; 225 return -EINVAL;
226 } 226 }
227 227
228 dev_info(tc35892->dev, "manufacturer: %#x, version: %#x\n", manf, ver); 228 dev_info(tc3589x->dev, "manufacturer: %#x, version: %#x\n", manf, ver);
229 229
230 /* Put everything except the IRQ module into reset */ 230 /* Put everything except the IRQ module into reset */
231 ret = tc35892_reg_write(tc35892, TC35892_RSTCTRL, 231 ret = tc3589x_reg_write(tc3589x, TC3589x_RSTCTRL,
232 TC35892_RSTCTRL_TIMRST 232 TC3589x_RSTCTRL_TIMRST
233 | TC35892_RSTCTRL_ROTRST 233 | TC3589x_RSTCTRL_ROTRST
234 | TC35892_RSTCTRL_KBDRST 234 | TC3589x_RSTCTRL_KBDRST
235 | TC35892_RSTCTRL_GPIRST); 235 | TC3589x_RSTCTRL_GPIRST);
236 if (ret < 0) 236 if (ret < 0)
237 return ret; 237 return ret;
238 238
239 /* Clear the reset interrupt. */ 239 /* Clear the reset interrupt. */
240 return tc35892_reg_write(tc35892, TC35892_RSTINTCLR, 0x1); 240 return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
241} 241}
242 242
243static int __devinit tc35892_probe(struct i2c_client *i2c, 243static int __devinit tc3589x_probe(struct i2c_client *i2c,
244 const struct i2c_device_id *id) 244 const struct i2c_device_id *id)
245{ 245{
246 struct tc35892_platform_data *pdata = i2c->dev.platform_data; 246 struct tc3589x_platform_data *pdata = i2c->dev.platform_data;
247 struct tc35892 *tc35892; 247 struct tc3589x *tc3589x;
248 int ret; 248 int ret;
249 249
250 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA 250 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA
251 | I2C_FUNC_SMBUS_I2C_BLOCK)) 251 | I2C_FUNC_SMBUS_I2C_BLOCK))
252 return -EIO; 252 return -EIO;
253 253
254 tc35892 = kzalloc(sizeof(struct tc35892), GFP_KERNEL); 254 tc3589x = kzalloc(sizeof(struct tc3589x), GFP_KERNEL);
255 if (!tc35892) 255 if (!tc3589x)
256 return -ENOMEM; 256 return -ENOMEM;
257 257
258 mutex_init(&tc35892->lock); 258 mutex_init(&tc3589x->lock);
259 259
260 tc35892->dev = &i2c->dev; 260 tc3589x->dev = &i2c->dev;
261 tc35892->i2c = i2c; 261 tc3589x->i2c = i2c;
262 tc35892->pdata = pdata; 262 tc3589x->pdata = pdata;
263 tc35892->irq_base = pdata->irq_base; 263 tc3589x->irq_base = pdata->irq_base;
264 tc35892->num_gpio = id->driver_data; 264 tc3589x->num_gpio = id->driver_data;
265 265
266 i2c_set_clientdata(i2c, tc35892); 266 i2c_set_clientdata(i2c, tc3589x);
267 267
268 ret = tc35892_chip_init(tc35892); 268 ret = tc3589x_chip_init(tc3589x);
269 if (ret) 269 if (ret)
270 goto out_free; 270 goto out_free;
271 271
272 ret = tc35892_irq_init(tc35892); 272 ret = tc3589x_irq_init(tc3589x);
273 if (ret) 273 if (ret)
274 goto out_free; 274 goto out_free;
275 275
276 ret = request_threaded_irq(tc35892->i2c->irq, NULL, tc35892_irq, 276 ret = request_threaded_irq(tc3589x->i2c->irq, NULL, tc3589x_irq,
277 IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 277 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
278 "tc35892", tc35892); 278 "tc3589x", tc3589x);
279 if (ret) { 279 if (ret) {
280 dev_err(tc35892->dev, "failed to request IRQ: %d\n", ret); 280 dev_err(tc3589x->dev, "failed to request IRQ: %d\n", ret);
281 goto out_removeirq; 281 goto out_removeirq;
282 } 282 }
283 283
284 ret = mfd_add_devices(tc35892->dev, -1, tc35892_devs, 284 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_devs,
285 ARRAY_SIZE(tc35892_devs), NULL, 285 ARRAY_SIZE(tc3589x_devs), NULL,
286 tc35892->irq_base); 286 tc3589x->irq_base);
287 if (ret) { 287 if (ret) {
288 dev_err(tc35892->dev, "failed to add children\n"); 288 dev_err(tc3589x->dev, "failed to add children\n");
289 goto out_freeirq; 289 goto out_freeirq;
290 } 290 }
291 291
292 return 0; 292 return 0;
293 293
294out_freeirq: 294out_freeirq:
295 free_irq(tc35892->i2c->irq, tc35892); 295 free_irq(tc3589x->i2c->irq, tc3589x);
296out_removeirq: 296out_removeirq:
297 tc35892_irq_remove(tc35892); 297 tc3589x_irq_remove(tc3589x);
298out_free: 298out_free:
299 kfree(tc35892); 299 kfree(tc3589x);
300 return ret; 300 return ret;
301} 301}
302 302
303static int __devexit tc35892_remove(struct i2c_client *client) 303static int __devexit tc3589x_remove(struct i2c_client *client)
304{ 304{
305 struct tc35892 *tc35892 = i2c_get_clientdata(client); 305 struct tc3589x *tc3589x = i2c_get_clientdata(client);
306 306
307 mfd_remove_devices(tc35892->dev); 307 mfd_remove_devices(tc3589x->dev);
308 308
309 free_irq(tc35892->i2c->irq, tc35892); 309 free_irq(tc3589x->i2c->irq, tc3589x);
310 tc35892_irq_remove(tc35892); 310 tc3589x_irq_remove(tc3589x);
311 311
312 kfree(tc35892); 312 kfree(tc3589x);
313 313
314 return 0; 314 return 0;
315} 315}
316 316
317static const struct i2c_device_id tc35892_id[] = { 317static const struct i2c_device_id tc3589x_id[] = {
318 { "tc35892", 24 }, 318 { "tc3589x", 24 },
319 { } 319 { }
320}; 320};
321MODULE_DEVICE_TABLE(i2c, tc35892_id); 321MODULE_DEVICE_TABLE(i2c, tc3589x_id);
322 322
323static struct i2c_driver tc35892_driver = { 323static struct i2c_driver tc3589x_driver = {
324 .driver.name = "tc35892", 324 .driver.name = "tc3589x",
325 .driver.owner = THIS_MODULE, 325 .driver.owner = THIS_MODULE,
326 .probe = tc35892_probe, 326 .probe = tc3589x_probe,
327 .remove = __devexit_p(tc35892_remove), 327 .remove = __devexit_p(tc3589x_remove),
328 .id_table = tc35892_id, 328 .id_table = tc3589x_id,
329}; 329};
330 330
331static int __init tc35892_init(void) 331static int __init tc3589x_init(void)
332{ 332{
333 return i2c_add_driver(&tc35892_driver); 333 return i2c_add_driver(&tc3589x_driver);
334} 334}
335subsys_initcall(tc35892_init); 335subsys_initcall(tc3589x_init);
336 336
337static void __exit tc35892_exit(void) 337static void __exit tc3589x_exit(void)
338{ 338{
339 i2c_del_driver(&tc35892_driver); 339 i2c_del_driver(&tc3589x_driver);
340} 340}
341module_exit(tc35892_exit); 341module_exit(tc3589x_exit);
342 342
343MODULE_LICENSE("GPL v2"); 343MODULE_LICENSE("GPL v2");
344MODULE_DESCRIPTION("TC35892 MFD core driver"); 344MODULE_DESCRIPTION("TC3589x MFD core driver");
345MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent"); 345MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent");
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index eff3094ca84e..ea1918896f5b 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -4,133 +4,133 @@
4 * License Terms: GNU General Public License, version 2 4 * License Terms: GNU General Public License, version 2
5 */ 5 */
6 6
7#ifndef __LINUX_MFD_TC35892_H 7#ifndef __LINUX_MFD_TC3589x_H
8#define __LINUX_MFD_TC35892_H 8#define __LINUX_MFD_TC3589x_H
9 9
10#include <linux/device.h> 10#include <linux/device.h>
11 11
12#define TC35892_RSTCTRL_IRQRST (1 << 4) 12#define TC3589x_RSTCTRL_IRQRST (1 << 4)
13#define TC35892_RSTCTRL_TIMRST (1 << 3) 13#define TC3589x_RSTCTRL_TIMRST (1 << 3)
14#define TC35892_RSTCTRL_ROTRST (1 << 2) 14#define TC3589x_RSTCTRL_ROTRST (1 << 2)
15#define TC35892_RSTCTRL_KBDRST (1 << 1) 15#define TC3589x_RSTCTRL_KBDRST (1 << 1)
16#define TC35892_RSTCTRL_GPIRST (1 << 0) 16#define TC3589x_RSTCTRL_GPIRST (1 << 0)
17 17
18#define TC35892_IRQST 0x91 18#define TC3589x_IRQST 0x91
19 19
20#define TC35892_MANFCODE_MAGIC 0x03 20#define TC3589x_MANFCODE_MAGIC 0x03
21#define TC35892_MANFCODE 0x80 21#define TC3589x_MANFCODE 0x80
22#define TC35892_VERSION 0x81 22#define TC3589x_VERSION 0x81
23#define TC35892_IOCFG 0xA7 23#define TC3589x_IOCFG 0xA7
24 24
25#define TC35892_CLKMODE 0x88 25#define TC3589x_CLKMODE 0x88
26#define TC35892_CLKCFG 0x89 26#define TC3589x_CLKCFG 0x89
27#define TC35892_CLKEN 0x8A 27#define TC3589x_CLKEN 0x8A
28 28
29#define TC35892_RSTCTRL 0x82 29#define TC3589x_RSTCTRL 0x82
30#define TC35892_EXTRSTN 0x83 30#define TC3589x_EXTRSTN 0x83
31#define TC35892_RSTINTCLR 0x84 31#define TC3589x_RSTINTCLR 0x84
32 32
33#define TC35892_GPIOIS0 0xC9 33#define TC3589x_GPIOIS0 0xC9
34#define TC35892_GPIOIS1 0xCA 34#define TC3589x_GPIOIS1 0xCA
35#define TC35892_GPIOIS2 0xCB 35#define TC3589x_GPIOIS2 0xCB
36#define TC35892_GPIOIBE0 0xCC 36#define TC3589x_GPIOIBE0 0xCC
37#define TC35892_GPIOIBE1 0xCD 37#define TC3589x_GPIOIBE1 0xCD
38#define TC35892_GPIOIBE2 0xCE 38#define TC3589x_GPIOIBE2 0xCE
39#define TC35892_GPIOIEV0 0xCF 39#define TC3589x_GPIOIEV0 0xCF
40#define TC35892_GPIOIEV1 0xD0 40#define TC3589x_GPIOIEV1 0xD0
41#define TC35892_GPIOIEV2 0xD1 41#define TC3589x_GPIOIEV2 0xD1
42#define TC35892_GPIOIE0 0xD2 42#define TC3589x_GPIOIE0 0xD2
43#define TC35892_GPIOIE1 0xD3 43#define TC3589x_GPIOIE1 0xD3
44#define TC35892_GPIOIE2 0xD4 44#define TC3589x_GPIOIE2 0xD4
45#define TC35892_GPIORIS0 0xD6 45#define TC3589x_GPIORIS0 0xD6
46#define TC35892_GPIORIS1 0xD7 46#define TC3589x_GPIORIS1 0xD7
47#define TC35892_GPIORIS2 0xD8 47#define TC3589x_GPIORIS2 0xD8
48#define TC35892_GPIOMIS0 0xD9 48#define TC3589x_GPIOMIS0 0xD9
49#define TC35892_GPIOMIS1 0xDA 49#define TC3589x_GPIOMIS1 0xDA
50#define TC35892_GPIOMIS2 0xDB 50#define TC3589x_GPIOMIS2 0xDB
51#define TC35892_GPIOIC0 0xDC 51#define TC3589x_GPIOIC0 0xDC
52#define TC35892_GPIOIC1 0xDD 52#define TC3589x_GPIOIC1 0xDD
53#define TC35892_GPIOIC2 0xDE 53#define TC3589x_GPIOIC2 0xDE
54 54
55#define TC35892_GPIODATA0 0xC0 55#define TC3589x_GPIODATA0 0xC0
56#define TC35892_GPIOMASK0 0xc1 56#define TC3589x_GPIOMASK0 0xc1
57#define TC35892_GPIODATA1 0xC2 57#define TC3589x_GPIODATA1 0xC2
58#define TC35892_GPIOMASK1 0xc3 58#define TC3589x_GPIOMASK1 0xc3
59#define TC35892_GPIODATA2 0xC4 59#define TC3589x_GPIODATA2 0xC4
60#define TC35892_GPIOMASK2 0xC5 60#define TC3589x_GPIOMASK2 0xC5
61 61
62#define TC35892_GPIODIR0 0xC6 62#define TC3589x_GPIODIR0 0xC6
63#define TC35892_GPIODIR1 0xC7 63#define TC3589x_GPIODIR1 0xC7
64#define TC35892_GPIODIR2 0xC8 64#define TC3589x_GPIODIR2 0xC8
65 65
66#define TC35892_GPIOSYNC0 0xE6 66#define TC3589x_GPIOSYNC0 0xE6
67#define TC35892_GPIOSYNC1 0xE7 67#define TC3589x_GPIOSYNC1 0xE7
68#define TC35892_GPIOSYNC2 0xE8 68#define TC3589x_GPIOSYNC2 0xE8
69 69
70#define TC35892_GPIOWAKE0 0xE9 70#define TC3589x_GPIOWAKE0 0xE9
71#define TC35892_GPIOWAKE1 0xEA 71#define TC3589x_GPIOWAKE1 0xEA
72#define TC35892_GPIOWAKE2 0xEB 72#define TC3589x_GPIOWAKE2 0xEB
73 73
74#define TC35892_GPIOODM0 0xE0 74#define TC3589x_GPIOODM0 0xE0
75#define TC35892_GPIOODE0 0xE1 75#define TC3589x_GPIOODE0 0xE1
76#define TC35892_GPIOODM1 0xE2 76#define TC3589x_GPIOODM1 0xE2
77#define TC35892_GPIOODE1 0xE3 77#define TC3589x_GPIOODE1 0xE3
78#define TC35892_GPIOODM2 0xE4 78#define TC3589x_GPIOODM2 0xE4
79#define TC35892_GPIOODE2 0xE5 79#define TC3589x_GPIOODE2 0xE5
80 80
81#define TC35892_INT_GPIIRQ 0 81#define TC3589x_INT_GPIIRQ 0
82#define TC35892_INT_TI0IRQ 1 82#define TC3589x_INT_TI0IRQ 1
83#define TC35892_INT_TI1IRQ 2 83#define TC3589x_INT_TI1IRQ 2
84#define TC35892_INT_TI2IRQ 3 84#define TC3589x_INT_TI2IRQ 3
85#define TC35892_INT_ROTIRQ 5 85#define TC3589x_INT_ROTIRQ 5
86#define TC35892_INT_KBDIRQ 6 86#define TC3589x_INT_KBDIRQ 6
87#define TC35892_INT_PORIRQ 7 87#define TC3589x_INT_PORIRQ 7
88 88
89#define TC35892_NR_INTERNAL_IRQS 8 89#define TC3589x_NR_INTERNAL_IRQS 8
90#define TC35892_INT_GPIO(x) (TC35892_NR_INTERNAL_IRQS + (x)) 90#define TC3589x_INT_GPIO(x) (TC3589x_NR_INTERNAL_IRQS + (x))
91 91
92struct tc35892 { 92struct tc3589x {
93 struct mutex lock; 93 struct mutex lock;
94 struct device *dev; 94 struct device *dev;
95 struct i2c_client *i2c; 95 struct i2c_client *i2c;
96 96
97 int irq_base; 97 int irq_base;
98 int num_gpio; 98 int num_gpio;
99 struct tc35892_platform_data *pdata; 99 struct tc3589x_platform_data *pdata;
100}; 100};
101 101
102extern int tc35892_reg_write(struct tc35892 *tc35892, u8 reg, u8 data); 102extern int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data);
103extern int tc35892_reg_read(struct tc35892 *tc35892, u8 reg); 103extern int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg);
104extern int tc35892_block_read(struct tc35892 *tc35892, u8 reg, u8 length, 104extern int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length,
105 u8 *values); 105 u8 *values);
106extern int tc35892_block_write(struct tc35892 *tc35892, u8 reg, u8 length, 106extern int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length,
107 const u8 *values); 107 const u8 *values);
108extern int tc35892_set_bits(struct tc35892 *tc35892, u8 reg, u8 mask, u8 val); 108extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
109 109
110/** 110/**
111 * struct tc35892_gpio_platform_data - TC35892 GPIO platform data 111 * struct tc3589x_gpio_platform_data - TC3589x GPIO platform data
112 * @gpio_base: first gpio number assigned to TC35892. A maximum of 112 * @gpio_base: first gpio number assigned to TC3589x. A maximum of
113 * %TC35892_NR_GPIOS GPIOs will be allocated. 113 * %TC3589x_NR_GPIOS GPIOs will be allocated.
114 * @setup: callback for board-specific initialization 114 * @setup: callback for board-specific initialization
115 * @remove: callback for board-specific teardown 115 * @remove: callback for board-specific teardown
116 */ 116 */
117struct tc35892_gpio_platform_data { 117struct tc3589x_gpio_platform_data {
118 int gpio_base; 118 int gpio_base;
119 void (*setup)(struct tc35892 *tc35892, unsigned gpio_base); 119 void (*setup)(struct tc3589x *tc3589x, unsigned gpio_base);
120 void (*remove)(struct tc35892 *tc35892, unsigned gpio_base); 120 void (*remove)(struct tc3589x *tc3589x, unsigned gpio_base);
121}; 121};
122 122
123/** 123/**
124 * struct tc35892_platform_data - TC35892 platform data 124 * struct tc3589x_platform_data - TC3589x platform data
125 * @irq_base: base IRQ number. %TC35892_NR_IRQS irqs will be used. 125 * @irq_base: base IRQ number. %TC3589x_NR_IRQS irqs will be used.
126 * @gpio: GPIO-specific platform data 126 * @gpio: GPIO-specific platform data
127 */ 127 */
128struct tc35892_platform_data { 128struct tc3589x_platform_data {
129 int irq_base; 129 int irq_base;
130 struct tc35892_gpio_platform_data *gpio; 130 struct tc3589x_gpio_platform_data *gpio;
131}; 131};
132 132
133#define TC35892_NR_GPIOS 24 133#define TC3589x_NR_GPIOS 24
134#define TC35892_NR_IRQS TC35892_INT_GPIO(TC35892_NR_GPIOS) 134#define TC3589x_NR_IRQS TC3589x_INT_GPIO(TC3589x_NR_GPIOS)
135 135
136#endif 136#endif