aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-03-07 05:10:50 -0500
committerMark Brown <broonie@linaro.org>2014-03-19 09:02:51 -0400
commit15f77300c9eedb095c8f4097628af51e8e14de30 (patch)
tree3442c586ccaa8a01e28874e2af1c0f41c7c665f9
parent236b11de51c7501c454ca125d84152b06ef7f27e (diff)
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>
-rw-r--r--drivers/regulator/Kconfig9
-rw-r--r--drivers/regulator/s2mps11.c252
2 files changed, 196 insertions, 65 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 8f8e6710bb45..69e6bf755e00 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -424,12 +424,13 @@ config REGULATOR_S2MPA01
424 via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs. 424 via I2C bus. S2MPA01 has 10 Bucks and 26 LDO outputs.
425 425
426config REGULATOR_S2MPS11 426config REGULATOR_S2MPS11
427 tristate "Samsung S2MPS11 voltage regulator" 427 tristate "Samsung S2MPS11/S2MPS14 voltage regulator"
428 depends on MFD_SEC_CORE 428 depends on MFD_SEC_CORE
429 help 429 help
430 This driver supports a Samsung S2MPS11 voltage output regulator 430 This driver supports a Samsung S2MPS11/S2MPS14 voltage output
431 via I2C bus. S2MPS11 is comprised of high efficient Buck converters 431 regulator via I2C bus. The chip is comprised of high efficient Buck
432 including Dual-Phase Buck converter, Buck-Boost converter, various LDOs. 432 converters including Dual-Phase Buck converter, Buck-Boost converter,
433 various LDOs.
433 434
434config REGULATOR_S5M8767 435config REGULATOR_S5M8767
435 tristate "Samsung S5M8767A voltage regulator" 436 tristate "Samsung S5M8767A voltage regulator"
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index ca876de72eae..65697b1a26c0 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1,13 +1,18 @@
1/* 1/*
2 * s2mps11.c 2 * s2mps11.c
3 * 3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd 4 * Copyright (c) 2012-2014 Samsung Electronics Co., Ltd
5 * http://www.samsung.com 5 * http://www.samsung.com
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 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 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 9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. 10 * option) any later version.
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.
11 * 16 *
12 */ 17 */
13 18
@@ -24,6 +29,7 @@
24#include <linux/regulator/of_regulator.h> 29#include <linux/regulator/of_regulator.h>
25#include <linux/mfd/samsung/core.h> 30#include <linux/mfd/samsung/core.h>
26#include <linux/mfd/samsung/s2mps11.h> 31#include <linux/mfd/samsung/s2mps11.h>
32#include <linux/mfd/samsung/s2mps14.h>
27 33
28struct s2mps11_info { 34struct s2mps11_info {
29 unsigned int rdev_num; 35 unsigned int rdev_num;
@@ -233,7 +239,7 @@ static struct regulator_ops s2mps11_buck_ops = {
233 .set_ramp_delay = s2mps11_set_ramp_delay, 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 .name = "LDO"#num, \ 243 .name = "LDO"#num, \
238 .id = S2MPS11_LDO##num, \ 244 .id = S2MPS11_LDO##num, \
239 .ops = &s2mps11_ldo_ops, \ 245 .ops = &s2mps11_ldo_ops, \
@@ -247,7 +253,7 @@ static struct regulator_ops s2mps11_buck_ops = {
247 .enable_reg = S2MPS11_REG_L1CTRL + num - 1, \ 253 .enable_reg = S2MPS11_REG_L1CTRL + num - 1, \
248 .enable_mask = S2MPS11_ENABLE_MASK \ 254 .enable_mask = S2MPS11_ENABLE_MASK \
249} 255}
250#define regulator_desc_ldo2(num) { \ 256#define regulator_desc_s2mps11_ldo2(num) { \
251 .name = "LDO"#num, \ 257 .name = "LDO"#num, \
252 .id = S2MPS11_LDO##num, \ 258 .id = S2MPS11_LDO##num, \
253 .ops = &s2mps11_ldo_ops, \ 259 .ops = &s2mps11_ldo_ops, \
@@ -262,7 +268,7 @@ static struct regulator_ops s2mps11_buck_ops = {
262 .enable_mask = S2MPS11_ENABLE_MASK \ 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 .name = "BUCK"#num, \ 272 .name = "BUCK"#num, \
267 .id = S2MPS11_BUCK##num, \ 273 .id = S2MPS11_BUCK##num, \
268 .ops = &s2mps11_buck_ops, \ 274 .ops = &s2mps11_buck_ops, \
@@ -278,7 +284,7 @@ static struct regulator_ops s2mps11_buck_ops = {
278 .enable_mask = S2MPS11_ENABLE_MASK \ 284 .enable_mask = S2MPS11_ENABLE_MASK \
279} 285}
280 286
281#define regulator_desc_buck5 { \ 287#define regulator_desc_s2mps11_buck5 { \
282 .name = "BUCK5", \ 288 .name = "BUCK5", \
283 .id = S2MPS11_BUCK5, \ 289 .id = S2MPS11_BUCK5, \
284 .ops = &s2mps11_buck_ops, \ 290 .ops = &s2mps11_buck_ops, \
@@ -294,7 +300,7 @@ static struct regulator_ops s2mps11_buck_ops = {
294 .enable_mask = S2MPS11_ENABLE_MASK \ 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 .name = "BUCK"#num, \ 304 .name = "BUCK"#num, \
299 .id = S2MPS11_BUCK##num, \ 305 .id = S2MPS11_BUCK##num, \
300 .ops = &s2mps11_buck_ops, \ 306 .ops = &s2mps11_buck_ops, \
@@ -310,7 +316,7 @@ static struct regulator_ops s2mps11_buck_ops = {
310 .enable_mask = S2MPS11_ENABLE_MASK \ 316 .enable_mask = S2MPS11_ENABLE_MASK \
311} 317}
312 318
313#define regulator_desc_buck9 { \ 319#define regulator_desc_s2mps11_buck9 { \
314 .name = "BUCK9", \ 320 .name = "BUCK9", \
315 .id = S2MPS11_BUCK9, \ 321 .id = S2MPS11_BUCK9, \
316 .ops = &s2mps11_buck_ops, \ 322 .ops = &s2mps11_buck_ops, \
@@ -326,7 +332,7 @@ static struct regulator_ops s2mps11_buck_ops = {
326 .enable_mask = S2MPS11_ENABLE_MASK \ 332 .enable_mask = S2MPS11_ENABLE_MASK \
327} 333}
328 334
329#define regulator_desc_buck10 { \ 335#define regulator_desc_s2mps11_buck10 { \
330 .name = "BUCK10", \ 336 .name = "BUCK10", \
331 .id = S2MPS11_BUCK10, \ 337 .id = S2MPS11_BUCK10, \
332 .ops = &s2mps11_buck_ops, \ 338 .ops = &s2mps11_buck_ops, \
@@ -343,54 +349,173 @@ static struct regulator_ops s2mps11_buck_ops = {
343} 349}
344 350
345static const struct regulator_desc s2mps11_regulators[] = { 351static const struct regulator_desc s2mps11_regulators[] = {
346 regulator_desc_ldo2(1), 352 regulator_desc_s2mps11_ldo2(1),
347 regulator_desc_ldo1(2), 353 regulator_desc_s2mps11_ldo1(2),
348 regulator_desc_ldo1(3), 354 regulator_desc_s2mps11_ldo1(3),
349 regulator_desc_ldo1(4), 355 regulator_desc_s2mps11_ldo1(4),
350 regulator_desc_ldo1(5), 356 regulator_desc_s2mps11_ldo1(5),
351 regulator_desc_ldo2(6), 357 regulator_desc_s2mps11_ldo2(6),
352 regulator_desc_ldo1(7), 358 regulator_desc_s2mps11_ldo1(7),
353 regulator_desc_ldo1(8), 359 regulator_desc_s2mps11_ldo1(8),
354 regulator_desc_ldo1(9), 360 regulator_desc_s2mps11_ldo1(9),
355 regulator_desc_ldo1(10), 361 regulator_desc_s2mps11_ldo1(10),
356 regulator_desc_ldo2(11), 362 regulator_desc_s2mps11_ldo2(11),
357 regulator_desc_ldo1(12), 363 regulator_desc_s2mps11_ldo1(12),
358 regulator_desc_ldo1(13), 364 regulator_desc_s2mps11_ldo1(13),
359 regulator_desc_ldo1(14), 365 regulator_desc_s2mps11_ldo1(14),
360 regulator_desc_ldo1(15), 366 regulator_desc_s2mps11_ldo1(15),
361 regulator_desc_ldo1(16), 367 regulator_desc_s2mps11_ldo1(16),
362 regulator_desc_ldo1(17), 368 regulator_desc_s2mps11_ldo1(17),
363 regulator_desc_ldo1(18), 369 regulator_desc_s2mps11_ldo1(18),
364 regulator_desc_ldo1(19), 370 regulator_desc_s2mps11_ldo1(19),
365 regulator_desc_ldo1(20), 371 regulator_desc_s2mps11_ldo1(20),
366 regulator_desc_ldo1(21), 372 regulator_desc_s2mps11_ldo1(21),
367 regulator_desc_ldo2(22), 373 regulator_desc_s2mps11_ldo2(22),
368 regulator_desc_ldo2(23), 374 regulator_desc_s2mps11_ldo2(23),
369 regulator_desc_ldo1(24), 375 regulator_desc_s2mps11_ldo1(24),
370 regulator_desc_ldo1(25), 376 regulator_desc_s2mps11_ldo1(25),
371 regulator_desc_ldo1(26), 377 regulator_desc_s2mps11_ldo1(26),
372 regulator_desc_ldo2(27), 378 regulator_desc_s2mps11_ldo2(27),
373 regulator_desc_ldo1(28), 379 regulator_desc_s2mps11_ldo1(28),
374 regulator_desc_ldo1(29), 380 regulator_desc_s2mps11_ldo1(29),
375 regulator_desc_ldo1(30), 381 regulator_desc_s2mps11_ldo1(30),
376 regulator_desc_ldo1(31), 382 regulator_desc_s2mps11_ldo1(31),
377 regulator_desc_ldo1(32), 383 regulator_desc_s2mps11_ldo1(32),
378 regulator_desc_ldo1(33), 384 regulator_desc_s2mps11_ldo1(33),
379 regulator_desc_ldo1(34), 385 regulator_desc_s2mps11_ldo1(34),
380 regulator_desc_ldo1(35), 386 regulator_desc_s2mps11_ldo1(35),
381 regulator_desc_ldo1(36), 387 regulator_desc_s2mps11_ldo1(36),
382 regulator_desc_ldo1(37), 388 regulator_desc_s2mps11_ldo1(37),
383 regulator_desc_ldo1(38), 389 regulator_desc_s2mps11_ldo1(38),
384 regulator_desc_buck1_4(1), 390 regulator_desc_s2mps11_buck1_4(1),
385 regulator_desc_buck1_4(2), 391 regulator_desc_s2mps11_buck1_4(2),
386 regulator_desc_buck1_4(3), 392 regulator_desc_s2mps11_buck1_4(3),
387 regulator_desc_buck1_4(4), 393 regulator_desc_s2mps11_buck1_4(4),
388 regulator_desc_buck5, 394 regulator_desc_s2mps11_buck5,
389 regulator_desc_buck6_8(6), 395 regulator_desc_s2mps11_buck6_8(6),
390 regulator_desc_buck6_8(7), 396 regulator_desc_s2mps11_buck6_8(7),
391 regulator_desc_buck6_8(8), 397 regulator_desc_s2mps11_buck6_8(8),
392 regulator_desc_buck9, 398 regulator_desc_s2mps11_buck9,
393 regulator_desc_buck10, 399 regulator_desc_s2mps11_buck10,
400};
401
402static 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
488static 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),
394}; 519};
395 520
396static int s2mps11_pmic_probe(struct platform_device *pdev) 521static int s2mps11_pmic_probe(struct platform_device *pdev)
@@ -416,6 +541,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
416 s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators); 541 s2mps11->rdev_num = ARRAY_SIZE(s2mps11_regulators);
417 regulators = s2mps11_regulators; 542 regulators = s2mps11_regulators;
418 break; 543 break;
544 case S2MPS14X:
545 s2mps11->rdev_num = ARRAY_SIZE(s2mps14_regulators);
546 regulators = s2mps14_regulators;
547 break;
419 default: 548 default:
420 dev_err(&pdev->dev, "Invalid device type: %u\n", dev_type); 549 dev_err(&pdev->dev, "Invalid device type: %u\n", dev_type);
421 return -EINVAL; 550 return -EINVAL;
@@ -482,6 +611,7 @@ out:
482 611
483static const struct platform_device_id s2mps11_pmic_id[] = { 612static const struct platform_device_id s2mps11_pmic_id[] = {
484 { "s2mps11-pmic", S2MPS11X}, 613 { "s2mps11-pmic", S2MPS11X},
614 { "s2mps14-pmic", S2MPS14X},
485 { }, 615 { },
486}; 616};
487MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id); 617MODULE_DEVICE_TABLE(platform, s2mps11_pmic_id);
@@ -509,5 +639,5 @@ module_exit(s2mps11_pmic_exit);
509 639
510/* Module information */ 640/* Module information */
511MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>"); 641MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
512MODULE_DESCRIPTION("SAMSUNG S2MPS11 Regulator Driver"); 642MODULE_DESCRIPTION("SAMSUNG S2MPS11/S2MPS14 Regulator Driver");
513MODULE_LICENSE("GPL"); 643MODULE_LICENSE("GPL");