blob: a81abd4871bada15973e315519de8cb4eb6fa7e9 [file] [log] [blame]
Anuj Aggarwal30e65992009-08-21 00:39:31 +05301/*
2 * tps65023-regulator.c
3 *
4 * Supports TPS65023 Regulator
5 *
6 * Copyright (C) 2009 Texas Instrument Incorporated - http://www.ti.com/
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation version 2.
11 *
12 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/err.h>
22#include <linux/platform_device.h>
23#include <linux/regulator/driver.h>
24#include <linux/regulator/machine.h>
25#include <linux/i2c.h>
26#include <linux/delay.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090027#include <linux/slab.h>
Mark Brown90923352011-06-18 01:18:51 +010028#include <linux/regmap.h>
Anuj Aggarwal30e65992009-08-21 00:39:31 +053029
30/* Register definitions */
31#define TPS65023_REG_VERSION 0
32#define TPS65023_REG_PGOODZ 1
33#define TPS65023_REG_MASK 2
34#define TPS65023_REG_REG_CTRL 3
35#define TPS65023_REG_CON_CTRL 4
36#define TPS65023_REG_CON_CTRL2 5
37#define TPS65023_REG_DEF_CORE 6
38#define TPS65023_REG_DEFSLEW 7
39#define TPS65023_REG_LDO_CTRL 8
40
41/* PGOODZ bitfields */
42#define TPS65023_PGOODZ_PWRFAILZ BIT(7)
43#define TPS65023_PGOODZ_LOWBATTZ BIT(6)
44#define TPS65023_PGOODZ_VDCDC1 BIT(5)
45#define TPS65023_PGOODZ_VDCDC2 BIT(4)
46#define TPS65023_PGOODZ_VDCDC3 BIT(3)
47#define TPS65023_PGOODZ_LDO2 BIT(2)
48#define TPS65023_PGOODZ_LDO1 BIT(1)
49
50/* MASK bitfields */
51#define TPS65023_MASK_PWRFAILZ BIT(7)
52#define TPS65023_MASK_LOWBATTZ BIT(6)
53#define TPS65023_MASK_VDCDC1 BIT(5)
54#define TPS65023_MASK_VDCDC2 BIT(4)
55#define TPS65023_MASK_VDCDC3 BIT(3)
56#define TPS65023_MASK_LDO2 BIT(2)
57#define TPS65023_MASK_LDO1 BIT(1)
58
59/* REG_CTRL bitfields */
60#define TPS65023_REG_CTRL_VDCDC1_EN BIT(5)
61#define TPS65023_REG_CTRL_VDCDC2_EN BIT(4)
62#define TPS65023_REG_CTRL_VDCDC3_EN BIT(3)
63#define TPS65023_REG_CTRL_LDO2_EN BIT(2)
64#define TPS65023_REG_CTRL_LDO1_EN BIT(1)
65
Marcus Folkessonfc999b82011-08-04 13:33:49 +020066/* REG_CTRL2 bitfields */
67#define TPS65023_REG_CTRL2_GO BIT(7)
68#define TPS65023_REG_CTRL2_CORE_ADJ BIT(6)
69#define TPS65023_REG_CTRL2_DCDC2 BIT(2)
70#define TPS65023_REG_CTRL2_DCDC1 BIT(2)
71#define TPS65023_REG_CTRL2_DCDC3 BIT(0)
72
Anuj Aggarwal30e65992009-08-21 00:39:31 +053073/* LDO_CTRL bitfields */
74#define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4)
75#define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0xF0 >> ((ldo_id)*4))
76
77/* Number of step-down converters available */
78#define TPS65023_NUM_DCDC 3
79/* Number of LDO voltage regulators available */
80#define TPS65023_NUM_LDO 2
81/* Number of total regulators available */
82#define TPS65023_NUM_REGULATOR (TPS65023_NUM_DCDC + TPS65023_NUM_LDO)
83
84/* DCDCs */
85#define TPS65023_DCDC_1 0
86#define TPS65023_DCDC_2 1
87#define TPS65023_DCDC_3 2
88/* LDOs */
89#define TPS65023_LDO_1 3
90#define TPS65023_LDO_2 4
91
92#define TPS65023_MAX_REG_ID TPS65023_LDO_2
93
94/* Supported voltage values for regulators */
95static const u16 VDCDC1_VSEL_table[] = {
96 800, 825, 850, 875,
97 900, 925, 950, 975,
98 1000, 1025, 1050, 1075,
99 1100, 1125, 1150, 1175,
100 1200, 1225, 1250, 1275,
101 1300, 1325, 1350, 1375,
102 1400, 1425, 1450, 1475,
103 1500, 1525, 1550, 1600,
104};
105
106static const u16 LDO1_VSEL_table[] = {
107 1000, 1100, 1300, 1800,
108 2200, 2600, 2800, 3150,
109};
110
111static const u16 LDO2_VSEL_table[] = {
112 1050, 1200, 1300, 1800,
113 2500, 2800, 3000, 3300,
114};
115
116static unsigned int num_voltages[] = {ARRAY_SIZE(VDCDC1_VSEL_table),
117 0, 0, ARRAY_SIZE(LDO1_VSEL_table),
118 ARRAY_SIZE(LDO2_VSEL_table)};
119
120/* Regulator specific details */
121struct tps_info {
122 const char *name;
123 unsigned min_uV;
124 unsigned max_uV;
125 bool fixed;
126 u8 table_len;
127 const u16 *table;
128};
129
130/* PMIC details */
131struct tps_pmic {
132 struct regulator_desc desc[TPS65023_NUM_REGULATOR];
133 struct i2c_client *client;
134 struct regulator_dev *rdev[TPS65023_NUM_REGULATOR];
135 const struct tps_info *info[TPS65023_NUM_REGULATOR];
Mark Brown90923352011-06-18 01:18:51 +0100136 struct regmap *regmap;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530137};
138
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530139static int tps_65023_set_bits(struct tps_pmic *tps, u8 reg, u8 mask)
140{
Mark Brown90923352011-06-18 01:18:51 +0100141 return regmap_update_bits(tps->regmap, reg, mask, mask);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530142}
143
144static int tps_65023_clear_bits(struct tps_pmic *tps, u8 reg, u8 mask)
145{
Mark Brown90923352011-06-18 01:18:51 +0100146 return regmap_update_bits(tps->regmap, reg, mask, 0);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530147}
148
149static int tps_65023_reg_read(struct tps_pmic *tps, u8 reg)
150{
Mark Brown90923352011-06-18 01:18:51 +0100151 unsigned int val;
152 int ret;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530153
Mark Brown90923352011-06-18 01:18:51 +0100154 ret = regmap_read(tps->regmap, reg, &val);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530155
Mark Brown90923352011-06-18 01:18:51 +0100156 if (ret != 0)
157 return ret;
158 else
159 return val;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530160}
161
162static int tps_65023_reg_write(struct tps_pmic *tps, u8 reg, u8 val)
163{
Mark Brown90923352011-06-18 01:18:51 +0100164 return regmap_write(tps->regmap, reg, val);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530165}
166
167static int tps65023_dcdc_is_enabled(struct regulator_dev *dev)
168{
169 struct tps_pmic *tps = rdev_get_drvdata(dev);
170 int data, dcdc = rdev_get_id(dev);
171 u8 shift;
172
173 if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
174 return -EINVAL;
175
176 shift = TPS65023_NUM_REGULATOR - dcdc;
177 data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
178
179 if (data < 0)
180 return data;
181 else
182 return (data & 1<<shift) ? 1 : 0;
183}
184
185static int tps65023_ldo_is_enabled(struct regulator_dev *dev)
186{
187 struct tps_pmic *tps = rdev_get_drvdata(dev);
188 int data, ldo = rdev_get_id(dev);
189 u8 shift;
190
191 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
192 return -EINVAL;
193
194 shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
195 data = tps_65023_reg_read(tps, TPS65023_REG_REG_CTRL);
196
197 if (data < 0)
198 return data;
199 else
200 return (data & 1<<shift) ? 1 : 0;
201}
202
203static int tps65023_dcdc_enable(struct regulator_dev *dev)
204{
205 struct tps_pmic *tps = rdev_get_drvdata(dev);
206 int dcdc = rdev_get_id(dev);
207 u8 shift;
208
209 if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
210 return -EINVAL;
211
212 shift = TPS65023_NUM_REGULATOR - dcdc;
213 return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
214}
215
216static int tps65023_dcdc_disable(struct regulator_dev *dev)
217{
218 struct tps_pmic *tps = rdev_get_drvdata(dev);
219 int dcdc = rdev_get_id(dev);
220 u8 shift;
221
222 if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
223 return -EINVAL;
224
225 shift = TPS65023_NUM_REGULATOR - dcdc;
226 return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
227}
228
229static int tps65023_ldo_enable(struct regulator_dev *dev)
230{
231 struct tps_pmic *tps = rdev_get_drvdata(dev);
232 int ldo = rdev_get_id(dev);
233 u8 shift;
234
235 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
236 return -EINVAL;
237
238 shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
239 return tps_65023_set_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
240}
241
242static int tps65023_ldo_disable(struct regulator_dev *dev)
243{
244 struct tps_pmic *tps = rdev_get_drvdata(dev);
245 int ldo = rdev_get_id(dev);
246 u8 shift;
247
248 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
249 return -EINVAL;
250
251 shift = (ldo == TPS65023_LDO_1 ? 1 : 2);
252 return tps_65023_clear_bits(tps, TPS65023_REG_REG_CTRL, 1 << shift);
253}
254
255static int tps65023_dcdc_get_voltage(struct regulator_dev *dev)
256{
257 struct tps_pmic *tps = rdev_get_drvdata(dev);
258 int data, dcdc = rdev_get_id(dev);
259
260 if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
261 return -EINVAL;
262
263 if (dcdc == TPS65023_DCDC_1) {
264 data = tps_65023_reg_read(tps, TPS65023_REG_DEF_CORE);
265 if (data < 0)
266 return data;
267 data &= (tps->info[dcdc]->table_len - 1);
268 return tps->info[dcdc]->table[data] * 1000;
269 } else
270 return tps->info[dcdc]->min_uV;
271}
272
273static int tps65023_dcdc_set_voltage(struct regulator_dev *dev,
Mark Brown3a93f2a2010-11-10 14:38:29 +0000274 int min_uV, int max_uV,
275 unsigned *selector)
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530276{
277 struct tps_pmic *tps = rdev_get_drvdata(dev);
278 int dcdc = rdev_get_id(dev);
279 int vsel;
280
281 if (dcdc != TPS65023_DCDC_1)
282 return -EINVAL;
283
284 if (min_uV < tps->info[dcdc]->min_uV
285 || min_uV > tps->info[dcdc]->max_uV)
286 return -EINVAL;
287 if (max_uV < tps->info[dcdc]->min_uV
288 || max_uV > tps->info[dcdc]->max_uV)
289 return -EINVAL;
290
291 for (vsel = 0; vsel < tps->info[dcdc]->table_len; vsel++) {
292 int mV = tps->info[dcdc]->table[vsel];
293 int uV = mV * 1000;
294
295 /* Break at the first in-range value */
296 if (min_uV <= uV && uV <= max_uV)
297 break;
298 }
299
Mark Brown3a93f2a2010-11-10 14:38:29 +0000300 *selector = vsel;
301
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530302 /* write to the register in case we found a match */
303 if (vsel == tps->info[dcdc]->table_len)
304 return -EINVAL;
305 else
306 return tps_65023_reg_write(tps, TPS65023_REG_DEF_CORE, vsel);
307}
308
309static int tps65023_ldo_get_voltage(struct regulator_dev *dev)
310{
311 struct tps_pmic *tps = rdev_get_drvdata(dev);
312 int data, ldo = rdev_get_id(dev);
313
314 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
315 return -EINVAL;
316
317 data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
318 if (data < 0)
319 return data;
320
321 data >>= (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1));
322 data &= (tps->info[ldo]->table_len - 1);
323 return tps->info[ldo]->table[data] * 1000;
324}
325
326static int tps65023_ldo_set_voltage(struct regulator_dev *dev,
Mark Brown3a93f2a2010-11-10 14:38:29 +0000327 int min_uV, int max_uV, unsigned *selector)
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530328{
329 struct tps_pmic *tps = rdev_get_drvdata(dev);
330 int data, vsel, ldo = rdev_get_id(dev);
331
332 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
333 return -EINVAL;
334
335 if (min_uV < tps->info[ldo]->min_uV || min_uV > tps->info[ldo]->max_uV)
336 return -EINVAL;
337 if (max_uV < tps->info[ldo]->min_uV || max_uV > tps->info[ldo]->max_uV)
338 return -EINVAL;
339
340 for (vsel = 0; vsel < tps->info[ldo]->table_len; vsel++) {
341 int mV = tps->info[ldo]->table[vsel];
342 int uV = mV * 1000;
343
344 /* Break at the first in-range value */
345 if (min_uV <= uV && uV <= max_uV)
346 break;
347 }
348
349 if (vsel == tps->info[ldo]->table_len)
350 return -EINVAL;
351
Mark Brown3a93f2a2010-11-10 14:38:29 +0000352 *selector = vsel;
353
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530354 data = tps_65023_reg_read(tps, TPS65023_REG_LDO_CTRL);
355 if (data < 0)
356 return data;
357
358 data &= TPS65023_LDO_CTRL_LDOx_MASK(ldo - TPS65023_LDO_1);
359 data |= (vsel << (TPS65023_LDO_CTRL_LDOx_SHIFT(ldo - TPS65023_LDO_1)));
360 return tps_65023_reg_write(tps, TPS65023_REG_LDO_CTRL, data);
361}
362
363static int tps65023_dcdc_list_voltage(struct regulator_dev *dev,
364 unsigned selector)
365{
366 struct tps_pmic *tps = rdev_get_drvdata(dev);
367 int dcdc = rdev_get_id(dev);
368
369 if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3)
370 return -EINVAL;
371
372 if (dcdc == TPS65023_DCDC_1) {
373 if (selector >= tps->info[dcdc]->table_len)
374 return -EINVAL;
375 else
376 return tps->info[dcdc]->table[selector] * 1000;
377 } else
378 return tps->info[dcdc]->min_uV;
379}
380
381static int tps65023_ldo_list_voltage(struct regulator_dev *dev,
382 unsigned selector)
383{
384 struct tps_pmic *tps = rdev_get_drvdata(dev);
385 int ldo = rdev_get_id(dev);
386
387 if (ldo < TPS65023_LDO_1 || ldo > TPS65023_LDO_2)
388 return -EINVAL;
389
390 if (selector >= tps->info[ldo]->table_len)
391 return -EINVAL;
392 else
393 return tps->info[ldo]->table[selector] * 1000;
394}
395
396/* Operations permitted on VDCDCx */
397static struct regulator_ops tps65023_dcdc_ops = {
398 .is_enabled = tps65023_dcdc_is_enabled,
399 .enable = tps65023_dcdc_enable,
400 .disable = tps65023_dcdc_disable,
401 .get_voltage = tps65023_dcdc_get_voltage,
402 .set_voltage = tps65023_dcdc_set_voltage,
403 .list_voltage = tps65023_dcdc_list_voltage,
404};
405
406/* Operations permitted on LDOx */
407static struct regulator_ops tps65023_ldo_ops = {
408 .is_enabled = tps65023_ldo_is_enabled,
409 .enable = tps65023_ldo_enable,
410 .disable = tps65023_ldo_disable,
411 .get_voltage = tps65023_ldo_get_voltage,
412 .set_voltage = tps65023_ldo_set_voltage,
413 .list_voltage = tps65023_ldo_list_voltage,
414};
415
Mark Brown90923352011-06-18 01:18:51 +0100416static struct regmap_config tps65023_regmap_config = {
417 .reg_bits = 8,
418 .val_bits = 8,
419};
420
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800421static int __devinit tps_65023_probe(struct i2c_client *client,
422 const struct i2c_device_id *id)
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530423{
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530424 const struct tps_info *info = (void *)id->driver_data;
425 struct regulator_init_data *init_data;
426 struct regulator_dev *rdev;
427 struct tps_pmic *tps;
428 int i;
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800429 int error;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530430
431 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
432 return -EIO;
433
434 /**
435 * init_data points to array of regulator_init structures
436 * coming from the board-evm file.
437 */
438 init_data = client->dev.platform_data;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530439 if (!init_data)
440 return -EIO;
441
442 tps = kzalloc(sizeof(*tps), GFP_KERNEL);
443 if (!tps)
444 return -ENOMEM;
445
Mark Brown90923352011-06-18 01:18:51 +0100446 tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config);
447 if (IS_ERR(tps->regmap)) {
448 error = PTR_ERR(tps->regmap);
449 dev_err(&client->dev, "Failed to allocate register map: %d\n",
450 error);
451 goto fail_alloc;
452 }
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530453
454 /* common for all regulators */
455 tps->client = client;
456
457 for (i = 0; i < TPS65023_NUM_REGULATOR; i++, info++, init_data++) {
458 /* Store regulator specific information */
459 tps->info[i] = info;
460
461 tps->desc[i].name = info->name;
Axel Lin77fa44d2011-05-12 13:47:50 +0800462 tps->desc[i].id = i;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530463 tps->desc[i].n_voltages = num_voltages[i];
464 tps->desc[i].ops = (i > TPS65023_DCDC_3 ?
465 &tps65023_ldo_ops : &tps65023_dcdc_ops);
466 tps->desc[i].type = REGULATOR_VOLTAGE;
467 tps->desc[i].owner = THIS_MODULE;
468
469 /* Register the regulators */
470 rdev = regulator_register(&tps->desc[i], &client->dev,
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800471 init_data, tps);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530472 if (IS_ERR(rdev)) {
473 dev_err(&client->dev, "failed to register %s\n",
474 id->name);
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800475 error = PTR_ERR(rdev);
476 goto fail;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530477 }
478
479 /* Save regulator for cleanup */
480 tps->rdev[i] = rdev;
481 }
482
483 i2c_set_clientdata(client, tps);
484
Marcus Folkessonfc999b82011-08-04 13:33:49 +0200485 /* Enable setting output voltage by I2C */
486 tps_65023_clear_bits(tps, TPS65023_REG_CON_CTRL2,
487 TPS65023_REG_CTRL2_CORE_ADJ);
488
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530489 return 0;
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800490
491 fail:
492 while (--i >= 0)
493 regulator_unregister(tps->rdev[i]);
494
Mark Brown90923352011-06-18 01:18:51 +0100495 regmap_exit(tps->regmap);
496 fail_alloc:
Dmitry Torokhov54d13ab2010-02-23 23:38:06 -0800497 kfree(tps);
498 return error;
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530499}
500
501/**
502 * tps_65023_remove - TPS65023 driver i2c remove handler
503 * @client: i2c driver client device structure
504 *
505 * Unregister TPS driver as an i2c client device driver
506 */
507static int __devexit tps_65023_remove(struct i2c_client *client)
508{
509 struct tps_pmic *tps = i2c_get_clientdata(client);
510 int i;
511
512 for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
513 regulator_unregister(tps->rdev[i]);
514
Mark Brown90923352011-06-18 01:18:51 +0100515 regmap_exit(tps->regmap);
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530516 kfree(tps);
517
518 return 0;
519}
520
521static const struct tps_info tps65023_regs[] = {
522 {
523 .name = "VDCDC1",
524 .min_uV = 800000,
525 .max_uV = 1600000,
526 .table_len = ARRAY_SIZE(VDCDC1_VSEL_table),
527 .table = VDCDC1_VSEL_table,
528 },
529 {
530 .name = "VDCDC2",
531 .min_uV = 3300000,
532 .max_uV = 3300000,
533 .fixed = 1,
534 },
535 {
536 .name = "VDCDC3",
537 .min_uV = 1800000,
538 .max_uV = 1800000,
539 .fixed = 1,
540 },
541 {
542 .name = "LDO1",
543 .min_uV = 1000000,
544 .max_uV = 3150000,
545 .table_len = ARRAY_SIZE(LDO1_VSEL_table),
546 .table = LDO1_VSEL_table,
547 },
548 {
549 .name = "LDO2",
550 .min_uV = 1050000,
551 .max_uV = 3300000,
552 .table_len = ARRAY_SIZE(LDO2_VSEL_table),
553 .table = LDO2_VSEL_table,
554 },
555};
556
Liam Girdwood9e108d32009-08-24 10:31:34 +0100557static const struct i2c_device_id tps_65023_id[] = {
558 {.name = "tps65023",
559 .driver_data = (unsigned long) tps65023_regs,},
Marek Vasut1880a2f2010-06-24 15:49:49 +0200560 {.name = "tps65021",
561 .driver_data = (unsigned long) tps65023_regs,},
Liam Girdwood9e108d32009-08-24 10:31:34 +0100562 { },
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530563};
564
565MODULE_DEVICE_TABLE(i2c, tps_65023_id);
566
567static struct i2c_driver tps_65023_i2c_driver = {
568 .driver = {
569 .name = "tps65023",
570 .owner = THIS_MODULE,
571 },
572 .probe = tps_65023_probe,
573 .remove = __devexit_p(tps_65023_remove),
Liam Girdwood9e108d32009-08-24 10:31:34 +0100574 .id_table = tps_65023_id,
Anuj Aggarwal30e65992009-08-21 00:39:31 +0530575};
576
577/**
578 * tps_65023_init
579 *
580 * Module init function
581 */
582static int __init tps_65023_init(void)
583{
584 return i2c_add_driver(&tps_65023_i2c_driver);
585}
586subsys_initcall(tps_65023_init);
587
588/**
589 * tps_65023_cleanup
590 *
591 * Module exit function
592 */
593static void __exit tps_65023_cleanup(void)
594{
595 i2c_del_driver(&tps_65023_i2c_driver);
596}
597module_exit(tps_65023_cleanup);
598
599MODULE_AUTHOR("Texas Instruments");
600MODULE_DESCRIPTION("TPS65023 voltage regulator driver");
Liam Girdwood9e108d32009-08-24 10:31:34 +0100601MODULE_LICENSE("GPL v2");