diff options
author | Javier Martinez Canillas <javier.martinez@collabora.co.uk> | 2014-07-24 08:39:24 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-07-25 10:31:48 -0400 |
commit | a259f3896a39ec7cbcd5f630a6ec95bdcbc080d2 (patch) | |
tree | 3e3a31d191f1466a27da0f0610addbc5c67f3c1e | |
parent | ad83533a634b82c3a291e8a00c778bb6bcd7862b (diff) |
mfd: max77686: Add Maxim 77802 PMIC support
Maxim MAX77802 is a power management chip that contains 10 high
efficiency Buck regulators, 32 Low-dropout (LDO) regulators used
to power up application processors and peripherals, a 2-channel
32kHz clock outputs, a Real-Time-Clock (RTC) and a I2C interface
to program the individual regulators, clocks outputs and the RTC.
This patch adds support for MAX77802 to the MAX77686 driver and is
based on a driver added to the Chrome OS kernel 3.8 by Simon Glass.
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/Kconfig | 6 | ||||
-rw-r--r-- | drivers/mfd/max77686.c | 197 | ||||
-rw-r--r-- | include/linux/mfd/max77686-private.h | 208 | ||||
-rw-r--r-- | include/linux/mfd/max77686.h | 57 |
4 files changed, 436 insertions, 32 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 30102042dcaf..de5abf244746 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -380,15 +380,15 @@ config MFD_MAX14577 | |||
380 | of the device. | 380 | of the device. |
381 | 381 | ||
382 | config MFD_MAX77686 | 382 | config MFD_MAX77686 |
383 | bool "Maxim Semiconductor MAX77686 PMIC Support" | 383 | bool "Maxim Semiconductor MAX77686/802 PMIC Support" |
384 | depends on I2C=y | 384 | depends on I2C=y |
385 | select MFD_CORE | 385 | select MFD_CORE |
386 | select REGMAP_I2C | 386 | select REGMAP_I2C |
387 | select REGMAP_IRQ | 387 | select REGMAP_IRQ |
388 | select IRQ_DOMAIN | 388 | select IRQ_DOMAIN |
389 | help | 389 | help |
390 | Say yes here to add support for Maxim Semiconductor MAX77686. | 390 | Say yes here to add support for Maxim Semiconductor MAX77686 and |
391 | This is a Power Management IC with RTC on chip. | 391 | MAX77802 which are Power Management IC with an RTC on chip. |
392 | This driver provides common support for accessing the device; | 392 | This driver provides common support for accessing the device; |
393 | additional drivers must be enabled in order to use the functionality | 393 | additional drivers must be enabled in order to use the functionality |
394 | of the device. | 394 | of the device. |
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index f2bd69915987..c65332291bb4 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * max77686.c - mfd core driver for the Maxim 77686 | 2 | * max77686.c - mfd core driver for the Maxim 77686/802 |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Samsung Electronics | 4 | * Copyright (C) 2012 Samsung Electronics |
5 | * Chiwoong Byun <woong.byun@smasung.com> | 5 | * Chiwoong Byun <woong.byun@smasung.com> |
@@ -43,6 +43,74 @@ static const struct mfd_cell max77686_devs[] = { | |||
43 | { .name = "max77686-clk", }, | 43 | { .name = "max77686-clk", }, |
44 | }; | 44 | }; |
45 | 45 | ||
46 | static const struct mfd_cell max77802_devs[] = { | ||
47 | { .name = "max77802-pmic", }, | ||
48 | { .name = "max77802-clk", }, | ||
49 | { .name = "max77802-rtc", }, | ||
50 | }; | ||
51 | |||
52 | static bool max77802_pmic_is_accessible_reg(struct device *dev, | ||
53 | unsigned int reg) | ||
54 | { | ||
55 | return (reg >= MAX77802_REG_DEVICE_ID && reg < MAX77802_REG_PMIC_END); | ||
56 | } | ||
57 | |||
58 | static bool max77802_rtc_is_accessible_reg(struct device *dev, | ||
59 | unsigned int reg) | ||
60 | { | ||
61 | return (reg >= MAX77802_RTC_INT && reg < MAX77802_RTC_END); | ||
62 | } | ||
63 | |||
64 | static bool max77802_is_accessible_reg(struct device *dev, unsigned int reg) | ||
65 | { | ||
66 | return (max77802_pmic_is_accessible_reg(dev, reg) || | ||
67 | max77802_rtc_is_accessible_reg(dev, reg)); | ||
68 | } | ||
69 | |||
70 | static bool max77802_pmic_is_precious_reg(struct device *dev, unsigned int reg) | ||
71 | { | ||
72 | return (reg == MAX77802_REG_INTSRC || reg == MAX77802_REG_INT1 || | ||
73 | reg == MAX77802_REG_INT2); | ||
74 | } | ||
75 | |||
76 | static bool max77802_rtc_is_precious_reg(struct device *dev, unsigned int reg) | ||
77 | { | ||
78 | return (reg == MAX77802_RTC_INT || | ||
79 | reg == MAX77802_RTC_UPDATE0 || | ||
80 | reg == MAX77802_RTC_UPDATE1); | ||
81 | } | ||
82 | |||
83 | static bool max77802_is_precious_reg(struct device *dev, unsigned int reg) | ||
84 | { | ||
85 | return (max77802_pmic_is_precious_reg(dev, reg) || | ||
86 | max77802_rtc_is_precious_reg(dev, reg)); | ||
87 | } | ||
88 | |||
89 | static bool max77802_pmic_is_volatile_reg(struct device *dev, unsigned int reg) | ||
90 | { | ||
91 | return (max77802_is_precious_reg(dev, reg) || | ||
92 | reg == MAX77802_REG_STATUS1 || reg == MAX77802_REG_STATUS2 || | ||
93 | reg == MAX77802_REG_PWRON); | ||
94 | } | ||
95 | |||
96 | static bool max77802_rtc_is_volatile_reg(struct device *dev, unsigned int reg) | ||
97 | { | ||
98 | return (max77802_rtc_is_precious_reg(dev, reg) || | ||
99 | reg == MAX77802_RTC_SEC || | ||
100 | reg == MAX77802_RTC_MIN || | ||
101 | reg == MAX77802_RTC_HOUR || | ||
102 | reg == MAX77802_RTC_WEEKDAY || | ||
103 | reg == MAX77802_RTC_MONTH || | ||
104 | reg == MAX77802_RTC_YEAR || | ||
105 | reg == MAX77802_RTC_DATE); | ||
106 | } | ||
107 | |||
108 | static bool max77802_is_volatile_reg(struct device *dev, unsigned int reg) | ||
109 | { | ||
110 | return (max77802_pmic_is_volatile_reg(dev, reg) || | ||
111 | max77802_rtc_is_volatile_reg(dev, reg)); | ||
112 | } | ||
113 | |||
46 | static struct regmap_config max77686_regmap_config = { | 114 | static struct regmap_config max77686_regmap_config = { |
47 | .reg_bits = 8, | 115 | .reg_bits = 8, |
48 | .val_bits = 8, | 116 | .val_bits = 8, |
@@ -53,6 +121,17 @@ static struct regmap_config max77686_rtc_regmap_config = { | |||
53 | .val_bits = 8, | 121 | .val_bits = 8, |
54 | }; | 122 | }; |
55 | 123 | ||
124 | static struct regmap_config max77802_regmap_config = { | ||
125 | .reg_bits = 8, | ||
126 | .val_bits = 8, | ||
127 | .writeable_reg = max77802_is_accessible_reg, | ||
128 | .readable_reg = max77802_is_accessible_reg, | ||
129 | .precious_reg = max77802_is_precious_reg, | ||
130 | .volatile_reg = max77802_is_volatile_reg, | ||
131 | .name = "max77802-pmic", | ||
132 | .cache_type = REGCACHE_RBTREE, | ||
133 | }; | ||
134 | |||
56 | static const struct regmap_irq max77686_irqs[] = { | 135 | static const struct regmap_irq max77686_irqs[] = { |
57 | /* INT1 interrupts */ | 136 | /* INT1 interrupts */ |
58 | { .reg_offset = 0, .mask = MAX77686_INT1_PWRONF_MSK, }, | 137 | { .reg_offset = 0, .mask = MAX77686_INT1_PWRONF_MSK, }, |
@@ -96,9 +175,34 @@ static const struct regmap_irq_chip max77686_rtc_irq_chip = { | |||
96 | .num_irqs = ARRAY_SIZE(max77686_rtc_irqs), | 175 | .num_irqs = ARRAY_SIZE(max77686_rtc_irqs), |
97 | }; | 176 | }; |
98 | 177 | ||
178 | static const struct regmap_irq_chip max77802_irq_chip = { | ||
179 | .name = "max77802-pmic", | ||
180 | .status_base = MAX77802_REG_INT1, | ||
181 | .mask_base = MAX77802_REG_INT1MSK, | ||
182 | .num_regs = 2, | ||
183 | .irqs = max77686_irqs, /* same masks as 77686 */ | ||
184 | .num_irqs = ARRAY_SIZE(max77686_irqs), | ||
185 | }; | ||
186 | |||
187 | static const struct regmap_irq_chip max77802_rtc_irq_chip = { | ||
188 | .name = "max77802-rtc", | ||
189 | .status_base = MAX77802_RTC_INT, | ||
190 | .mask_base = MAX77802_RTC_INTM, | ||
191 | .num_regs = 1, | ||
192 | .irqs = max77686_rtc_irqs, /* same masks as 77686 */ | ||
193 | .num_irqs = ARRAY_SIZE(max77686_rtc_irqs), | ||
194 | }; | ||
195 | |||
99 | static const struct of_device_id max77686_pmic_dt_match[] = { | 196 | static const struct of_device_id max77686_pmic_dt_match[] = { |
100 | {.compatible = "maxim,max77686", .data = NULL}, | 197 | { |
101 | {}, | 198 | .compatible = "maxim,max77686", |
199 | .data = (void *)TYPE_MAX77686, | ||
200 | }, | ||
201 | { | ||
202 | .compatible = "maxim,max77802", | ||
203 | .data = (void *)TYPE_MAX77802, | ||
204 | }, | ||
205 | { }, | ||
102 | }; | 206 | }; |
103 | 207 | ||
104 | static struct max77686_platform_data *max77686_i2c_parse_dt_pdata(struct device | 208 | static struct max77686_platform_data *max77686_i2c_parse_dt_pdata(struct device |
@@ -119,8 +223,15 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
119 | { | 223 | { |
120 | struct max77686_dev *max77686 = NULL; | 224 | struct max77686_dev *max77686 = NULL; |
121 | struct max77686_platform_data *pdata = dev_get_platdata(&i2c->dev); | 225 | struct max77686_platform_data *pdata = dev_get_platdata(&i2c->dev); |
226 | const struct of_device_id *match; | ||
122 | unsigned int data; | 227 | unsigned int data; |
123 | int ret = 0; | 228 | int ret = 0; |
229 | const struct regmap_config *config; | ||
230 | const struct regmap_irq_chip *irq_chip; | ||
231 | const struct regmap_irq_chip *rtc_irq_chip; | ||
232 | struct regmap **rtc_regmap; | ||
233 | const struct mfd_cell *cells; | ||
234 | int n_devs; | ||
124 | 235 | ||
125 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node && !pdata) | 236 | if (IS_ENABLED(CONFIG_OF) && i2c->dev.of_node && !pdata) |
126 | pdata = max77686_i2c_parse_dt_pdata(&i2c->dev); | 237 | pdata = max77686_i2c_parse_dt_pdata(&i2c->dev); |
@@ -135,15 +246,40 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
135 | if (!max77686) | 246 | if (!max77686) |
136 | return -ENOMEM; | 247 | return -ENOMEM; |
137 | 248 | ||
249 | if (i2c->dev.of_node) { | ||
250 | match = of_match_node(max77686_pmic_dt_match, i2c->dev.of_node); | ||
251 | if (!match) | ||
252 | return -EINVAL; | ||
253 | |||
254 | max77686->type = (int)match->data; | ||
255 | } else { | ||
256 | max77686->type = id->driver_data; | ||
257 | } | ||
258 | |||
138 | i2c_set_clientdata(i2c, max77686); | 259 | i2c_set_clientdata(i2c, max77686); |
139 | max77686->dev = &i2c->dev; | 260 | max77686->dev = &i2c->dev; |
140 | max77686->i2c = i2c; | 261 | max77686->i2c = i2c; |
141 | max77686->type = id->driver_data; | ||
142 | 262 | ||
143 | max77686->wakeup = pdata->wakeup; | 263 | max77686->wakeup = pdata->wakeup; |
144 | max77686->irq = i2c->irq; | 264 | max77686->irq = i2c->irq; |
145 | 265 | ||
146 | max77686->regmap = devm_regmap_init_i2c(i2c, &max77686_regmap_config); | 266 | if (max77686->type == TYPE_MAX77686) { |
267 | config = &max77686_regmap_config; | ||
268 | irq_chip = &max77686_irq_chip; | ||
269 | rtc_irq_chip = &max77686_rtc_irq_chip; | ||
270 | rtc_regmap = &max77686->rtc_regmap; | ||
271 | cells = max77686_devs; | ||
272 | n_devs = ARRAY_SIZE(max77686_devs); | ||
273 | } else { | ||
274 | config = &max77802_regmap_config; | ||
275 | irq_chip = &max77802_irq_chip; | ||
276 | rtc_irq_chip = &max77802_rtc_irq_chip; | ||
277 | rtc_regmap = &max77686->regmap; | ||
278 | cells = max77802_devs; | ||
279 | n_devs = ARRAY_SIZE(max77802_devs); | ||
280 | } | ||
281 | |||
282 | max77686->regmap = devm_regmap_init_i2c(i2c, config); | ||
147 | if (IS_ERR(max77686->regmap)) { | 283 | if (IS_ERR(max77686->regmap)) { |
148 | ret = PTR_ERR(max77686->regmap); | 284 | ret = PTR_ERR(max77686->regmap); |
149 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", | 285 | dev_err(max77686->dev, "Failed to allocate register map: %d\n", |
@@ -158,41 +294,46 @@ static int max77686_i2c_probe(struct i2c_client *i2c, | |||
158 | return -ENODEV; | 294 | return -ENODEV; |
159 | } | 295 | } |
160 | 296 | ||
161 | max77686->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); | 297 | if (max77686->type == TYPE_MAX77686) { |
162 | if (!max77686->rtc) { | 298 | max77686->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); |
163 | dev_err(max77686->dev, "Failed to allocate I2C device for RTC\n"); | 299 | if (!max77686->rtc) { |
164 | return -ENODEV; | 300 | dev_err(max77686->dev, |
165 | } | 301 | "Failed to allocate I2C device for RTC\n"); |
166 | i2c_set_clientdata(max77686->rtc, max77686); | 302 | return -ENODEV; |
167 | 303 | } | |
168 | max77686->rtc_regmap = devm_regmap_init_i2c(max77686->rtc, | 304 | i2c_set_clientdata(max77686->rtc, max77686); |
169 | &max77686_rtc_regmap_config); | 305 | |
170 | if (IS_ERR(max77686->rtc_regmap)) { | 306 | max77686->rtc_regmap = |
171 | ret = PTR_ERR(max77686->rtc_regmap); | 307 | devm_regmap_init_i2c(max77686->rtc, |
172 | dev_err(max77686->dev, "failed to allocate RTC regmap: %d\n", | 308 | &max77686_rtc_regmap_config); |
173 | ret); | 309 | if (IS_ERR(max77686->rtc_regmap)) { |
174 | goto err_unregister_i2c; | 310 | ret = PTR_ERR(max77686->rtc_regmap); |
311 | dev_err(max77686->dev, | ||
312 | "failed to allocate RTC regmap: %d\n", | ||
313 | ret); | ||
314 | goto err_unregister_i2c; | ||
315 | } | ||
175 | } | 316 | } |
176 | 317 | ||
177 | ret = regmap_add_irq_chip(max77686->regmap, max77686->irq, | 318 | ret = regmap_add_irq_chip(max77686->regmap, max77686->irq, |
178 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | | 319 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | |
179 | IRQF_SHARED, 0, &max77686_irq_chip, | 320 | IRQF_SHARED, 0, irq_chip, |
180 | &max77686->irq_data); | 321 | &max77686->irq_data); |
181 | if (ret) { | 322 | if (ret) { |
182 | dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret); | 323 | dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret); |
183 | goto err_unregister_i2c; | 324 | goto err_unregister_i2c; |
184 | } | 325 | } |
185 | ret = regmap_add_irq_chip(max77686->rtc_regmap, max77686->irq, | 326 | |
327 | ret = regmap_add_irq_chip(*rtc_regmap, max77686->irq, | ||
186 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | | 328 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT | |
187 | IRQF_SHARED, 0, &max77686_rtc_irq_chip, | 329 | IRQF_SHARED, 0, rtc_irq_chip, |
188 | &max77686->rtc_irq_data); | 330 | &max77686->rtc_irq_data); |
189 | if (ret) { | 331 | if (ret) { |
190 | dev_err(&i2c->dev, "failed to add RTC irq chip: %d\n", ret); | 332 | dev_err(&i2c->dev, "failed to add RTC irq chip: %d\n", ret); |
191 | goto err_del_irqc; | 333 | goto err_del_irqc; |
192 | } | 334 | } |
193 | 335 | ||
194 | ret = mfd_add_devices(max77686->dev, -1, max77686_devs, | 336 | ret = mfd_add_devices(max77686->dev, -1, cells, n_devs, NULL, 0, NULL); |
195 | ARRAY_SIZE(max77686_devs), NULL, 0, NULL); | ||
196 | if (ret < 0) { | 337 | if (ret < 0) { |
197 | dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); | 338 | dev_err(&i2c->dev, "failed to add MFD devices: %d\n", ret); |
198 | goto err_del_rtc_irqc; | 339 | goto err_del_rtc_irqc; |
@@ -205,7 +346,8 @@ err_del_rtc_irqc: | |||
205 | err_del_irqc: | 346 | err_del_irqc: |
206 | regmap_del_irq_chip(max77686->irq, max77686->irq_data); | 347 | regmap_del_irq_chip(max77686->irq, max77686->irq_data); |
207 | err_unregister_i2c: | 348 | err_unregister_i2c: |
208 | i2c_unregister_device(max77686->rtc); | 349 | if (max77686->type == TYPE_MAX77686) |
350 | i2c_unregister_device(max77686->rtc); | ||
209 | 351 | ||
210 | return ret; | 352 | return ret; |
211 | } | 353 | } |
@@ -219,7 +361,8 @@ static int max77686_i2c_remove(struct i2c_client *i2c) | |||
219 | regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data); | 361 | regmap_del_irq_chip(max77686->irq, max77686->rtc_irq_data); |
220 | regmap_del_irq_chip(max77686->irq, max77686->irq_data); | 362 | regmap_del_irq_chip(max77686->irq, max77686->irq_data); |
221 | 363 | ||
222 | i2c_unregister_device(max77686->rtc); | 364 | if (max77686->type == TYPE_MAX77686) |
365 | i2c_unregister_device(max77686->rtc); | ||
223 | 366 | ||
224 | return 0; | 367 | return 0; |
225 | } | 368 | } |
@@ -294,6 +437,6 @@ static void __exit max77686_i2c_exit(void) | |||
294 | } | 437 | } |
295 | module_exit(max77686_i2c_exit); | 438 | module_exit(max77686_i2c_exit); |
296 | 439 | ||
297 | MODULE_DESCRIPTION("MAXIM 77686 multi-function core driver"); | 440 | MODULE_DESCRIPTION("MAXIM 77686/802 multi-function core driver"); |
298 | MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>"); | 441 | MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>"); |
299 | MODULE_LICENSE("GPL"); | 442 | MODULE_LICENSE("GPL"); |
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h index 8e177806cba1..0d60b38e5b5c 100644 --- a/include/linux/mfd/max77686-private.h +++ b/include/linux/mfd/max77686-private.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * max77686-private.h - Voltage regulator driver for the Maxim 77686 | 2 | * max77686-private.h - Voltage regulator driver for the Maxim 77686/802 |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Samsung Electrnoics | 4 | * Copyright (C) 2012 Samsung Electrnoics |
5 | * Chiwoong Byun <woong.byun@samsung.com> | 5 | * Chiwoong Byun <woong.byun@samsung.com> |
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #define MAX77686_REG_INVALID (0xff) | 29 | #define MAX77686_REG_INVALID (0xff) |
30 | 30 | ||
31 | /* MAX77686 PMIC registers */ | ||
31 | enum max77686_pmic_reg { | 32 | enum max77686_pmic_reg { |
32 | MAX77686_REG_DEVICE_ID = 0x00, | 33 | MAX77686_REG_DEVICE_ID = 0x00, |
33 | MAX77686_REG_INTSRC = 0x01, | 34 | MAX77686_REG_INTSRC = 0x01, |
@@ -181,6 +182,210 @@ enum max77686_rtc_reg { | |||
181 | MAX77686_ALARM2_DATE = 0x1B, | 182 | MAX77686_ALARM2_DATE = 0x1B, |
182 | }; | 183 | }; |
183 | 184 | ||
185 | /* MAX77802 PMIC registers */ | ||
186 | enum max77802_pmic_reg { | ||
187 | MAX77802_REG_DEVICE_ID = 0x00, | ||
188 | MAX77802_REG_INTSRC = 0x01, | ||
189 | MAX77802_REG_INT1 = 0x02, | ||
190 | MAX77802_REG_INT2 = 0x03, | ||
191 | |||
192 | MAX77802_REG_INT1MSK = 0x04, | ||
193 | MAX77802_REG_INT2MSK = 0x05, | ||
194 | |||
195 | MAX77802_REG_STATUS1 = 0x06, | ||
196 | MAX77802_REG_STATUS2 = 0x07, | ||
197 | |||
198 | MAX77802_REG_PWRON = 0x08, | ||
199 | /* Reserved: 0x09 */ | ||
200 | MAX77802_REG_MRSTB = 0x0A, | ||
201 | MAX77802_REG_EPWRHOLD = 0x0B, | ||
202 | /* Reserved: 0x0C-0x0D */ | ||
203 | MAX77802_REG_BOOSTCTRL = 0x0E, | ||
204 | MAX77802_REG_BOOSTOUT = 0x0F, | ||
205 | |||
206 | MAX77802_REG_BUCK1CTRL = 0x10, | ||
207 | MAX77802_REG_BUCK1DVS1 = 0x11, | ||
208 | MAX77802_REG_BUCK1DVS2 = 0x12, | ||
209 | MAX77802_REG_BUCK1DVS3 = 0x13, | ||
210 | MAX77802_REG_BUCK1DVS4 = 0x14, | ||
211 | MAX77802_REG_BUCK1DVS5 = 0x15, | ||
212 | MAX77802_REG_BUCK1DVS6 = 0x16, | ||
213 | MAX77802_REG_BUCK1DVS7 = 0x17, | ||
214 | MAX77802_REG_BUCK1DVS8 = 0x18, | ||
215 | /* Reserved: 0x19 */ | ||
216 | MAX77802_REG_BUCK2CTRL1 = 0x1A, | ||
217 | MAX77802_REG_BUCK2CTRL2 = 0x1B, | ||
218 | MAX77802_REG_BUCK2PHTRAN = 0x1C, | ||
219 | MAX77802_REG_BUCK2DVS1 = 0x1D, | ||
220 | MAX77802_REG_BUCK2DVS2 = 0x1E, | ||
221 | MAX77802_REG_BUCK2DVS3 = 0x1F, | ||
222 | MAX77802_REG_BUCK2DVS4 = 0x20, | ||
223 | MAX77802_REG_BUCK2DVS5 = 0x21, | ||
224 | MAX77802_REG_BUCK2DVS6 = 0x22, | ||
225 | MAX77802_REG_BUCK2DVS7 = 0x23, | ||
226 | MAX77802_REG_BUCK2DVS8 = 0x24, | ||
227 | /* Reserved: 0x25-0x26 */ | ||
228 | MAX77802_REG_BUCK3CTRL1 = 0x27, | ||
229 | MAX77802_REG_BUCK3DVS1 = 0x28, | ||
230 | MAX77802_REG_BUCK3DVS2 = 0x29, | ||
231 | MAX77802_REG_BUCK3DVS3 = 0x2A, | ||
232 | MAX77802_REG_BUCK3DVS4 = 0x2B, | ||
233 | MAX77802_REG_BUCK3DVS5 = 0x2C, | ||
234 | MAX77802_REG_BUCK3DVS6 = 0x2D, | ||
235 | MAX77802_REG_BUCK3DVS7 = 0x2E, | ||
236 | MAX77802_REG_BUCK3DVS8 = 0x2F, | ||
237 | /* Reserved: 0x30-0x36 */ | ||
238 | MAX77802_REG_BUCK4CTRL1 = 0x37, | ||
239 | MAX77802_REG_BUCK4DVS1 = 0x38, | ||
240 | MAX77802_REG_BUCK4DVS2 = 0x39, | ||
241 | MAX77802_REG_BUCK4DVS3 = 0x3A, | ||
242 | MAX77802_REG_BUCK4DVS4 = 0x3B, | ||
243 | MAX77802_REG_BUCK4DVS5 = 0x3C, | ||
244 | MAX77802_REG_BUCK4DVS6 = 0x3D, | ||
245 | MAX77802_REG_BUCK4DVS7 = 0x3E, | ||
246 | MAX77802_REG_BUCK4DVS8 = 0x3F, | ||
247 | /* Reserved: 0x40 */ | ||
248 | MAX77802_REG_BUCK5CTRL = 0x41, | ||
249 | MAX77802_REG_BUCK5OUT = 0x42, | ||
250 | /* Reserved: 0x43 */ | ||
251 | MAX77802_REG_BUCK6CTRL = 0x44, | ||
252 | MAX77802_REG_BUCK6DVS1 = 0x45, | ||
253 | MAX77802_REG_BUCK6DVS2 = 0x46, | ||
254 | MAX77802_REG_BUCK6DVS3 = 0x47, | ||
255 | MAX77802_REG_BUCK6DVS4 = 0x48, | ||
256 | MAX77802_REG_BUCK6DVS5 = 0x49, | ||
257 | MAX77802_REG_BUCK6DVS6 = 0x4A, | ||
258 | MAX77802_REG_BUCK6DVS7 = 0x4B, | ||
259 | MAX77802_REG_BUCK6DVS8 = 0x4C, | ||
260 | /* Reserved: 0x4D */ | ||
261 | MAX77802_REG_BUCK7CTRL = 0x4E, | ||
262 | MAX77802_REG_BUCK7OUT = 0x4F, | ||
263 | /* Reserved: 0x50 */ | ||
264 | MAX77802_REG_BUCK8CTRL = 0x51, | ||
265 | MAX77802_REG_BUCK8OUT = 0x52, | ||
266 | /* Reserved: 0x53 */ | ||
267 | MAX77802_REG_BUCK9CTRL = 0x54, | ||
268 | MAX77802_REG_BUCK9OUT = 0x55, | ||
269 | /* Reserved: 0x56 */ | ||
270 | MAX77802_REG_BUCK10CTRL = 0x57, | ||
271 | MAX77802_REG_BUCK10OUT = 0x58, | ||
272 | |||
273 | /* Reserved: 0x59-0x5F */ | ||
274 | |||
275 | MAX77802_REG_LDO1CTRL1 = 0x60, | ||
276 | MAX77802_REG_LDO2CTRL1 = 0x61, | ||
277 | MAX77802_REG_LDO3CTRL1 = 0x62, | ||
278 | MAX77802_REG_LDO4CTRL1 = 0x63, | ||
279 | MAX77802_REG_LDO5CTRL1 = 0x64, | ||
280 | MAX77802_REG_LDO6CTRL1 = 0x65, | ||
281 | MAX77802_REG_LDO7CTRL1 = 0x66, | ||
282 | MAX77802_REG_LDO8CTRL1 = 0x67, | ||
283 | MAX77802_REG_LDO9CTRL1 = 0x68, | ||
284 | MAX77802_REG_LDO10CTRL1 = 0x69, | ||
285 | MAX77802_REG_LDO11CTRL1 = 0x6A, | ||
286 | MAX77802_REG_LDO12CTRL1 = 0x6B, | ||
287 | MAX77802_REG_LDO13CTRL1 = 0x6C, | ||
288 | MAX77802_REG_LDO14CTRL1 = 0x6D, | ||
289 | MAX77802_REG_LDO15CTRL1 = 0x6E, | ||
290 | /* Reserved: 0x6F */ | ||
291 | MAX77802_REG_LDO17CTRL1 = 0x70, | ||
292 | MAX77802_REG_LDO18CTRL1 = 0x71, | ||
293 | MAX77802_REG_LDO19CTRL1 = 0x72, | ||
294 | MAX77802_REG_LDO20CTRL1 = 0x73, | ||
295 | MAX77802_REG_LDO21CTRL1 = 0x74, | ||
296 | MAX77802_REG_LDO22CTRL1 = 0x75, | ||
297 | MAX77802_REG_LDO23CTRL1 = 0x76, | ||
298 | MAX77802_REG_LDO24CTRL1 = 0x77, | ||
299 | MAX77802_REG_LDO25CTRL1 = 0x78, | ||
300 | MAX77802_REG_LDO26CTRL1 = 0x79, | ||
301 | MAX77802_REG_LDO27CTRL1 = 0x7A, | ||
302 | MAX77802_REG_LDO28CTRL1 = 0x7B, | ||
303 | MAX77802_REG_LDO29CTRL1 = 0x7C, | ||
304 | MAX77802_REG_LDO30CTRL1 = 0x7D, | ||
305 | /* Reserved: 0x7E */ | ||
306 | MAX77802_REG_LDO32CTRL1 = 0x7F, | ||
307 | MAX77802_REG_LDO33CTRL1 = 0x80, | ||
308 | MAX77802_REG_LDO34CTRL1 = 0x81, | ||
309 | MAX77802_REG_LDO35CTRL1 = 0x82, | ||
310 | /* Reserved: 0x83-0x8F */ | ||
311 | MAX77802_REG_LDO1CTRL2 = 0x90, | ||
312 | MAX77802_REG_LDO2CTRL2 = 0x91, | ||
313 | MAX77802_REG_LDO3CTRL2 = 0x92, | ||
314 | MAX77802_REG_LDO4CTRL2 = 0x93, | ||
315 | MAX77802_REG_LDO5CTRL2 = 0x94, | ||
316 | MAX77802_REG_LDO6CTRL2 = 0x95, | ||
317 | MAX77802_REG_LDO7CTRL2 = 0x96, | ||
318 | MAX77802_REG_LDO8CTRL2 = 0x97, | ||
319 | MAX77802_REG_LDO9CTRL2 = 0x98, | ||
320 | MAX77802_REG_LDO10CTRL2 = 0x99, | ||
321 | MAX77802_REG_LDO11CTRL2 = 0x9A, | ||
322 | MAX77802_REG_LDO12CTRL2 = 0x9B, | ||
323 | MAX77802_REG_LDO13CTRL2 = 0x9C, | ||
324 | MAX77802_REG_LDO14CTRL2 = 0x9D, | ||
325 | MAX77802_REG_LDO15CTRL2 = 0x9E, | ||
326 | /* Reserved: 0x9F */ | ||
327 | MAX77802_REG_LDO17CTRL2 = 0xA0, | ||
328 | MAX77802_REG_LDO18CTRL2 = 0xA1, | ||
329 | MAX77802_REG_LDO19CTRL2 = 0xA2, | ||
330 | MAX77802_REG_LDO20CTRL2 = 0xA3, | ||
331 | MAX77802_REG_LDO21CTRL2 = 0xA4, | ||
332 | MAX77802_REG_LDO22CTRL2 = 0xA5, | ||
333 | MAX77802_REG_LDO23CTRL2 = 0xA6, | ||
334 | MAX77802_REG_LDO24CTRL2 = 0xA7, | ||
335 | MAX77802_REG_LDO25CTRL2 = 0xA8, | ||
336 | MAX77802_REG_LDO26CTRL2 = 0xA9, | ||
337 | MAX77802_REG_LDO27CTRL2 = 0xAA, | ||
338 | MAX77802_REG_LDO28CTRL2 = 0xAB, | ||
339 | MAX77802_REG_LDO29CTRL2 = 0xAC, | ||
340 | MAX77802_REG_LDO30CTRL2 = 0xAD, | ||
341 | /* Reserved: 0xAE */ | ||
342 | MAX77802_REG_LDO32CTRL2 = 0xAF, | ||
343 | MAX77802_REG_LDO33CTRL2 = 0xB0, | ||
344 | MAX77802_REG_LDO34CTRL2 = 0xB1, | ||
345 | MAX77802_REG_LDO35CTRL2 = 0xB2, | ||
346 | /* Reserved: 0xB3 */ | ||
347 | |||
348 | MAX77802_REG_BBAT_CHG = 0xB4, | ||
349 | MAX77802_REG_32KHZ = 0xB5, | ||
350 | |||
351 | MAX77802_REG_PMIC_END = 0xB6, | ||
352 | }; | ||
353 | |||
354 | enum max77802_rtc_reg { | ||
355 | MAX77802_RTC_INT = 0xC0, | ||
356 | MAX77802_RTC_INTM = 0xC1, | ||
357 | MAX77802_RTC_CONTROLM = 0xC2, | ||
358 | MAX77802_RTC_CONTROL = 0xC3, | ||
359 | MAX77802_RTC_UPDATE0 = 0xC4, | ||
360 | MAX77802_RTC_UPDATE1 = 0xC5, | ||
361 | MAX77802_WTSR_SMPL_CNTL = 0xC6, | ||
362 | MAX77802_RTC_SEC = 0xC7, | ||
363 | MAX77802_RTC_MIN = 0xC8, | ||
364 | MAX77802_RTC_HOUR = 0xC9, | ||
365 | MAX77802_RTC_WEEKDAY = 0xCA, | ||
366 | MAX77802_RTC_MONTH = 0xCB, | ||
367 | MAX77802_RTC_YEAR = 0xCC, | ||
368 | MAX77802_RTC_DATE = 0xCD, | ||
369 | MAX77802_RTC_AE1 = 0xCE, | ||
370 | MAX77802_ALARM1_SEC = 0xCF, | ||
371 | MAX77802_ALARM1_MIN = 0xD0, | ||
372 | MAX77802_ALARM1_HOUR = 0xD1, | ||
373 | MAX77802_ALARM1_WEEKDAY = 0xD2, | ||
374 | MAX77802_ALARM1_MONTH = 0xD3, | ||
375 | MAX77802_ALARM1_YEAR = 0xD4, | ||
376 | MAX77802_ALARM1_DATE = 0xD5, | ||
377 | MAX77802_RTC_AE2 = 0xD6, | ||
378 | MAX77802_ALARM2_SEC = 0xD7, | ||
379 | MAX77802_ALARM2_MIN = 0xD8, | ||
380 | MAX77802_ALARM2_HOUR = 0xD9, | ||
381 | MAX77802_ALARM2_WEEKDAY = 0xDA, | ||
382 | MAX77802_ALARM2_MONTH = 0xDB, | ||
383 | MAX77802_ALARM2_YEAR = 0xDC, | ||
384 | MAX77802_ALARM2_DATE = 0xDD, | ||
385 | |||
386 | MAX77802_RTC_END = 0xDF, | ||
387 | }; | ||
388 | |||
184 | enum max77686_irq_source { | 389 | enum max77686_irq_source { |
185 | PMIC_INT1 = 0, | 390 | PMIC_INT1 = 0, |
186 | PMIC_INT2, | 391 | PMIC_INT2, |
@@ -250,6 +455,7 @@ struct max77686_dev { | |||
250 | 455 | ||
251 | enum max77686_types { | 456 | enum max77686_types { |
252 | TYPE_MAX77686, | 457 | TYPE_MAX77686, |
458 | TYPE_MAX77802, | ||
253 | }; | 459 | }; |
254 | 460 | ||
255 | extern int max77686_irq_init(struct max77686_dev *max77686); | 461 | extern int max77686_irq_init(struct max77686_dev *max77686); |
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h index 4cbcc13e8a2a..7e6dc4b2b795 100644 --- a/include/linux/mfd/max77686.h +++ b/include/linux/mfd/max77686.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * max77686.h - Driver for the Maxim 77686 | 2 | * max77686.h - Driver for the Maxim 77686/802 |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Samsung Electrnoics | 4 | * Copyright (C) 2012 Samsung Electrnoics |
5 | * Chiwoong Byun <woong.byun@samsung.com> | 5 | * Chiwoong Byun <woong.byun@samsung.com> |
@@ -71,6 +71,54 @@ enum max77686_regulators { | |||
71 | MAX77686_REG_MAX, | 71 | MAX77686_REG_MAX, |
72 | }; | 72 | }; |
73 | 73 | ||
74 | /* MAX77802 regulator IDs */ | ||
75 | enum max77802_regulators { | ||
76 | MAX77802_BUCK1 = 0, | ||
77 | MAX77802_BUCK2, | ||
78 | MAX77802_BUCK3, | ||
79 | MAX77802_BUCK4, | ||
80 | MAX77802_BUCK5, | ||
81 | MAX77802_BUCK6, | ||
82 | MAX77802_BUCK7, | ||
83 | MAX77802_BUCK8, | ||
84 | MAX77802_BUCK9, | ||
85 | MAX77802_BUCK10, | ||
86 | MAX77802_LDO1, | ||
87 | MAX77802_LDO2, | ||
88 | MAX77802_LDO3, | ||
89 | MAX77802_LDO4, | ||
90 | MAX77802_LDO5, | ||
91 | MAX77802_LDO6, | ||
92 | MAX77802_LDO7, | ||
93 | MAX77802_LDO8, | ||
94 | MAX77802_LDO9, | ||
95 | MAX77802_LDO10, | ||
96 | MAX77802_LDO11, | ||
97 | MAX77802_LDO12, | ||
98 | MAX77802_LDO13, | ||
99 | MAX77802_LDO14, | ||
100 | MAX77802_LDO15, | ||
101 | MAX77802_LDO17, | ||
102 | MAX77802_LDO18, | ||
103 | MAX77802_LDO19, | ||
104 | MAX77802_LDO20, | ||
105 | MAX77802_LDO21, | ||
106 | MAX77802_LDO23, | ||
107 | MAX77802_LDO24, | ||
108 | MAX77802_LDO25, | ||
109 | MAX77802_LDO26, | ||
110 | MAX77802_LDO27, | ||
111 | MAX77802_LDO28, | ||
112 | MAX77802_LDO29, | ||
113 | MAX77802_LDO30, | ||
114 | MAX77802_LDO32, | ||
115 | MAX77802_LDO33, | ||
116 | MAX77802_LDO34, | ||
117 | MAX77802_LDO35, | ||
118 | |||
119 | MAX77802_REG_MAX, | ||
120 | }; | ||
121 | |||
74 | struct max77686_regulator_data { | 122 | struct max77686_regulator_data { |
75 | int id; | 123 | int id; |
76 | struct regulator_init_data *initdata; | 124 | struct regulator_init_data *initdata; |
@@ -83,6 +131,13 @@ enum max77686_opmode { | |||
83 | MAX77686_OPMODE_STANDBY, | 131 | MAX77686_OPMODE_STANDBY, |
84 | }; | 132 | }; |
85 | 133 | ||
134 | enum max77802_opmode { | ||
135 | MAX77802_OPMODE_OFF, | ||
136 | MAX77802_OPMODE_STANDBY, | ||
137 | MAX77802_OPMODE_LP, | ||
138 | MAX77802_OPMODE_NORMAL, | ||
139 | }; | ||
140 | |||
86 | struct max77686_opmode_data { | 141 | struct max77686_opmode_data { |
87 | int id; | 142 | int id; |
88 | int mode; | 143 | int mode; |