Yidi Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46687 )
Change subject: mb/google/asurada: Implement enable_requlator and regulator_is_enabled ......................................................................
mb/google/asurada: Implement enable_requlator and regulator_is_enabled
SD Card driver needs to access two regulators - MT6360_LDO5 and MT6360_LDO3. These two regulators are disabled by default.
Two APIs are implemented, mainboard_enable_requlator - Configure the regulator as enabled / disabled. mainboard_regulator_is_enabled - Query if the regulator is enabled.
BUG=b:168863056,b:147789962 BRANCH=none TEST=emerge-asurada coreboot
Change-Id: I391f908fcb33ffdcccc53063644482eabc863ac4 Signed-off-by: Yidi Lin yidi.lin@mediatek.com --- M src/mainboard/google/asurada/regulator.c M src/soc/mediatek/common/include/soc/regulator.h 2 files changed, 38 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/46687/1
diff --git a/src/mainboard/google/asurada/regulator.c b/src/mainboard/google/asurada/regulator.c index 740d98b..ecfe4ef 100644 --- a/src/mainboard/google/asurada/regulator.c +++ b/src/mainboard/google/asurada/regulator.c @@ -25,6 +25,10 @@ return MT6360_LDO7; case MTK_REGULATOR_VMDDR: return MT6360_LDO6; + case MTK_REGULATOR_VCC: + return MT6360_LDO5; + case MTK_REGULATOR_VCCQ: + return MT6360_LDO3; default: break; } @@ -96,3 +100,32 @@
return 0; } + +void mainboard_enable_requlator(enum mtk_regulator regulator, uint8_t enable) +{ + int id; + + id = get_mt6360_regulator_id(regulator); + if (id >= 0) { + google_chromeec_regulator_enable(id, enable); + return; + } + + printk(BIOS_WARNING, "Invalid regualtor ID: %d\n", regulator); +} + +uint8_t mainboard_regulator_is_enabled(enum mtk_regulator regulator) +{ + int id; + + id = get_mt6360_regulator_id(regulator); + if (id >= 0) { + uint8_t enabled = 0; + google_chromeec_regulator_is_enabled(id, &enabled); + return enabled; + } + + printk(BIOS_WARNING, "Invalid regualtor ID: %d\n", regulator); + + return 0; +} diff --git a/src/soc/mediatek/common/include/soc/regulator.h b/src/soc/mediatek/common/include/soc/regulator.h index 6d9ff4e..35ce1ac 100644 --- a/src/soc/mediatek/common/include/soc/regulator.h +++ b/src/soc/mediatek/common/include/soc/regulator.h @@ -11,10 +11,15 @@ MTK_REGULATOR_VDDQ, MTK_REGULATOR_VMDDR, MTK_REGULATOR_VCORE, + MTK_REGULATOR_VCC, + MTK_REGULATOR_VCCQ, };
void mainboard_set_regulator_vol(enum mtk_regulator regulator, uint32_t voltage_uv); uint32_t mainboard_get_regulator_vol(enum mtk_regulator regulator);
+void mainboard_enable_requlator(enum mtk_regulator regulator, uint8_t enable); +uint8_t mainboard_regulator_is_enabled(enum mtk_regulator regulator); + #endif /* SOC_MEDIATEK_COMMON_REGULATOR_H */