diff options
author | J Keerthy <j-keerthy@ti.com> | 2013-06-19 01:57:48 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-20 05:29:18 -0400 |
commit | 1ffb0be3ad6186b421921de91092917f0b3ee3e2 (patch) | |
tree | 648c9f7c74880fbfb921a6b95c9e67ce92ae59d9 | |
parent | ad522f4e351d020714959d9570baf3de7fcbad11 (diff) |
mfd: palmas: Add SMPS10_BOOST feature
The SMPS10 regulator is not presesnt in all the variants
of the PALMAS PMIC family. Hence adding a feature to distingush
between them.
Signed-off-by: J Keerthy <j-keerthy@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/palmas.c | 29 | ||||
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 3 | ||||
-rw-r--r-- | include/linux/mfd/palmas.h | 14 |
3 files changed, 38 insertions, 8 deletions
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index b24bee3d00b4..a4e53caa76cd 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/err.h> | 23 | #include <linux/err.h> |
24 | #include <linux/mfd/core.h> | 24 | #include <linux/mfd/core.h> |
25 | #include <linux/mfd/palmas.h> | 25 | #include <linux/mfd/palmas.h> |
26 | #include <linux/of_platform.h> | 26 | #include <linux/of_device.h> |
27 | 27 | ||
28 | static const struct regmap_config palmas_regmap_config[PALMAS_NUM_CLIENTS] = { | 28 | static const struct regmap_config palmas_regmap_config[PALMAS_NUM_CLIENTS] = { |
29 | { | 29 | { |
@@ -231,6 +231,16 @@ static void palmas_dt_to_pdata(struct i2c_client *i2c, | |||
231 | palmas_set_pdata_irq_flag(i2c, pdata); | 231 | palmas_set_pdata_irq_flag(i2c, pdata); |
232 | } | 232 | } |
233 | 233 | ||
234 | static unsigned int palmas_features = PALMAS_PMIC_FEATURE_SMPS10_BOOST; | ||
235 | |||
236 | static const struct of_device_id of_palmas_match_tbl[] = { | ||
237 | { | ||
238 | .compatible = "ti,palmas", | ||
239 | .data = &palmas_features, | ||
240 | }, | ||
241 | { }, | ||
242 | }; | ||
243 | |||
234 | static int palmas_i2c_probe(struct i2c_client *i2c, | 244 | static int palmas_i2c_probe(struct i2c_client *i2c, |
235 | const struct i2c_device_id *id) | 245 | const struct i2c_device_id *id) |
236 | { | 246 | { |
@@ -238,8 +248,9 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
238 | struct palmas_platform_data *pdata; | 248 | struct palmas_platform_data *pdata; |
239 | struct device_node *node = i2c->dev.of_node; | 249 | struct device_node *node = i2c->dev.of_node; |
240 | int ret = 0, i; | 250 | int ret = 0, i; |
241 | unsigned int reg, addr; | 251 | unsigned int reg, addr, *features; |
242 | int slave; | 252 | int slave; |
253 | const struct of_device_id *match; | ||
243 | 254 | ||
244 | pdata = dev_get_platdata(&i2c->dev); | 255 | pdata = dev_get_platdata(&i2c->dev); |
245 | 256 | ||
@@ -261,9 +272,16 @@ static int palmas_i2c_probe(struct i2c_client *i2c, | |||
261 | 272 | ||
262 | i2c_set_clientdata(i2c, palmas); | 273 | i2c_set_clientdata(i2c, palmas); |
263 | palmas->dev = &i2c->dev; | 274 | palmas->dev = &i2c->dev; |
264 | palmas->id = id->driver_data; | ||
265 | palmas->irq = i2c->irq; | 275 | palmas->irq = i2c->irq; |
266 | 276 | ||
277 | match = of_match_device(of_match_ptr(of_palmas_match_tbl), &i2c->dev); | ||
278 | |||
279 | if (!match) | ||
280 | return -ENODATA; | ||
281 | |||
282 | features = (unsigned int *)match->data; | ||
283 | palmas->features = *features; | ||
284 | |||
267 | for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { | 285 | for (i = 0; i < PALMAS_NUM_CLIENTS; i++) { |
268 | if (i == 0) | 286 | if (i == 0) |
269 | palmas->i2c_clients[i] = i2c; | 287 | palmas->i2c_clients[i] = i2c; |
@@ -433,11 +451,6 @@ static const struct i2c_device_id palmas_i2c_id[] = { | |||
433 | }; | 451 | }; |
434 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); | 452 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); |
435 | 453 | ||
436 | static struct of_device_id of_palmas_match_tbl[] = { | ||
437 | { .compatible = "ti,palmas", }, | ||
438 | { /* end */ } | ||
439 | }; | ||
440 | |||
441 | static struct i2c_driver palmas_i2c_driver = { | 454 | static struct i2c_driver palmas_i2c_driver = { |
442 | .driver = { | 455 | .driver = { |
443 | .name = "palmas", | 456 | .name = "palmas", |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 3ae44ac12a94..1ae1e83448cf 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -838,6 +838,9 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
838 | continue; | 838 | continue; |
839 | ramp_delay_support = true; | 839 | ramp_delay_support = true; |
840 | break; | 840 | break; |
841 | case PALMAS_REG_SMPS10: | ||
842 | if (!PALMAS_PMIC_HAS(palmas, SMPS10_BOOST)) | ||
843 | continue; | ||
841 | } | 844 | } |
842 | 845 | ||
843 | if ((id == PALMAS_REG_SMPS6) || (id == PALMAS_REG_SMPS8)) | 846 | if ((id == PALMAS_REG_SMPS6) || (id == PALMAS_REG_SMPS8)) |
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 8f21daf62fb5..98058caa7aca 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
@@ -32,6 +32,19 @@ | |||
32 | ((a) == PALMAS_CHIP_ID)) | 32 | ((a) == PALMAS_CHIP_ID)) |
33 | #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) | 33 | #define is_palmas_charger(a) ((a) == PALMAS_CHIP_CHARGER_ID) |
34 | 34 | ||
35 | /** | ||
36 | * Palmas PMIC feature types | ||
37 | * | ||
38 | * PALMAS_PMIC_FEATURE_SMPS10_BOOST - used when the PMIC provides SMPS10_BOOST | ||
39 | * regulator. | ||
40 | * | ||
41 | * PALMAS_PMIC_HAS(b, f) - macro to check if a bandgap device is capable of a | ||
42 | * specific feature (above) or not. Return non-zero, if yes. | ||
43 | */ | ||
44 | #define PALMAS_PMIC_FEATURE_SMPS10_BOOST BIT(0) | ||
45 | #define PALMAS_PMIC_HAS(b, f) \ | ||
46 | ((b)->features & PALMAS_PMIC_FEATURE_ ## f) | ||
47 | |||
35 | struct palmas_pmic; | 48 | struct palmas_pmic; |
36 | struct palmas_gpadc; | 49 | struct palmas_gpadc; |
37 | struct palmas_resource; | 50 | struct palmas_resource; |
@@ -46,6 +59,7 @@ struct palmas { | |||
46 | /* Stored chip id */ | 59 | /* Stored chip id */ |
47 | int id; | 60 | int id; |
48 | 61 | ||
62 | unsigned int features; | ||
49 | /* IRQ Data */ | 63 | /* IRQ Data */ |
50 | int irq; | 64 | int irq; |
51 | u32 irq_mask; | 65 | u32 irq_mask; |