diff options
author | Yu-Ping Wu <yupingso@chromium.org> | 2024-11-20 15:30:35 +0800 |
---|---|---|
committer | Yu-Ping Wu <yupingso@google.com> | 2024-11-21 16:13:42 +0000 |
commit | 4ed67d92eb821632087f364b4f925078a4383212 (patch) | |
tree | f1d58f73cb78f649038f3f165465100493124d2c /src/soc/mediatek/common | |
parent | 3d79bced9549922c8c4a8611327818c32d4feda5 (diff) |
soc/mediatek: Rename pmif_ulposc_* function arguments
Rename the arguments of pmif_ulposc_check() and pmif_ulposc_cali()
to make the frequency unit clearer.
Change-Id: I7719fd4dc43edd47bf014af13fb57ad38f43778c
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85203
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
Diffstat (limited to 'src/soc/mediatek/common')
-rw-r--r-- | src/soc/mediatek/common/include/soc/pmif_clk_common.h | 4 | ||||
-rw-r--r-- | src/soc/mediatek/common/pmif_clk.c | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/soc/mediatek/common/include/soc/pmif_clk_common.h b/src/soc/mediatek/common/include/soc/pmif_clk_common.h index c61cd1a96e..dc03bfc1d6 100644 --- a/src/soc/mediatek/common/include/soc/pmif_clk_common.h +++ b/src/soc/mediatek/common/include/soc/pmif_clk_common.h @@ -3,7 +3,7 @@ #ifndef __MEDIATEK_SOC_PMIF_CLK_COMMON__ #define __MEDIATEK_SOC_PMIF_CLK_COMMON__ -int pmif_ulposc_check(u32 current_clk, u32 target_clk); -int pmif_ulposc_cali(u32 target_val); +int pmif_ulposc_check(u32 current_clk_mhz, u32 target_clk_mhz); +int pmif_ulposc_cali(u32 target_freq_mhz); #endif /*__MEDIATEK_SOC_PMIF_CLK_COMMON__*/ diff --git a/src/soc/mediatek/common/pmif_clk.c b/src/soc/mediatek/common/pmif_clk.c index f4e1d0eb7b..ee1996ea46 100644 --- a/src/soc/mediatek/common/pmif_clk.c +++ b/src/soc/mediatek/common/pmif_clk.c @@ -6,24 +6,24 @@ #include <soc/pmif_clk_common.h> #include <soc/pmif_sw.h> -int pmif_ulposc_check(u32 current_clk, u32 target_clk) +int pmif_ulposc_check(u32 current_clk_mhz, u32 target_clk_mhz) { - if (current_clk < (target_clk * (1000 - CAL_TOL_RATE) / 1000) || - current_clk > (target_clk * (1000 + CAL_TOL_RATE) / 1000)) { + if (current_clk_mhz < (target_clk_mhz * (1000 - CAL_TOL_RATE) / 1000) || + current_clk_mhz > (target_clk_mhz * (1000 + CAL_TOL_RATE) / 1000)) { printk(BIOS_WARNING, "[%s] calibration fail: cur=%dM, CAL_RATE=%d, target=%dM\n", - __func__, current_clk, CAL_TOL_RATE, target_clk); + __func__, current_clk_mhz, CAL_TOL_RATE, target_clk_mhz); return -1; } printk(BIOS_DEBUG, "[%s] calibration done: cur=%dM, CAL_RATE=%d, target=%dM\n", - __func__, current_clk, CAL_TOL_RATE, target_clk); + __func__, current_clk_mhz, CAL_TOL_RATE, target_clk_mhz); return 0; } -int pmif_ulposc_cali(u32 target_val) +int pmif_ulposc_cali(u32 target_freq_mhz) { u32 current_val, min = 0, max = CAL_MAX_VAL, middle; int diff_by_min, diff_by_max, cal_result; @@ -34,21 +34,21 @@ int pmif_ulposc_cali(u32 target_val) break; current_val = pmif_get_ulposc_freq_mhz(middle); - if (current_val > target_val) + if (current_val > target_freq_mhz) max = middle; else min = middle; } while (min <= max); - diff_by_min = pmif_get_ulposc_freq_mhz(min) - target_val; + diff_by_min = pmif_get_ulposc_freq_mhz(min) - target_freq_mhz; diff_by_min = ABS(diff_by_min); - diff_by_max = pmif_get_ulposc_freq_mhz(max) - target_val; + diff_by_max = pmif_get_ulposc_freq_mhz(max) - target_freq_mhz; diff_by_max = ABS(diff_by_max); cal_result = (diff_by_min < diff_by_max) ? min : max; current_val = pmif_get_ulposc_freq_mhz(cal_result); /* check if calibrated value is in the range of target value +- 15% */ - return pmif_ulposc_check(current_val, target_val); + return pmif_ulposc_check(current_val, target_freq_mhz); } |