aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/s2mps11.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2014-11-18 03:59:40 -0500
committerLee Jones <lee.jones@linaro.org>2014-11-25 10:55:06 -0500
commit76b9840b24ae049b39f1b3cf0e49f21b7c41748f (patch)
tree0148131e1e95707d9fe6a9ca35572802e40273af /drivers/regulator/s2mps11.c
parent3bc2ee91a470c52fb3979c23c12d43283455f10d (diff)
regulator: s2mps11: Add support S2MPS13 regulator device
This patch adds S2MPS13 regulator device to existing S2MPS11 device driver. The S2MPS13 has just different number of regulators from S2MPS14. The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10]. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/regulator/s2mps11.c')
-rw-r--r--drivers/regulator/s2mps11.c102
1 files changed, 99 insertions, 3 deletions
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index adab82d5279f..738dc7763d47 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -30,6 +30,7 @@
30#include <linux/of_gpio.h> 30#include <linux/of_gpio.h>
31#include <linux/mfd/samsung/core.h> 31#include <linux/mfd/samsung/core.h>
32#include <linux/mfd/samsung/s2mps11.h> 32#include <linux/mfd/samsung/s2mps11.h>
33#include <linux/mfd/samsung/s2mps13.h>
33#include <linux/mfd/samsung/s2mps14.h> 34#include <linux/mfd/samsung/s2mps14.h>
34#include <linux/mfd/samsung/s2mpu02.h> 35#include <linux/mfd/samsung/s2mpu02.h>
35 36
@@ -45,10 +46,10 @@ struct s2mps11_info {
45 enum sec_device_type dev_type; 46 enum sec_device_type dev_type;
46 47
47 /* 48 /*
48 * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode 49 * One bit for each S2MPS13/S2MPS14/S2MPU02 regulator whether
49 * was enabled. 50 * the suspend mode was enabled.
50 */ 51 */
51 unsigned long long s2mps14_suspend_state:35; 52 unsigned long long s2mps14_suspend_state:50;
52 53
53 /* Array of size rdev_num with GPIO-s for external sleep control */ 54 /* Array of size rdev_num with GPIO-s for external sleep control */
54 int *ext_control_gpio; 55 int *ext_control_gpio;
@@ -369,12 +370,101 @@ static const struct regulator_desc s2mps11_regulators[] = {
369 regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV), 370 regulator_desc_s2mps11_buck6_10(10, MIN_750_MV, STEP_12_5_MV),
370}; 371};
371 372
373static struct regulator_ops s2mps14_reg_ops;
374
375#define regulator_desc_s2mps13_ldo(num, min, step, min_sel) { \
376 .name = "LDO"#num, \
377 .id = S2MPS13_LDO##num, \
378 .ops = &s2mps14_reg_ops, \
379 .type = REGULATOR_VOLTAGE, \
380 .owner = THIS_MODULE, \
381 .min_uV = min, \
382 .uV_step = step, \
383 .linear_min_sel = min_sel, \
384 .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
385 .vsel_reg = S2MPS13_REG_L1CTRL + num - 1, \
386 .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
387 .enable_reg = S2MPS13_REG_L1CTRL + num - 1, \
388 .enable_mask = S2MPS14_ENABLE_MASK \
389}
390
391#define regulator_desc_s2mps13_buck(num, min, step, min_sel) { \
392 .name = "BUCK"#num, \
393 .id = S2MPS13_BUCK##num, \
394 .ops = &s2mps14_reg_ops, \
395 .type = REGULATOR_VOLTAGE, \
396 .owner = THIS_MODULE, \
397 .min_uV = min, \
398 .uV_step = step, \
399 .linear_min_sel = min_sel, \
400 .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
401 .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
402 .vsel_reg = S2MPS13_REG_B1OUT + (num - 1) * 2, \
403 .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
404 .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
405 .enable_mask = S2MPS14_ENABLE_MASK \
406}
407
408static const struct regulator_desc s2mps13_regulators[] = {
409 regulator_desc_s2mps13_ldo(1, MIN_800_MV, STEP_12_5_MV, 0x00),
410 regulator_desc_s2mps13_ldo(2, MIN_1400_MV, STEP_50_MV, 0x0C),
411 regulator_desc_s2mps13_ldo(3, MIN_1000_MV, STEP_25_MV, 0x08),
412 regulator_desc_s2mps13_ldo(4, MIN_800_MV, STEP_12_5_MV, 0x00),
413 regulator_desc_s2mps13_ldo(5, MIN_800_MV, STEP_12_5_MV, 0x00),
414 regulator_desc_s2mps13_ldo(6, MIN_800_MV, STEP_12_5_MV, 0x00),
415 regulator_desc_s2mps13_ldo(7, MIN_1000_MV, STEP_25_MV, 0x08),
416 regulator_desc_s2mps13_ldo(8, MIN_1000_MV, STEP_25_MV, 0x08),
417 regulator_desc_s2mps13_ldo(9, MIN_1000_MV, STEP_25_MV, 0x08),
418 regulator_desc_s2mps13_ldo(10, MIN_1400_MV, STEP_50_MV, 0x0C),
419 regulator_desc_s2mps13_ldo(11, MIN_800_MV, STEP_25_MV, 0x10),
420 regulator_desc_s2mps13_ldo(12, MIN_800_MV, STEP_25_MV, 0x10),
421 regulator_desc_s2mps13_ldo(13, MIN_800_MV, STEP_25_MV, 0x10),
422 regulator_desc_s2mps13_ldo(14, MIN_800_MV, STEP_12_5_MV, 0x00),
423 regulator_desc_s2mps13_ldo(15, MIN_800_MV, STEP_12_5_MV, 0x00),
424 regulator_desc_s2mps13_ldo(16, MIN_1400_MV, STEP_50_MV, 0x0C),
425 regulator_desc_s2mps13_ldo(17, MIN_1400_MV, STEP_50_MV, 0x0C),
426 regulator_desc_s2mps13_ldo(18, MIN_1000_MV, STEP_25_MV, 0x08),
427 regulator_desc_s2mps13_ldo(19, MIN_1000_MV, STEP_25_MV, 0x08),
428 regulator_desc_s2mps13_ldo(20, MIN_1400_MV, STEP_50_MV, 0x0C),
429 regulator_desc_s2mps13_ldo(21, MIN_1000_MV, STEP_25_MV, 0x08),
430 regulator_desc_s2mps13_ldo(22, MIN_1000_MV, STEP_25_MV, 0x08),
431 regulator_desc_s2mps13_ldo(23, MIN_800_MV, STEP_12_5_MV, 0x00),
432 regulator_desc_s2mps13_ldo(24, MIN_800_MV, STEP_12_5_MV, 0x00),
433 regulator_desc_s2mps13_ldo(25, MIN_1400_MV, STEP_50_MV, 0x0C),
434 regulator_desc_s2mps13_ldo(26, MIN_1400_MV, STEP_50_MV, 0x0C),
435 regulator_desc_s2mps13_ldo(27, MIN_1400_MV, STEP_50_MV, 0x0C),
436 regulator_desc_s2mps13_ldo(28, MIN_1000_MV, STEP_25_MV, 0x08),
437 regulator_desc_s2mps13_ldo(29, MIN_1400_MV, STEP_50_MV, 0x0C),
438 regulator_desc_s2mps13_ldo(30, MIN_1400_MV, STEP_50_MV, 0x0C),
439 regulator_desc_s2mps13_ldo(31, MIN_1000_MV, STEP_25_MV, 0x08),
440 regulator_desc_s2mps13_ldo(32, MIN_1000_MV, STEP_25_MV, 0x08),
441 regulator_desc_s2mps13_ldo(33, MIN_1400_MV, STEP_50_MV, 0x0C),
442 regulator_desc_s2mps13_ldo(34, MIN_1000_MV, STEP_25_MV, 0x08),
443 regulator_desc_s2mps13_ldo(35, MIN_1400_MV, STEP_50_MV, 0x0C),
444 regulator_desc_s2mps13_ldo(36, MIN_800_MV, STEP_12_5_MV, 0x00),
445 regulator_desc_s2mps13_ldo(37, MIN_1000_MV, STEP_25_MV, 0x08),
446 regulator_desc_s2mps13_ldo(38, MIN_1400_MV, STEP_50_MV, 0x0C),
447 regulator_desc_s2mps13_ldo(39, MIN_1000_MV, STEP_25_MV, 0x08),
448 regulator_desc_s2mps13_ldo(40, MIN_1400_MV, STEP_50_MV, 0x0C),
449 regulator_desc_s2mps13_buck(1, MIN_500_MV, STEP_6_25_MV, 0x10),
450 regulator_desc_s2mps13_buck(2, MIN_500_MV, STEP_6_25_MV, 0x10),
451 regulator_desc_s2mps13_buck(3, MIN_500_MV, STEP_6_25_MV, 0x10),
452 regulator_desc_s2mps13_buck(4, MIN_500_MV, STEP_6_25_MV, 0x10),
453 regulator_desc_s2mps13_buck(5, MIN_500_MV, STEP_6_25_MV, 0x10),
454 regulator_desc_s2mps13_buck(6, MIN_500_MV, STEP_6_25_MV, 0x10),
455 regulator_desc_s2mps13_buck(7, MIN_500_MV, STEP_6_25_MV, 0x10),
456 regulator_desc_s2mps13_buck(8, MIN_1000_MV, STEP_12_5_MV, 0x20),
457 regulator_desc_s2mps13_buck(9, MIN_1000_MV, STEP_12_5_MV, 0x20),
458 regulator_desc_s2mps13_buck(10, MIN_500_MV, STEP_6_25_MV, 0x10),
459};
460
372static int s2mps14_regulator_enable(struct regulator_dev *rdev) 461static int s2mps14_regulator_enable(struct regulator_dev *rdev)
373{ 462{
374 struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); 463 struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
375 unsigned int val; 464 unsigned int val;
376 465
377 switch (s2mps11->dev_type) { 466 switch (s2mps11->dev_type) {
467 case S2MPS13X:
378 case S2MPS14X: 468 case S2MPS14X:
379 if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) 469 if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev)))
380 val = S2MPS14_ENABLE_SUSPEND; 470 val = S2MPS14_ENABLE_SUSPEND;
@@ -406,6 +496,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
406 496
407 /* Below LDO should be always on or does not support suspend mode. */ 497 /* Below LDO should be always on or does not support suspend mode. */
408 switch (s2mps11->dev_type) { 498 switch (s2mps11->dev_type) {
499 case S2MPS13X:
409 case S2MPS14X: 500 case S2MPS14X:
410 switch (rdev_id) { 501 switch (rdev_id) {
411 case S2MPS14_LDO3: 502 case S2MPS14_LDO3:
@@ -831,6 +922,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
831 s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); 922 s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
832 regulators = s2mps11_regulators; 923 regulators = s2mps11_regulators;
833 break; 924 break;
925 case S2MPS13X:
926 s2mps11->rdev_num = ARRAY_SIZE(s2mps13_regulators);
927 regulators = s2mps13_regulators;
928 break;
834 case S2MPS14X: 929 case S2MPS14X:
835 s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); 930 s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
836 regulators = s2mps14_regulators; 931 regulators = s2mps14_regulators;
@@ -927,6 +1022,7 @@ out:
927 1022
928static const struct platform_device_id s2mps11_pmic_id[] = { 1023static const struct platform_device_id s2mps11_pmic_id[] = {
929 { "s2mps11-pmic", S2MPS11X}, 1024 { "s2mps11-pmic", S2MPS11X},
1025 { "s2mps13-pmic", S2MPS13X},
930 { "s2mps14-pmic", S2MPS14X}, 1026 { "s2mps14-pmic", S2MPS14X},
931 { "s2mpu02-pmic", S2MPU02}, 1027 { "s2mpu02-pmic", S2MPU02},
932 { }, 1028 { },