Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: da9063: add voltage monitoring registers

Add the definitions for the registers responsible for voltage
monitoring. Add a voltage monitor enable bitfield per regulator.

Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Reviewed-by: Adam Ward <DLG-Adam.Ward.opensource@dm.renesas.com>
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Link: https://lore.kernel.org/r/20230403-da9063-disable-unused-v3-1-cc4dc698864c@skidata.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Benjamin Bara and committed by
Mark Brown
13186dae 53e59b5c

+52
+29
drivers/regulator/da9063-regulator.c
··· 83 83 84 84 /* DA9063 event detection bit */ 85 85 struct reg_field oc_event; 86 + 87 + /* DA9063 voltage monitor bit */ 88 + struct reg_field vmon; 86 89 }; 87 90 88 91 /* Macros for LDO */ ··· 151 148 struct regmap_field *suspend; 152 149 struct regmap_field *sleep; 153 150 struct regmap_field *suspend_sleep; 151 + struct regmap_field *vmon; 154 152 }; 155 153 156 154 /* Encapsulates all information for the regulators driver */ ··· 585 581 da9063_buck_a_limits, 586 582 DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK), 587 583 DA9063_BUCK_COMMON_FIELDS(BCORE1), 584 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN), 588 585 }, 589 586 { 590 587 DA9063_BUCK(DA9063, BCORE2, 300, 10, 1570, 591 588 da9063_buck_a_limits, 592 589 DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK), 593 590 DA9063_BUCK_COMMON_FIELDS(BCORE2), 591 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE2_MON_EN), 594 592 }, 595 593 { 596 594 DA9063_BUCK(DA9063, BPRO, 530, 10, 1800, 597 595 da9063_buck_a_limits, 598 596 DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK), 599 597 DA9063_BUCK_COMMON_FIELDS(BPRO), 598 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPRO_MON_EN), 600 599 }, 601 600 { 602 601 DA9063_BUCK(DA9063, BMEM, 800, 20, 3340, 603 602 da9063_buck_b_limits, 604 603 DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK), 605 604 DA9063_BUCK_COMMON_FIELDS(BMEM), 605 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN), 606 606 }, 607 607 { 608 608 DA9063_BUCK(DA9063, BIO, 800, 20, 3340, 609 609 da9063_buck_b_limits, 610 610 DA9063_REG_BUCK_ILIM_A, DA9063_BIO_ILIM_MASK), 611 611 DA9063_BUCK_COMMON_FIELDS(BIO), 612 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BIO_MON_EN), 612 613 }, 613 614 { 614 615 DA9063_BUCK(DA9063, BPERI, 800, 20, 3340, 615 616 da9063_buck_b_limits, 616 617 DA9063_REG_BUCK_ILIM_B, DA9063_BPERI_ILIM_MASK), 617 618 DA9063_BUCK_COMMON_FIELDS(BPERI), 619 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPERI_MON_EN), 618 620 }, 619 621 { 620 622 DA9063_BUCK(DA9063, BCORES_MERGED, 300, 10, 1570, ··· 628 618 DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK), 629 619 /* BCORES_MERGED uses the same register fields as BCORE1 */ 630 620 DA9063_BUCK_COMMON_FIELDS(BCORE1), 621 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN), 631 622 }, 632 623 { 633 624 DA9063_BUCK(DA9063, BMEM_BIO_MERGED, 800, 20, 3340, ··· 636 625 DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK), 637 626 /* BMEM_BIO_MERGED uses the same register fields as BMEM */ 638 627 DA9063_BUCK_COMMON_FIELDS(BMEM), 628 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN), 639 629 }, 640 630 { 641 631 DA9063_LDO(DA9063, LDO3, 900, 20, 3440), 642 632 .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM), 633 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO3_MON_EN), 643 634 }, 644 635 { 645 636 DA9063_LDO(DA9063, LDO7, 900, 50, 3600), 646 637 .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM), 638 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO7_MON_EN), 647 639 }, 648 640 { 649 641 DA9063_LDO(DA9063, LDO8, 900, 50, 3600), 650 642 .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM), 643 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO8_MON_EN), 651 644 }, 652 645 { 653 646 DA9063_LDO(DA9063, LDO9, 950, 50, 3600), 647 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO9_MON_EN), 654 648 }, 655 649 { 656 650 DA9063_LDO(DA9063, LDO11, 900, 50, 3600), 657 651 .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM), 652 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO11_MON_EN), 658 653 }, 659 654 660 655 /* The following LDOs are present only on DA9063, not on DA9063L */ 661 656 { 662 657 DA9063_LDO(DA9063, LDO1, 600, 20, 1860), 658 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO1_MON_EN), 663 659 }, 664 660 { 665 661 DA9063_LDO(DA9063, LDO2, 600, 20, 1860), 662 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO2_MON_EN), 666 663 }, 667 664 { 668 665 DA9063_LDO(DA9063, LDO4, 900, 20, 3440), 669 666 .oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO4_LIM), 667 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO4_MON_EN), 670 668 }, 671 669 { 672 670 DA9063_LDO(DA9063, LDO5, 900, 50, 3600), 671 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO5_MON_EN), 673 672 }, 674 673 { 675 674 DA9063_LDO(DA9063, LDO6, 900, 50, 3600), 675 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO6_MON_EN), 676 676 }, 677 677 678 678 { 679 679 DA9063_LDO(DA9063, LDO10, 900, 50, 3600), 680 + .vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO10_MON_EN), 680 681 }, 681 682 }; 682 683 ··· 954 931 da9063->regmap, regl->info->suspend_sleep); 955 932 if (IS_ERR(regl->suspend_sleep)) 956 933 return PTR_ERR(regl->suspend_sleep); 934 + } 935 + if (regl->info->vmon.reg) { 936 + regl->vmon = devm_regmap_field_alloc(&pdev->dev, 937 + da9063->regmap, regl->info->vmon); 938 + if (IS_ERR(regl->vmon)) 939 + return PTR_ERR(regl->vmon); 957 940 } 958 941 959 942 /* Register regulator */
+23
include/linux/mfd/da9063/registers.h
··· 1040 1040 /* DA9063_REG_CONFIG_J (addr=0x10F) */ 1041 1041 #define DA9063_TWOWIRE_TO 0x40 1042 1042 1043 + /* DA9063_REG_MON_REG_2 (addr=0x115) */ 1044 + #define DA9063_LDO1_MON_EN 0x01 1045 + #define DA9063_LDO2_MON_EN 0x02 1046 + #define DA9063_LDO3_MON_EN 0x04 1047 + #define DA9063_LDO4_MON_EN 0x08 1048 + #define DA9063_LDO5_MON_EN 0x10 1049 + #define DA9063_LDO6_MON_EN 0x20 1050 + #define DA9063_LDO7_MON_EN 0x40 1051 + #define DA9063_LDO8_MON_EN 0x80 1052 + 1053 + /* DA9063_REG_MON_REG_3 (addr=0x116) */ 1054 + #define DA9063_LDO9_MON_EN 0x01 1055 + #define DA9063_LDO10_MON_EN 0x02 1056 + #define DA9063_LDO11_MON_EN 0x04 1057 + 1058 + /* DA9063_REG_MON_REG_4 (addr=0x117) */ 1059 + #define DA9063_BCORE1_MON_EN 0x04 1060 + #define DA9063_BCORE2_MON_EN 0x08 1061 + #define DA9063_BPRO_MON_EN 0x10 1062 + #define DA9063_BIO_MON_EN 0x20 1063 + #define DA9063_BMEM_MON_EN 0x40 1064 + #define DA9063_BPERI_MON_EN 0x80 1065 + 1043 1066 /* DA9063_REG_MON_REG_5 (addr=0x116) */ 1044 1067 #define DA9063_MON_A8_IDX_MASK 0x07 1045 1068 #define DA9063_MON_A8_IDX_NONE 0x00