summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCong Yang <yangcong5@huaqin.corp-partner.google.com>2023-04-13 14:50:48 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-04-14 12:09:24 +0000
commitf9d72e3745a742d154d2d56ecaf58d7ff217b0d2 (patch)
tree927f3f598def9eb34f335c18ae3080919e66126b
parent4eba95d1b34606e84498fb6e71687cd0495e9cba (diff)
soc/mediatek: Add assert for regulator VRF12
Add assert for MT6366_VRF12, define a constant macro for 1200000. BUG=none TEST=build board starmie with mt8186. Change-Id: I6d6a969ae993afcda0596a19928e8f98f343d589 Signed-off-by: Cong Yang <yangcong5@huaqin.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/74394 Reviewed-by: Yidi Lin <yidilin@google.com> Reviewed-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
-rw-r--r--src/soc/mediatek/mt8186/mt6366.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/soc/mediatek/mt8186/mt6366.c b/src/soc/mediatek/mt8186/mt6366.c
index 7874c08d68..9dbf483f51 100644
--- a/src/soc/mediatek/mt8186/mt6366.c
+++ b/src/soc/mediatek/mt8186/mt6366.c
@@ -725,14 +725,17 @@ static void pmic_set_vmc_vol(u32 vmc_uv)
pwrap_write_field(PMIC_LDO_VMC_CON0, 1, 0xFF, 0);
}
+#define VRF12_VOLTAGE_UV 1200000
+
static u32 pmic_get_vrf12_vol(void)
{
return (pwrap_read_field(PMIC_LDO_VRF12_CON0, 0x3, 0) &
- pwrap_read_field(PMIC_LDO_VRF12_OP_EN, 0x3, 0)) ? 1200000 : 0;
+ pwrap_read_field(PMIC_LDO_VRF12_OP_EN, 0x3, 0)) ? VRF12_VOLTAGE_UV : 0;
}
-static void pmic_enable_vrf12(void)
+static void pmic_set_vrf12_vol(u32 vrf12_uv)
{
+ assert(vrf12_uv == VRF12_VOLTAGE_UV);
pwrap_write_field(PMIC_LDO_VRF12_CON0, 1, 0x3, 0);
pwrap_write_field(PMIC_LDO_VRF12_OP_EN, 1, 0x3, 0);
}
@@ -921,8 +924,7 @@ void mt6366_set_voltage(enum mt6366_regulator_id id, u32 voltage_uv)
pmic_set_vsram_proc12_vol(voltage_uv);
break;
case MT6366_VRF12:
- /* VRF12 only provides 1.2V, so we just need to enable it */
- pmic_enable_vrf12();
+ pmic_set_vrf12_vol(voltage_uv);
break;
case MT6366_VCN33:
pmic_set_vcn33_vol(voltage_uv);