forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 ea08eeccae9297f7aabd2ef7f0c2517ac4549acc
kernel/drivers/regulator/max77620-regulator.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Maxim MAX77620 Regulator driver
34 *
....@@ -5,10 +6,6 @@
56 *
67 * Author: Mallikarjun Kasoju <mkasoju@nvidia.com>
78 * Laxman Dewangan <ldewangan@nvidia.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify it
10
- * under the terms and conditions of the GNU General Public License,
11
- * version 2, as published by the Free Software Foundation.
129 */
1310
1411 #include <linux/init.h>
....@@ -470,7 +467,7 @@
470467 {
471468 struct max77620_regulator *pmic = rdev_get_drvdata(rdev);
472469 int id = rdev_get_id(rdev);
473
- int ret = 1;
470
+ int ret;
474471
475472 if (pmic->active_fps_src[id] != MAX77620_FPS_SRC_NONE)
476473 return 1;
....@@ -690,6 +687,7 @@
690687 .active_discharge_mask = MAX77620_SD_CFG1_ADE_MASK, \
691688 .active_discharge_reg = MAX77620_REG_##_id##_CFG, \
692689 .type = REGULATOR_VOLTAGE, \
690
+ .owner = THIS_MODULE, \
693691 }, \
694692 }
695693
....@@ -721,6 +719,7 @@
721719 .active_discharge_mask = MAX77620_LDO_CFG2_ADE_MASK, \
722720 .active_discharge_reg = MAX77620_REG_##_id##_CFG2, \
723721 .type = REGULATOR_VOLTAGE, \
722
+ .owner = THIS_MODULE, \
724723 }, \
725724 }
726725
....@@ -744,6 +743,24 @@
744743 static struct max77620_regulator_info max20024_regs_info[MAX77620_NUM_REGS] = {
745744 RAIL_SD(SD0, sd0, "in-sd0", SD0, 800000, 1587500, 12500, 0x22, SD0),
746745 RAIL_SD(SD1, sd1, "in-sd1", SD1, 600000, 3387500, 12500, 0x22, SD1),
746
+ RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE),
747
+ RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE),
748
+ RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE),
749
+
750
+ RAIL_LDO(LDO0, ldo0, "in-ldo0-1", N, 800000, 2375000, 25000),
751
+ RAIL_LDO(LDO1, ldo1, "in-ldo0-1", N, 800000, 2375000, 25000),
752
+ RAIL_LDO(LDO2, ldo2, "in-ldo2", P, 800000, 3950000, 50000),
753
+ RAIL_LDO(LDO3, ldo3, "in-ldo3-5", P, 800000, 3950000, 50000),
754
+ RAIL_LDO(LDO4, ldo4, "in-ldo4-6", P, 800000, 1587500, 12500),
755
+ RAIL_LDO(LDO5, ldo5, "in-ldo3-5", P, 800000, 3950000, 50000),
756
+ RAIL_LDO(LDO6, ldo6, "in-ldo4-6", P, 800000, 3950000, 50000),
757
+ RAIL_LDO(LDO7, ldo7, "in-ldo7-8", N, 800000, 3950000, 50000),
758
+ RAIL_LDO(LDO8, ldo8, "in-ldo7-8", N, 800000, 3950000, 50000),
759
+};
760
+
761
+static struct max77620_regulator_info max77663_regs_info[MAX77620_NUM_REGS] = {
762
+ RAIL_SD(SD0, sd0, "in-sd0", SD0, 600000, 3387500, 12500, 0xFF, NONE),
763
+ RAIL_SD(SD1, sd1, "in-sd1", SD1, 800000, 1587500, 12500, 0xFF, NONE),
747764 RAIL_SD(SD2, sd2, "in-sd2", SDX, 600000, 3787500, 12500, 0xFF, NONE),
748765 RAIL_SD(SD3, sd3, "in-sd3", SDX, 600000, 3787500, 12500, 0xFF, NONE),
749766 RAIL_SD(SD4, sd4, "in-sd4", SDX, 600000, 3787500, 12500, 0xFF, NONE),
....@@ -783,9 +800,14 @@
783800 case MAX77620:
784801 rinfo = max77620_regs_info;
785802 break;
786
- default:
803
+ case MAX20024:
787804 rinfo = max20024_regs_info;
788805 break;
806
+ case MAX77663:
807
+ rinfo = max77663_regs_info;
808
+ break;
809
+ default:
810
+ return -EINVAL;
789811 }
790812
791813 config.regmap = pmic->rmap;
....@@ -808,7 +830,7 @@
808830 continue;
809831
810832 rdesc = &rinfo[id].desc;
811
- pmic->rinfo[id] = &max77620_regs_info[id];
833
+ pmic->rinfo[id] = &rinfo[id];
812834 pmic->enable_power_mode[id] = MAX77620_POWER_MODE_NORMAL;
813835 pmic->reg_pdata[id].active_fps_src = -1;
814836 pmic->reg_pdata[id].active_fps_pd_slot = -1;
....@@ -886,6 +908,7 @@
886908 static const struct platform_device_id max77620_regulator_devtype[] = {
887909 { .name = "max77620-pmic", },
888910 { .name = "max20024-pmic", },
911
+ { .name = "max77663-pmic", },
889912 {},
890913 };
891914 MODULE_DEVICE_TABLE(platform, max77620_regulator_devtype);