blob: 729dbeed2ce09f0c83f09483e345ffe1c1e63ebb [file] [log] [blame]
Rabin Vincentb4ecd322010-05-10 23:39:47 +02001/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License Terms: GNU General Public License, version 2
5 * Author: Hanumath Prasad <hanumath.prasad@stericsson.com> for ST-Ericsson
6 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
7 */
8
9#include <linux/module.h>
10#include <linux/interrupt.h>
11#include <linux/irq.h>
12#include <linux/slab.h>
13#include <linux/i2c.h>
14#include <linux/mfd/core.h>
Sundar Iyerc6eda6c2010-12-13 09:33:12 +053015#include <linux/mfd/tc3589x.h>
Rabin Vincentb4ecd322010-05-10 23:39:47 +020016
Sundar Iyer593e9d72010-12-13 09:33:18 +053017#define TC3589x_CLKMODE_MODCTL_SLEEP 0x0
18#define TC3589x_CLKMODE_MODCTL_OPERATION (1 << 0)
19
Rabin Vincentb4ecd322010-05-10 23:39:47 +020020/**
Sundar Iyer20406eb2010-12-13 09:33:14 +053021 * tc3589x_reg_read() - read a single TC3589x register
22 * @tc3589x: Device to read from
Rabin Vincentb4ecd322010-05-10 23:39:47 +020023 * @reg: Register to read
24 */
Sundar Iyer20406eb2010-12-13 09:33:14 +053025int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg)
Rabin Vincentb4ecd322010-05-10 23:39:47 +020026{
27 int ret;
28
Sundar Iyer20406eb2010-12-13 09:33:14 +053029 ret = i2c_smbus_read_byte_data(tc3589x->i2c, reg);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020030 if (ret < 0)
Sundar Iyer20406eb2010-12-13 09:33:14 +053031 dev_err(tc3589x->dev, "failed to read reg %#x: %d\n",
Rabin Vincentb4ecd322010-05-10 23:39:47 +020032 reg, ret);
33
34 return ret;
35}
Sundar Iyer20406eb2010-12-13 09:33:14 +053036EXPORT_SYMBOL_GPL(tc3589x_reg_read);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020037
38/**
Sundar Iyer20406eb2010-12-13 09:33:14 +053039 * tc3589x_reg_read() - write a single TC3589x register
40 * @tc3589x: Device to write to
Rabin Vincentb4ecd322010-05-10 23:39:47 +020041 * @reg: Register to read
42 * @data: Value to write
43 */
Sundar Iyer20406eb2010-12-13 09:33:14 +053044int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data)
Rabin Vincentb4ecd322010-05-10 23:39:47 +020045{
46 int ret;
47
Sundar Iyer20406eb2010-12-13 09:33:14 +053048 ret = i2c_smbus_write_byte_data(tc3589x->i2c, reg, data);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020049 if (ret < 0)
Sundar Iyer20406eb2010-12-13 09:33:14 +053050 dev_err(tc3589x->dev, "failed to write reg %#x: %d\n",
Rabin Vincentb4ecd322010-05-10 23:39:47 +020051 reg, ret);
52
53 return ret;
54}
Sundar Iyer20406eb2010-12-13 09:33:14 +053055EXPORT_SYMBOL_GPL(tc3589x_reg_write);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020056
57/**
Sundar Iyer20406eb2010-12-13 09:33:14 +053058 * tc3589x_block_read() - read multiple TC3589x registers
59 * @tc3589x: Device to read from
Rabin Vincentb4ecd322010-05-10 23:39:47 +020060 * @reg: First register
61 * @length: Number of registers
62 * @values: Buffer to write to
63 */
Sundar Iyer20406eb2010-12-13 09:33:14 +053064int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length, u8 *values)
Rabin Vincentb4ecd322010-05-10 23:39:47 +020065{
66 int ret;
67
Sundar Iyer20406eb2010-12-13 09:33:14 +053068 ret = i2c_smbus_read_i2c_block_data(tc3589x->i2c, reg, length, values);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020069 if (ret < 0)
Sundar Iyer20406eb2010-12-13 09:33:14 +053070 dev_err(tc3589x->dev, "failed to read regs %#x: %d\n",
Rabin Vincentb4ecd322010-05-10 23:39:47 +020071 reg, ret);
72
73 return ret;
74}
Sundar Iyer20406eb2010-12-13 09:33:14 +053075EXPORT_SYMBOL_GPL(tc3589x_block_read);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020076
77/**
Sundar Iyer20406eb2010-12-13 09:33:14 +053078 * tc3589x_block_write() - write multiple TC3589x registers
79 * @tc3589x: Device to write to
Rabin Vincentb4ecd322010-05-10 23:39:47 +020080 * @reg: First register
81 * @length: Number of registers
82 * @values: Values to write
83 */
Sundar Iyer20406eb2010-12-13 09:33:14 +053084int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length,
Rabin Vincentb4ecd322010-05-10 23:39:47 +020085 const u8 *values)
86{
87 int ret;
88
Sundar Iyer20406eb2010-12-13 09:33:14 +053089 ret = i2c_smbus_write_i2c_block_data(tc3589x->i2c, reg, length,
Rabin Vincentb4ecd322010-05-10 23:39:47 +020090 values);
91 if (ret < 0)
Sundar Iyer20406eb2010-12-13 09:33:14 +053092 dev_err(tc3589x->dev, "failed to write regs %#x: %d\n",
Rabin Vincentb4ecd322010-05-10 23:39:47 +020093 reg, ret);
94
95 return ret;
96}
Sundar Iyer20406eb2010-12-13 09:33:14 +053097EXPORT_SYMBOL_GPL(tc3589x_block_write);
Rabin Vincentb4ecd322010-05-10 23:39:47 +020098
99/**
Sundar Iyer20406eb2010-12-13 09:33:14 +0530100 * tc3589x_set_bits() - set the value of a bitfield in a TC3589x register
101 * @tc3589x: Device to write to
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200102 * @reg: Register to write
103 * @mask: Mask of bits to set
104 * @values: Value to set
105 */
Sundar Iyer20406eb2010-12-13 09:33:14 +0530106int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200107{
108 int ret;
109
Sundar Iyer20406eb2010-12-13 09:33:14 +0530110 mutex_lock(&tc3589x->lock);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200111
Sundar Iyer20406eb2010-12-13 09:33:14 +0530112 ret = tc3589x_reg_read(tc3589x, reg);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200113 if (ret < 0)
114 goto out;
115
116 ret &= ~mask;
117 ret |= val;
118
Sundar Iyer20406eb2010-12-13 09:33:14 +0530119 ret = tc3589x_reg_write(tc3589x, reg, ret);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200120
121out:
Sundar Iyer20406eb2010-12-13 09:33:14 +0530122 mutex_unlock(&tc3589x->lock);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200123 return ret;
124}
Sundar Iyer20406eb2010-12-13 09:33:14 +0530125EXPORT_SYMBOL_GPL(tc3589x_set_bits);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200126
127static struct resource gpio_resources[] = {
128 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530129 .start = TC3589x_INT_GPIIRQ,
130 .end = TC3589x_INT_GPIIRQ,
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200131 .flags = IORESOURCE_IRQ,
132 },
133};
134
Sundar Iyer09c730a2010-12-21 15:53:31 +0530135static struct resource keypad_resources[] = {
136 {
137 .start = TC3589x_INT_KBDIRQ,
138 .end = TC3589x_INT_KBDIRQ,
139 .flags = IORESOURCE_IRQ,
140 },
141};
142
Sundar Iyer611b7592010-12-13 09:33:15 +0530143static struct mfd_cell tc3589x_dev_gpio[] = {
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200144 {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530145 .name = "tc3589x-gpio",
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200146 .num_resources = ARRAY_SIZE(gpio_resources),
147 .resources = &gpio_resources[0],
148 },
149};
150
Sundar Iyer09c730a2010-12-21 15:53:31 +0530151static struct mfd_cell tc3589x_dev_keypad[] = {
152 {
153 .name = "tc3589x-keypad",
154 .num_resources = ARRAY_SIZE(keypad_resources),
155 .resources = &keypad_resources[0],
156 },
157};
158
Sundar Iyer20406eb2010-12-13 09:33:14 +0530159static irqreturn_t tc3589x_irq(int irq, void *data)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200160{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530161 struct tc3589x *tc3589x = data;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200162 int status;
163
Sundar Iyerbd77efd2010-12-13 09:33:16 +0530164again:
Sundar Iyer20406eb2010-12-13 09:33:14 +0530165 status = tc3589x_reg_read(tc3589x, TC3589x_IRQST);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200166 if (status < 0)
167 return IRQ_NONE;
168
169 while (status) {
170 int bit = __ffs(status);
171
Sundar Iyer20406eb2010-12-13 09:33:14 +0530172 handle_nested_irq(tc3589x->irq_base + bit);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200173 status &= ~(1 << bit);
174 }
175
176 /*
177 * A dummy read or write (to any register) appears to be necessary to
178 * have the last interrupt clear (for example, GPIO IC write) take
Sundar Iyerbd77efd2010-12-13 09:33:16 +0530179 * effect. In such a case, recheck for any interrupt which is still
180 * pending.
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200181 */
Sundar Iyerbd77efd2010-12-13 09:33:16 +0530182 status = tc3589x_reg_read(tc3589x, TC3589x_IRQST);
183 if (status)
184 goto again;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200185
186 return IRQ_HANDLED;
187}
188
Sundar Iyer20406eb2010-12-13 09:33:14 +0530189static int tc3589x_irq_init(struct tc3589x *tc3589x)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200190{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530191 int base = tc3589x->irq_base;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200192 int irq;
193
Sundar Iyer20406eb2010-12-13 09:33:14 +0530194 for (irq = base; irq < base + TC3589x_NR_INTERNAL_IRQS; irq++) {
195 set_irq_chip_data(irq, tc3589x);
Samuel Ortizabda3a22010-12-20 13:01:30 +0100196 set_irq_chip_and_handler(irq, &dummy_irq_chip,
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200197 handle_edge_irq);
198 set_irq_nested_thread(irq, 1);
199#ifdef CONFIG_ARM
200 set_irq_flags(irq, IRQF_VALID);
201#else
202 set_irq_noprobe(irq);
203#endif
204 }
205
206 return 0;
207}
208
Sundar Iyer20406eb2010-12-13 09:33:14 +0530209static void tc3589x_irq_remove(struct tc3589x *tc3589x)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200210{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530211 int base = tc3589x->irq_base;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200212 int irq;
213
Sundar Iyer20406eb2010-12-13 09:33:14 +0530214 for (irq = base; irq < base + TC3589x_NR_INTERNAL_IRQS; irq++) {
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200215#ifdef CONFIG_ARM
216 set_irq_flags(irq, 0);
217#endif
218 set_irq_chip_and_handler(irq, NULL, NULL);
219 set_irq_chip_data(irq, NULL);
220 }
221}
222
Sundar Iyer20406eb2010-12-13 09:33:14 +0530223static int tc3589x_chip_init(struct tc3589x *tc3589x)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200224{
225 int manf, ver, ret;
226
Sundar Iyer20406eb2010-12-13 09:33:14 +0530227 manf = tc3589x_reg_read(tc3589x, TC3589x_MANFCODE);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200228 if (manf < 0)
229 return manf;
230
Sundar Iyer20406eb2010-12-13 09:33:14 +0530231 ver = tc3589x_reg_read(tc3589x, TC3589x_VERSION);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200232 if (ver < 0)
233 return ver;
234
Sundar Iyer20406eb2010-12-13 09:33:14 +0530235 if (manf != TC3589x_MANFCODE_MAGIC) {
236 dev_err(tc3589x->dev, "unknown manufacturer: %#x\n", manf);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200237 return -EINVAL;
238 }
239
Sundar Iyer20406eb2010-12-13 09:33:14 +0530240 dev_info(tc3589x->dev, "manufacturer: %#x, version: %#x\n", manf, ver);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200241
Sundar Iyer523bc382010-12-13 09:33:17 +0530242 /*
243 * Put everything except the IRQ module into reset;
244 * also spare the GPIO module for any pin initialization
245 * done during pre-kernel boot
246 */
Sundar Iyer20406eb2010-12-13 09:33:14 +0530247 ret = tc3589x_reg_write(tc3589x, TC3589x_RSTCTRL,
248 TC3589x_RSTCTRL_TIMRST
249 | TC3589x_RSTCTRL_ROTRST
Sundar Iyer523bc382010-12-13 09:33:17 +0530250 | TC3589x_RSTCTRL_KBDRST);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200251 if (ret < 0)
252 return ret;
253
254 /* Clear the reset interrupt. */
Sundar Iyer20406eb2010-12-13 09:33:14 +0530255 return tc3589x_reg_write(tc3589x, TC3589x_RSTINTCLR, 0x1);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200256}
257
Sundar Iyer611b7592010-12-13 09:33:15 +0530258static int __devinit tc3589x_device_init(struct tc3589x *tc3589x)
259{
260 int ret = 0;
261 unsigned int blocks = tc3589x->pdata->block;
262
263 if (blocks & TC3589x_BLOCK_GPIO) {
264 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_gpio,
265 ARRAY_SIZE(tc3589x_dev_gpio), NULL,
266 tc3589x->irq_base);
267 if (ret) {
268 dev_err(tc3589x->dev, "failed to add gpio child\n");
269 return ret;
270 }
271 dev_info(tc3589x->dev, "added gpio block\n");
272 }
273
Sundar Iyer09c730a2010-12-21 15:53:31 +0530274 if (blocks & TC3589x_BLOCK_KEYPAD) {
275 ret = mfd_add_devices(tc3589x->dev, -1, tc3589x_dev_keypad,
276 ARRAY_SIZE(tc3589x_dev_keypad), NULL,
277 tc3589x->irq_base);
278 if (ret) {
279 dev_err(tc3589x->dev, "failed to keypad child\n");
280 return ret;
281 }
282 dev_info(tc3589x->dev, "added keypad block\n");
283 }
Sundar Iyer611b7592010-12-13 09:33:15 +0530284
Sundar Iyer09c730a2010-12-21 15:53:31 +0530285 return ret;
Sundar Iyer611b7592010-12-13 09:33:15 +0530286}
287
Sundar Iyer20406eb2010-12-13 09:33:14 +0530288static int __devinit tc3589x_probe(struct i2c_client *i2c,
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200289 const struct i2c_device_id *id)
290{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530291 struct tc3589x_platform_data *pdata = i2c->dev.platform_data;
292 struct tc3589x *tc3589x;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200293 int ret;
294
295 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA
296 | I2C_FUNC_SMBUS_I2C_BLOCK))
297 return -EIO;
298
Sundar Iyer20406eb2010-12-13 09:33:14 +0530299 tc3589x = kzalloc(sizeof(struct tc3589x), GFP_KERNEL);
300 if (!tc3589x)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200301 return -ENOMEM;
302
Sundar Iyer20406eb2010-12-13 09:33:14 +0530303 mutex_init(&tc3589x->lock);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200304
Sundar Iyer20406eb2010-12-13 09:33:14 +0530305 tc3589x->dev = &i2c->dev;
306 tc3589x->i2c = i2c;
307 tc3589x->pdata = pdata;
308 tc3589x->irq_base = pdata->irq_base;
309 tc3589x->num_gpio = id->driver_data;
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200310
Sundar Iyer20406eb2010-12-13 09:33:14 +0530311 i2c_set_clientdata(i2c, tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200312
Sundar Iyer20406eb2010-12-13 09:33:14 +0530313 ret = tc3589x_chip_init(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200314 if (ret)
315 goto out_free;
316
Sundar Iyer20406eb2010-12-13 09:33:14 +0530317 ret = tc3589x_irq_init(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200318 if (ret)
319 goto out_free;
320
Sundar Iyer20406eb2010-12-13 09:33:14 +0530321 ret = request_threaded_irq(tc3589x->i2c->irq, NULL, tc3589x_irq,
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200322 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Sundar Iyer20406eb2010-12-13 09:33:14 +0530323 "tc3589x", tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200324 if (ret) {
Sundar Iyer20406eb2010-12-13 09:33:14 +0530325 dev_err(tc3589x->dev, "failed to request IRQ: %d\n", ret);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200326 goto out_removeirq;
327 }
328
Sundar Iyer611b7592010-12-13 09:33:15 +0530329 ret = tc3589x_device_init(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200330 if (ret) {
Sundar Iyer611b7592010-12-13 09:33:15 +0530331 dev_err(tc3589x->dev, "failed to add child devices\n");
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200332 goto out_freeirq;
333 }
334
335 return 0;
336
337out_freeirq:
Sundar Iyer20406eb2010-12-13 09:33:14 +0530338 free_irq(tc3589x->i2c->irq, tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200339out_removeirq:
Sundar Iyer20406eb2010-12-13 09:33:14 +0530340 tc3589x_irq_remove(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200341out_free:
Sundar Iyer20406eb2010-12-13 09:33:14 +0530342 kfree(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200343 return ret;
344}
345
Sundar Iyer20406eb2010-12-13 09:33:14 +0530346static int __devexit tc3589x_remove(struct i2c_client *client)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200347{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530348 struct tc3589x *tc3589x = i2c_get_clientdata(client);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200349
Sundar Iyer20406eb2010-12-13 09:33:14 +0530350 mfd_remove_devices(tc3589x->dev);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200351
Sundar Iyer20406eb2010-12-13 09:33:14 +0530352 free_irq(tc3589x->i2c->irq, tc3589x);
353 tc3589x_irq_remove(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200354
Sundar Iyer20406eb2010-12-13 09:33:14 +0530355 kfree(tc3589x);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200356
357 return 0;
358}
359
Sundar Iyer593e9d72010-12-13 09:33:18 +0530360static int tc3589x_suspend(struct device *dev)
361{
362 struct tc3589x *tc3589x = dev_get_drvdata(dev);
363 struct i2c_client *client = tc3589x->i2c;
364 int ret = 0;
365
366 /* put the system to sleep mode */
367 if (!device_may_wakeup(&client->dev))
368 ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE,
369 TC3589x_CLKMODE_MODCTL_SLEEP);
370
371 return ret;
372}
373
374static int tc3589x_resume(struct device *dev)
375{
376 struct tc3589x *tc3589x = dev_get_drvdata(dev);
377 struct i2c_client *client = tc3589x->i2c;
378 int ret = 0;
379
380 /* enable the system into operation */
381 if (!device_may_wakeup(&client->dev))
382 ret = tc3589x_reg_write(tc3589x, TC3589x_CLKMODE,
383 TC3589x_CLKMODE_MODCTL_OPERATION);
384
385 return ret;
386}
387
388static const SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend,
389 tc3589x_resume);
390
Sundar Iyer20406eb2010-12-13 09:33:14 +0530391static const struct i2c_device_id tc3589x_id[] = {
392 { "tc3589x", 24 },
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200393 { }
394};
Sundar Iyer20406eb2010-12-13 09:33:14 +0530395MODULE_DEVICE_TABLE(i2c, tc3589x_id);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200396
Sundar Iyer20406eb2010-12-13 09:33:14 +0530397static struct i2c_driver tc3589x_driver = {
398 .driver.name = "tc3589x",
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200399 .driver.owner = THIS_MODULE,
Sundar Iyer593e9d72010-12-13 09:33:18 +0530400#ifdef CONFIG_PM
401 .driver.pm = &tc3589x_dev_pm_ops,
402#endif
Sundar Iyer20406eb2010-12-13 09:33:14 +0530403 .probe = tc3589x_probe,
404 .remove = __devexit_p(tc3589x_remove),
405 .id_table = tc3589x_id,
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200406};
407
Sundar Iyer20406eb2010-12-13 09:33:14 +0530408static int __init tc3589x_init(void)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200409{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530410 return i2c_add_driver(&tc3589x_driver);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200411}
Sundar Iyer20406eb2010-12-13 09:33:14 +0530412subsys_initcall(tc3589x_init);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200413
Sundar Iyer20406eb2010-12-13 09:33:14 +0530414static void __exit tc3589x_exit(void)
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200415{
Sundar Iyer20406eb2010-12-13 09:33:14 +0530416 i2c_del_driver(&tc3589x_driver);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200417}
Sundar Iyer20406eb2010-12-13 09:33:14 +0530418module_exit(tc3589x_exit);
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200419
420MODULE_LICENSE("GPL v2");
Sundar Iyer20406eb2010-12-13 09:33:14 +0530421MODULE_DESCRIPTION("TC3589x MFD core driver");
Rabin Vincentb4ecd322010-05-10 23:39:47 +0200422MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent");