diff --git a/src/soc/mediatek/common/include/soc/regulator.h b/src/soc/mediatek/common/include/soc/regulator.h index e2b92517fd..3cec8f06eb 100644 --- a/src/soc/mediatek/common/include/soc/regulator.h +++ b/src/soc/mediatek/common/include/soc/regulator.h @@ -23,6 +23,7 @@ enum mtk_regulator { MTK_REGULATOR_VRF12, MTK_REGULATOR_VCN33, MTK_REGULATOR_VDD18, + MTK_REGULATOR_VIO18, MTK_REGULATOR_NUM, }; diff --git a/src/soc/mediatek/mt8186/include/soc/mt6366.h b/src/soc/mediatek/mt8186/include/soc/mt6366.h index 2315a24a76..b64cd8a17a 100644 --- a/src/soc/mediatek/mt8186/include/soc/mt6366.h +++ b/src/soc/mediatek/mt8186/include/soc/mt6366.h @@ -39,6 +39,7 @@ enum { PMIC_VDRAM1_DBG0 = 0x161e, PMIC_VDRAM1_VOSEL = 0x1626, PMIC_SMPS_ANA_CON0 = 0x1808, + PMIC_LDO_VIO18_CON0 = 0x1aec, PMIC_VDDQ_OP_EN = 0x1b16, PMIC_VSRAM_PROC12_OP_EN = 0x1b90, PMIC_VSRAM_PROC12_DBG0 = 0x1ba2, @@ -67,6 +68,7 @@ enum mt6366_regulator_id { MT6366_VSRAM_PROC12, MT6366_VRF12, MT6366_VCN33, + MT6366_VIO18, MT6366_REGULATOR_NUM, }; diff --git a/src/soc/mediatek/mt8186/mt6366.c b/src/soc/mediatek/mt8186/mt6366.c index 7ef8c24637..7874c08d68 100644 --- a/src/soc/mediatek/mt8186/mt6366.c +++ b/src/soc/mediatek/mt8186/mt6366.c @@ -787,6 +787,19 @@ static void pmic_set_vcn33_vol(u32 vcn33_uv) pwrap_write_field(PMIC_LDO_VCN33_CON0_0, 1, 0x1, 0); } +#define VIO18_VOLTAGE_UV 1800000 + +static u32 pmic_get_vio18_vol(void) +{ + return pwrap_read_field(PMIC_LDO_VIO18_CON0, 0x1, 0) ? VIO18_VOLTAGE_UV : 0; +} + +static void pmic_set_vio18_vol(u32 vio18_uv) +{ + assert(vio18_uv == VIO18_VOLTAGE_UV); + pwrap_write_field(PMIC_LDO_VIO18_CON0, 1, 0x1, 0); +} + static void pmic_wdt_set(void) { /* [5]=1, RG_WDTRSTB_DEB */ @@ -914,6 +927,9 @@ void mt6366_set_voltage(enum mt6366_regulator_id id, u32 voltage_uv) case MT6366_VCN33: pmic_set_vcn33_vol(voltage_uv); break; + case MT6366_VIO18: + pmic_set_vio18_vol(voltage_uv); + break; default: printk(BIOS_ERR, "%s: PMIC %d is not supported\n", __func__, id); break; @@ -941,6 +957,8 @@ u32 mt6366_get_voltage(enum mt6366_regulator_id id) return pmic_get_vrf12_vol(); case MT6366_VCN33: return pmic_get_vcn33_vol(); + case MT6366_VIO18: + return pmic_get_vio18_vol(); default: printk(BIOS_ERR, "%s: PMIC %d is not supported\n", __func__, id); break;