aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Fischer <todd.fischer@ridgerun.com>2010-04-05 22:23:57 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2010-05-27 19:37:37 -0400
commit0bc20bba357f18a0e52f45afc452d0b69cf06f76 (patch)
tree38a1c5edfd04aa04a37afc404d4779244b740c09
parentd183fcc975cbbc9c427deb2d7948ab03673995c9 (diff)
mfd: Add tps6507x board data structure
Add mfd structure which refrences sub-driver initialization data. For example, for a giving hardware implementation, the voltage regulator sub-driver initialization data provides the mapping betten a voltage regulator and what the output voltage is being used for. 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--arch/arm/mach-davinci/board-da850-evm.c7
-rw-r--r--drivers/regulator/tps6507x-regulator.c14
-rw-r--r--include/linux/mfd/tps6507x.h11
3 files changed, 29 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index abd04932917b..95adfd42d0e6 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,6 +17,7 @@
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/i2c/at24.h> 18#include <linux/i2c/at24.h>
19#include <linux/i2c/pca953x.h> 19#include <linux/i2c/pca953x.h>
20#include <linux/mfd/tps6507x.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
@@ -533,10 +534,14 @@ struct regulator_init_data tps65070_regulator_data[] = {
533 }, 534 },
534}; 535};
535 536
537static struct tps6507x_board tps_board = {
538 .tps6507x_pmic_init_data = &tps65070_regulator_data[0],
539};
540
536static struct i2c_board_info __initdata da850evm_tps65070_info[] = { 541static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
537 { 542 {
538 I2C_BOARD_INFO("tps6507x", 0x48), 543 I2C_BOARD_INFO("tps6507x", 0x48),
539 .platform_data = &tps65070_regulator_data[0], 544 .platform_data = &tps_board,
540 }, 545 },
541}; 546};
542 547
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c
index 23c0597ab1f5..c3f1bf822fd0 100644
--- a/drivers/regulator/tps6507x-regulator.c
+++ b/drivers/regulator/tps6507x-regulator.c
@@ -489,6 +489,7 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
489 struct regulator_init_data *init_data; 489 struct regulator_init_data *init_data;
490 struct regulator_dev *rdev; 490 struct regulator_dev *rdev;
491 struct tps_pmic *tps; 491 struct tps_pmic *tps;
492 struct tps6507x_board *tps_board;
492 int i; 493 int i;
493 int error; 494 int error;
494 495
@@ -497,12 +498,21 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
497 return -EIO; 498 return -EIO;
498 499
499 /** 500 /**
501 * tps_board points to pmic related constants
502 * coming from the board-evm file.
503 */
504
505 tps_board = dev_get_platdata(&client->dev);
506 if (!tps_board)
507 return -EINVAL;
508
509 /**
500 * init_data points to array of regulator_init structures 510 * init_data points to array of regulator_init structures
501 * coming from the board-evm file. 511 * coming from the board-evm file.
502 */ 512 */
503 init_data = client->dev.platform_data; 513 init_data = tps_board->tps6507x_pmic_init_data;
504 if (!init_data) 514 if (!init_data)
505 return -EIO; 515 return -EINVAL;
506 516
507 tps = kzalloc(sizeof(*tps), GFP_KERNEL); 517 tps = kzalloc(sizeof(*tps), GFP_KERNEL);
508 if (!tps) 518 if (!tps)
diff --git a/include/linux/mfd/tps6507x.h b/include/linux/mfd/tps6507x.h
index 155bee1f7823..fd73af5fb95a 100644
--- a/include/linux/mfd/tps6507x.h
+++ b/include/linux/mfd/tps6507x.h
@@ -131,4 +131,15 @@
131/* VDCDC MASK */ 131/* VDCDC MASK */
132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F 132#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
133 133
134/**
135 * struct tps6507x_board - packages regulator and touchscreen init data
136 * @tps6507x_regulator_data: regulator initialization values
137 *
138 * Board data may be used to initialize regulator and touchscreen.
139 */
140
141struct tps6507x_board {
142 struct regulator_init_data *tps6507x_pmic_init_data;
143};
144
134#endif /* __LINUX_MFD_TPS6507X_H */ 145#endif /* __LINUX_MFD_TPS6507X_H */