diff options
author | Mark Brown <broonie@linaro.org> | 2013-07-01 23:02:19 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-07-02 00:54:39 +0200 |
commit | 25f311fa58c18c19ae1348336265ccb8368638f0 (patch) | |
tree | 7667a9d5295123108147a2b4f789de69c2b7d4c0 /drivers/mfd/sec-core.c | |
parent | da002d8924a49e8d8e289d07d46339e12dd56899 (diff) |
mfd: sec: Provide max_register to regmap
Enable debugfs register dumps and greater error checking within the
regmap API providing the maximum register to the regmap API.
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/sec-core.c')
-rw-r--r-- | drivers/mfd/sec-core.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index cc896d1c1cdd..79767681483a 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -25,6 +25,9 @@ #include <linux/mfd/samsung/core.h> #include <linux/mfd/samsung/irq.h> #include <linux/mfd/samsung/rtc.h> +#include <linux/mfd/samsung/s2mps11.h> +#include <linux/mfd/samsung/s5m8763.h> +#include <linux/mfd/samsung/s5m8767.h> #include <linux/regmap.h> static struct mfd_cell s5m8751_devs[] = { @@ -105,6 +108,26 @@ static struct regmap_config sec_regmap_config = { .val_bits = 8, }; +static struct regmap_config s2mps11_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = S2MPS11_REG_L38CTRL, +}; + +static struct regmap_config s5m8763_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = S5M8763_REG_LBCNFG2, +}; + +static struct regmap_config s5m8767_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + + .max_register = S5M8767_REG_LDO28CTRL, +}; #ifdef CONFIG_OF /* @@ -160,6 +183,7 @@ static int sec_pmic_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct sec_platform_data *pdata = i2c->dev.platform_data; + const struct regmap_config *regmap; struct sec_pmic_dev *sec_pmic; int ret; @@ -190,7 +214,22 @@ static int sec_pmic_probe(struct i2c_client *i2c, sec_pmic->pdata = pdata; } - sec_pmic->regmap = devm_regmap_init_i2c(i2c, &sec_regmap_config); + switch (sec_pmic->device_type) { + case S2MPS11X: + regmap = &s2mps11_regmap_config; + break; + case S5M8763X: + regmap = &s5m8763_regmap_config; + break; + case S5M8767X: + regmap = &s5m8767_regmap_config; + break; + default: + regmap = &sec_regmap_config; + break; + } + + sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); if (IS_ERR(sec_pmic->regmap)) { ret = PTR_ERR(sec_pmic->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |