Commit e2d753bc authored by Todd Fischer's avatar Todd Fischer Committed by Kevin Hilman

-V3 Make room for other tps6507x drivers to have board specific initialization data.

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: default avatarTodd Fischer <todd.fischer@ridgerun.com>
parent 69506c81
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/i2c/at24.h> #include <linux/i2c/at24.h>
#include <linux/i2c/pca953x.h> #include <linux/i2c/pca953x.h>
#include <linux/mfd/tps6507x.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
...@@ -533,10 +534,14 @@ struct regulator_init_data tps65070_regulator_data[] = { ...@@ -533,10 +534,14 @@ struct regulator_init_data tps65070_regulator_data[] = {
}, },
}; };
static struct tps6507x_board tps_board = {
.tps6507x_pmic_init_data = &tps65070_regulator_data[0],
};
static struct i2c_board_info __initdata da850evm_tps65070_info[] = { static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
{ {
I2C_BOARD_INFO("tps6507x", 0x48), I2C_BOARD_INFO("tps6507x", 0x48),
.platform_data = &tps65070_regulator_data[0], .platform_data = &tps_board,
}, },
}; };
......
...@@ -489,6 +489,7 @@ static int __devinit tps_6507x_probe(struct i2c_client *client, ...@@ -489,6 +489,7 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
struct regulator_init_data *init_data; struct regulator_init_data *init_data;
struct regulator_dev *rdev; struct regulator_dev *rdev;
struct tps_pmic *tps; struct tps_pmic *tps;
struct tps6507x_board *tps_board;
int i; int i;
int error; int error;
...@@ -496,13 +497,22 @@ static int __devinit tps_6507x_probe(struct i2c_client *client, ...@@ -496,13 +497,22 @@ static int __devinit tps_6507x_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_BYTE_DATA)) I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO; return -EIO;
/**
* tps_board points to pmic related constants
* coming from the board-evm file.
*/
tps_board = dev_get_platdata(&client->dev);
if (!tps_board)
return -EINVAL;
/** /**
* init_data points to array of regulator_init structures * init_data points to array of regulator_init structures
* coming from the board-evm file. * coming from the board-evm file.
*/ */
init_data = client->dev.platform_data; init_data = tps_board->tps6507x_pmic_init_data;
if (!init_data) if (!init_data)
return -EIO; return -EINVAL;
tps = kzalloc(sizeof(*tps), GFP_KERNEL); tps = kzalloc(sizeof(*tps), GFP_KERNEL);
if (!tps) if (!tps)
......
...@@ -131,4 +131,15 @@ ...@@ -131,4 +131,15 @@
/* VDCDC MASK */ /* VDCDC MASK */
#define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F #define TPS6507X_DEFDCDCX_DCDC_MASK 0X3F
/**
* struct tps6507x_board - packages regulator and touchscreen init data
* @tps6507x_regulator_data: regulator initialization values
*
* Board data may be used to initialize regulator and touchscreen.
*/
struct tps6507x_board {
struct regulator_init_data *tps6507x_pmic_init_data;
};
#endif /* __LINUX_MFD_TPS6507X_H */ #endif /* __LINUX_MFD_TPS6507X_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment