Commit 15f77300c9eedb095c8f4097628af51e8e14de30
Committed by
Mark Brown
1 parent
236b11de51
Exists in
master
and in
13 other branches
regulator: s2mps11: Add support for S2MPS14 regulators
Add support for S2MPS14 PMIC regulators to s2mps11 driver. The S2MPS14 has fewer BUCK-s and LDO-s than S2MPS11. It also does not support controlling the BUCK ramp delay. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Cc: Mark Brown <broonie@kernel.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Showing 2 changed files with 196 additions and 65 deletions Side-by-side Diff
drivers/regulator/Kconfig
... | ... | @@ -424,12 +424,13 @@ |
424 | 424 | via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs. |
425 | 425 | |
426 | 426 | config REGULATOR_S2MPS11 |
427 | - tristate "Samsung S2MPS11 voltage regulator" | |
427 | + tristate "Samsung S2MPS11/S2MPS14 voltage regulator" | |
428 | 428 | depends on MFD_SEC_CORE |
429 | 429 | help |
430 | - This driver supports a Samsung S2MPS11 voltage output regulator | |
431 | - via I2C bus. S2MPS11 is comprised of high efficient Buck converters | |
432 | - including Dual-Phase Buck converter, Buck-Boost converter, various LDOs. | |
430 | + This driver supports a Samsung S2MPS11/S2MPS14 voltage output | |
431 | + regulator via I2C bus. The chip is comprised of high efficient Buck | |
432 | + converters including Dual-Phase Buck converter, Buck-Boost converter, | |
433 | + various LDOs. | |
433 | 434 | |
434 | 435 | config REGULATOR_S5M8767 |
435 | 436 | tristate "Samsung S5M8767A voltage regulator" |
drivers/regulator/s2mps11.c
1 | 1 | /* |
2 | 2 | * s2mps11.c |
3 | 3 | * |
4 | - * Copyright (c) 2012 Samsung Electronics Co., Ltd | |
4 | + * Copyright (c) 2012-2014 Samsung Electronics Co., Ltd | |
5 | 5 | * http://www.samsung.com |
6 | 6 | * |
7 | - * This program is free software; you can redistribute it and/or modify it | |
8 | - * under the terms of the GNU General Public License as published by the | |
9 | - * Free Software Foundation; either version 2 of the License, or (at your | |
10 | - * option) any later version. | |
7 | + * This program is free software; you can redistribute it and/or modify it | |
8 | + * under the terms of the GNU General Public License as published by the | |
9 | + * Free Software Foundation; either version 2 of the License, or (at your | |
10 | + * option) any later version. | |
11 | 11 | * |
12 | + * This program is distributed in the hope that it will be useful, | |
13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | + * GNU General Public License for more details. | |
16 | + * | |
12 | 17 | */ |
13 | 18 | |
14 | 19 | #include <linux/bug.h> |
... | ... | @@ -24,6 +29,7 @@ |
24 | 29 | #include <linux/regulator/of_regulator.h> |
25 | 30 | #include <linux/mfd/samsung/core.h> |
26 | 31 | #include <linux/mfd/samsung/s2mps11.h> |
32 | +#include <linux/mfd/samsung/s2mps14.h> | |
27 | 33 | |
28 | 34 | struct s2mps11_info { |
29 | 35 | unsigned int rdev_num; |
... | ... | @@ -233,7 +239,7 @@ |
233 | 239 | .set_ramp_delay = s2mps11_set_ramp_delay, |
234 | 240 | }; |
235 | 241 | |
236 | -#define regulator_desc_ldo1(num) { \ | |
242 | +#define regulator_desc_s2mps11_ldo1(num) { \ | |
237 | 243 | .name = "LDO"#num, \ |
238 | 244 | .id = S2MPS11_LDO##num, \ |
239 | 245 | .ops = &s2mps11_ldo_ops, \ |
... | ... | @@ -247,7 +253,7 @@ |
247 | 253 | .enable_reg = S2MPS11_REG_L1CTRL + num - 1, \ |
248 | 254 | .enable_mask = S2MPS11_ENABLE_MASK \ |
249 | 255 | } |
250 | -#define regulator_desc_ldo2(num) { \ | |
256 | +#define regulator_desc_s2mps11_ldo2(num) { \ | |
251 | 257 | .name = "LDO"#num, \ |
252 | 258 | .id = S2MPS11_LDO##num, \ |
253 | 259 | .ops = &s2mps11_ldo_ops, \ |
... | ... | @@ -262,7 +268,7 @@ |
262 | 268 | .enable_mask = S2MPS11_ENABLE_MASK \ |
263 | 269 | } |
264 | 270 | |
265 | -#define regulator_desc_buck1_4(num) { \ | |
271 | +#define regulator_desc_s2mps11_buck1_4(num) { \ | |
266 | 272 | .name = "BUCK"#num, \ |
267 | 273 | .id = S2MPS11_BUCK##num, \ |
268 | 274 | .ops = &s2mps11_buck_ops, \ |
... | ... | @@ -278,7 +284,7 @@ |
278 | 284 | .enable_mask = S2MPS11_ENABLE_MASK \ |
279 | 285 | } |
280 | 286 | |
281 | -#define regulator_desc_buck5 { \ | |
287 | +#define regulator_desc_s2mps11_buck5 { \ | |
282 | 288 | .name = "BUCK5", \ |
283 | 289 | .id = S2MPS11_BUCK5, \ |
284 | 290 | .ops = &s2mps11_buck_ops, \ |
... | ... | @@ -294,7 +300,7 @@ |
294 | 300 | .enable_mask = S2MPS11_ENABLE_MASK \ |
295 | 301 | } |
296 | 302 | |
297 | -#define regulator_desc_buck6_8(num) { \ | |
303 | +#define regulator_desc_s2mps11_buck6_8(num) { \ | |
298 | 304 | .name = "BUCK"#num, \ |
299 | 305 | .id = S2MPS11_BUCK##num, \ |
300 | 306 | .ops = &s2mps11_buck_ops, \ |
... | ... | @@ -310,7 +316,7 @@ |
310 | 316 | .enable_mask = S2MPS11_ENABLE_MASK \ |
311 | 317 | } |
312 | 318 | |
313 | -#define regulator_desc_buck9 { \ | |
319 | +#define regulator_desc_s2mps11_buck9 { \ | |
314 | 320 | .name = "BUCK9", \ |
315 | 321 | .id = S2MPS11_BUCK9, \ |
316 | 322 | .ops = &s2mps11_buck_ops, \ |
... | ... | @@ -326,7 +332,7 @@ |
326 | 332 | .enable_mask = S2MPS11_ENABLE_MASK \ |
327 | 333 | } |
328 | 334 | |
329 | -#define regulator_desc_buck10 { \ | |
335 | +#define regulator_desc_s2mps11_buck10 { \ | |
330 | 336 | .name = "BUCK10", \ |
331 | 337 | .id = S2MPS11_BUCK10, \ |
332 | 338 | .ops = &s2mps11_buck_ops, \ |
333 | 339 | |
... | ... | @@ -343,56 +349,175 @@ |
343 | 349 | } |
344 | 350 | |
345 | 351 | static const struct regulator_desc s2mps11_regulators[] = { |
346 | - regulator_desc_ldo2(1), | |
347 | - regulator_desc_ldo1(2), | |
348 | - regulator_desc_ldo1(3), | |
349 | - regulator_desc_ldo1(4), | |
350 | - regulator_desc_ldo1(5), | |
351 | - regulator_desc_ldo2(6), | |
352 | - regulator_desc_ldo1(7), | |
353 | - regulator_desc_ldo1(8), | |
354 | - regulator_desc_ldo1(9), | |
355 | - regulator_desc_ldo1(10), | |
356 | - regulator_desc_ldo2(11), | |
357 | - regulator_desc_ldo1(12), | |
358 | - regulator_desc_ldo1(13), | |
359 | - regulator_desc_ldo1(14), | |
360 | - regulator_desc_ldo1(15), | |
361 | - regulator_desc_ldo1(16), | |
362 | - regulator_desc_ldo1(17), | |
363 | - regulator_desc_ldo1(18), | |
364 | - regulator_desc_ldo1(19), | |
365 | - regulator_desc_ldo1(20), | |
366 | - regulator_desc_ldo1(21), | |
367 | - regulator_desc_ldo2(22), | |
368 | - regulator_desc_ldo2(23), | |
369 | - regulator_desc_ldo1(24), | |
370 | - regulator_desc_ldo1(25), | |
371 | - regulator_desc_ldo1(26), | |
372 | - regulator_desc_ldo2(27), | |
373 | - regulator_desc_ldo1(28), | |
374 | - regulator_desc_ldo1(29), | |
375 | - regulator_desc_ldo1(30), | |
376 | - regulator_desc_ldo1(31), | |
377 | - regulator_desc_ldo1(32), | |
378 | - regulator_desc_ldo1(33), | |
379 | - regulator_desc_ldo1(34), | |
380 | - regulator_desc_ldo1(35), | |
381 | - regulator_desc_ldo1(36), | |
382 | - regulator_desc_ldo1(37), | |
383 | - regulator_desc_ldo1(38), | |
384 | - regulator_desc_buck1_4(1), | |
385 | - regulator_desc_buck1_4(2), | |
386 | - regulator_desc_buck1_4(3), | |
387 | - regulator_desc_buck1_4(4), | |
388 | - regulator_desc_buck5, | |
389 | - regulator_desc_buck6_8(6), | |
390 | - regulator_desc_buck6_8(7), | |
391 | - regulator_desc_buck6_8(8), | |
392 | - regulator_desc_buck9, | |
393 | - regulator_desc_buck10, | |
352 | + regulator_desc_s2mps11_ldo2(1), | |
353 | + regulator_desc_s2mps11_ldo1(2), | |
354 | + regulator_desc_s2mps11_ldo1(3), | |
355 | + regulator_desc_s2mps11_ldo1(4), | |
356 | + regulator_desc_s2mps11_ldo1(5), | |
357 | + regulator_desc_s2mps11_ldo2(6), | |
358 | + regulator_desc_s2mps11_ldo1(7), | |
359 | + regulator_desc_s2mps11_ldo1(8), | |
360 | + regulator_desc_s2mps11_ldo1(9), | |
361 | + regulator_desc_s2mps11_ldo1(10), | |
362 | + regulator_desc_s2mps11_ldo2(11), | |
363 | + regulator_desc_s2mps11_ldo1(12), | |
364 | + regulator_desc_s2mps11_ldo1(13), | |
365 | + regulator_desc_s2mps11_ldo1(14), | |
366 | + regulator_desc_s2mps11_ldo1(15), | |
367 | + regulator_desc_s2mps11_ldo1(16), | |
368 | + regulator_desc_s2mps11_ldo1(17), | |
369 | + regulator_desc_s2mps11_ldo1(18), | |
370 | + regulator_desc_s2mps11_ldo1(19), | |
371 | + regulator_desc_s2mps11_ldo1(20), | |
372 | + regulator_desc_s2mps11_ldo1(21), | |
373 | + regulator_desc_s2mps11_ldo2(22), | |
374 | + regulator_desc_s2mps11_ldo2(23), | |
375 | + regulator_desc_s2mps11_ldo1(24), | |
376 | + regulator_desc_s2mps11_ldo1(25), | |
377 | + regulator_desc_s2mps11_ldo1(26), | |
378 | + regulator_desc_s2mps11_ldo2(27), | |
379 | + regulator_desc_s2mps11_ldo1(28), | |
380 | + regulator_desc_s2mps11_ldo1(29), | |
381 | + regulator_desc_s2mps11_ldo1(30), | |
382 | + regulator_desc_s2mps11_ldo1(31), | |
383 | + regulator_desc_s2mps11_ldo1(32), | |
384 | + regulator_desc_s2mps11_ldo1(33), | |
385 | + regulator_desc_s2mps11_ldo1(34), | |
386 | + regulator_desc_s2mps11_ldo1(35), | |
387 | + regulator_desc_s2mps11_ldo1(36), | |
388 | + regulator_desc_s2mps11_ldo1(37), | |
389 | + regulator_desc_s2mps11_ldo1(38), | |
390 | + regulator_desc_s2mps11_buck1_4(1), | |
391 | + regulator_desc_s2mps11_buck1_4(2), | |
392 | + regulator_desc_s2mps11_buck1_4(3), | |
393 | + regulator_desc_s2mps11_buck1_4(4), | |
394 | + regulator_desc_s2mps11_buck5, | |
395 | + regulator_desc_s2mps11_buck6_8(6), | |
396 | + regulator_desc_s2mps11_buck6_8(7), | |
397 | + regulator_desc_s2mps11_buck6_8(8), | |
398 | + regulator_desc_s2mps11_buck9, | |
399 | + regulator_desc_s2mps11_buck10, | |
394 | 400 | }; |
395 | 401 | |
402 | +static struct regulator_ops s2mps14_reg_ops = { | |
403 | + .list_voltage = regulator_list_voltage_linear, | |
404 | + .map_voltage = regulator_map_voltage_linear, | |
405 | + .is_enabled = regulator_is_enabled_regmap, | |
406 | + .enable = regulator_enable_regmap, | |
407 | + .disable = regulator_disable_regmap, | |
408 | + .get_voltage_sel = regulator_get_voltage_sel_regmap, | |
409 | + .set_voltage_sel = regulator_set_voltage_sel_regmap, | |
410 | + .set_voltage_time_sel = regulator_set_voltage_time_sel, | |
411 | +}; | |
412 | + | |
413 | +#define regulator_desc_s2mps14_ldo1(num) { \ | |
414 | + .name = "LDO"#num, \ | |
415 | + .id = S2MPS14_LDO##num, \ | |
416 | + .ops = &s2mps14_reg_ops, \ | |
417 | + .type = REGULATOR_VOLTAGE, \ | |
418 | + .owner = THIS_MODULE, \ | |
419 | + .min_uV = S2MPS14_LDO_MIN_800MV, \ | |
420 | + .uV_step = S2MPS14_LDO_STEP_25MV, \ | |
421 | + .n_voltages = S2MPS14_LDO_N_VOLTAGES, \ | |
422 | + .vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
423 | + .vsel_mask = S2MPS14_LDO_VSEL_MASK, \ | |
424 | + .enable_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
425 | + .enable_mask = S2MPS14_ENABLE_MASK \ | |
426 | +} | |
427 | +#define regulator_desc_s2mps14_ldo2(num) { \ | |
428 | + .name = "LDO"#num, \ | |
429 | + .id = S2MPS14_LDO##num, \ | |
430 | + .ops = &s2mps14_reg_ops, \ | |
431 | + .type = REGULATOR_VOLTAGE, \ | |
432 | + .owner = THIS_MODULE, \ | |
433 | + .min_uV = S2MPS14_LDO_MIN_1800MV, \ | |
434 | + .uV_step = S2MPS14_LDO_STEP_25MV, \ | |
435 | + .n_voltages = S2MPS14_LDO_N_VOLTAGES, \ | |
436 | + .vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
437 | + .vsel_mask = S2MPS14_LDO_VSEL_MASK, \ | |
438 | + .enable_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
439 | + .enable_mask = S2MPS14_ENABLE_MASK \ | |
440 | +} | |
441 | +#define regulator_desc_s2mps14_ldo3(num) { \ | |
442 | + .name = "LDO"#num, \ | |
443 | + .id = S2MPS14_LDO##num, \ | |
444 | + .ops = &s2mps14_reg_ops, \ | |
445 | + .type = REGULATOR_VOLTAGE, \ | |
446 | + .owner = THIS_MODULE, \ | |
447 | + .min_uV = S2MPS14_LDO_MIN_800MV, \ | |
448 | + .uV_step = S2MPS14_LDO_STEP_12_5MV, \ | |
449 | + .n_voltages = S2MPS14_LDO_N_VOLTAGES, \ | |
450 | + .vsel_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
451 | + .vsel_mask = S2MPS14_LDO_VSEL_MASK, \ | |
452 | + .enable_reg = S2MPS14_REG_L1CTRL + num - 1, \ | |
453 | + .enable_mask = S2MPS14_ENABLE_MASK \ | |
454 | +} | |
455 | +#define regulator_desc_s2mps14_buck1235(num) { \ | |
456 | + .name = "BUCK"#num, \ | |
457 | + .id = S2MPS14_BUCK##num, \ | |
458 | + .ops = &s2mps14_reg_ops, \ | |
459 | + .type = REGULATOR_VOLTAGE, \ | |
460 | + .owner = THIS_MODULE, \ | |
461 | + .min_uV = S2MPS14_BUCK1235_MIN_600MV, \ | |
462 | + .uV_step = S2MPS14_BUCK1235_STEP_6_25MV, \ | |
463 | + .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ | |
464 | + .linear_min_sel = S2MPS14_BUCK1235_START_SEL, \ | |
465 | + .ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \ | |
466 | + .vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \ | |
467 | + .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \ | |
468 | + .enable_reg = S2MPS14_REG_B1CTRL1 + (num - 1) * 2, \ | |
469 | + .enable_mask = S2MPS14_ENABLE_MASK \ | |
470 | +} | |
471 | +#define regulator_desc_s2mps14_buck4(num) { \ | |
472 | + .name = "BUCK"#num, \ | |
473 | + .id = S2MPS14_BUCK##num, \ | |
474 | + .ops = &s2mps14_reg_ops, \ | |
475 | + .type = REGULATOR_VOLTAGE, \ | |
476 | + .owner = THIS_MODULE, \ | |
477 | + .min_uV = S2MPS14_BUCK4_MIN_1400MV, \ | |
478 | + .uV_step = S2MPS14_BUCK4_STEP_12_5MV, \ | |
479 | + .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \ | |
480 | + .linear_min_sel = S2MPS14_BUCK4_START_SEL, \ | |
481 | + .ramp_delay = S2MPS14_BUCK_RAMP_DELAY, \ | |
482 | + .vsel_reg = S2MPS14_REG_B1CTRL2 + (num - 1) * 2, \ | |
483 | + .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \ | |
484 | + .enable_reg = S2MPS14_REG_B1CTRL1 + (num - 1) * 2, \ | |
485 | + .enable_mask = S2MPS14_ENABLE_MASK \ | |
486 | +} | |
487 | + | |
488 | +static const struct regulator_desc s2mps14_regulators[] = { | |
489 | + regulator_desc_s2mps14_ldo3(1), | |
490 | + regulator_desc_s2mps14_ldo3(2), | |
491 | + regulator_desc_s2mps14_ldo1(3), | |
492 | + regulator_desc_s2mps14_ldo1(4), | |
493 | + regulator_desc_s2mps14_ldo3(5), | |
494 | + regulator_desc_s2mps14_ldo3(6), | |
495 | + regulator_desc_s2mps14_ldo1(7), | |
496 | + regulator_desc_s2mps14_ldo2(8), | |
497 | + regulator_desc_s2mps14_ldo3(9), | |
498 | + regulator_desc_s2mps14_ldo3(10), | |
499 | + regulator_desc_s2mps14_ldo1(11), | |
500 | + regulator_desc_s2mps14_ldo2(12), | |
501 | + regulator_desc_s2mps14_ldo2(13), | |
502 | + regulator_desc_s2mps14_ldo2(14), | |
503 | + regulator_desc_s2mps14_ldo2(15), | |
504 | + regulator_desc_s2mps14_ldo2(16), | |
505 | + regulator_desc_s2mps14_ldo2(17), | |
506 | + regulator_desc_s2mps14_ldo2(18), | |
507 | + regulator_desc_s2mps14_ldo1(19), | |
508 | + regulator_desc_s2mps14_ldo1(20), | |
509 | + regulator_desc_s2mps14_ldo1(21), | |
510 | + regulator_desc_s2mps14_ldo3(22), | |
511 | + regulator_desc_s2mps14_ldo1(23), | |
512 | + regulator_desc_s2mps14_ldo2(24), | |
513 | + regulator_desc_s2mps14_ldo2(25), | |
514 | + regulator_desc_s2mps14_buck1235(1), | |
515 | + regulator_desc_s2mps14_buck1235(2), | |
516 | + regulator_desc_s2mps14_buck1235(3), | |
517 | + regulator_desc_s2mps14_buck4(4), | |
518 | + regulator_desc_s2mps14_buck1235(5), | |
519 | +}; | |
520 | + | |
396 | 521 | static int s2mps11_pmic_probe(struct platform_device *pdev) |
397 | 522 | { |
398 | 523 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
... | ... | @@ -416,6 +541,10 @@ |
416 | 541 | s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); |
417 | 542 | regulators = s2mps11_regulators; |
418 | 543 | break; |
544 | + case S2MPS14X: | |
545 | + s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators); | |
546 | + regulators = s2mps14_regulators; | |
547 | + break; | |
419 | 548 | default: |
420 | 549 | dev_err(&pdev->dev, "Invalid device type: %u\n", dev_type); |
421 | 550 | return -EINVAL; |
... | ... | @@ -482,6 +611,7 @@ |
482 | 611 | |
483 | 612 | static const struct platform_device_id s2mps11_pmic_id[] = { |
484 | 613 | { "s2mps11-pmic", S2MPS11X}, |
614 | + { "s2mps14-pmic", S2MPS14X}, | |
485 | 615 | { }, |
486 | 616 | }; |
487 | 617 | MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id); |
... | ... | @@ -509,6 +639,6 @@ |
509 | 639 | |
510 | 640 | /* Module information */ |
511 | 641 | MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>"); |
512 | -MODULE_DESCRIPTION("SAMSUNG S2MPS11 Regulator Driver"); | |
642 | +MODULE_DESCRIPTION("SAMSUNG S2MPS11/S2MPS14 Regulator Driver"); | |
513 | 643 | MODULE_LICENSE("GPL"); |