aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/sec-core.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-02-28 05:41:44 -0500
committerLee Jones <lee.jones@linaro.org>2014-03-18 06:50:09 -0400
commitdc6919663f7a02d02cc08d605a1f68d6cefe0042 (patch)
treef114b7cbbb668615d3aa747421da5da9bb5d00e8 /drivers/mfd/sec-core.c
parent677620952a0fd1b1618bed57c1ebd94bf3c710f3 (diff)
mfd: sec: Add support for S2MPS14
Add support for S2MPS14 PMIC device to the MFD sec-core driver. The S2MPS14 is similar to S2MPS11 but it has fewer regulators, two clocks instead of three and a little different registers layout. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/sec-core.c')
-rw-r--r--drivers/mfd/sec-core.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 9623899e6f7c..a4df76c160f8 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -27,6 +27,7 @@
27#include <linux/mfd/samsung/irq.h> 27#include <linux/mfd/samsung/irq.h>
28#include <linux/mfd/samsung/rtc.h> 28#include <linux/mfd/samsung/rtc.h>
29#include <linux/mfd/samsung/s2mps11.h> 29#include <linux/mfd/samsung/s2mps11.h>
30#include <linux/mfd/samsung/s2mps14.h>
30#include <linux/mfd/samsung/s5m8763.h> 31#include <linux/mfd/samsung/s5m8763.h>
31#include <linux/mfd/samsung/s5m8767.h> 32#include <linux/mfd/samsung/s5m8767.h>
32#include <linux/regmap.h> 33#include <linux/regmap.h>
@@ -69,6 +70,16 @@ static const struct mfd_cell s2mps11_devs[] = {
69 } 70 }
70}; 71};
71 72
73static const struct mfd_cell s2mps14_devs[] = {
74 {
75 .name = "s2mps14-pmic",
76 }, {
77 .name = "s2mps14-rtc",
78 }, {
79 .name = "s2mps14-clk",
80 }
81};
82
72#ifdef CONFIG_OF 83#ifdef CONFIG_OF
73static struct of_device_id sec_dt_match[] = { 84static struct of_device_id sec_dt_match[] = {
74 { .compatible = "samsung,s5m8767-pmic", 85 { .compatible = "samsung,s5m8767-pmic",
@@ -77,6 +88,9 @@ static struct of_device_id sec_dt_match[] = {
77 { .compatible = "samsung,s2mps11-pmic", 88 { .compatible = "samsung,s2mps11-pmic",
78 .data = (void *)S2MPS11X, 89 .data = (void *)S2MPS11X,
79 }, 90 },
91 { .compatible = "samsung,s2mps14-pmic",
92 .data = (void *)S2MPS14X,
93 },
80 {}, 94 {},
81}; 95};
82#endif 96#endif
@@ -120,6 +134,15 @@ static const struct regmap_config s2mps11_regmap_config = {
120 .cache_type = REGCACHE_FLAT, 134 .cache_type = REGCACHE_FLAT,
121}; 135};
122 136
137static const struct regmap_config s2mps14_regmap_config = {
138 .reg_bits = 8,
139 .val_bits = 8,
140
141 .max_register = S2MPS14_REG_LDODSCH3,
142 .volatile_reg = s2mps11_volatile,
143 .cache_type = REGCACHE_FLAT,
144};
145
123static const struct regmap_config s5m8763_regmap_config = { 146static const struct regmap_config s5m8763_regmap_config = {
124 .reg_bits = 8, 147 .reg_bits = 8,
125 .val_bits = 8, 148 .val_bits = 8,
@@ -138,13 +161,20 @@ static const struct regmap_config s5m8767_regmap_config = {
138 .cache_type = REGCACHE_FLAT, 161 .cache_type = REGCACHE_FLAT,
139}; 162};
140 163
141static const struct regmap_config sec_rtc_regmap_config = { 164static const struct regmap_config s5m_rtc_regmap_config = {
142 .reg_bits = 8, 165 .reg_bits = 8,
143 .val_bits = 8, 166 .val_bits = 8,
144 167
145 .max_register = SEC_RTC_REG_MAX, 168 .max_register = SEC_RTC_REG_MAX,
146}; 169};
147 170
171static const struct regmap_config s2mps14_rtc_regmap_config = {
172 .reg_bits = 8,
173 .val_bits = 8,
174
175 .max_register = S2MPS_RTC_REG_MAX,
176};
177
148#ifdef CONFIG_OF 178#ifdef CONFIG_OF
149/* 179/*
150 * Only the common platform data elements for s5m8767 are parsed here from the 180 * Only the common platform data elements for s5m8767 are parsed here from the
@@ -239,19 +269,23 @@ static int sec_pmic_probe(struct i2c_client *i2c,
239 * However we must pass something to devm_regmap_init_i2c() 269 * However we must pass something to devm_regmap_init_i2c()
240 * so use S5M-like regmap config even though it wouldn't work. 270 * so use S5M-like regmap config even though it wouldn't work.
241 */ 271 */
242 regmap_rtc = &sec_rtc_regmap_config; 272 regmap_rtc = &s5m_rtc_regmap_config;
273 break;
274 case S2MPS14X:
275 regmap = &s2mps14_regmap_config;
276 regmap_rtc = &s2mps14_rtc_regmap_config;
243 break; 277 break;
244 case S5M8763X: 278 case S5M8763X:
245 regmap = &s5m8763_regmap_config; 279 regmap = &s5m8763_regmap_config;
246 regmap_rtc = &sec_rtc_regmap_config; 280 regmap_rtc = &s5m_rtc_regmap_config;
247 break; 281 break;
248 case S5M8767X: 282 case S5M8767X:
249 regmap = &s5m8767_regmap_config; 283 regmap = &s5m8767_regmap_config;
250 regmap_rtc = &sec_rtc_regmap_config; 284 regmap_rtc = &s5m_rtc_regmap_config;
251 break; 285 break;
252 default: 286 default:
253 regmap = &sec_regmap_config; 287 regmap = &sec_regmap_config;
254 regmap_rtc = &sec_rtc_regmap_config; 288 regmap_rtc = &s5m_rtc_regmap_config;
255 break; 289 break;
256 } 290 }
257 291
@@ -298,6 +332,10 @@ static int sec_pmic_probe(struct i2c_client *i2c,
298 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs, 332 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps11_devs,
299 ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL); 333 ARRAY_SIZE(s2mps11_devs), NULL, 0, NULL);
300 break; 334 break;
335 case S2MPS14X:
336 ret = mfd_add_devices(sec_pmic->dev, -1, s2mps14_devs,
337 ARRAY_SIZE(s2mps14_devs), NULL, 0, NULL);
338 break;
301 default: 339 default:
302 /* If this happens the probe function is problem */ 340 /* If this happens the probe function is problem */
303 BUG(); 341 BUG();