diff options
author | Krzysztof Kozlowski <k.kozlowski.k@gmail.com> | 2015-07-15 08:59:55 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-16 16:39:30 -0400 |
commit | 2a32b401a11fc48193e58b0a5af6ea82de0272de (patch) | |
tree | 33e1c6e4a7d22975f44b9b8df5e6da85f1c4e1b4 /drivers | |
parent | 9e9a08e86733d994fe08876de7878148411d6bb5 (diff) |
regulator: Remove the max77843 driver
The max77693 regulator driver supports Maxim 77843 device so remove the
max77843 driver.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/regulator/Kconfig | 8 | ||||
-rw-r--r-- | drivers/regulator/Makefile | 1 | ||||
-rw-r--r-- | drivers/regulator/max77843.c | 203 |
3 files changed, 0 insertions, 212 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index b1022c2fd877..ed5ac9eb5063 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -424,14 +424,6 @@ config REGULATOR_MAX77802 | |||
424 | Exynos5420/Exynos5800 SoCs to control various voltages. | 424 | Exynos5420/Exynos5800 SoCs to control various voltages. |
425 | It includes support for control of voltage and ramp speed. | 425 | It includes support for control of voltage and ramp speed. |
426 | 426 | ||
427 | config REGULATOR_MAX77843 | ||
428 | tristate "Maxim 77843 regulator" | ||
429 | depends on MFD_MAX77843 | ||
430 | help | ||
431 | This driver controls a Maxim 77843 regulator. | ||
432 | The regulator include two 'SAFEOUT' for USB(Universal Serial Bus) | ||
433 | This is suitable for Exynos5433 SoC chips. | ||
434 | |||
435 | config REGULATOR_MC13XXX_CORE | 427 | config REGULATOR_MC13XXX_CORE |
436 | tristate | 428 | tristate |
437 | 429 | ||
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 91bf76267404..6429e629dcb6 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -56,7 +56,6 @@ obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o | |||
56 | obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o | 56 | obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o |
57 | obj-$(CONFIG_REGULATOR_MAX77693) += max77693.o | 57 | obj-$(CONFIG_REGULATOR_MAX77693) += max77693.o |
58 | obj-$(CONFIG_REGULATOR_MAX77802) += max77802.o | 58 | obj-$(CONFIG_REGULATOR_MAX77802) += max77802.o |
59 | obj-$(CONFIG_REGULATOR_MAX77843) += max77843.o | ||
60 | obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o | 59 | obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o |
61 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o | 60 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o |
62 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o | 61 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o |
diff --git a/drivers/regulator/max77843.c b/drivers/regulator/max77843.c deleted file mode 100644 index 9926247aae6b..000000000000 --- a/drivers/regulator/max77843.c +++ /dev/null | |||
@@ -1,203 +0,0 @@ | |||
1 | /* | ||
2 | * max77843.c - Regulator driver for the Maxim MAX77843 | ||
3 | * | ||
4 | * Copyright (C) 2015 Samsung Electronics | ||
5 | * Author: Jaewon Kim <jaewon02.kim@samsung.com> | ||
6 | * Author: Beomho Seo <beomho.seo@samsung.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/regulator/driver.h> | ||
17 | #include <linux/regulator/machine.h> | ||
18 | #include <linux/mfd/max77693-common.h> | ||
19 | #include <linux/mfd/max77843-private.h> | ||
20 | #include <linux/regulator/of_regulator.h> | ||
21 | |||
22 | enum max77843_regulator_type { | ||
23 | MAX77843_SAFEOUT1 = 0, | ||
24 | MAX77843_SAFEOUT2, | ||
25 | MAX77843_CHARGER, | ||
26 | |||
27 | MAX77843_NUM, | ||
28 | }; | ||
29 | |||
30 | static const unsigned int max77843_safeout_voltage_table[] = { | ||
31 | 4850000, | ||
32 | 4900000, | ||
33 | 4950000, | ||
34 | 3300000, | ||
35 | }; | ||
36 | |||
37 | static int max77843_reg_get_current_limit(struct regulator_dev *rdev) | ||
38 | { | ||
39 | struct regmap *regmap = rdev->regmap; | ||
40 | unsigned int chg_min_uA = rdev->constraints->min_uA; | ||
41 | unsigned int chg_max_uA = rdev->constraints->max_uA; | ||
42 | unsigned int val; | ||
43 | int ret; | ||
44 | unsigned int reg, sel; | ||
45 | |||
46 | ret = regmap_read(regmap, MAX77843_CHG_REG_CHG_CNFG_02, ®); | ||
47 | if (ret) { | ||
48 | dev_err(&rdev->dev, "Failed to read charger register\n"); | ||
49 | return ret; | ||
50 | } | ||
51 | |||
52 | sel = reg & MAX77843_CHG_FAST_CHG_CURRENT_MASK; | ||
53 | |||
54 | if (sel < 0x03) | ||
55 | sel = 0; | ||
56 | else | ||
57 | sel -= 2; | ||
58 | |||
59 | val = chg_min_uA + MAX77843_CHG_FAST_CHG_CURRENT_STEP * sel; | ||
60 | if (val > chg_max_uA) | ||
61 | return -EINVAL; | ||
62 | |||
63 | return val; | ||
64 | } | ||
65 | |||
66 | static int max77843_reg_set_current_limit(struct regulator_dev *rdev, | ||
67 | int min_uA, int max_uA) | ||
68 | { | ||
69 | struct regmap *regmap = rdev->regmap; | ||
70 | unsigned int chg_min_uA = rdev->constraints->min_uA; | ||
71 | int sel = 0; | ||
72 | |||
73 | while (chg_min_uA + MAX77843_CHG_FAST_CHG_CURRENT_STEP * sel < min_uA) | ||
74 | sel++; | ||
75 | |||
76 | if (chg_min_uA + MAX77843_CHG_FAST_CHG_CURRENT_STEP * sel > max_uA) | ||
77 | return -EINVAL; | ||
78 | |||
79 | sel += 2; | ||
80 | |||
81 | return regmap_write(regmap, MAX77843_CHG_REG_CHG_CNFG_02, sel); | ||
82 | } | ||
83 | |||
84 | static struct regulator_ops max77843_charger_ops = { | ||
85 | .is_enabled = regulator_is_enabled_regmap, | ||
86 | .enable = regulator_enable_regmap, | ||
87 | .disable = regulator_disable_regmap, | ||
88 | .get_current_limit = max77843_reg_get_current_limit, | ||
89 | .set_current_limit = max77843_reg_set_current_limit, | ||
90 | }; | ||
91 | |||
92 | static struct regulator_ops max77843_regulator_ops = { | ||
93 | .is_enabled = regulator_is_enabled_regmap, | ||
94 | .enable = regulator_enable_regmap, | ||
95 | .disable = regulator_disable_regmap, | ||
96 | .list_voltage = regulator_list_voltage_table, | ||
97 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
98 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
99 | }; | ||
100 | |||
101 | #define MAX77843_SAFEOUT(num) { \ | ||
102 | .name = "SAFEOUT" # num, \ | ||
103 | .id = MAX77843_SAFEOUT ## num, \ | ||
104 | .ops = &max77843_regulator_ops, \ | ||
105 | .of_match = of_match_ptr("SAFEOUT" # num), \ | ||
106 | .regulators_node = of_match_ptr("regulators"), \ | ||
107 | .type = REGULATOR_VOLTAGE, \ | ||
108 | .owner = THIS_MODULE, \ | ||
109 | .n_voltages = ARRAY_SIZE(max77843_safeout_voltage_table), \ | ||
110 | .volt_table = max77843_safeout_voltage_table, \ | ||
111 | .enable_reg = MAX77843_SYS_REG_SAFEOUTCTRL, \ | ||
112 | .enable_mask = MAX77843_REG_SAFEOUTCTRL_ENSAFEOUT ## num, \ | ||
113 | .vsel_reg = MAX77843_SYS_REG_SAFEOUTCTRL, \ | ||
114 | .vsel_mask = MAX77843_REG_SAFEOUTCTRL_SAFEOUT ## num ## _MASK, \ | ||
115 | } | ||
116 | |||
117 | static const struct regulator_desc max77843_supported_regulators[] = { | ||
118 | [MAX77843_SAFEOUT1] = MAX77843_SAFEOUT(1), | ||
119 | [MAX77843_SAFEOUT2] = MAX77843_SAFEOUT(2), | ||
120 | [MAX77843_CHARGER] = { | ||
121 | .name = "CHARGER", | ||
122 | .id = MAX77843_CHARGER, | ||
123 | .ops = &max77843_charger_ops, | ||
124 | .of_match = of_match_ptr("CHARGER"), | ||
125 | .regulators_node = of_match_ptr("regulators"), | ||
126 | .type = REGULATOR_CURRENT, | ||
127 | .owner = THIS_MODULE, | ||
128 | .enable_reg = MAX77843_CHG_REG_CHG_CNFG_00, | ||
129 | .enable_mask = MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK, | ||
130 | .enable_val = MAX77843_CHG_MASK | MAX77843_CHG_BUCK_MASK, | ||
131 | }, | ||
132 | }; | ||
133 | |||
134 | static struct regmap *max77843_get_regmap(struct max77693_dev *max77843, | ||
135 | int reg_id) | ||
136 | { | ||
137 | switch (reg_id) { | ||
138 | case MAX77843_SAFEOUT1: | ||
139 | case MAX77843_SAFEOUT2: | ||
140 | return max77843->regmap; | ||
141 | case MAX77843_CHARGER: | ||
142 | return max77843->regmap_chg; | ||
143 | default: | ||
144 | return max77843->regmap; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | static int max77843_regulator_probe(struct platform_device *pdev) | ||
149 | { | ||
150 | struct max77693_dev *max77843 = dev_get_drvdata(pdev->dev.parent); | ||
151 | struct regulator_config config = {}; | ||
152 | int i; | ||
153 | |||
154 | config.dev = max77843->dev; | ||
155 | config.driver_data = max77843; | ||
156 | |||
157 | for (i = 0; i < ARRAY_SIZE(max77843_supported_regulators); i++) { | ||
158 | struct regulator_dev *regulator; | ||
159 | |||
160 | config.regmap = max77843_get_regmap(max77843, | ||
161 | max77843_supported_regulators[i].id); | ||
162 | |||
163 | regulator = devm_regulator_register(&pdev->dev, | ||
164 | &max77843_supported_regulators[i], &config); | ||
165 | if (IS_ERR(regulator)) { | ||
166 | dev_err(&pdev->dev, | ||
167 | "Failed to regiser regulator-%d\n", i); | ||
168 | return PTR_ERR(regulator); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | return 0; | ||
173 | } | ||
174 | |||
175 | static const struct platform_device_id max77843_regulator_id[] = { | ||
176 | { "max77843-regulator", }, | ||
177 | { /* sentinel */ }, | ||
178 | }; | ||
179 | |||
180 | static struct platform_driver max77843_regulator_driver = { | ||
181 | .driver = { | ||
182 | .name = "max77843-regulator", | ||
183 | }, | ||
184 | .probe = max77843_regulator_probe, | ||
185 | .id_table = max77843_regulator_id, | ||
186 | }; | ||
187 | |||
188 | static int __init max77843_regulator_init(void) | ||
189 | { | ||
190 | return platform_driver_register(&max77843_regulator_driver); | ||
191 | } | ||
192 | subsys_initcall(max77843_regulator_init); | ||
193 | |||
194 | static void __exit max77843_regulator_exit(void) | ||
195 | { | ||
196 | platform_driver_unregister(&max77843_regulator_driver); | ||
197 | } | ||
198 | module_exit(max77843_regulator_exit); | ||
199 | |||
200 | MODULE_AUTHOR("Jaewon Kim <jaewon02.kim@samsung.com>"); | ||
201 | MODULE_AUTHOR("Beomho Seo <beomho.seo@samsung.com>"); | ||
202 | MODULE_DESCRIPTION("Maxim MAX77843 regulator driver"); | ||
203 | MODULE_LICENSE("GPL"); | ||