aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Fischer <todd.fischer@ridgerun.com>2010-04-08 03:04:55 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-05-27 19:37:38 -0400
commit31dd6a2672e337f5de188df3e5169ee732798236 (patch)
treed0a12a6622d9a32a107267a4479f6e12a495dbd3
parent4ce5ba5ba2dfc8186bf31fe7f2d23ff6b5384124 (diff)
mfd: Add TPS6507x support
TPS6507x are multi function (PM, touchscreen) chipsets from TI. This commit also changes the corresponding regulator driver from being standalone to an MFD subdevice. Signed-off-by: Todd Fischer <todd.fischer@ridgerun.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/Kconfig12
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/tps6507x.c156
-rw-r--r--drivers/regulator/tps6507x-regulator.c153
-rw-r--r--include/linux/mfd/tps6507x.h22
5 files changed, 265 insertions, 79 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 05c137d16b04..40e0a0a7df5b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -116,6 +116,18 @@ config TPS65010
116 This driver can also be built as a module. If so, the module 116 This driver can also be built as a module. If so, the module
117 will be called tps65010. 117 will be called tps65010.
118 118
119config TPS6507X
120 tristate "TPS6507x Power Management / Touch Screen chips"
121 select MFD_CORE
122 depends on I2C
123 help
124 If you say yes here you get support for the TPS6507x series of
125 Power Management / Touch Screen chips. These include voltage
126 regulators, lithium ion/polymer battery charging, touch screen
127 and other features that are often used in portable devices.
128 This driver can also be built as a module. If so, the module
129 will be called tps6507x.
130
119config MENELAUS 131config MENELAUS
120 bool "Texas Instruments TWL92330/Menelaus PM chip" 132 bool "Texas Instruments TWL92330/Menelaus PM chip"
121 depends on I2C=y && ARCH_OMAP2 133 depends on I2C=y && ARCH_OMAP2
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 21eff85b288a..abf6f1766dcd 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
29obj-$(CONFIG_MFD_WM8994) += wm8994-core.o wm8994-irq.o 29obj-$(CONFIG_MFD_WM8994) += wm8994-core.o wm8994-irq.o
30 30
31obj-$(CONFIG_TPS65010) += tps65010.o 31obj-$(CONFIG_TPS65010) += tps65010.o
32obj-$(CONFIG_TPS6507X) += tps6507x.o
32obj-$(CONFIG_MENELAUS) += menelaus.o 33obj-$(CONFIG_MENELAUS) += menelaus.o
33 34
34obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o 35obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c
new file mode 100644
index 000000000000..c59f74570b3b
--- /dev/null
+++ b/drivers/mfd/tps6507x.c
@@ -0,0 +1,156 @@
1/*
2 * tps6507x.c -- TPS6507x chip family multi-function driver
3 *
4 * Copyright (c) 2010 RidgeRun (todd.fischer@ridgerun.com)
5 *
6 * Author: Todd Fischer
7 * todd.fischer@ridgerun.com
8 *
9 * Credits:
10 *
11 * Using code from wm831x-*.c, wm8400-core, Wolfson Microelectronics PLC.
12 *
13 * For licencing details see kernel-base/COPYING
14 *
15 */
16
17#include <linux/module.h>
18#include <linux/moduleparam.h>
19#include <linux/init.h>
20#include <linux/slab.h>
21#include <linux/i2c.h>
22#include <linux/mfd/core.h>
23#include <linux/mfd/tps6507x.h>
24
25static struct mfd_cell tps6507x_devs[] = {
26 {
27 .name = "tps6507x-pmic",
28 },
29};
30
31
32static int tps6507x_i2c_read_device(struct tps6507x_dev *tps6507x, char reg,
33 int bytes, void *dest)
34{
35 struct i2c_client *i2c = tps6507x->i2c_client;
36 struct i2c_msg xfer[2];
37 int ret;
38
39 /* Write register */
40 xfer[0].addr = i2c->addr;
41 xfer[0].flags = 0;
42 xfer[0].len = 1;
43 xfer[0].buf = &reg;
44
45 /* Read data */
46 xfer[1].addr = i2c->addr;
47 xfer[1].flags = I2C_M_RD;
48 xfer[1].len = bytes;
49 xfer[1].buf = dest;
50
51 ret = i2c_transfer(i2c->adapter, xfer, 2);
52 if (ret == 2)
53 ret = 0;
54 else if (ret >= 0)
55 ret = -EIO;
56
57 return ret;
58}
59
60static int tps6507x_i2c_write_device(struct tps6507x_dev *tps6507x, char reg,
61 int bytes, void *src)
62{
63 struct i2c_client *i2c = tps6507x->i2c_client;
64 /* we add 1 byte for device register */
65 u8 msg[TPS6507X_MAX_REGISTER + 1];
66 int ret;
67
68 if (bytes > (TPS6507X_MAX_REGISTER + 1))
69 return -EINVAL;
70
71 msg[0] = reg;
72 memcpy(&msg[1], src, bytes);
73
74 ret = i2c_master_send(i2c, msg, bytes + 1);
75 if (ret < 0)
76 return ret;
77 if (ret != bytes + 1)
78 return -EIO;
79 return 0;
80}
81
82static int tps6507x_i2c_probe(struct i2c_client *i2c,
83 const struct i2c_device_id *id)
84{
85 struct tps6507x_dev *tps6507x;
86 int ret = 0;
87
88 tps6507x = kzalloc(sizeof(struct tps6507x_dev), GFP_KERNEL);
89 if (tps6507x == NULL) {
90 kfree(i2c);
91 return -ENOMEM;
92 }
93
94 i2c_set_clientdata(i2c, tps6507x);
95 tps6507x->dev = &i2c->dev;
96 tps6507x->i2c_client = i2c;
97 tps6507x->read_dev = tps6507x_i2c_read_device;
98 tps6507x->write_dev = tps6507x_i2c_write_device;
99
100 ret = mfd_add_devices(tps6507x->dev, -1,
101 tps6507x_devs, ARRAY_SIZE(tps6507x_devs),
102 NULL, 0);
103
104 if (ret < 0)
105 goto err;
106
107 return ret;
108
109err:
110 mfd_remove_devices(tps6507x->dev);
111 kfree(tps6507x);
112 return ret;
113}
114
115static int tps6507x_i2c_remove(struct i2c_client *i2c)
116{
117 struct tps6507x_dev *tps6507x = i2c_get_clientdata(i2c);
118
119 mfd_remove_devices(tps6507x->dev);
120 kfree(tps6507x);
121
122 return 0;
123}
124
125static const struct i2c_device_id tps6507x_i2c_id[] = {
126 { "tps6507x", 0 },
127 { }
128};
129MODULE_DEVICE_TABLE(i2c, tps6507x_i2c_id);
130
131
132static struct i2c_driver tps6507x_i2c_driver = {
133 .driver = {
134 .name = "tps6507x",
135 .owner = THIS_MODULE,
136 },
137 .probe = tps6507x_i2c_probe,
138 .remove = tps6507x_i2c_remove,
139 .id_table = tps6507x_i2c_id,
140};
141
142static int __init tps6507x_i2c_init(void)
143{
144 return i2c_add_driver(&tps6507x_i2c_driver);
145}
146/* init early so consumer devices can complete system boot */
147subsys_initcall(tps6507x_i2c_init);
148
149static void __exit tps6507x_i2c_exit(void)
150{
151 i2c_del_driver(&tps6507x_i2c_driver);
152}
153module_exit(tps6507x_i2c_exit);
154
155MODULE_DESCRIPTION("TPS6507x chip family multi-function driver");
156MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index ea44741fcd47..14b4576281c5 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -22,7 +22,6 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/regulator/driver.h> 23#include <linux/regulator/driver.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/i2c.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/mfd/tps6507x.h> 27#include <linux/mfd/tps6507x.h>
@@ -104,22 +103,67 @@ struct tps_info {
104 const u16 *table; 103 const u16 *table;
105}; 104};
106 105
106static const struct tps_info tps6507x_pmic_regs[] = {
107 {
108 .name = "VDCDC1",
109 .min_uV = 725000,
110 .max_uV = 3300000,
111 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
112 .table = VDCDCx_VSEL_table,
113 },
114 {
115 .name = "VDCDC2",
116 .min_uV = 725000,
117 .max_uV = 3300000,
118 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
119 .table = VDCDCx_VSEL_table,
120 },
121 {
122 .name = "VDCDC3",
123 .min_uV = 725000,
124 .max_uV = 3300000,
125 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
126 .table = VDCDCx_VSEL_table,
127 },
128 {
129 .name = "LDO1",
130 .min_uV = 1000000,
131 .max_uV = 3300000,
132 .table_len = ARRAY_SIZE(LDO1_VSEL_table),
133 .table = LDO1_VSEL_table,
134 },
135 {
136 .name = "LDO2",
137 .min_uV = 725000,
138 .max_uV = 3300000,
139 .table_len = ARRAY_SIZE(LDO2_VSEL_table),
140 .table = LDO2_VSEL_table,
141 },
142};
143
107struct tps6507x_pmic { 144struct tps6507x_pmic {
108 struct regulator_desc desc[TPS6507X_NUM_REGULATOR]; 145 struct regulator_desc desc[TPS6507X_NUM_REGULATOR];
109 struct i2c_client *client; 146 struct tps6507x_dev *mfd;
110 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR]; 147 struct regulator_dev *rdev[TPS6507X_NUM_REGULATOR];
111 const struct tps_info *info[TPS6507X_NUM_REGULATOR]; 148 const struct tps_info *info[TPS6507X_NUM_REGULATOR];
112 struct mutex io_lock; 149 struct mutex io_lock;
113}; 150};
114
115static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg) 151static inline int tps6507x_pmic_read(struct tps6507x_pmic *tps, u8 reg)
116{ 152{
117 return i2c_smbus_read_byte_data(tps->client, reg); 153 u8 val;
154 int err;
155
156 err = tps->mfd->read_dev(tps->mfd, reg, 1, &val);
157
158 if (err)
159 return err;
160
161 return val;
118} 162}
119 163
120static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val) 164static inline int tps6507x_pmic_write(struct tps6507x_pmic *tps, u8 reg, u8 val)
121{ 165{
122 return i2c_smbus_write_byte_data(tps->client, reg, val); 166 return tps->mfd->write_dev(tps->mfd, reg, 1, &val);
123} 167}
124 168
125static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask) 169static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask)
@@ -130,7 +174,7 @@ static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask)
130 174
131 data = tps6507x_pmic_read(tps, reg); 175 data = tps6507x_pmic_read(tps, reg);
132 if (data < 0) { 176 if (data < 0) {
133 dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); 177 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
134 err = data; 178 err = data;
135 goto out; 179 goto out;
136 } 180 }
@@ -138,7 +182,7 @@ static int tps6507x_pmic_set_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask)
138 data |= mask; 182 data |= mask;
139 err = tps6507x_pmic_write(tps, reg, data); 183 err = tps6507x_pmic_write(tps, reg, data);
140 if (err) 184 if (err)
141 dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); 185 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
142 186
143out: 187out:
144 mutex_unlock(&tps->io_lock); 188 mutex_unlock(&tps->io_lock);
@@ -153,7 +197,7 @@ static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask)
153 197
154 data = tps6507x_pmic_read(tps, reg); 198 data = tps6507x_pmic_read(tps, reg);
155 if (data < 0) { 199 if (data < 0) {
156 dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); 200 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
157 err = data; 201 err = data;
158 goto out; 202 goto out;
159 } 203 }
@@ -161,7 +205,7 @@ static int tps6507x_pmic_clear_bits(struct tps6507x_pmic *tps, u8 reg, u8 mask)
161 data &= ~mask; 205 data &= ~mask;
162 err = tps6507x_pmic_write(tps, reg, data); 206 err = tps6507x_pmic_write(tps, reg, data);
163 if (err) 207 if (err)
164 dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); 208 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
165 209
166out: 210out:
167 mutex_unlock(&tps->io_lock); 211 mutex_unlock(&tps->io_lock);
@@ -176,7 +220,7 @@ static int tps6507x_pmic_reg_read(struct tps6507x_pmic *tps, u8 reg)
176 220
177 data = tps6507x_pmic_read(tps, reg); 221 data = tps6507x_pmic_read(tps, reg);
178 if (data < 0) 222 if (data < 0)
179 dev_err(&tps->client->dev, "Read from reg 0x%x failed\n", reg); 223 dev_err(tps->mfd->dev, "Read from reg 0x%x failed\n", reg);
180 224
181 mutex_unlock(&tps->io_lock); 225 mutex_unlock(&tps->io_lock);
182 return data; 226 return data;
@@ -190,7 +234,7 @@ static int tps6507x_pmic_reg_write(struct tps6507x_pmic *tps, u8 reg, u8 val)
190 234
191 err = tps6507x_pmic_write(tps, reg, val); 235 err = tps6507x_pmic_write(tps, reg, val);
192 if (err < 0) 236 if (err < 0)
193 dev_err(&tps->client->dev, "Write for reg 0x%x failed\n", reg); 237 dev_err(tps->mfd->dev, "Write for reg 0x%x failed\n", reg);
194 238
195 mutex_unlock(&tps->io_lock); 239 mutex_unlock(&tps->io_lock);
196 return err; 240 return err;
@@ -483,11 +527,12 @@ static struct regulator_ops tps6507x_pmic_ldo_ops = {
483 .list_voltage = tps6507x_pmic_ldo_list_voltage, 527 .list_voltage = tps6507x_pmic_ldo_list_voltage,
484}; 528};
485 529
486static int __devinit tps6507x_pmic_probe(struct i2c_client *client, 530static __devinit
487 const struct i2c_device_id *id) 531int tps6507x_pmic_probe(struct platform_device *pdev)
488{ 532{
533 struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
489 static int desc_id; 534 static int desc_id;
490 const struct tps_info *info = (void *)id->driver_data; 535 const struct tps_info *info = &tps6507x_pmic_regs[0];
491 struct regulator_init_data *init_data; 536 struct regulator_init_data *init_data;
492 struct regulator_dev *rdev; 537 struct regulator_dev *rdev;
493 struct tps6507x_pmic *tps; 538 struct tps6507x_pmic *tps;
@@ -495,16 +540,12 @@ static int __devinit tps6507x_pmic_probe(struct i2c_client *client,
495 int i; 540 int i;
496 int error; 541 int error;
497 542
498 if (!i2c_check_functionality(client->adapter,
499 I2C_FUNC_SMBUS_BYTE_DATA))
500 return -EIO;
501
502 /** 543 /**
503 * tps_board points to pmic related constants 544 * tps_board points to pmic related constants
504 * coming from the board-evm file. 545 * coming from the board-evm file.
505 */ 546 */
506 547
507 tps_board = dev_get_platdata(&client->dev); 548 tps_board = dev_get_platdata(tps6507x_dev->dev);
508 if (!tps_board) 549 if (!tps_board)
509 return -EINVAL; 550 return -EINVAL;
510 551
@@ -523,7 +564,7 @@ static int __devinit tps6507x_pmic_probe(struct i2c_client *client,
523 mutex_init(&tps->io_lock); 564 mutex_init(&tps->io_lock);
524 565
525 /* common for all regulators */ 566 /* common for all regulators */
526 tps->client = client; 567 tps->mfd = tps6507x_dev;
527 568
528 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) { 569 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++, info++, init_data++) {
529 /* Register the regulators */ 570 /* Register the regulators */
@@ -537,10 +578,11 @@ static int __devinit tps6507x_pmic_probe(struct i2c_client *client,
537 tps->desc[i].owner = THIS_MODULE; 578 tps->desc[i].owner = THIS_MODULE;
538 579
539 rdev = regulator_register(&tps->desc[i], 580 rdev = regulator_register(&tps->desc[i],
540 &client->dev, init_data, tps); 581 tps6507x_dev->dev, init_data, tps);
541 if (IS_ERR(rdev)) { 582 if (IS_ERR(rdev)) {
542 dev_err(&client->dev, "failed to register %s\n", 583 dev_err(tps6507x_dev->dev,
543 id->name); 584 "failed to register %s regulator\n",
585 pdev->name);
544 error = PTR_ERR(rdev); 586 error = PTR_ERR(rdev);
545 goto fail; 587 goto fail;
546 } 588 }
@@ -549,7 +591,7 @@ static int __devinit tps6507x_pmic_probe(struct i2c_client *client,
549 tps->rdev[i] = rdev; 591 tps->rdev[i] = rdev;
550 } 592 }
551 593
552 i2c_set_clientdata(client, tps); 594 tps6507x_dev->pmic = tps;
553 595
554 return 0; 596 return 0;
555 597
@@ -567,14 +609,12 @@ fail:
567 * 609 *
568 * Unregister TPS driver as an i2c client device driver 610 * Unregister TPS driver as an i2c client device driver
569 */ 611 */
570static int __devexit tps6507x_pmic_remove(struct i2c_client *client) 612static int __devexit tps6507x_pmic_remove(struct platform_device *pdev)
571{ 613{
572 struct tps6507x_pmic *tps = i2c_get_clientdata(client); 614 struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
615 struct tps6507x_pmic *tps = tps6507x_dev->pmic;
573 int i; 616 int i;
574 617
575 /* clear the client data in i2c */
576 i2c_set_clientdata(client, NULL);
577
578 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++) 618 for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
579 regulator_unregister(tps->rdev[i]); 619 regulator_unregister(tps->rdev[i]);
580 620
@@ -583,59 +623,13 @@ static int __devexit tps6507x_pmic_remove(struct i2c_client *client)
583 return 0; 623 return 0;
584} 624}
585 625
586static const struct tps_info tps6507x_pmic_regs[] = { 626static struct platform_driver tps6507x_pmic_driver = {
587 {
588 .name = "VDCDC1",
589 .min_uV = 725000,
590 .max_uV = 3300000,
591 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
592 .table = VDCDCx_VSEL_table,
593 },
594 {
595 .name = "VDCDC2",
596 .min_uV = 725000,
597 .max_uV = 3300000,
598 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
599 .table = VDCDCx_VSEL_table,
600 },
601 {
602 .name = "VDCDC3",
603 .min_uV = 725000,
604 .max_uV = 3300000,
605 .table_len = ARRAY_SIZE(VDCDCx_VSEL_table),
606 .table = VDCDCx_VSEL_table,
607 },
608 {
609 .name = "LDO1",
610 .min_uV = 1000000,
611 .max_uV = 3300000,
612 .table_len = ARRAY_SIZE(LDO1_VSEL_table),
613 .table = LDO1_VSEL_table,
614 },
615 {
616 .name = "LDO2",
617 .min_uV = 725000,
618 .max_uV = 3300000,
619 .table_len = ARRAY_SIZE(LDO2_VSEL_table),
620 .table = LDO2_VSEL_table,
621 },
622};
623
624static const struct i2c_device_id tps6507x_pmic_id[] = {
625 {.name = "tps6507x",
626 .driver_data = (unsigned long) tps6507x_pmic_regs,},
627 { },
628};
629MODULE_DEVICE_TABLE(i2c, tps6507x_pmic_id);
630
631static struct i2c_driver tps6507x_i2c_driver = {
632 .driver = { 627 .driver = {
633 .name = "tps6507x", 628 .name = "tps6507x-pmic",
634 .owner = THIS_MODULE, 629 .owner = THIS_MODULE,
635 }, 630 },
636 .probe = tps6507x_pmic_probe, 631 .probe = tps6507x_pmic_probe,
637 .remove = __devexit_p(tps6507x_pmic_remove), 632 .remove = __devexit_p(tps6507x_pmic_remove),
638 .id_table = tps6507x_pmic_id,
639}; 633};
640 634
641/** 635/**
@@ -645,7 +639,7 @@ static struct i2c_driver tps6507x_i2c_driver = {
645 */ 639 */
646static int __init tps6507x_pmic_init(void) 640static int __init tps6507x_pmic_init(void)
647{ 641{
648 return i2c_add_driver(&tps6507x_i2c_driver); 642 return platform_driver_register(&tps6507x_pmic_driver);
649} 643}
650subsys_initcall(tps6507x_pmic_init); 644subsys_initcall(tps6507x_pmic_init);
651 645
@@ -656,10 +650,11 @@ subsys_initcall(tps6507x_pmic_init);
656 */ 650 */
657static void __exit tps6507x_pmic_cleanup(void) 651static void __exit tps6507x_pmic_cleanup(void)
658{ 652{
659 i2c_del_driver(&tps6507x_i2c_driver); 653 platform_driver_unregister(&tps6507x_pmic_driver);
660} 654}
661module_exit(tps6507x_pmic_cleanup); 655module_exit(tps6507x_pmic_cleanup);
662 656
663MODULE_AUTHOR("Texas Instruments"); 657MODULE_AUTHOR("Texas Instruments");
664MODULE_DESCRIPTION("TPS6507x voltage regulator driver"); 658MODULE_DESCRIPTION("TPS6507x voltage regulator driver");
665MODULE_LICENSE("GPL v2"); 659MODULE_LICENSE("GPL v2");
660MODULE_ALIAS("platform:tps6507x-pmic");
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
index fd73af5fb95a..9543cb716428 100644
--- a/include/linux/mfd/tps6507x.h
+++ b/include/linux/mfd/tps6507x.h
@@ -131,6 +131,8 @@
131/* VDCDC MASK */ 131/* VDCDC MASK */
132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F 132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
133 133
134#define TPS6507X_MAX_REGISTER 0X19
135
134/** 136/**
135 * struct tps6507x_board - packages regulator and touchscreen init data 137 * struct tps6507x_board - packages regulator and touchscreen init data
136 * @tps6507x_regulator_data: regulator initialization values 138 * @tps6507x_regulator_data: regulator initialization values
@@ -142,4 +144,24 @@ struct tps6507x_board {
142 struct regulator_init_data *tps6507x_pmic_init_data; 144 struct regulator_init_data *tps6507x_pmic_init_data;
143}; 145};
144 146
147/**
148 * struct tps6507x_dev - tps6507x sub-driver chip access routines
149 * @read_dev() - I2C register read function
150 * @write_dev() - I2C register write function
151 *
152 * Device data may be used to access the TPS6507x chip
153 */
154
155struct tps6507x_dev {
156 struct device *dev;
157 struct i2c_client *i2c_client;
158 int (*read_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
159 void *dest);
160 int (*write_dev)(struct tps6507x_dev *tps6507x, char reg, int size,
161 void *src);
162
163 /* Client devices */
164 struct tps6507x_pmic *pmic;
165};
166
145#endif /* __LINUX_MFD_TPS6507X_H */ 167#endif /* __LINUX_MFD_TPS6507X_H */