diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-06-25 03:14:45 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-07-09 09:58:11 -0400 |
commit | 00e2573d2c10813d4192cc8e5969edc4b250a26e (patch) | |
tree | 492c43794106cabe8b9fe307a9dbf91f331cbb7e /drivers/regulator | |
parent | 54e8827d5f0e66d152ef63e7958030ef4880cd85 (diff) |
regulator: s2mps11: Add support S2MPU02 regulator device
This patch add S2MPU02 regulator device to existing S2MPS11 device driver
because of little difference between S2MPS1x and S2MPU02. The S2MPU02
regulator device includes LDO[1-28] and BUCK[1-7].
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[Add missing linear_min_sel of S2MPU02 LDO regulators by Jonghwa Lee]
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/s2mps11.c | 321 |
1 files changed, 300 insertions, 21 deletions
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 02e2fb2fca66..2daacc632e65 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
@@ -31,6 +31,7 @@ | |||
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/s2mps14.h> | 33 | #include <linux/mfd/samsung/s2mps14.h> |
34 | #include <linux/mfd/samsung/s2mpu02.h> | ||
34 | 35 | ||
35 | struct s2mps11_info { | 36 | struct s2mps11_info { |
36 | unsigned int rdev_num; | 37 | unsigned int rdev_num; |
@@ -40,11 +41,15 @@ struct s2mps11_info { | |||
40 | int ramp_delay16; | 41 | int ramp_delay16; |
41 | int ramp_delay7810; | 42 | int ramp_delay7810; |
42 | int ramp_delay9; | 43 | int ramp_delay9; |
44 | |||
45 | enum sec_device_type dev_type; | ||
46 | |||
43 | /* | 47 | /* |
44 | * One bit for each S2MPS14 regulator whether the suspend mode | 48 | * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode |
45 | * was enabled. | 49 | * was enabled. |
46 | */ | 50 | */ |
47 | unsigned int s2mps14_suspend_state:30; | 51 | unsigned long long s2mps14_suspend_state:35; |
52 | |||
48 | /* Array of size rdev_num with GPIO-s for external sleep control */ | 53 | /* Array of size rdev_num with GPIO-s for external sleep control */ |
49 | int *ext_control_gpio; | 54 | int *ext_control_gpio; |
50 | }; | 55 | }; |
@@ -415,12 +420,24 @@ static int s2mps14_regulator_enable(struct regulator_dev *rdev) | |||
415 | struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); | 420 | struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); |
416 | unsigned int val; | 421 | unsigned int val; |
417 | 422 | ||
418 | if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) | 423 | switch (s2mps11->dev_type) { |
419 | val = S2MPS14_ENABLE_SUSPEND; | 424 | case S2MPS14X: |
420 | else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)])) | 425 | if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) |
421 | val = S2MPS14_ENABLE_EXT_CONTROL; | 426 | val = S2MPS14_ENABLE_SUSPEND; |
422 | else | 427 | else if (gpio_is_valid(s2mps11->ext_control_gpio[rdev_get_id(rdev)])) |
423 | val = rdev->desc->enable_mask; | 428 | val = S2MPS14_ENABLE_EXT_CONTROL; |
429 | else | ||
430 | val = rdev->desc->enable_mask; | ||
431 | break; | ||
432 | case S2MPU02: | ||
433 | if (s2mps11->s2mps14_suspend_state & (1 << rdev_get_id(rdev))) | ||
434 | val = S2MPU02_ENABLE_SUSPEND; | ||
435 | else | ||
436 | val = rdev->desc->enable_mask; | ||
437 | break; | ||
438 | default: | ||
439 | return -EINVAL; | ||
440 | }; | ||
424 | 441 | ||
425 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 442 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
426 | rdev->desc->enable_mask, val); | 443 | rdev->desc->enable_mask, val); |
@@ -429,12 +446,38 @@ static int s2mps14_regulator_enable(struct regulator_dev *rdev) | |||
429 | static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev) | 446 | static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev) |
430 | { | 447 | { |
431 | int ret; | 448 | int ret; |
432 | unsigned int val; | 449 | unsigned int val, state; |
433 | struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); | 450 | struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev); |
451 | int rdev_id = rdev_get_id(rdev); | ||
434 | 452 | ||
435 | /* LDO3 should be always on and does not support suspend mode */ | 453 | /* Below LDO should be always on or does not support suspend mode. */ |
436 | if (rdev_get_id(rdev) == S2MPS14_LDO3) | 454 | switch (s2mps11->dev_type) { |
437 | return 0; | 455 | case S2MPS14X: |
456 | switch (rdev_id) { | ||
457 | case S2MPS14_LDO3: | ||
458 | return 0; | ||
459 | default: | ||
460 | state = S2MPS14_ENABLE_SUSPEND; | ||
461 | break; | ||
462 | }; | ||
463 | break; | ||
464 | case S2MPU02: | ||
465 | switch (rdev_id) { | ||
466 | case S2MPU02_LDO13: | ||
467 | case S2MPU02_LDO14: | ||
468 | case S2MPU02_LDO15: | ||
469 | case S2MPU02_LDO17: | ||
470 | case S2MPU02_BUCK7: | ||
471 | state = S2MPU02_DISABLE_SUSPEND; | ||
472 | break; | ||
473 | default: | ||
474 | state = S2MPU02_ENABLE_SUSPEND; | ||
475 | break; | ||
476 | }; | ||
477 | break; | ||
478 | default: | ||
479 | return -EINVAL; | ||
480 | }; | ||
438 | 481 | ||
439 | ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val); | 482 | ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val); |
440 | if (ret < 0) | 483 | if (ret < 0) |
@@ -452,7 +495,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev) | |||
452 | return 0; | 495 | return 0; |
453 | 496 | ||
454 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 497 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
455 | rdev->desc->enable_mask, S2MPS14_ENABLE_SUSPEND); | 498 | rdev->desc->enable_mask, state); |
456 | } | 499 | } |
457 | 500 | ||
458 | static struct regulator_ops s2mps14_reg_ops = { | 501 | static struct regulator_ops s2mps14_reg_ops = { |
@@ -605,8 +648,7 @@ static void s2mps14_pmic_dt_parse_ext_control_gpio(struct platform_device *pdev, | |||
605 | } | 648 | } |
606 | 649 | ||
607 | static int s2mps11_pmic_dt_parse(struct platform_device *pdev, | 650 | static int s2mps11_pmic_dt_parse(struct platform_device *pdev, |
608 | struct of_regulator_match *rdata, struct s2mps11_info *s2mps11, | 651 | struct of_regulator_match *rdata, struct s2mps11_info *s2mps11) |
609 | enum sec_device_type dev_type) | ||
610 | { | 652 | { |
611 | struct device_node *reg_np; | 653 | struct device_node *reg_np; |
612 | 654 | ||
@@ -617,7 +659,7 @@ static int s2mps11_pmic_dt_parse(struct platform_device *pdev, | |||
617 | } | 659 | } |
618 | 660 | ||
619 | of_regulator_match(&pdev->dev, reg_np, rdata, s2mps11->rdev_num); | 661 | of_regulator_match(&pdev->dev, reg_np, rdata, s2mps11->rdev_num); |
620 | if (dev_type == S2MPS14X) | 662 | if (s2mps11->dev_type == S2MPS14X) |
621 | s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11); | 663 | s2mps14_pmic_dt_parse_ext_control_gpio(pdev, rdata, s2mps11); |
622 | 664 | ||
623 | of_node_put(reg_np); | 665 | of_node_put(reg_np); |
@@ -625,6 +667,238 @@ static int s2mps11_pmic_dt_parse(struct platform_device *pdev, | |||
625 | return 0; | 667 | return 0; |
626 | } | 668 | } |
627 | 669 | ||
670 | static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) | ||
671 | { | ||
672 | unsigned int ramp_val, ramp_shift, ramp_reg; | ||
673 | |||
674 | switch (rdev_get_id(rdev)) { | ||
675 | case S2MPU02_BUCK1: | ||
676 | ramp_shift = S2MPU02_BUCK1_RAMP_SHIFT; | ||
677 | break; | ||
678 | case S2MPU02_BUCK2: | ||
679 | ramp_shift = S2MPU02_BUCK2_RAMP_SHIFT; | ||
680 | break; | ||
681 | case S2MPU02_BUCK3: | ||
682 | ramp_shift = S2MPU02_BUCK3_RAMP_SHIFT; | ||
683 | break; | ||
684 | case S2MPU02_BUCK4: | ||
685 | ramp_shift = S2MPU02_BUCK4_RAMP_SHIFT; | ||
686 | break; | ||
687 | default: | ||
688 | return 0; | ||
689 | } | ||
690 | ramp_reg = S2MPU02_REG_RAMP1; | ||
691 | ramp_val = get_ramp_delay(ramp_delay); | ||
692 | |||
693 | return regmap_update_bits(rdev->regmap, ramp_reg, | ||
694 | S2MPU02_BUCK1234_RAMP_MASK << ramp_shift, | ||
695 | ramp_val << ramp_shift); | ||
696 | } | ||
697 | |||
698 | static struct regulator_ops s2mpu02_ldo_ops = { | ||
699 | .list_voltage = regulator_list_voltage_linear, | ||
700 | .map_voltage = regulator_map_voltage_linear, | ||
701 | .is_enabled = regulator_is_enabled_regmap, | ||
702 | .enable = s2mps14_regulator_enable, | ||
703 | .disable = regulator_disable_regmap, | ||
704 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
705 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
706 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
707 | .set_suspend_disable = s2mps14_regulator_set_suspend_disable, | ||
708 | }; | ||
709 | |||
710 | static struct regulator_ops s2mpu02_buck_ops = { | ||
711 | .list_voltage = regulator_list_voltage_linear, | ||
712 | .map_voltage = regulator_map_voltage_linear, | ||
713 | .is_enabled = regulator_is_enabled_regmap, | ||
714 | .enable = s2mps14_regulator_enable, | ||
715 | .disable = regulator_disable_regmap, | ||
716 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
717 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
718 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
719 | .set_suspend_disable = s2mps14_regulator_set_suspend_disable, | ||
720 | .set_ramp_delay = s2mpu02_set_ramp_delay, | ||
721 | }; | ||
722 | |||
723 | #define regulator_desc_s2mpu02_ldo1(num) { \ | ||
724 | .name = "LDO"#num, \ | ||
725 | .id = S2MPU02_LDO##num, \ | ||
726 | .ops = &s2mpu02_ldo_ops, \ | ||
727 | .type = REGULATOR_VOLTAGE, \ | ||
728 | .owner = THIS_MODULE, \ | ||
729 | .min_uV = S2MPU02_LDO_MIN_900MV, \ | ||
730 | .uV_step = S2MPU02_LDO_STEP_12_5MV, \ | ||
731 | .linear_min_sel = S2MPU02_LDO_GROUP1_START_SEL, \ | ||
732 | .n_voltages = S2MPU02_LDO_N_VOLTAGES, \ | ||
733 | .vsel_reg = S2MPU02_REG_L1CTRL, \ | ||
734 | .vsel_mask = S2MPU02_LDO_VSEL_MASK, \ | ||
735 | .enable_reg = S2MPU02_REG_L1CTRL, \ | ||
736 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
737 | } | ||
738 | #define regulator_desc_s2mpu02_ldo2(num) { \ | ||
739 | .name = "LDO"#num, \ | ||
740 | .id = S2MPU02_LDO##num, \ | ||
741 | .ops = &s2mpu02_ldo_ops, \ | ||
742 | .type = REGULATOR_VOLTAGE, \ | ||
743 | .owner = THIS_MODULE, \ | ||
744 | .min_uV = S2MPU02_LDO_MIN_1050MV, \ | ||
745 | .uV_step = S2MPU02_LDO_STEP_25MV, \ | ||
746 | .linear_min_sel = S2MPU02_LDO_GROUP2_START_SEL, \ | ||
747 | .n_voltages = S2MPU02_LDO_N_VOLTAGES, \ | ||
748 | .vsel_reg = S2MPU02_REG_L2CTRL1, \ | ||
749 | .vsel_mask = S2MPU02_LDO_VSEL_MASK, \ | ||
750 | .enable_reg = S2MPU02_REG_L2CTRL1, \ | ||
751 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
752 | } | ||
753 | #define regulator_desc_s2mpu02_ldo3(num) { \ | ||
754 | .name = "LDO"#num, \ | ||
755 | .id = S2MPU02_LDO##num, \ | ||
756 | .ops = &s2mpu02_ldo_ops, \ | ||
757 | .type = REGULATOR_VOLTAGE, \ | ||
758 | .owner = THIS_MODULE, \ | ||
759 | .min_uV = S2MPU02_LDO_MIN_900MV, \ | ||
760 | .uV_step = S2MPU02_LDO_STEP_12_5MV, \ | ||
761 | .linear_min_sel = S2MPU02_LDO_GROUP1_START_SEL, \ | ||
762 | .n_voltages = S2MPU02_LDO_N_VOLTAGES, \ | ||
763 | .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
764 | .vsel_mask = S2MPU02_LDO_VSEL_MASK, \ | ||
765 | .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
766 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
767 | } | ||
768 | #define regulator_desc_s2mpu02_ldo4(num) { \ | ||
769 | .name = "LDO"#num, \ | ||
770 | .id = S2MPU02_LDO##num, \ | ||
771 | .ops = &s2mpu02_ldo_ops, \ | ||
772 | .type = REGULATOR_VOLTAGE, \ | ||
773 | .owner = THIS_MODULE, \ | ||
774 | .min_uV = S2MPU02_LDO_MIN_1050MV, \ | ||
775 | .uV_step = S2MPU02_LDO_STEP_25MV, \ | ||
776 | .linear_min_sel = S2MPU02_LDO_GROUP2_START_SEL, \ | ||
777 | .n_voltages = S2MPU02_LDO_N_VOLTAGES, \ | ||
778 | .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
779 | .vsel_mask = S2MPU02_LDO_VSEL_MASK, \ | ||
780 | .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
781 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
782 | } | ||
783 | #define regulator_desc_s2mpu02_ldo5(num) { \ | ||
784 | .name = "LDO"#num, \ | ||
785 | .id = S2MPU02_LDO##num, \ | ||
786 | .ops = &s2mpu02_ldo_ops, \ | ||
787 | .type = REGULATOR_VOLTAGE, \ | ||
788 | .owner = THIS_MODULE, \ | ||
789 | .min_uV = S2MPU02_LDO_MIN_1600MV, \ | ||
790 | .uV_step = S2MPU02_LDO_STEP_50MV, \ | ||
791 | .linear_min_sel = S2MPU02_LDO_GROUP3_START_SEL, \ | ||
792 | .n_voltages = S2MPU02_LDO_N_VOLTAGES, \ | ||
793 | .vsel_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
794 | .vsel_mask = S2MPU02_LDO_VSEL_MASK, \ | ||
795 | .enable_reg = S2MPU02_REG_L3CTRL + num - 3, \ | ||
796 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
797 | } | ||
798 | |||
799 | #define regulator_desc_s2mpu02_buck1234(num) { \ | ||
800 | .name = "BUCK"#num, \ | ||
801 | .id = S2MPU02_BUCK##num, \ | ||
802 | .ops = &s2mpu02_buck_ops, \ | ||
803 | .type = REGULATOR_VOLTAGE, \ | ||
804 | .owner = THIS_MODULE, \ | ||
805 | .min_uV = S2MPU02_BUCK1234_MIN_600MV, \ | ||
806 | .uV_step = S2MPU02_BUCK1234_STEP_6_25MV, \ | ||
807 | .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \ | ||
808 | .linear_min_sel = S2MPU02_BUCK1234_START_SEL, \ | ||
809 | .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \ | ||
810 | .vsel_reg = S2MPU02_REG_B1CTRL2 + (num - 1) * 2, \ | ||
811 | .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \ | ||
812 | .enable_reg = S2MPU02_REG_B1CTRL1 + (num - 1) * 2, \ | ||
813 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
814 | } | ||
815 | #define regulator_desc_s2mpu02_buck5(num) { \ | ||
816 | .name = "BUCK"#num, \ | ||
817 | .id = S2MPU02_BUCK##num, \ | ||
818 | .ops = &s2mpu02_ldo_ops, \ | ||
819 | .type = REGULATOR_VOLTAGE, \ | ||
820 | .owner = THIS_MODULE, \ | ||
821 | .min_uV = S2MPU02_BUCK5_MIN_1081_25MV, \ | ||
822 | .uV_step = S2MPU02_BUCK5_STEP_6_25MV, \ | ||
823 | .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \ | ||
824 | .linear_min_sel = S2MPU02_BUCK5_START_SEL, \ | ||
825 | .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \ | ||
826 | .vsel_reg = S2MPU02_REG_B5CTRL2, \ | ||
827 | .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \ | ||
828 | .enable_reg = S2MPU02_REG_B5CTRL1, \ | ||
829 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
830 | } | ||
831 | #define regulator_desc_s2mpu02_buck6(num) { \ | ||
832 | .name = "BUCK"#num, \ | ||
833 | .id = S2MPU02_BUCK##num, \ | ||
834 | .ops = &s2mpu02_ldo_ops, \ | ||
835 | .type = REGULATOR_VOLTAGE, \ | ||
836 | .owner = THIS_MODULE, \ | ||
837 | .min_uV = S2MPU02_BUCK6_MIN_1700MV, \ | ||
838 | .uV_step = S2MPU02_BUCK6_STEP_2_50MV, \ | ||
839 | .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \ | ||
840 | .linear_min_sel = S2MPU02_BUCK6_START_SEL, \ | ||
841 | .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \ | ||
842 | .vsel_reg = S2MPU02_REG_B6CTRL2, \ | ||
843 | .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \ | ||
844 | .enable_reg = S2MPU02_REG_B6CTRL1, \ | ||
845 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
846 | } | ||
847 | #define regulator_desc_s2mpu02_buck7(num) { \ | ||
848 | .name = "BUCK"#num, \ | ||
849 | .id = S2MPU02_BUCK##num, \ | ||
850 | .ops = &s2mpu02_ldo_ops, \ | ||
851 | .type = REGULATOR_VOLTAGE, \ | ||
852 | .owner = THIS_MODULE, \ | ||
853 | .min_uV = S2MPU02_BUCK7_MIN_900MV, \ | ||
854 | .uV_step = S2MPU02_BUCK7_STEP_6_25MV, \ | ||
855 | .n_voltages = S2MPU02_BUCK_N_VOLTAGES, \ | ||
856 | .linear_min_sel = S2MPU02_BUCK7_START_SEL, \ | ||
857 | .ramp_delay = S2MPU02_BUCK_RAMP_DELAY, \ | ||
858 | .vsel_reg = S2MPU02_REG_B7CTRL2, \ | ||
859 | .vsel_mask = S2MPU02_BUCK_VSEL_MASK, \ | ||
860 | .enable_reg = S2MPU02_REG_B7CTRL1, \ | ||
861 | .enable_mask = S2MPU02_ENABLE_MASK \ | ||
862 | } | ||
863 | |||
864 | static const struct regulator_desc s2mpu02_regulators[] = { | ||
865 | regulator_desc_s2mpu02_ldo1(1), | ||
866 | regulator_desc_s2mpu02_ldo2(2), | ||
867 | regulator_desc_s2mpu02_ldo4(3), | ||
868 | regulator_desc_s2mpu02_ldo5(4), | ||
869 | regulator_desc_s2mpu02_ldo4(5), | ||
870 | regulator_desc_s2mpu02_ldo3(6), | ||
871 | regulator_desc_s2mpu02_ldo3(7), | ||
872 | regulator_desc_s2mpu02_ldo4(8), | ||
873 | regulator_desc_s2mpu02_ldo5(9), | ||
874 | regulator_desc_s2mpu02_ldo3(10), | ||
875 | regulator_desc_s2mpu02_ldo4(11), | ||
876 | regulator_desc_s2mpu02_ldo5(12), | ||
877 | regulator_desc_s2mpu02_ldo5(13), | ||
878 | regulator_desc_s2mpu02_ldo5(14), | ||
879 | regulator_desc_s2mpu02_ldo5(15), | ||
880 | regulator_desc_s2mpu02_ldo5(16), | ||
881 | regulator_desc_s2mpu02_ldo4(17), | ||
882 | regulator_desc_s2mpu02_ldo5(18), | ||
883 | regulator_desc_s2mpu02_ldo3(19), | ||
884 | regulator_desc_s2mpu02_ldo4(20), | ||
885 | regulator_desc_s2mpu02_ldo5(21), | ||
886 | regulator_desc_s2mpu02_ldo5(22), | ||
887 | regulator_desc_s2mpu02_ldo5(23), | ||
888 | regulator_desc_s2mpu02_ldo4(24), | ||
889 | regulator_desc_s2mpu02_ldo5(25), | ||
890 | regulator_desc_s2mpu02_ldo4(26), | ||
891 | regulator_desc_s2mpu02_ldo5(27), | ||
892 | regulator_desc_s2mpu02_ldo5(28), | ||
893 | regulator_desc_s2mpu02_buck1234(1), | ||
894 | regulator_desc_s2mpu02_buck1234(2), | ||
895 | regulator_desc_s2mpu02_buck1234(3), | ||
896 | regulator_desc_s2mpu02_buck1234(4), | ||
897 | regulator_desc_s2mpu02_buck5(5), | ||
898 | regulator_desc_s2mpu02_buck6(6), | ||
899 | regulator_desc_s2mpu02_buck7(7), | ||
900 | }; | ||
901 | |||
628 | static int s2mps11_pmic_probe(struct platform_device *pdev) | 902 | static int s2mps11_pmic_probe(struct platform_device *pdev) |
629 | { | 903 | { |
630 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 904 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
@@ -634,15 +908,14 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) | |||
634 | struct s2mps11_info *s2mps11; | 908 | struct s2mps11_info *s2mps11; |
635 | int i, ret = 0; | 909 | int i, ret = 0; |
636 | const struct regulator_desc *regulators; | 910 | const struct regulator_desc *regulators; |
637 | enum sec_device_type dev_type; | ||
638 | 911 | ||
639 | s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), | 912 | s2mps11 = devm_kzalloc(&pdev->dev, sizeof(struct s2mps11_info), |
640 | GFP_KERNEL); | 913 | GFP_KERNEL); |
641 | if (!s2mps11) | 914 | if (!s2mps11) |
642 | return -ENOMEM; | 915 | return -ENOMEM; |
643 | 916 | ||
644 | dev_type = platform_get_device_id(pdev)->driver_data; | 917 | s2mps11->dev_type = platform_get_device_id(pdev)->driver_data; |
645 | switch (dev_type) { | 918 | switch (s2mps11->dev_type) { |
646 | case S2MPS11X: | 919 | case S2MPS11X: |
647 | s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); | 920 | s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); |
648 | regulators = s2mps11_regulators; | 921 | regulators = s2mps11_regulators; |
@@ -651,8 +924,13 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) | |||
651 | s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); | 924 | s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); |
652 | regulators = s2mps14_regulators; | 925 | regulators = s2mps14_regulators; |
653 | break; | 926 | break; |
927 | case S2MPU02: | ||
928 | s2mps11->rdev_num = ARRAY_SIZE(s2mpu02_regulators); | ||
929 | regulators = s2mpu02_regulators; | ||
930 | break; | ||
654 | default: | 931 | default: |
655 | dev_err(&pdev->dev, "Invalid device type: %u\n", dev_type); | 932 | dev_err(&pdev->dev, "Invalid device type: %u\n", |
933 | s2mps11->dev_type); | ||
656 | return -EINVAL; | 934 | return -EINVAL; |
657 | }; | 935 | }; |
658 | 936 | ||
@@ -686,7 +964,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev) | |||
686 | for (i = 0; i < s2mps11->rdev_num; i++) | 964 | for (i = 0; i < s2mps11->rdev_num; i++) |
687 | rdata[i].name = regulators[i].name; | 965 | rdata[i].name = regulators[i].name; |
688 | 966 | ||
689 | ret = s2mps11_pmic_dt_parse(pdev, rdata, s2mps11, dev_type); | 967 | ret = s2mps11_pmic_dt_parse(pdev, rdata, s2mps11); |
690 | if (ret) | 968 | if (ret) |
691 | goto out; | 969 | goto out; |
692 | 970 | ||
@@ -739,6 +1017,7 @@ out: | |||
739 | static const struct platform_device_id s2mps11_pmic_id[] = { | 1017 | static const struct platform_device_id s2mps11_pmic_id[] = { |
740 | { "s2mps11-pmic", S2MPS11X}, | 1018 | { "s2mps11-pmic", S2MPS11X}, |
741 | { "s2mps14-pmic", S2MPS14X}, | 1019 | { "s2mps14-pmic", S2MPS14X}, |
1020 | { "s2mpu02-pmic", S2MPU02}, | ||
742 | { }, | 1021 | { }, |
743 | }; | 1022 | }; |
744 | MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id); | 1023 | MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id); |