aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/act8865-regulator.c
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2014-07-05 09:20:55 -0400
committerMark Brown <broonie@linaro.org>2014-08-05 13:02:53 -0400
commitac0c0ea8b62949eb371b3227481385362a1425c6 (patch)
treeb925d60d981ddb5cafa506b06a23e9735167edf3 /drivers/regulator/act8865-regulator.c
parent50a03e35b09ea5098ca42a59ad3fdb56a965f2dd (diff)
regulator: act8865: add support for act8846
Add device id and definition of registers and regulators to support the act8846 PMU. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Tested-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/act8865-regulator.c')
-rw-r--r--drivers/regulator/act8865-regulator.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index b26eaf7580fc..a5ad69a0aca9 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -29,6 +29,40 @@
29#include <linux/regmap.h> 29#include <linux/regmap.h>
30 30
31/* 31/*
32 * ACT8846 Global Register Map.
33 */
34#define ACT8846_SYS0 0x00
35#define ACT8846_SYS1 0x01
36#define ACT8846_REG1_VSET 0x10
37#define ACT8846_REG1_CTRL 0x12
38#define ACT8846_REG2_VSET0 0x20
39#define ACT8846_REG2_VSET1 0x21
40#define ACT8846_REG2_CTRL 0x22
41#define ACT8846_REG3_VSET0 0x30
42#define ACT8846_REG3_VSET1 0x31
43#define ACT8846_REG3_CTRL 0x32
44#define ACT8846_REG4_VSET0 0x40
45#define ACT8846_REG4_VSET1 0x41
46#define ACT8846_REG4_CTRL 0x42
47#define ACT8846_REG5_VSET 0x50
48#define ACT8846_REG5_CTRL 0x51
49#define ACT8846_REG6_VSET 0x58
50#define ACT8846_REG6_CTRL 0x59
51#define ACT8846_REG7_VSET 0x60
52#define ACT8846_REG7_CTRL 0x61
53#define ACT8846_REG8_VSET 0x68
54#define ACT8846_REG8_CTRL 0x69
55#define ACT8846_REG9_VSET 0x70
56#define ACT8846_REG9_CTRL 0x71
57#define ACT8846_REG10_VSET 0x80
58#define ACT8846_REG10_CTRL 0x81
59#define ACT8846_REG11_VSET 0x90
60#define ACT8846_REG11_CTRL 0x91
61#define ACT8846_REG12_VSET 0xa0
62#define ACT8846_REG12_CTRL 0xa1
63#define ACT8846_REG13_CTRL 0xb1
64
65/*
32 * ACT8865 Global Register Map. 66 * ACT8865 Global Register Map.
33 */ 67 */
34#define ACT8865_SYS_MODE 0x00 68#define ACT8865_SYS_MODE 0x00
@@ -103,6 +137,21 @@ static struct regulator_ops act8865_ops = {
103 .owner = THIS_MODULE, \ 137 .owner = THIS_MODULE, \
104 } 138 }
105 139
140static const struct regulator_desc act8846_regulators[] = {
141 ACT88xx_REG("REG1", ACT8846, REG1, VSET),
142 ACT88xx_REG("REG2", ACT8846, REG2, VSET0),
143 ACT88xx_REG("REG3", ACT8846, REG3, VSET0),
144 ACT88xx_REG("REG4", ACT8846, REG4, VSET0),
145 ACT88xx_REG("REG5", ACT8846, REG5, VSET),
146 ACT88xx_REG("REG6", ACT8846, REG6, VSET),
147 ACT88xx_REG("REG7", ACT8846, REG7, VSET),
148 ACT88xx_REG("REG8", ACT8846, REG8, VSET),
149 ACT88xx_REG("REG9", ACT8846, REG9, VSET),
150 ACT88xx_REG("REG10", ACT8846, REG10, VSET),
151 ACT88xx_REG("REG11", ACT8846, REG11, VSET),
152 ACT88xx_REG("REG12", ACT8846, REG12, VSET),
153};
154
106static const struct regulator_desc act8865_regulators[] = { 155static const struct regulator_desc act8865_regulators[] = {
107 ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1), 156 ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1),
108 ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1), 157 ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1),
@@ -115,11 +164,27 @@ static const struct regulator_desc act8865_regulators[] = {
115 164
116#ifdef CONFIG_OF 165#ifdef CONFIG_OF
117static const struct of_device_id act8865_dt_ids[] = { 166static const struct of_device_id act8865_dt_ids[] = {
167 { .compatible = "active-semi,act8846", .data = (void *)ACT8846 },
118 { .compatible = "active-semi,act8865", .data = (void *)ACT8865 }, 168 { .compatible = "active-semi,act8865", .data = (void *)ACT8865 },
119 { } 169 { }
120}; 170};
121MODULE_DEVICE_TABLE(of, act8865_dt_ids); 171MODULE_DEVICE_TABLE(of, act8865_dt_ids);
122 172
173static struct of_regulator_match act8846_matches[] = {
174 [ACT8846_ID_REG1] = { .name = "REG1" },
175 [ACT8846_ID_REG2] = { .name = "REG2" },
176 [ACT8846_ID_REG3] = { .name = "REG3" },
177 [ACT8846_ID_REG4] = { .name = "REG4" },
178 [ACT8846_ID_REG5] = { .name = "REG5" },
179 [ACT8846_ID_REG6] = { .name = "REG6" },
180 [ACT8846_ID_REG7] = { .name = "REG7" },
181 [ACT8846_ID_REG8] = { .name = "REG8" },
182 [ACT8846_ID_REG9] = { .name = "REG9" },
183 [ACT8846_ID_REG10] = { .name = "REG10" },
184 [ACT8846_ID_REG11] = { .name = "REG11" },
185 [ACT8846_ID_REG12] = { .name = "REG12" },
186};
187
123static struct of_regulator_match act8865_matches[] = { 188static struct of_regulator_match act8865_matches[] = {
124 [ACT8865_ID_DCDC1] = { .name = "DCDC_REG1"}, 189 [ACT8865_ID_DCDC1] = { .name = "DCDC_REG1"},
125 [ACT8865_ID_DCDC2] = { .name = "DCDC_REG2"}, 190 [ACT8865_ID_DCDC2] = { .name = "DCDC_REG2"},
@@ -222,6 +287,11 @@ static int act8865_pmic_probe(struct i2c_client *client,
222 } 287 }
223 288
224 switch (type) { 289 switch (type) {
290 case ACT8846:
291 matches = act8846_matches;
292 regulators = act8846_regulators;
293 num_regulators = ARRAY_SIZE(act8846_regulators);
294 break;
225 case ACT8865: 295 case ACT8865:
226 matches = act8865_matches; 296 matches = act8865_matches;
227 regulators = act8865_regulators; 297 regulators = act8865_regulators;
@@ -290,6 +360,7 @@ static int act8865_pmic_probe(struct i2c_client *client,
290} 360}
291 361
292static const struct i2c_device_id act8865_ids[] = { 362static const struct i2c_device_id act8865_ids[] = {
363 { .name = "act8846", .driver_data = ACT8846 },
293 { .name = "act8865", .driver_data = ACT8865 }, 364 { .name = "act8865", .driver_data = ACT8865 },
294 { }, 365 { },
295}; 366};