30
30
#include <linux/of_gpio.h>
31
31
#include <linux/mfd/samsung/core.h>
32
32
#include <linux/mfd/samsung/s2mps11.h>
33
+ #include <linux/mfd/samsung/s2mps13.h>
33
34
#include <linux/mfd/samsung/s2mps14.h>
34
35
#include <linux/mfd/samsung/s2mpu02.h>
35
36
@@ -45,10 +46,10 @@ struct s2mps11_info {
45
46
enum sec_device_type dev_type ;
46
47
47
48
/*
48
- * One bit for each S2MPS14/S2MPU02 regulator whether the suspend mode
49
- * was enabled.
49
+ * One bit for each S2MPS13/ S2MPS14/S2MPU02 regulator whether
50
+ * the suspend mode was enabled.
50
51
*/
51
- unsigned long long s2mps14_suspend_state :35 ;
52
+ unsigned long long s2mps14_suspend_state :50 ;
52
53
53
54
/* Array of size rdev_num with GPIO-s for external sleep control */
54
55
int * ext_control_gpio ;
@@ -369,12 +370,101 @@ static const struct regulator_desc s2mps11_regulators[] = {
369
370
regulator_desc_s2mps11_buck6_10 (10 , MIN_750_MV , STEP_12_5_MV ),
370
371
};
371
372
373
+ static struct regulator_ops s2mps14_reg_ops ;
374
+
375
+ #define regulator_desc_s2mps13_ldo (num , min , step , min_sel ) { \
376
+ .name = "LDO"#num, \
377
+ .id = S2MPS13_LDO##num, \
378
+ .ops = &s2mps14_reg_ops, \
379
+ .type = REGULATOR_VOLTAGE, \
380
+ .owner = THIS_MODULE, \
381
+ .min_uV = min, \
382
+ .uV_step = step, \
383
+ .linear_min_sel = min_sel, \
384
+ .n_voltages = S2MPS14_LDO_N_VOLTAGES, \
385
+ .vsel_reg = S2MPS13_REG_L1CTRL + num - 1, \
386
+ .vsel_mask = S2MPS14_LDO_VSEL_MASK, \
387
+ .enable_reg = S2MPS13_REG_L1CTRL + num - 1, \
388
+ .enable_mask = S2MPS14_ENABLE_MASK \
389
+ }
390
+
391
+ #define regulator_desc_s2mps13_buck (num , min , step , min_sel ) { \
392
+ .name = "BUCK"#num, \
393
+ .id = S2MPS13_BUCK##num, \
394
+ .ops = &s2mps14_reg_ops, \
395
+ .type = REGULATOR_VOLTAGE, \
396
+ .owner = THIS_MODULE, \
397
+ .min_uV = min, \
398
+ .uV_step = step, \
399
+ .linear_min_sel = min_sel, \
400
+ .n_voltages = S2MPS14_BUCK_N_VOLTAGES, \
401
+ .ramp_delay = S2MPS13_BUCK_RAMP_DELAY, \
402
+ .vsel_reg = S2MPS13_REG_B1OUT + (num - 1) * 2, \
403
+ .vsel_mask = S2MPS14_BUCK_VSEL_MASK, \
404
+ .enable_reg = S2MPS13_REG_B1CTRL + (num - 1) * 2, \
405
+ .enable_mask = S2MPS14_ENABLE_MASK \
406
+ }
407
+
408
+ static const struct regulator_desc s2mps13_regulators [] = {
409
+ regulator_desc_s2mps13_ldo (1 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
410
+ regulator_desc_s2mps13_ldo (2 , MIN_1400_MV , STEP_50_MV , 0x0C ),
411
+ regulator_desc_s2mps13_ldo (3 , MIN_1000_MV , STEP_25_MV , 0x08 ),
412
+ regulator_desc_s2mps13_ldo (4 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
413
+ regulator_desc_s2mps13_ldo (5 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
414
+ regulator_desc_s2mps13_ldo (6 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
415
+ regulator_desc_s2mps13_ldo (7 , MIN_1000_MV , STEP_25_MV , 0x08 ),
416
+ regulator_desc_s2mps13_ldo (8 , MIN_1000_MV , STEP_25_MV , 0x08 ),
417
+ regulator_desc_s2mps13_ldo (9 , MIN_1000_MV , STEP_25_MV , 0x08 ),
418
+ regulator_desc_s2mps13_ldo (10 , MIN_1400_MV , STEP_50_MV , 0x0C ),
419
+ regulator_desc_s2mps13_ldo (11 , MIN_800_MV , STEP_25_MV , 0x10 ),
420
+ regulator_desc_s2mps13_ldo (12 , MIN_800_MV , STEP_25_MV , 0x10 ),
421
+ regulator_desc_s2mps13_ldo (13 , MIN_800_MV , STEP_25_MV , 0x10 ),
422
+ regulator_desc_s2mps13_ldo (14 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
423
+ regulator_desc_s2mps13_ldo (15 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
424
+ regulator_desc_s2mps13_ldo (16 , MIN_1400_MV , STEP_50_MV , 0x0C ),
425
+ regulator_desc_s2mps13_ldo (17 , MIN_1400_MV , STEP_50_MV , 0x0C ),
426
+ regulator_desc_s2mps13_ldo (18 , MIN_1000_MV , STEP_25_MV , 0x08 ),
427
+ regulator_desc_s2mps13_ldo (19 , MIN_1000_MV , STEP_25_MV , 0x08 ),
428
+ regulator_desc_s2mps13_ldo (20 , MIN_1400_MV , STEP_50_MV , 0x0C ),
429
+ regulator_desc_s2mps13_ldo (21 , MIN_1000_MV , STEP_25_MV , 0x08 ),
430
+ regulator_desc_s2mps13_ldo (22 , MIN_1000_MV , STEP_25_MV , 0x08 ),
431
+ regulator_desc_s2mps13_ldo (23 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
432
+ regulator_desc_s2mps13_ldo (24 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
433
+ regulator_desc_s2mps13_ldo (25 , MIN_1400_MV , STEP_50_MV , 0x0C ),
434
+ regulator_desc_s2mps13_ldo (26 , MIN_1400_MV , STEP_50_MV , 0x0C ),
435
+ regulator_desc_s2mps13_ldo (27 , MIN_1400_MV , STEP_50_MV , 0x0C ),
436
+ regulator_desc_s2mps13_ldo (28 , MIN_1000_MV , STEP_25_MV , 0x08 ),
437
+ regulator_desc_s2mps13_ldo (29 , MIN_1400_MV , STEP_50_MV , 0x0C ),
438
+ regulator_desc_s2mps13_ldo (30 , MIN_1400_MV , STEP_50_MV , 0x0C ),
439
+ regulator_desc_s2mps13_ldo (31 , MIN_1000_MV , STEP_25_MV , 0x08 ),
440
+ regulator_desc_s2mps13_ldo (32 , MIN_1000_MV , STEP_25_MV , 0x08 ),
441
+ regulator_desc_s2mps13_ldo (33 , MIN_1400_MV , STEP_50_MV , 0x0C ),
442
+ regulator_desc_s2mps13_ldo (34 , MIN_1000_MV , STEP_25_MV , 0x08 ),
443
+ regulator_desc_s2mps13_ldo (35 , MIN_1400_MV , STEP_50_MV , 0x0C ),
444
+ regulator_desc_s2mps13_ldo (36 , MIN_800_MV , STEP_12_5_MV , 0x00 ),
445
+ regulator_desc_s2mps13_ldo (37 , MIN_1000_MV , STEP_25_MV , 0x08 ),
446
+ regulator_desc_s2mps13_ldo (38 , MIN_1400_MV , STEP_50_MV , 0x0C ),
447
+ regulator_desc_s2mps13_ldo (39 , MIN_1000_MV , STEP_25_MV , 0x08 ),
448
+ regulator_desc_s2mps13_ldo (40 , MIN_1400_MV , STEP_50_MV , 0x0C ),
449
+ regulator_desc_s2mps13_buck (1 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
450
+ regulator_desc_s2mps13_buck (2 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
451
+ regulator_desc_s2mps13_buck (3 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
452
+ regulator_desc_s2mps13_buck (4 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
453
+ regulator_desc_s2mps13_buck (5 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
454
+ regulator_desc_s2mps13_buck (6 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
455
+ regulator_desc_s2mps13_buck (7 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
456
+ regulator_desc_s2mps13_buck (8 , MIN_1000_MV , STEP_12_5_MV , 0x20 ),
457
+ regulator_desc_s2mps13_buck (9 , MIN_1000_MV , STEP_12_5_MV , 0x20 ),
458
+ regulator_desc_s2mps13_buck (10 , MIN_500_MV , STEP_6_25_MV , 0x10 ),
459
+ };
460
+
372
461
static int s2mps14_regulator_enable (struct regulator_dev * rdev )
373
462
{
374
463
struct s2mps11_info * s2mps11 = rdev_get_drvdata (rdev );
375
464
unsigned int val ;
376
465
377
466
switch (s2mps11 -> dev_type ) {
467
+ case S2MPS13X :
378
468
case S2MPS14X :
379
469
if (s2mps11 -> s2mps14_suspend_state & (1 << rdev_get_id (rdev )))
380
470
val = S2MPS14_ENABLE_SUSPEND ;
@@ -406,6 +496,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
406
496
407
497
/* Below LDO should be always on or does not support suspend mode. */
408
498
switch (s2mps11 -> dev_type ) {
499
+ case S2MPS13X :
409
500
case S2MPS14X :
410
501
switch (rdev_id ) {
411
502
case S2MPS14_LDO3 :
@@ -831,6 +922,10 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
831
922
s2mps11 -> rdev_num = ARRAY_SIZE (s2mps11_regulators );
832
923
regulators = s2mps11_regulators ;
833
924
break ;
925
+ case S2MPS13X :
926
+ s2mps11 -> rdev_num = ARRAY_SIZE (s2mps13_regulators );
927
+ regulators = s2mps13_regulators ;
928
+ break ;
834
929
case S2MPS14X :
835
930
s2mps11 -> rdev_num = ARRAY_SIZE (s2mps14_regulators );
836
931
regulators = s2mps14_regulators ;
@@ -927,6 +1022,7 @@ static int s2mps11_pmic_probe(struct platform_device *pdev)
927
1022
928
1023
static const struct platform_device_id s2mps11_pmic_id [] = {
929
1024
{ "s2mps11-pmic" , S2MPS11X },
1025
+ { "s2mps13-pmic" , S2MPS13X },
930
1026
{ "s2mps14-pmic" , S2MPS14X },
931
1027
{ "s2mpu02-pmic" , S2MPU02 },
932
1028
{ },
0 commit comments