lib/vsprintf.c: kptr_restrict: fix pK-error in SysRq show-all-timers(Q)
[linux-2.6/libata-dev.git] / drivers / mfd / tps6586x.c
blobc84b5506d5fbd06ee82d12b476abc6239ae4508f
1 /*
2 * Core driver for TI TPS6586x PMIC family
4 * Copyright (c) 2010 CompuLab Ltd.
5 * Mike Rapoport <mike@compulab.co.il>
7 * Based on da903x.c.
8 * Copyright (C) 2008 Compulab, Ltd.
9 * Mike Rapoport <mike@compulab.co.il>
10 * Copyright (C) 2006-2008 Marvell International Ltd.
11 * Eric Miao <eric.miao@marvell.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
18 #include <linux/interrupt.h>
19 #include <linux/irq.h>
20 #include <linux/kernel.h>
21 #include <linux/module.h>
22 #include <linux/mutex.h>
23 #include <linux/slab.h>
24 #include <linux/gpio.h>
25 #include <linux/i2c.h>
26 #include <linux/regulator/of_regulator.h>
28 #include <linux/mfd/core.h>
29 #include <linux/mfd/tps6586x.h>
31 /* GPIO control registers */
32 #define TPS6586X_GPIOSET1 0x5d
33 #define TPS6586X_GPIOSET2 0x5e
35 /* interrupt control registers */
36 #define TPS6586X_INT_ACK1 0xb5
37 #define TPS6586X_INT_ACK2 0xb6
38 #define TPS6586X_INT_ACK3 0xb7
39 #define TPS6586X_INT_ACK4 0xb8
41 /* interrupt mask registers */
42 #define TPS6586X_INT_MASK1 0xb0
43 #define TPS6586X_INT_MASK2 0xb1
44 #define TPS6586X_INT_MASK3 0xb2
45 #define TPS6586X_INT_MASK4 0xb3
46 #define TPS6586X_INT_MASK5 0xb4
48 /* device id */
49 #define TPS6586X_VERSIONCRC 0xcd
51 struct tps6586x_irq_data {
52 u8 mask_reg;
53 u8 mask_mask;
56 #define TPS6586X_IRQ(_reg, _mask) \
57 { \
58 .mask_reg = (_reg) - TPS6586X_INT_MASK1, \
59 .mask_mask = (_mask), \
62 static const struct tps6586x_irq_data tps6586x_irqs[] = {
63 [TPS6586X_INT_PLDO_0] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 0),
64 [TPS6586X_INT_PLDO_1] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 1),
65 [TPS6586X_INT_PLDO_2] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 2),
66 [TPS6586X_INT_PLDO_3] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 3),
67 [TPS6586X_INT_PLDO_4] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 4),
68 [TPS6586X_INT_PLDO_5] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 5),
69 [TPS6586X_INT_PLDO_6] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 6),
70 [TPS6586X_INT_PLDO_7] = TPS6586X_IRQ(TPS6586X_INT_MASK1, 1 << 7),
71 [TPS6586X_INT_COMP_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 1 << 0),
72 [TPS6586X_INT_ADC] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 1),
73 [TPS6586X_INT_PLDO_8] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 2),
74 [TPS6586X_INT_PLDO_9] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 3),
75 [TPS6586X_INT_PSM_0] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 4),
76 [TPS6586X_INT_PSM_1] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 5),
77 [TPS6586X_INT_PSM_2] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 6),
78 [TPS6586X_INT_PSM_3] = TPS6586X_IRQ(TPS6586X_INT_MASK2, 1 << 7),
79 [TPS6586X_INT_RTC_ALM1] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 4),
80 [TPS6586X_INT_ACUSB_OVP] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 0x03),
81 [TPS6586X_INT_USB_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 2),
82 [TPS6586X_INT_AC_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 3),
83 [TPS6586X_INT_BAT_DET] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 1 << 0),
84 [TPS6586X_INT_CHG_STAT] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 0xfc),
85 [TPS6586X_INT_CHG_TEMP] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 0x06),
86 [TPS6586X_INT_PP] = TPS6586X_IRQ(TPS6586X_INT_MASK3, 0xf0),
87 [TPS6586X_INT_RESUME] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 5),
88 [TPS6586X_INT_LOW_SYS] = TPS6586X_IRQ(TPS6586X_INT_MASK5, 1 << 6),
89 [TPS6586X_INT_RTC_ALM2] = TPS6586X_IRQ(TPS6586X_INT_MASK4, 1 << 1),
92 struct tps6586x {
93 struct mutex lock;
94 struct device *dev;
95 struct i2c_client *client;
97 struct gpio_chip gpio;
98 struct irq_chip irq_chip;
99 struct mutex irq_lock;
100 int irq_base;
101 u32 irq_en;
102 u8 mask_cache[5];
103 u8 mask_reg[5];
106 static inline int __tps6586x_read(struct i2c_client *client,
107 int reg, uint8_t *val)
109 int ret;
111 ret = i2c_smbus_read_byte_data(client, reg);
112 if (ret < 0) {
113 dev_err(&client->dev, "failed reading at 0x%02x\n", reg);
114 return ret;
117 *val = (uint8_t)ret;
119 return 0;
122 static inline int __tps6586x_reads(struct i2c_client *client, int reg,
123 int len, uint8_t *val)
125 int ret;
127 ret = i2c_smbus_read_i2c_block_data(client, reg, len, val);
128 if (ret < 0) {
129 dev_err(&client->dev, "failed reading from 0x%02x\n", reg);
130 return ret;
133 return 0;
136 static inline int __tps6586x_write(struct i2c_client *client,
137 int reg, uint8_t val)
139 int ret;
141 ret = i2c_smbus_write_byte_data(client, reg, val);
142 if (ret < 0) {
143 dev_err(&client->dev, "failed writing 0x%02x to 0x%02x\n",
144 val, reg);
145 return ret;
148 return 0;
151 static inline int __tps6586x_writes(struct i2c_client *client, int reg,
152 int len, uint8_t *val)
154 int ret, i;
156 for (i = 0; i < len; i++) {
157 ret = __tps6586x_write(client, reg + i, *(val + i));
158 if (ret < 0)
159 return ret;
162 return 0;
165 int tps6586x_write(struct device *dev, int reg, uint8_t val)
167 return __tps6586x_write(to_i2c_client(dev), reg, val);
169 EXPORT_SYMBOL_GPL(tps6586x_write);
171 int tps6586x_writes(struct device *dev, int reg, int len, uint8_t *val)
173 return __tps6586x_writes(to_i2c_client(dev), reg, len, val);
175 EXPORT_SYMBOL_GPL(tps6586x_writes);
177 int tps6586x_read(struct device *dev, int reg, uint8_t *val)
179 return __tps6586x_read(to_i2c_client(dev), reg, val);
181 EXPORT_SYMBOL_GPL(tps6586x_read);
183 int tps6586x_reads(struct device *dev, int reg, int len, uint8_t *val)
185 return __tps6586x_reads(to_i2c_client(dev), reg, len, val);
187 EXPORT_SYMBOL_GPL(tps6586x_reads);
189 int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
191 struct tps6586x *tps6586x = dev_get_drvdata(dev);
192 uint8_t reg_val;
193 int ret = 0;
195 mutex_lock(&tps6586x->lock);
197 ret = __tps6586x_read(to_i2c_client(dev), reg, &reg_val);
198 if (ret)
199 goto out;
201 if ((reg_val & bit_mask) != bit_mask) {
202 reg_val |= bit_mask;
203 ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val);
205 out:
206 mutex_unlock(&tps6586x->lock);
207 return ret;
209 EXPORT_SYMBOL_GPL(tps6586x_set_bits);
211 int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask)
213 struct tps6586x *tps6586x = dev_get_drvdata(dev);
214 uint8_t reg_val;
215 int ret = 0;
217 mutex_lock(&tps6586x->lock);
219 ret = __tps6586x_read(to_i2c_client(dev), reg, &reg_val);
220 if (ret)
221 goto out;
223 if (reg_val & bit_mask) {
224 reg_val &= ~bit_mask;
225 ret = __tps6586x_write(to_i2c_client(dev), reg, reg_val);
227 out:
228 mutex_unlock(&tps6586x->lock);
229 return ret;
231 EXPORT_SYMBOL_GPL(tps6586x_clr_bits);
233 int tps6586x_update(struct device *dev, int reg, uint8_t val, uint8_t mask)
235 struct tps6586x *tps6586x = dev_get_drvdata(dev);
236 uint8_t reg_val;
237 int ret = 0;
239 mutex_lock(&tps6586x->lock);
241 ret = __tps6586x_read(tps6586x->client, reg, &reg_val);
242 if (ret)
243 goto out;
245 if ((reg_val & mask) != val) {
246 reg_val = (reg_val & ~mask) | val;
247 ret = __tps6586x_write(tps6586x->client, reg, reg_val);
249 out:
250 mutex_unlock(&tps6586x->lock);
251 return ret;
253 EXPORT_SYMBOL_GPL(tps6586x_update);
255 static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset)
257 struct tps6586x *tps6586x = container_of(gc, struct tps6586x, gpio);
258 uint8_t val;
259 int ret;
261 ret = __tps6586x_read(tps6586x->client, TPS6586X_GPIOSET2, &val);
262 if (ret)
263 return ret;
265 return !!(val & (1 << offset));
269 static void tps6586x_gpio_set(struct gpio_chip *chip, unsigned offset,
270 int value)
272 struct tps6586x *tps6586x = container_of(chip, struct tps6586x, gpio);
274 tps6586x_update(tps6586x->dev, TPS6586X_GPIOSET2,
275 value << offset, 1 << offset);
278 static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset,
279 int value)
281 struct tps6586x *tps6586x = container_of(gc, struct tps6586x, gpio);
282 uint8_t val, mask;
284 tps6586x_gpio_set(gc, offset, value);
286 val = 0x1 << (offset * 2);
287 mask = 0x3 << (offset * 2);
289 return tps6586x_update(tps6586x->dev, TPS6586X_GPIOSET1, val, mask);
292 static int tps6586x_gpio_init(struct tps6586x *tps6586x, int gpio_base)
294 if (!gpio_base)
295 return 0;
297 tps6586x->gpio.owner = THIS_MODULE;
298 tps6586x->gpio.label = tps6586x->client->name;
299 tps6586x->gpio.dev = tps6586x->dev;
300 tps6586x->gpio.base = gpio_base;
301 tps6586x->gpio.ngpio = 4;
302 tps6586x->gpio.can_sleep = 1;
304 /* FIXME: add handling of GPIOs as dedicated inputs */
305 tps6586x->gpio.direction_output = tps6586x_gpio_output;
306 tps6586x->gpio.set = tps6586x_gpio_set;
307 tps6586x->gpio.get = tps6586x_gpio_get;
309 return gpiochip_add(&tps6586x->gpio);
312 static int __remove_subdev(struct device *dev, void *unused)
314 platform_device_unregister(to_platform_device(dev));
315 return 0;
318 static int tps6586x_remove_subdevs(struct tps6586x *tps6586x)
320 return device_for_each_child(tps6586x->dev, NULL, __remove_subdev);
323 static void tps6586x_irq_lock(struct irq_data *data)
325 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data);
327 mutex_lock(&tps6586x->irq_lock);
330 static void tps6586x_irq_enable(struct irq_data *irq_data)
332 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
333 unsigned int __irq = irq_data->irq - tps6586x->irq_base;
334 const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq];
336 tps6586x->mask_reg[data->mask_reg] &= ~data->mask_mask;
337 tps6586x->irq_en |= (1 << __irq);
340 static void tps6586x_irq_disable(struct irq_data *irq_data)
342 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data);
344 unsigned int __irq = irq_data->irq - tps6586x->irq_base;
345 const struct tps6586x_irq_data *data = &tps6586x_irqs[__irq];
347 tps6586x->mask_reg[data->mask_reg] |= data->mask_mask;
348 tps6586x->irq_en &= ~(1 << __irq);
351 static void tps6586x_irq_sync_unlock(struct irq_data *data)
353 struct tps6586x *tps6586x = irq_data_get_irq_chip_data(data);
354 int i;
356 for (i = 0; i < ARRAY_SIZE(tps6586x->mask_reg); i++) {
357 if (tps6586x->mask_reg[i] != tps6586x->mask_cache[i]) {
358 if (!WARN_ON(tps6586x_write(tps6586x->dev,
359 TPS6586X_INT_MASK1 + i,
360 tps6586x->mask_reg[i])))
361 tps6586x->mask_cache[i] = tps6586x->mask_reg[i];
365 mutex_unlock(&tps6586x->irq_lock);
368 static irqreturn_t tps6586x_irq(int irq, void *data)
370 struct tps6586x *tps6586x = data;
371 u32 acks;
372 int ret = 0;
374 ret = tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1,
375 sizeof(acks), (uint8_t *)&acks);
377 if (ret < 0) {
378 dev_err(tps6586x->dev, "failed to read interrupt status\n");
379 return IRQ_NONE;
382 acks = le32_to_cpu(acks);
384 while (acks) {
385 int i = __ffs(acks);
387 if (tps6586x->irq_en & (1 << i))
388 handle_nested_irq(tps6586x->irq_base + i);
390 acks &= ~(1 << i);
393 return IRQ_HANDLED;
396 static int __devinit tps6586x_irq_init(struct tps6586x *tps6586x, int irq,
397 int irq_base)
399 int i, ret;
400 u8 tmp[4];
402 if (!irq_base) {
403 dev_warn(tps6586x->dev, "No interrupt support on IRQ base\n");
404 return -EINVAL;
407 mutex_init(&tps6586x->irq_lock);
408 for (i = 0; i < 5; i++) {
409 tps6586x->mask_cache[i] = 0xff;
410 tps6586x->mask_reg[i] = 0xff;
411 tps6586x_write(tps6586x->dev, TPS6586X_INT_MASK1 + i, 0xff);
414 tps6586x_reads(tps6586x->dev, TPS6586X_INT_ACK1, sizeof(tmp), tmp);
416 tps6586x->irq_base = irq_base;
418 tps6586x->irq_chip.name = "tps6586x";
419 tps6586x->irq_chip.irq_enable = tps6586x_irq_enable;
420 tps6586x->irq_chip.irq_disable = tps6586x_irq_disable;
421 tps6586x->irq_chip.irq_bus_lock = tps6586x_irq_lock;
422 tps6586x->irq_chip.irq_bus_sync_unlock = tps6586x_irq_sync_unlock;
424 for (i = 0; i < ARRAY_SIZE(tps6586x_irqs); i++) {
425 int __irq = i + tps6586x->irq_base;
426 irq_set_chip_data(__irq, tps6586x);
427 irq_set_chip_and_handler(__irq, &tps6586x->irq_chip,
428 handle_simple_irq);
429 irq_set_nested_thread(__irq, 1);
430 #ifdef CONFIG_ARM
431 set_irq_flags(__irq, IRQF_VALID);
432 #endif
435 ret = request_threaded_irq(irq, NULL, tps6586x_irq, IRQF_ONESHOT,
436 "tps6586x", tps6586x);
438 if (!ret) {
439 device_init_wakeup(tps6586x->dev, 1);
440 enable_irq_wake(irq);
443 return ret;
446 static int __devinit tps6586x_add_subdevs(struct tps6586x *tps6586x,
447 struct tps6586x_platform_data *pdata)
449 struct tps6586x_subdev_info *subdev;
450 struct platform_device *pdev;
451 int i, ret = 0;
453 for (i = 0; i < pdata->num_subdevs; i++) {
454 subdev = &pdata->subdevs[i];
456 pdev = platform_device_alloc(subdev->name, subdev->id);
457 if (!pdev) {
458 ret = -ENOMEM;
459 goto failed;
462 pdev->dev.parent = tps6586x->dev;
463 pdev->dev.platform_data = subdev->platform_data;
464 pdev->dev.of_node = subdev->of_node;
466 ret = platform_device_add(pdev);
467 if (ret) {
468 platform_device_put(pdev);
469 goto failed;
472 return 0;
474 failed:
475 tps6586x_remove_subdevs(tps6586x);
476 return ret;
479 #ifdef CONFIG_OF
480 static struct of_regulator_match tps6586x_matches[] = {
481 { .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 },
482 { .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 },
483 { .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 },
484 { .name = "ldo0", .driver_data = (void *)TPS6586X_ID_LDO_0 },
485 { .name = "ldo1", .driver_data = (void *)TPS6586X_ID_LDO_1 },
486 { .name = "ldo2", .driver_data = (void *)TPS6586X_ID_LDO_2 },
487 { .name = "ldo3", .driver_data = (void *)TPS6586X_ID_LDO_3 },
488 { .name = "ldo4", .driver_data = (void *)TPS6586X_ID_LDO_4 },
489 { .name = "ldo5", .driver_data = (void *)TPS6586X_ID_LDO_5 },
490 { .name = "ldo6", .driver_data = (void *)TPS6586X_ID_LDO_6 },
491 { .name = "ldo7", .driver_data = (void *)TPS6586X_ID_LDO_7 },
492 { .name = "ldo8", .driver_data = (void *)TPS6586X_ID_LDO_8 },
493 { .name = "ldo9", .driver_data = (void *)TPS6586X_ID_LDO_9 },
494 { .name = "ldo_rtc", .driver_data = (void *)TPS6586X_ID_LDO_RTC },
497 static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client)
499 const unsigned int num = ARRAY_SIZE(tps6586x_matches);
500 struct device_node *np = client->dev.of_node;
501 struct tps6586x_platform_data *pdata;
502 struct tps6586x_subdev_info *devs;
503 struct device_node *regs;
504 unsigned int count;
505 unsigned int i, j;
506 int err;
508 regs = of_find_node_by_name(np, "regulators");
509 if (!regs)
510 return NULL;
512 err = of_regulator_match(&client->dev, regs, tps6586x_matches, num);
513 if (err < 0) {
514 of_node_put(regs);
515 return NULL;
518 of_node_put(regs);
519 count = err;
521 devs = devm_kzalloc(&client->dev, count * sizeof(*devs), GFP_KERNEL);
522 if (!devs)
523 return NULL;
525 for (i = 0, j = 0; i < num && j < count; i++) {
526 if (!tps6586x_matches[i].init_data)
527 continue;
529 devs[j].name = "tps6586x-regulator";
530 devs[j].platform_data = tps6586x_matches[i].init_data;
531 devs[j].id = (int)tps6586x_matches[i].driver_data;
532 devs[j].of_node = tps6586x_matches[i].of_node;
533 j++;
536 pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
537 if (!pdata)
538 return NULL;
540 pdata->num_subdevs = count;
541 pdata->subdevs = devs;
542 pdata->gpio_base = -1;
543 pdata->irq_base = -1;
545 return pdata;
548 static struct of_device_id tps6586x_of_match[] = {
549 { .compatible = "ti,tps6586x", },
550 { },
552 #else
553 static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client)
555 return NULL;
557 #endif
559 static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
560 const struct i2c_device_id *id)
562 struct tps6586x_platform_data *pdata = client->dev.platform_data;
563 struct tps6586x *tps6586x;
564 int ret;
566 if (!pdata && client->dev.of_node)
567 pdata = tps6586x_parse_dt(client);
569 if (!pdata) {
570 dev_err(&client->dev, "tps6586x requires platform data\n");
571 return -ENOTSUPP;
574 ret = i2c_smbus_read_byte_data(client, TPS6586X_VERSIONCRC);
575 if (ret < 0) {
576 dev_err(&client->dev, "Chip ID read failed: %d\n", ret);
577 return -EIO;
580 dev_info(&client->dev, "VERSIONCRC is %02x\n", ret);
582 tps6586x = kzalloc(sizeof(struct tps6586x), GFP_KERNEL);
583 if (tps6586x == NULL)
584 return -ENOMEM;
586 tps6586x->client = client;
587 tps6586x->dev = &client->dev;
588 i2c_set_clientdata(client, tps6586x);
590 mutex_init(&tps6586x->lock);
592 if (client->irq) {
593 ret = tps6586x_irq_init(tps6586x, client->irq,
594 pdata->irq_base);
595 if (ret) {
596 dev_err(&client->dev, "IRQ init failed: %d\n", ret);
597 goto err_irq_init;
601 ret = tps6586x_gpio_init(tps6586x, pdata->gpio_base);
602 if (ret) {
603 dev_err(&client->dev, "GPIO registration failed: %d\n", ret);
604 goto err_gpio_init;
607 ret = tps6586x_add_subdevs(tps6586x, pdata);
608 if (ret) {
609 dev_err(&client->dev, "add devices failed: %d\n", ret);
610 goto err_add_devs;
613 return 0;
615 err_add_devs:
616 if (pdata->gpio_base) {
617 ret = gpiochip_remove(&tps6586x->gpio);
618 if (ret)
619 dev_err(&client->dev, "Can't remove gpio chip: %d\n",
620 ret);
622 err_gpio_init:
623 if (client->irq)
624 free_irq(client->irq, tps6586x);
625 err_irq_init:
626 kfree(tps6586x);
627 return ret;
630 static int __devexit tps6586x_i2c_remove(struct i2c_client *client)
632 struct tps6586x *tps6586x = i2c_get_clientdata(client);
633 struct tps6586x_platform_data *pdata = client->dev.platform_data;
634 int ret;
636 if (client->irq)
637 free_irq(client->irq, tps6586x);
639 if (pdata->gpio_base) {
640 ret = gpiochip_remove(&tps6586x->gpio);
641 if (ret)
642 dev_err(&client->dev, "Can't remove gpio chip: %d\n",
643 ret);
646 tps6586x_remove_subdevs(tps6586x);
647 kfree(tps6586x);
648 return 0;
651 static const struct i2c_device_id tps6586x_id_table[] = {
652 { "tps6586x", 0 },
653 { },
655 MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
657 static struct i2c_driver tps6586x_driver = {
658 .driver = {
659 .name = "tps6586x",
660 .owner = THIS_MODULE,
661 .of_match_table = of_match_ptr(tps6586x_of_match),
663 .probe = tps6586x_i2c_probe,
664 .remove = __devexit_p(tps6586x_i2c_remove),
665 .id_table = tps6586x_id_table,
668 static int __init tps6586x_init(void)
670 return i2c_add_driver(&tps6586x_driver);
672 subsys_initcall(tps6586x_init);
674 static void __exit tps6586x_exit(void)
676 i2c_del_driver(&tps6586x_driver);
678 module_exit(tps6586x_exit);
680 MODULE_DESCRIPTION("TPS6586X core driver");
681 MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
682 MODULE_LICENSE("GPL");