diff options
| author | Mark Brown <broonie@linaro.org> | 2013-07-01 18:02:19 -0400 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-07-01 18:54:39 -0400 |
| commit | 25f311fa58c18c19ae1348336265ccb8368638f0 (patch) | |
| tree | 7667a9d5295123108147a2b4f789de69c2b7d4c0 | |
| 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>
| -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 @@ | |||
| 25 | #include <linux/mfd/samsung/core.h> | 25 | #include <linux/mfd/samsung/core.h> |
| 26 | #include <linux/mfd/samsung/irq.h> | 26 | #include <linux/mfd/samsung/irq.h> |
| 27 | #include <linux/mfd/samsung/rtc.h> | 27 | #include <linux/mfd/samsung/rtc.h> |
| 28 | #include <linux/mfd/samsung/s2mps11.h> | ||
| 29 | #include <linux/mfd/samsung/s5m8763.h> | ||
| 30 | #include <linux/mfd/samsung/s5m8767.h> | ||
| 28 | #include <linux/regmap.h> | 31 | #include <linux/regmap.h> |
| 29 | 32 | ||
| 30 | static struct mfd_cell s5m8751_devs[] = { | 33 | static struct mfd_cell s5m8751_devs[] = { |
| @@ -105,6 +108,26 @@ static struct regmap_config sec_regmap_config = { | |||
| 105 | .val_bits = 8, | 108 | .val_bits = 8, |
| 106 | }; | 109 | }; |
| 107 | 110 | ||
| 111 | static struct regmap_config s2mps11_regmap_config = { | ||
| 112 | .reg_bits = 8, | ||
| 113 | .val_bits = 8, | ||
| 114 | |||
| 115 | .max_register = S2MPS11_REG_L38CTRL, | ||
| 116 | }; | ||
| 117 | |||
| 118 | static struct regmap_config s5m8763_regmap_config = { | ||
| 119 | .reg_bits = 8, | ||
| 120 | .val_bits = 8, | ||
| 121 | |||
| 122 | .max_register = S5M8763_REG_LBCNFG2, | ||
| 123 | }; | ||
| 124 | |||
| 125 | static struct regmap_config s5m8767_regmap_config = { | ||
| 126 | .reg_bits = 8, | ||
| 127 | .val_bits = 8, | ||
| 128 | |||
| 129 | .max_register = S5M8767_REG_LDO28CTRL, | ||
| 130 | }; | ||
| 108 | 131 | ||
| 109 | #ifdef CONFIG_OF | 132 | #ifdef CONFIG_OF |
| 110 | /* | 133 | /* |
| @@ -160,6 +183,7 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
| 160 | const struct i2c_device_id *id) | 183 | const struct i2c_device_id *id) |
| 161 | { | 184 | { |
| 162 | struct sec_platform_data *pdata = i2c->dev.platform_data; | 185 | struct sec_platform_data *pdata = i2c->dev.platform_data; |
| 186 | const struct regmap_config *regmap; | ||
| 163 | struct sec_pmic_dev *sec_pmic; | 187 | struct sec_pmic_dev *sec_pmic; |
| 164 | int ret; | 188 | int ret; |
| 165 | 189 | ||
| @@ -190,7 +214,22 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
| 190 | sec_pmic->pdata = pdata; | 214 | sec_pmic->pdata = pdata; |
| 191 | } | 215 | } |
| 192 | 216 | ||
| 193 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, &sec_regmap_config); | 217 | switch (sec_pmic->device_type) { |
| 218 | case S2MPS11X: | ||
| 219 | regmap = &s2mps11_regmap_config; | ||
| 220 | break; | ||
| 221 | case S5M8763X: | ||
| 222 | regmap = &s5m8763_regmap_config; | ||
| 223 | break; | ||
| 224 | case S5M8767X: | ||
| 225 | regmap = &s5m8767_regmap_config; | ||
| 226 | break; | ||
| 227 | default: | ||
| 228 | regmap = &sec_regmap_config; | ||
| 229 | break; | ||
| 230 | } | ||
| 231 | |||
| 232 | sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); | ||
| 194 | if (IS_ERR(sec_pmic->regmap)) { | 233 | if (IS_ERR(sec_pmic->regmap)) { |
| 195 | ret = PTR_ERR(sec_pmic->regmap); | 234 | ret = PTR_ERR(sec_pmic->regmap); |
| 196 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 235 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
