diff options
author | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-01-11 14:19:40 -0500 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-01-11 14:19:40 -0500 |
commit | c60faa3afad0e926e63a39894489b64e9a8165df (patch) | |
tree | d170dd472ae265d0572daadb5669d7b3bb514e64 | |
parent | afd2ff9b7e1b367172f18ba7f693dfb62bdcb2dc (diff) | |
parent | a65e5efa7c5faa8c320fe56cc351d47fcd006749 (diff) |
Merge tag 'ib-mfd-regulator-rtc-v4.5' into rtc-next
Immutable branch between MFD, Regulator and RTC for the v4.5 merge window
-rw-r--r-- | drivers/mfd/sec-core.c | 31 | ||||
-rw-r--r-- | drivers/mfd/sec-irq.c | 8 | ||||
-rw-r--r-- | drivers/regulator/Kconfig | 4 | ||||
-rw-r--r-- | drivers/regulator/s2mps11.c | 135 | ||||
-rw-r--r-- | drivers/rtc/rtc-s5m.c | 37 | ||||
-rw-r--r-- | include/linux/mfd/samsung/core.h | 1 | ||||
-rw-r--r-- | include/linux/mfd/samsung/rtc.h | 2 | ||||
-rw-r--r-- | include/linux/mfd/samsung/s2mps15.h | 158 |
8 files changed, 369 insertions, 7 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 989076d6cb83..7c4e7be17f1e 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/mfd/samsung/s2mps11.h> | 29 | #include <linux/mfd/samsung/s2mps11.h> |
30 | #include <linux/mfd/samsung/s2mps13.h> | 30 | #include <linux/mfd/samsung/s2mps13.h> |
31 | #include <linux/mfd/samsung/s2mps14.h> | 31 | #include <linux/mfd/samsung/s2mps14.h> |
32 | #include <linux/mfd/samsung/s2mps15.h> | ||
32 | #include <linux/mfd/samsung/s2mpu02.h> | 33 | #include <linux/mfd/samsung/s2mpu02.h> |
33 | #include <linux/mfd/samsung/s5m8763.h> | 34 | #include <linux/mfd/samsung/s5m8763.h> |
34 | #include <linux/mfd/samsung/s5m8767.h> | 35 | #include <linux/mfd/samsung/s5m8767.h> |
@@ -96,6 +97,17 @@ static const struct mfd_cell s2mps14_devs[] = { | |||
96 | } | 97 | } |
97 | }; | 98 | }; |
98 | 99 | ||
100 | static const struct mfd_cell s2mps15_devs[] = { | ||
101 | { | ||
102 | .name = "s2mps15-regulator", | ||
103 | }, { | ||
104 | .name = "s2mps15-rtc", | ||
105 | }, { | ||
106 | .name = "s2mps13-clk", | ||
107 | .of_compatible = "samsung,s2mps13-clk", | ||
108 | }, | ||
109 | }; | ||
110 | |||
99 | static const struct mfd_cell s2mpa01_devs[] = { | 111 | static const struct mfd_cell s2mpa01_devs[] = { |
100 | { | 112 | { |
101 | .name = "s2mpa01-pmic", | 113 | .name = "s2mpa01-pmic", |
@@ -122,6 +134,9 @@ static const struct of_device_id sec_dt_match[] = { | |||
122 | .compatible = "samsung,s2mps14-pmic", | 134 | .compatible = "samsung,s2mps14-pmic", |
123 | .data = (void *)S2MPS14X, | 135 | .data = (void *)S2MPS14X, |
124 | }, { | 136 | }, { |
137 | .compatible = "samsung,s2mps15-pmic", | ||
138 | .data = (void *)S2MPS15X, | ||
139 | }, { | ||
125 | .compatible = "samsung,s2mpa01-pmic", | 140 | .compatible = "samsung,s2mpa01-pmic", |
126 | .data = (void *)S2MPA01, | 141 | .data = (void *)S2MPA01, |
127 | }, { | 142 | }, { |
@@ -223,6 +238,15 @@ static const struct regmap_config s2mps14_regmap_config = { | |||
223 | .cache_type = REGCACHE_FLAT, | 238 | .cache_type = REGCACHE_FLAT, |
224 | }; | 239 | }; |
225 | 240 | ||
241 | static const struct regmap_config s2mps15_regmap_config = { | ||
242 | .reg_bits = 8, | ||
243 | .val_bits = 8, | ||
244 | |||
245 | .max_register = S2MPS15_REG_LDODSCH4, | ||
246 | .volatile_reg = s2mps11_volatile, | ||
247 | .cache_type = REGCACHE_FLAT, | ||
248 | }; | ||
249 | |||
226 | static const struct regmap_config s2mpu02_regmap_config = { | 250 | static const struct regmap_config s2mpu02_regmap_config = { |
227 | .reg_bits = 8, | 251 | .reg_bits = 8, |
228 | .val_bits = 8, | 252 | .val_bits = 8, |
@@ -384,6 +408,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
384 | case S2MPS14X: | 408 | case S2MPS14X: |
385 | regmap = &s2mps14_regmap_config; | 409 | regmap = &s2mps14_regmap_config; |
386 | break; | 410 | break; |
411 | case S2MPS15X: | ||
412 | regmap = &s2mps15_regmap_config; | ||
413 | break; | ||
387 | case S5M8763X: | 414 | case S5M8763X: |
388 | regmap = &s5m8763_regmap_config; | 415 | regmap = &s5m8763_regmap_config; |
389 | break; | 416 | break; |
@@ -442,6 +469,10 @@ static int sec_pmic_probe(struct i2c_client *i2c, | |||
442 | sec_devs = s2mps14_devs; | 469 | sec_devs = s2mps14_devs; |
443 | num_sec_devs = ARRAY_SIZE(s2mps14_devs); | 470 | num_sec_devs = ARRAY_SIZE(s2mps14_devs); |
444 | break; | 471 | break; |
472 | case S2MPS15X: | ||
473 | sec_devs = s2mps15_devs; | ||
474 | num_sec_devs = ARRAY_SIZE(s2mps15_devs); | ||
475 | break; | ||
445 | case S2MPU02: | 476 | case S2MPU02: |
446 | sec_devs = s2mpu02_devs; | 477 | sec_devs = s2mpu02_devs; |
447 | num_sec_devs = ARRAY_SIZE(s2mpu02_devs); | 478 | num_sec_devs = ARRAY_SIZE(s2mpu02_devs); |
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 806fa8dbb22d..d77de431cc50 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c | |||
@@ -407,6 +407,11 @@ static const struct regmap_irq_chip s2mps14_irq_chip = { | |||
407 | S2MPS1X_IRQ_CHIP_COMMON_DATA, | 407 | S2MPS1X_IRQ_CHIP_COMMON_DATA, |
408 | }; | 408 | }; |
409 | 409 | ||
410 | static const struct regmap_irq_chip s2mps15_irq_chip = { | ||
411 | .name = "s2mps15", | ||
412 | S2MPS1X_IRQ_CHIP_COMMON_DATA, | ||
413 | }; | ||
414 | |||
410 | static const struct regmap_irq_chip s2mpu02_irq_chip = { | 415 | static const struct regmap_irq_chip s2mpu02_irq_chip = { |
411 | .name = "s2mpu02", | 416 | .name = "s2mpu02", |
412 | .irqs = s2mpu02_irqs, | 417 | .irqs = s2mpu02_irqs, |
@@ -466,6 +471,9 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) | |||
466 | case S2MPS14X: | 471 | case S2MPS14X: |
467 | sec_irq_chip = &s2mps14_irq_chip; | 472 | sec_irq_chip = &s2mps14_irq_chip; |
468 | break; | 473 | break; |
474 | case S2MPS15X: | ||
475 | sec_irq_chip = &s2mps15_irq_chip; | ||
476 | break; | ||
469 | case S2MPU02: | 477 | case S2MPU02: |
470 | sec_irq_chip = &s2mpu02_irq_chip; | 478 | sec_irq_chip = &s2mpu02_irq_chip; |
471 | break; | 479 | break; |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 8df0b0e62976..2805b014ae31 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -588,10 +588,10 @@ config REGULATOR_S2MPA01 | |||
588 | via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs. | 588 | via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs. |
589 | 589 | ||
590 | config REGULATOR_S2MPS11 | 590 | config REGULATOR_S2MPS11 |
591 | tristate "Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage regulator" | 591 | tristate "Samsung S2MPS11/13/14/15/S2MPU02 voltage regulator" |
592 | depends on MFD_SEC_CORE | 592 | depends on MFD_SEC_CORE |
593 | help | 593 | help |
594 | This driver supports a Samsung S2MPS11/S2MPS13/S2MPS14/S2MPU02 voltage | 594 | This driver supports a Samsung S2MPS11/13/14/15/S2MPU02 voltage |
595 | output regulator via I2C bus. The chip is comprised of high efficient | 595 | output regulator via I2C bus. The chip is comprised of high efficient |
596 | Buck converters including Dual-Phase Buck converter, Buck-Boost | 596 | Buck converters including Dual-Phase Buck converter, Buck-Boost |
597 | converter, various LDOs. | 597 | converter, various LDOs. |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 72fc3c32db49..b2f3a28e720c 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -32,6 +32,7 @@ | |||
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/s2mps13.h> |
34 | #include <linux/mfd/samsung/s2mps14.h> | 34 | #include <linux/mfd/samsung/s2mps14.h> |
35 | #include <linux/mfd/samsung/s2mps15.h> | ||
35 | #include <linux/mfd/samsung/s2mpu02.h> | 36 | #include <linux/mfd/samsung/s2mpu02.h> |
36 | 37 | ||
37 | /* The highest number of possible regulators for supported devices. */ | 38 | /* The highest number of possible regulators for supported devices. */ |
@@ -661,6 +662,133 @@ static const struct regulator_desc s2mps14_regulators[] = { | |||
661 | S2MPS14_BUCK1235_START_SEL), | 662 | S2MPS14_BUCK1235_START_SEL), |
662 | }; | 663 | }; |
663 | 664 | ||
665 | static struct regulator_ops s2mps15_reg_ldo_ops = { | ||
666 | .list_voltage = regulator_list_voltage_linear_range, | ||
667 | .map_voltage = regulator_map_voltage_linear_range, | ||
668 | .is_enabled = regulator_is_enabled_regmap, | ||
669 | .enable = regulator_enable_regmap, | ||
670 | .disable = regulator_disable_regmap, | ||
671 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
672 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
673 | }; | ||
674 | |||
675 | static struct regulator_ops s2mps15_reg_buck_ops = { | ||
676 | .list_voltage = regulator_list_voltage_linear_range, | ||
677 | .map_voltage = regulator_map_voltage_linear_range, | ||
678 | .is_enabled = regulator_is_enabled_regmap, | ||
679 | .enable = regulator_enable_regmap, | ||
680 | .disable = regulator_disable_regmap, | ||
681 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
682 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
683 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
684 | }; | ||
685 | |||
686 | #define regulator_desc_s2mps15_ldo(num, range) { \ | ||
687 | .name = "LDO"#num, \ | ||
688 | .id = S2MPS15_LDO##num, \ | ||
689 | .ops = &s2mps15_reg_ldo_ops, \ | ||
690 | .type = REGULATOR_VOLTAGE, \ | ||
691 | .owner = THIS_MODULE, \ | ||
692 | .linear_ranges = range, \ | ||
693 | .n_linear_ranges = ARRAY_SIZE(range), \ | ||
694 | .n_voltages = S2MPS15_LDO_N_VOLTAGES, \ | ||
695 | .vsel_reg = S2MPS15_REG_L1CTRL + num - 1, \ | ||
696 | .vsel_mask = S2MPS15_LDO_VSEL_MASK, \ | ||
697 | .enable_reg = S2MPS15_REG_L1CTRL + num - 1, \ | ||
698 | .enable_mask = S2MPS15_ENABLE_MASK \ | ||
699 | } | ||
700 | |||
701 | #define regulator_desc_s2mps15_buck(num, range) { \ | ||
702 | .name = "BUCK"#num, \ | ||
703 | .id = S2MPS15_BUCK##num, \ | ||
704 | .ops = &s2mps15_reg_buck_ops, \ | ||
705 | .type = REGULATOR_VOLTAGE, \ | ||
706 | .owner = THIS_MODULE, \ | ||
707 | .linear_ranges = range, \ | ||
708 | .n_linear_ranges = ARRAY_SIZE(range), \ | ||
709 | .ramp_delay = 12500, \ | ||
710 | .n_voltages = S2MPS15_BUCK_N_VOLTAGES, \ | ||
711 | .vsel_reg = S2MPS15_REG_B1CTRL2 + ((num - 1) * 2), \ | ||
712 | .vsel_mask = S2MPS15_BUCK_VSEL_MASK, \ | ||
713 | .enable_reg = S2MPS15_REG_B1CTRL1 + ((num - 1) * 2), \ | ||
714 | .enable_mask = S2MPS15_ENABLE_MASK \ | ||
715 | } | ||
716 | |||
717 | /* voltage range for s2mps15 LDO 3, 5, 15, 16, 18, 20, 23 and 27 */ | ||
718 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges1[] = { | ||
719 | REGULATOR_LINEAR_RANGE(1000000, 0xc, 0x38, 25000), | ||
720 | }; | ||
721 | |||
722 | /* voltage range for s2mps15 LDO 2, 6, 14, 17, 19, 21, 24 and 25 */ | ||
723 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges2[] = { | ||
724 | REGULATOR_LINEAR_RANGE(1800000, 0x0, 0x3f, 25000), | ||
725 | }; | ||
726 | |||
727 | /* voltage range for s2mps15 LDO 4, 11, 12, 13, 22 and 26 */ | ||
728 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges3[] = { | ||
729 | REGULATOR_LINEAR_RANGE(700000, 0x0, 0x34, 12500), | ||
730 | }; | ||
731 | |||
732 | /* voltage range for s2mps15 LDO 7, 8, 9 and 10 */ | ||
733 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges4[] = { | ||
734 | REGULATOR_LINEAR_RANGE(700000, 0xc, 0x18, 25000), | ||
735 | }; | ||
736 | |||
737 | /* voltage range for s2mps15 LDO 1 */ | ||
738 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges5[] = { | ||
739 | REGULATOR_LINEAR_RANGE(500000, 0x0, 0x20, 12500), | ||
740 | }; | ||
741 | |||
742 | /* voltage range for s2mps15 BUCK 1, 2, 3, 4, 5, 6 and 7 */ | ||
743 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges1[] = { | ||
744 | REGULATOR_LINEAR_RANGE(500000, 0x20, 0xb0, 6250), | ||
745 | }; | ||
746 | |||
747 | /* voltage range for s2mps15 BUCK 8, 9 and 10 */ | ||
748 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges2[] = { | ||
749 | REGULATOR_LINEAR_RANGE(1000000, 0x20, 0xc0, 12500), | ||
750 | }; | ||
751 | |||
752 | static const struct regulator_desc s2mps15_regulators[] = { | ||
753 | regulator_desc_s2mps15_ldo(1, s2mps15_ldo_voltage_ranges5), | ||
754 | regulator_desc_s2mps15_ldo(2, s2mps15_ldo_voltage_ranges2), | ||
755 | regulator_desc_s2mps15_ldo(3, s2mps15_ldo_voltage_ranges1), | ||
756 | regulator_desc_s2mps15_ldo(4, s2mps15_ldo_voltage_ranges3), | ||
757 | regulator_desc_s2mps15_ldo(5, s2mps15_ldo_voltage_ranges1), | ||
758 | regulator_desc_s2mps15_ldo(6, s2mps15_ldo_voltage_ranges2), | ||
759 | regulator_desc_s2mps15_ldo(7, s2mps15_ldo_voltage_ranges4), | ||
760 | regulator_desc_s2mps15_ldo(8, s2mps15_ldo_voltage_ranges4), | ||
761 | regulator_desc_s2mps15_ldo(9, s2mps15_ldo_voltage_ranges4), | ||
762 | regulator_desc_s2mps15_ldo(10, s2mps15_ldo_voltage_ranges4), | ||
763 | regulator_desc_s2mps15_ldo(11, s2mps15_ldo_voltage_ranges3), | ||
764 | regulator_desc_s2mps15_ldo(12, s2mps15_ldo_voltage_ranges3), | ||
765 | regulator_desc_s2mps15_ldo(13, s2mps15_ldo_voltage_ranges3), | ||
766 | regulator_desc_s2mps15_ldo(14, s2mps15_ldo_voltage_ranges2), | ||
767 | regulator_desc_s2mps15_ldo(15, s2mps15_ldo_voltage_ranges1), | ||
768 | regulator_desc_s2mps15_ldo(16, s2mps15_ldo_voltage_ranges1), | ||
769 | regulator_desc_s2mps15_ldo(17, s2mps15_ldo_voltage_ranges2), | ||
770 | regulator_desc_s2mps15_ldo(18, s2mps15_ldo_voltage_ranges1), | ||
771 | regulator_desc_s2mps15_ldo(19, s2mps15_ldo_voltage_ranges2), | ||
772 | regulator_desc_s2mps15_ldo(20, s2mps15_ldo_voltage_ranges1), | ||
773 | regulator_desc_s2mps15_ldo(21, s2mps15_ldo_voltage_ranges2), | ||
774 | regulator_desc_s2mps15_ldo(22, s2mps15_ldo_voltage_ranges3), | ||
775 | regulator_desc_s2mps15_ldo(23, s2mps15_ldo_voltage_ranges1), | ||
776 | regulator_desc_s2mps15_ldo(24, s2mps15_ldo_voltage_ranges2), | ||
777 | regulator_desc_s2mps15_ldo(25, s2mps15_ldo_voltage_ranges2), | ||
778 | regulator_desc_s2mps15_ldo(26, s2mps15_ldo_voltage_ranges3), | ||
779 | regulator_desc_s2mps15_ldo(27, s2mps15_ldo_voltage_ranges1), | ||
780 | regulator_desc_s2mps15_buck(1, s2mps15_buck_voltage_ranges1), | ||
781 | regulator_desc_s2mps15_buck(2, s2mps15_buck_voltage_ranges1), | ||
782 | regulator_desc_s2mps15_buck(3, s2mps15_buck_voltage_ranges1), | ||
783 | regulator_desc_s2mps15_buck(4, s2mps15_buck_voltage_ranges1), | ||
784 | regulator_desc_s2mps15_buck(5, s2mps15_buck_voltage_ranges1), | ||
785 | regulator_desc_s2mps15_buck(6, s2mps15_buck_voltage_ranges1), | ||
786 | regulator_desc_s2mps15_buck(7, s2mps15_buck_voltage_ranges1), | ||
787 | regulator_desc_s2mps15_buck(8, s2mps15_buck_voltage_ranges2), | ||
788 | regulator_desc_s2mps15_buck(9, s2mps15_buck_voltage_ranges2), | ||
789 | regulator_desc_s2mps15_buck(10, s2mps15_buck_voltage_ranges2), | ||
790 | }; | ||
791 | |||
664 | static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11, | 792 | static int s2mps14_pmic_enable_ext_control(struct s2mps11_info *s2mps11, |
665 | struct regulator_dev *rdev) | 793 | struct regulator_dev *rdev) |
666 | { | 794 | { |
@@ -974,6 +1102,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) | |||
974 | regulators = s2mps14_regulators; | 1102 | regulators = s2mps14_regulators; |
975 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); | 1103 | BUILD_BUG_ON(S2MPS_REGULATOR_MAX < s2mps11->rdev_num); |
976 | break; | 1104 | break; |
1105 | case S2MPS15X: | ||
1106 | s2mps11->rdev_num = ARRAY_SIZE(s2mps15_regulators); | ||
1107 | regulators = s2mps15_regulators; | ||
1108 | break; | ||
977 | case S2MPU02: | 1109 | case S2MPU02: |
978 | s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators); | 1110 | s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators); |
979 | regulators = s2mpu02_regulators; | 1111 | regulators = s2mpu02_regulators; |
@@ -1070,6 +1202,7 @@ static const struct platform_device_id s2mps11_pmic_id[] = { | |||
1070 | { "s2mps11-pmic", S2MPS11X}, | 1202 | { "s2mps11-pmic", S2MPS11X}, |
1071 | { "s2mps13-pmic", S2MPS13X}, | 1203 | { "s2mps13-pmic", S2MPS13X}, |
1072 | { "s2mps14-pmic", S2MPS14X}, | 1204 | { "s2mps14-pmic", S2MPS14X}, |
1205 | { "s2mps15-regulator", S2MPS15X}, | ||
1073 | { "s2mpu02-pmic", S2MPU02}, | 1206 | { "s2mpu02-pmic", S2MPU02}, |
1074 | { }, | 1207 | { }, |
1075 | }; | 1208 | }; |
@@ -1097,5 +1230,5 @@ module_exit(s2mps11_pmic_exit); | |||
1097 | 1230 | ||
1098 | /* Module information */ | 1231 | /* Module information */ |
1099 | MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>"); | 1232 | MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>"); |
1100 | MODULE_DESCRIPTION("SAMSUNG S2MPS11/S2MPS14/S2MPU02 Regulator Driver"); | 1233 | MODULE_DESCRIPTION("SAMSUNG S2MPS11/S2MPS14/S2MPS15/S2MPU02 Regulator Driver"); |
1101 | MODULE_LICENSE("GPL"); | 1234 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index f2504b4eef34..0d68a85dd429 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c | |||
@@ -188,6 +188,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info, | |||
188 | ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val); | 188 | ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val); |
189 | val &= S5M_ALARM0_STATUS; | 189 | val &= S5M_ALARM0_STATUS; |
190 | break; | 190 | break; |
191 | case S2MPS15X: | ||
191 | case S2MPS14X: | 192 | case S2MPS14X: |
192 | case S2MPS13X: | 193 | case S2MPS13X: |
193 | ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2, | 194 | ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2, |
@@ -219,9 +220,22 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) | |||
219 | return ret; | 220 | return ret; |
220 | } | 221 | } |
221 | 222 | ||
222 | data |= info->regs->rtc_udr_mask; | 223 | switch (info->device_type) { |
223 | if (info->device_type == S5M8763X || info->device_type == S5M8767X) | 224 | case S5M8763X: |
224 | data |= S5M_RTC_TIME_EN_MASK; | 225 | case S5M8767X: |
226 | data |= info->regs->rtc_udr_mask | S5M_RTC_TIME_EN_MASK; | ||
227 | case S2MPS15X: | ||
228 | /* As per UM, for write time register, set WUDR bit to high */ | ||
229 | data |= S2MPS15_RTC_WUDR_MASK; | ||
230 | break; | ||
231 | case S2MPS14X: | ||
232 | case S2MPS13X: | ||
233 | data |= info->regs->rtc_udr_mask; | ||
234 | break; | ||
235 | default: | ||
236 | return -EINVAL; | ||
237 | } | ||
238 | |||
225 | 239 | ||
226 | ret = regmap_write(info->regmap, info->regs->rtc_udr_update, data); | 240 | ret = regmap_write(info->regmap, info->regs->rtc_udr_update, data); |
227 | if (ret < 0) { | 241 | if (ret < 0) { |
@@ -252,6 +266,11 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) | |||
252 | case S5M8767X: | 266 | case S5M8767X: |
253 | data &= ~S5M_RTC_TIME_EN_MASK; | 267 | data &= ~S5M_RTC_TIME_EN_MASK; |
254 | break; | 268 | break; |
269 | case S2MPS15X: | ||
270 | /* As per UM, for write alarm, set A_UDR(bit[4]) to high | ||
271 | * rtc_udr_mask above sets bit[4] | ||
272 | */ | ||
273 | break; | ||
255 | case S2MPS14X: | 274 | case S2MPS14X: |
256 | data |= S2MPS_RTC_RUDR_MASK; | 275 | data |= S2MPS_RTC_RUDR_MASK; |
257 | break; | 276 | break; |
@@ -317,7 +336,8 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
317 | u8 data[info->regs->regs_count]; | 336 | u8 data[info->regs->regs_count]; |
318 | int ret; | 337 | int ret; |
319 | 338 | ||
320 | if (info->device_type == S2MPS14X || info->device_type == S2MPS13X) { | 339 | if (info->device_type == S2MPS15X || info->device_type == S2MPS14X || |
340 | info->device_type == S2MPS13X) { | ||
321 | ret = regmap_update_bits(info->regmap, | 341 | ret = regmap_update_bits(info->regmap, |
322 | info->regs->rtc_udr_update, | 342 | info->regs->rtc_udr_update, |
323 | S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK); | 343 | S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK); |
@@ -339,6 +359,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
339 | break; | 359 | break; |
340 | 360 | ||
341 | case S5M8767X: | 361 | case S5M8767X: |
362 | case S2MPS15X: | ||
342 | case S2MPS14X: | 363 | case S2MPS14X: |
343 | case S2MPS13X: | 364 | case S2MPS13X: |
344 | s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode); | 365 | s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode); |
@@ -366,6 +387,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
366 | s5m8763_tm_to_data(tm, data); | 387 | s5m8763_tm_to_data(tm, data); |
367 | break; | 388 | break; |
368 | case S5M8767X: | 389 | case S5M8767X: |
390 | case S2MPS15X: | ||
369 | case S2MPS14X: | 391 | case S2MPS14X: |
370 | case S2MPS13X: | 392 | case S2MPS13X: |
371 | ret = s5m8767_tm_to_data(tm, data); | 393 | ret = s5m8767_tm_to_data(tm, data); |
@@ -414,6 +436,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
414 | break; | 436 | break; |
415 | 437 | ||
416 | case S5M8767X: | 438 | case S5M8767X: |
439 | case S2MPS15X: | ||
417 | case S2MPS14X: | 440 | case S2MPS14X: |
418 | case S2MPS13X: | 441 | case S2MPS13X: |
419 | s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); | 442 | s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); |
@@ -463,6 +486,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) | |||
463 | break; | 486 | break; |
464 | 487 | ||
465 | case S5M8767X: | 488 | case S5M8767X: |
489 | case S2MPS15X: | ||
466 | case S2MPS14X: | 490 | case S2MPS14X: |
467 | case S2MPS13X: | 491 | case S2MPS13X: |
468 | for (i = 0; i < info->regs->regs_count; i++) | 492 | for (i = 0; i < info->regs->regs_count; i++) |
@@ -508,6 +532,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) | |||
508 | break; | 532 | break; |
509 | 533 | ||
510 | case S5M8767X: | 534 | case S5M8767X: |
535 | case S2MPS15X: | ||
511 | case S2MPS14X: | 536 | case S2MPS14X: |
512 | case S2MPS13X: | 537 | case S2MPS13X: |
513 | data[RTC_SEC] |= ALARM_ENABLE_MASK; | 538 | data[RTC_SEC] |= ALARM_ENABLE_MASK; |
@@ -548,6 +573,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
548 | break; | 573 | break; |
549 | 574 | ||
550 | case S5M8767X: | 575 | case S5M8767X: |
576 | case S2MPS15X: | ||
551 | case S2MPS14X: | 577 | case S2MPS14X: |
552 | case S2MPS13X: | 578 | case S2MPS13X: |
553 | s5m8767_tm_to_data(&alrm->time, data); | 579 | s5m8767_tm_to_data(&alrm->time, data); |
@@ -631,6 +657,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) | |||
631 | ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2); | 657 | ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2); |
632 | break; | 658 | break; |
633 | 659 | ||
660 | case S2MPS15X: | ||
634 | case S2MPS14X: | 661 | case S2MPS14X: |
635 | case S2MPS13X: | 662 | case S2MPS13X: |
636 | data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); | 663 | data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); |
@@ -679,6 +706,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) | |||
679 | return -ENOMEM; | 706 | return -ENOMEM; |
680 | 707 | ||
681 | switch (platform_get_device_id(pdev)->driver_data) { | 708 | switch (platform_get_device_id(pdev)->driver_data) { |
709 | case S2MPS15X: | ||
682 | case S2MPS14X: | 710 | case S2MPS14X: |
683 | case S2MPS13X: | 711 | case S2MPS13X: |
684 | regmap_cfg = &s2mps14_rtc_regmap_config; | 712 | regmap_cfg = &s2mps14_rtc_regmap_config; |
@@ -805,6 +833,7 @@ static const struct platform_device_id s5m_rtc_id[] = { | |||
805 | { "s5m-rtc", S5M8767X }, | 833 | { "s5m-rtc", S5M8767X }, |
806 | { "s2mps13-rtc", S2MPS13X }, | 834 | { "s2mps13-rtc", S2MPS13X }, |
807 | { "s2mps14-rtc", S2MPS14X }, | 835 | { "s2mps14-rtc", S2MPS14X }, |
836 | { "s2mps15-rtc", S2MPS15X }, | ||
808 | { }, | 837 | { }, |
809 | }; | 838 | }; |
810 | MODULE_DEVICE_TABLE(platform, s5m_rtc_id); | 839 | MODULE_DEVICE_TABLE(platform, s5m_rtc_id); |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index a06098639399..6bc4bcd488ac 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
@@ -44,6 +44,7 @@ enum sec_device_type { | |||
44 | S2MPS11X, | 44 | S2MPS11X, |
45 | S2MPS13X, | 45 | S2MPS13X, |
46 | S2MPS14X, | 46 | S2MPS14X, |
47 | S2MPS15X, | ||
47 | S2MPU02, | 48 | S2MPU02, |
48 | }; | 49 | }; |
49 | 50 | ||
diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h index 29c30ac36020..a65e4655d470 100644 --- a/include/linux/mfd/samsung/rtc.h +++ b/include/linux/mfd/samsung/rtc.h | |||
@@ -107,6 +107,8 @@ enum s2mps_rtc_reg { | |||
107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) | 107 | #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) |
108 | #define S2MPS13_RTC_AUDR_SHIFT 1 | 108 | #define S2MPS13_RTC_AUDR_SHIFT 1 |
109 | #define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT) | 109 | #define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT) |
110 | #define S2MPS15_RTC_WUDR_SHIFT 1 | ||
111 | #define S2MPS15_RTC_WUDR_MASK (1 << S2MPS15_RTC_WUDR_SHIFT) | ||
110 | #define S2MPS_RTC_RUDR_SHIFT 0 | 112 | #define S2MPS_RTC_RUDR_SHIFT 0 |
111 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) | 113 | #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) |
112 | #define RTC_TCON_SHIFT 1 | 114 | #define RTC_TCON_SHIFT 1 |
diff --git a/include/linux/mfd/samsung/s2mps15.h b/include/linux/mfd/samsung/s2mps15.h new file mode 100644 index 000000000000..36d35287c3c0 --- /dev/null +++ b/include/linux/mfd/samsung/s2mps15.h | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License as published by the | ||
7 | * Free Software Foundation; either version 2 of the License, or (at your | ||
8 | * option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef __LINUX_MFD_S2MPS15_H | ||
17 | #define __LINUX_MFD_S2MPS15_H | ||
18 | |||
19 | /* S2MPS15 registers */ | ||
20 | enum s2mps15_reg { | ||
21 | S2MPS15_REG_ID, | ||
22 | S2MPS15_REG_INT1, | ||
23 | S2MPS15_REG_INT2, | ||
24 | S2MPS15_REG_INT3, | ||
25 | S2MPS15_REG_INT1M, | ||
26 | S2MPS15_REG_INT2M, | ||
27 | S2MPS15_REG_INT3M, | ||
28 | S2MPS15_REG_ST1, | ||
29 | S2MPS15_REG_ST2, | ||
30 | S2MPS15_REG_PWRONSRC, | ||
31 | S2MPS15_REG_OFFSRC, | ||
32 | S2MPS15_REG_BU_CHG, | ||
33 | S2MPS15_REG_RTC_BUF, | ||
34 | S2MPS15_REG_CTRL1, | ||
35 | S2MPS15_REG_CTRL2, | ||
36 | S2MPS15_REG_RSVD1, | ||
37 | S2MPS15_REG_RSVD2, | ||
38 | S2MPS15_REG_RSVD3, | ||
39 | S2MPS15_REG_RSVD4, | ||
40 | S2MPS15_REG_RSVD5, | ||
41 | S2MPS15_REG_RSVD6, | ||
42 | S2MPS15_REG_CTRL3, | ||
43 | S2MPS15_REG_RSVD7, | ||
44 | S2MPS15_REG_RSVD8, | ||
45 | S2MPS15_REG_RSVD9, | ||
46 | S2MPS15_REG_B1CTRL1, | ||
47 | S2MPS15_REG_B1CTRL2, | ||
48 | S2MPS15_REG_B2CTRL1, | ||
49 | S2MPS15_REG_B2CTRL2, | ||
50 | S2MPS15_REG_B3CTRL1, | ||
51 | S2MPS15_REG_B3CTRL2, | ||
52 | S2MPS15_REG_B4CTRL1, | ||
53 | S2MPS15_REG_B4CTRL2, | ||
54 | S2MPS15_REG_B5CTRL1, | ||
55 | S2MPS15_REG_B5CTRL2, | ||
56 | S2MPS15_REG_B6CTRL1, | ||
57 | S2MPS15_REG_B6CTRL2, | ||
58 | S2MPS15_REG_B7CTRL1, | ||
59 | S2MPS15_REG_B7CTRL2, | ||
60 | S2MPS15_REG_B8CTRL1, | ||
61 | S2MPS15_REG_B8CTRL2, | ||
62 | S2MPS15_REG_B9CTRL1, | ||
63 | S2MPS15_REG_B9CTRL2, | ||
64 | S2MPS15_REG_B10CTRL1, | ||
65 | S2MPS15_REG_B10CTRL2, | ||
66 | S2MPS15_REG_BBCTRL1, | ||
67 | S2MPS15_REG_BBCTRL2, | ||
68 | S2MPS15_REG_BRAMP, | ||
69 | S2MPS15_REG_LDODVS1, | ||
70 | S2MPS15_REG_LDODVS2, | ||
71 | S2MPS15_REG_LDODVS3, | ||
72 | S2MPS15_REG_LDODVS4, | ||
73 | S2MPS15_REG_L1CTRL, | ||
74 | S2MPS15_REG_L2CTRL, | ||
75 | S2MPS15_REG_L3CTRL, | ||
76 | S2MPS15_REG_L4CTRL, | ||
77 | S2MPS15_REG_L5CTRL, | ||
78 | S2MPS15_REG_L6CTRL, | ||
79 | S2MPS15_REG_L7CTRL, | ||
80 | S2MPS15_REG_L8CTRL, | ||
81 | S2MPS15_REG_L9CTRL, | ||
82 | S2MPS15_REG_L10CTRL, | ||
83 | S2MPS15_REG_L11CTRL, | ||
84 | S2MPS15_REG_L12CTRL, | ||
85 | S2MPS15_REG_L13CTRL, | ||
86 | S2MPS15_REG_L14CTRL, | ||
87 | S2MPS15_REG_L15CTRL, | ||
88 | S2MPS15_REG_L16CTRL, | ||
89 | S2MPS15_REG_L17CTRL, | ||
90 | S2MPS15_REG_L18CTRL, | ||
91 | S2MPS15_REG_L19CTRL, | ||
92 | S2MPS15_REG_L20CTRL, | ||
93 | S2MPS15_REG_L21CTRL, | ||
94 | S2MPS15_REG_L22CTRL, | ||
95 | S2MPS15_REG_L23CTRL, | ||
96 | S2MPS15_REG_L24CTRL, | ||
97 | S2MPS15_REG_L25CTRL, | ||
98 | S2MPS15_REG_L26CTRL, | ||
99 | S2MPS15_REG_L27CTRL, | ||
100 | S2MPS15_REG_LDODSCH1, | ||
101 | S2MPS15_REG_LDODSCH2, | ||
102 | S2MPS15_REG_LDODSCH3, | ||
103 | S2MPS15_REG_LDODSCH4, | ||
104 | }; | ||
105 | |||
106 | /* S2MPS15 regulator ids */ | ||
107 | enum s2mps15_regulators { | ||
108 | S2MPS15_LDO1, | ||
109 | S2MPS15_LDO2, | ||
110 | S2MPS15_LDO3, | ||
111 | S2MPS15_LDO4, | ||
112 | S2MPS15_LDO5, | ||
113 | S2MPS15_LDO6, | ||
114 | S2MPS15_LDO7, | ||
115 | S2MPS15_LDO8, | ||
116 | S2MPS15_LDO9, | ||
117 | S2MPS15_LDO10, | ||
118 | S2MPS15_LDO11, | ||
119 | S2MPS15_LDO12, | ||
120 | S2MPS15_LDO13, | ||
121 | S2MPS15_LDO14, | ||
122 | S2MPS15_LDO15, | ||
123 | S2MPS15_LDO16, | ||
124 | S2MPS15_LDO17, | ||
125 | S2MPS15_LDO18, | ||
126 | S2MPS15_LDO19, | ||
127 | S2MPS15_LDO20, | ||
128 | S2MPS15_LDO21, | ||
129 | S2MPS15_LDO22, | ||
130 | S2MPS15_LDO23, | ||
131 | S2MPS15_LDO24, | ||
132 | S2MPS15_LDO25, | ||
133 | S2MPS15_LDO26, | ||
134 | S2MPS15_LDO27, | ||
135 | S2MPS15_BUCK1, | ||
136 | S2MPS15_BUCK2, | ||
137 | S2MPS15_BUCK3, | ||
138 | S2MPS15_BUCK4, | ||
139 | S2MPS15_BUCK5, | ||
140 | S2MPS15_BUCK6, | ||
141 | S2MPS15_BUCK7, | ||
142 | S2MPS15_BUCK8, | ||
143 | S2MPS15_BUCK9, | ||
144 | S2MPS15_BUCK10, | ||
145 | S2MPS15_BUCK11, | ||
146 | S2MPS15_REGULATOR_MAX, | ||
147 | }; | ||
148 | |||
149 | #define S2MPS15_LDO_VSEL_MASK (0x3F) | ||
150 | #define S2MPS15_BUCK_VSEL_MASK (0xFF) | ||
151 | |||
152 | #define S2MPS15_ENABLE_SHIFT (0x06) | ||
153 | #define S2MPS15_ENABLE_MASK (0x03 << S2MPS15_ENABLE_SHIFT) | ||
154 | |||
155 | #define S2MPS15_LDO_N_VOLTAGES (S2MPS15_LDO_VSEL_MASK + 1) | ||
156 | #define S2MPS15_BUCK_N_VOLTAGES (S2MPS15_BUCK_VSEL_MASK + 1) | ||
157 | |||
158 | #endif /* __LINUX_MFD_S2MPS15_H */ | ||