Skip to content

Commit 1c892e3

Browse files
marexLee Jones
authored andcommitted
regulator: da9063: Handle less LDOs on DA9063L
Move the LDOs present only on DA9063 at the end of the list, so that the DA9063L can simply indicate less LDOs and still share the list of regulators with DA9063. Signed-off-by: Marek Vasut <[email protected]> Acked-by: Mark Brown <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent c2ffec5 commit 1c892e3

File tree

1 file changed

+45
-31
lines changed

1 file changed

+45
-31
lines changed

drivers/regulator/da9063-regulator.c

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,32 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
529529
.ilimit = BFIELD(DA9063_REG_BUCK_ILIM_A,
530530
DA9063_BMEM_ILIM_MASK),
531531
},
532+
{
533+
DA9063_LDO(DA9063, LDO3, 900, 20, 3440),
534+
.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL),
535+
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM),
536+
},
537+
{
538+
DA9063_LDO(DA9063, LDO7, 900, 50, 3600),
539+
.suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL),
540+
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM),
541+
},
542+
{
543+
DA9063_LDO(DA9063, LDO8, 900, 50, 3600),
544+
.suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL),
545+
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM),
546+
},
547+
{
548+
DA9063_LDO(DA9063, LDO9, 950, 50, 3600),
549+
.suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL),
550+
},
551+
{
552+
DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
553+
.suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL),
554+
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM),
555+
},
556+
557+
/* The following LDOs are present only on DA9063, not on DA9063L */
532558
{
533559
DA9063_LDO(DA9063, LDO1, 600, 20, 1860),
534560
.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO1_SEL),
@@ -537,11 +563,6 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
537563
DA9063_LDO(DA9063, LDO2, 600, 20, 1860),
538564
.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO2_SEL),
539565
},
540-
{
541-
DA9063_LDO(DA9063, LDO3, 900, 20, 3440),
542-
.suspend = BFIELD(DA9063_REG_DVC_1, DA9063_VLDO3_SEL),
543-
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM),
544-
},
545566
{
546567
DA9063_LDO(DA9063, LDO4, 900, 20, 3440),
547568
.suspend = BFIELD(DA9063_REG_DVC_2, DA9063_VLDO4_SEL),
@@ -555,29 +576,11 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
555576
DA9063_LDO(DA9063, LDO6, 900, 50, 3600),
556577
.suspend = BFIELD(DA9063_REG_LDO6_CONT, DA9063_VLDO6_SEL),
557578
},
558-
{
559-
DA9063_LDO(DA9063, LDO7, 900, 50, 3600),
560-
.suspend = BFIELD(DA9063_REG_LDO7_CONT, DA9063_VLDO7_SEL),
561-
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM),
562-
},
563-
{
564-
DA9063_LDO(DA9063, LDO8, 900, 50, 3600),
565-
.suspend = BFIELD(DA9063_REG_LDO8_CONT, DA9063_VLDO8_SEL),
566-
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM),
567-
},
568-
{
569-
DA9063_LDO(DA9063, LDO9, 950, 50, 3600),
570-
.suspend = BFIELD(DA9063_REG_LDO9_CONT, DA9063_VLDO9_SEL),
571-
},
579+
572580
{
573581
DA9063_LDO(DA9063, LDO10, 900, 50, 3600),
574582
.suspend = BFIELD(DA9063_REG_LDO10_CONT, DA9063_VLDO10_SEL),
575583
},
576-
{
577-
DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
578-
.suspend = BFIELD(DA9063_REG_LDO11_CONT, DA9063_VLDO11_SEL),
579-
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM),
580-
},
581584
};
582585

583586
/* Link chip model with regulators info table */
@@ -587,6 +590,11 @@ static struct da9063_dev_model regulators_models[] = {
587590
.n_regulators = ARRAY_SIZE(da9063_regulator_info),
588591
.type = PMIC_TYPE_DA9063,
589592
},
593+
{
594+
.regulator_info = da9063_regulator_info,
595+
.n_regulators = ARRAY_SIZE(da9063_regulator_info) - 6,
596+
.type = PMIC_TYPE_DA9063L,
597+
},
590598
{ }
591599
};
592600

@@ -641,36 +649,42 @@ static struct of_regulator_match da9063_matches[] = {
641649
[DA9063_ID_BPERI] = { .name = "bperi", },
642650
[DA9063_ID_BCORES_MERGED] = { .name = "bcores-merged" },
643651
[DA9063_ID_BMEM_BIO_MERGED] = { .name = "bmem-bio-merged", },
652+
[DA9063_ID_LDO3] = { .name = "ldo3", },
653+
[DA9063_ID_LDO7] = { .name = "ldo7", },
654+
[DA9063_ID_LDO8] = { .name = "ldo8", },
655+
[DA9063_ID_LDO9] = { .name = "ldo9", },
656+
[DA9063_ID_LDO11] = { .name = "ldo11", },
657+
/* The following LDOs are present only on DA9063, not on DA9063L */
644658
[DA9063_ID_LDO1] = { .name = "ldo1", },
645659
[DA9063_ID_LDO2] = { .name = "ldo2", },
646-
[DA9063_ID_LDO3] = { .name = "ldo3", },
647660
[DA9063_ID_LDO4] = { .name = "ldo4", },
648661
[DA9063_ID_LDO5] = { .name = "ldo5", },
649662
[DA9063_ID_LDO6] = { .name = "ldo6", },
650-
[DA9063_ID_LDO7] = { .name = "ldo7", },
651-
[DA9063_ID_LDO8] = { .name = "ldo8", },
652-
[DA9063_ID_LDO9] = { .name = "ldo9", },
653663
[DA9063_ID_LDO10] = { .name = "ldo10", },
654-
[DA9063_ID_LDO11] = { .name = "ldo11", },
655664
};
656665

657666
static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
658667
struct platform_device *pdev,
659668
struct of_regulator_match **da9063_reg_matches)
660669
{
670+
struct da9063 *da9063 = dev_get_drvdata(pdev->dev.parent);
661671
struct da9063_regulators_pdata *pdata;
662672
struct da9063_regulator_data *rdata;
663673
struct device_node *node;
674+
int da9063_matches_len = ARRAY_SIZE(da9063_matches);
664675
int i, n, num;
665676

677+
if (da9063->type == PMIC_TYPE_DA9063L)
678+
da9063_matches_len -= 6;
679+
666680
node = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
667681
if (!node) {
668682
dev_err(&pdev->dev, "Regulators device node not found\n");
669683
return ERR_PTR(-ENODEV);
670684
}
671685

672686
num = of_regulator_match(&pdev->dev, node, da9063_matches,
673-
ARRAY_SIZE(da9063_matches));
687+
da9063_matches_len);
674688
of_node_put(node);
675689
if (num < 0) {
676690
dev_err(&pdev->dev, "Failed to match regulators\n");
@@ -689,7 +703,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt(
689703
pdata->n_regulators = num;
690704

691705
n = 0;
692-
for (i = 0; i < ARRAY_SIZE(da9063_matches); i++) {
706+
for (i = 0; i < da9063_matches_len; i++) {
693707
if (!da9063_matches[i].init_data)
694708
continue;
695709

0 commit comments

Comments
 (0)