From 24eee9bcb0bba13747345f47c88dacc541de0551 Mon Sep 17 00:00:00 2001 From: Seunghwan Kim Date: Tue, 16 Jul 2024 17:12:54 +0900 Subject: mb/google/brya/var/xol: Limit power limits for low/no battery case Xol has a shutdown issue on our reliability test environment: - High temperature - No battery condition It needs to have margin for the PL2 and PL4 values from the adapter power, this will limit the PL2/PL4 values up to 30W/40W for xol's 45W power adapter. The new values are confirmed by our power team. BUG=b:353395811 BRANCH=brya TEST=built and verified MSR PL2/PL4 values. Intel doc #614179 introduces how to check current PL values. [Original MSR PL1/PL2/PL4 register values for xol] cd /sys/class/powercap/intel-rapl/intel-rapl\:0/ grep . *power_limit* constraint_0_power_limit_uw:18000000 <= MSR PL1 (18W) constraint_1_power_limit_uw:55000000 <= MSR PL2 (55W) constraint_2_power_limit_uw:114000000 <= MSR PL4 (114W) [When connected 60W adapter without battery] Before: constraint_0_power_limit_uw:18000000 constraint_1_power_limit_uw:55000000 constraint_2_power_limit_uw:60000000 After: constraint_0_power_limit_uw:18000000 constraint_1_power_limit_uw:30000000 constraint_2_power_limit_uw:40000000 [When connected 45W adapter without battery] Before: constraint_0_power_limit_uw:18000000 constraint_1_power_limit_uw:45000000 constraint_2_power_limit_uw:45000000 After: constraint_0_power_limit_uw:18000000 constraint_1_power_limit_uw:30000000 constraint_2_power_limit_uw:40000000 Change-Id: Ic19119042ffdcc15c72764d8c27bcdce9f229438 Signed-off-by: Seunghwan Kim Reviewed-on: https://review.coreboot.org/c/coreboot/+/83479 Tested-by: build bot (Jenkins) Reviewed-by: YH Lin Reviewed-by: Eric Lai Reviewed-by: Sumeet R Pawnikar --- src/mainboard/google/brya/variants/xol/ramstage.c | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src/mainboard/google/brya') diff --git a/src/mainboard/google/brya/variants/xol/ramstage.c b/src/mainboard/google/brya/variants/xol/ramstage.c index 135ac6043b..02829ccc71 100644 --- a/src/mainboard/google/brya/variants/xol/ramstage.c +++ b/src/mainboard/google/brya/variants/xol/ramstage.c @@ -9,7 +9,8 @@ #include #include -#define DEFAULT_NO_BATTERY_POWER_LIMIT_WATTS 30 +#define NO_BATTERY_PL2_WATTS_LIMIT 30 +#define NO_BATTERY_PL4_WATTS_LIMIT 40 static bool get_pd_power_watts(u32 *watts) { @@ -32,6 +33,8 @@ void variant_devtree_update(void) { struct soc_power_limits_config *soc_config; u32 watts; + u32 pl2_watts = NO_BATTERY_PL2_WATTS_LIMIT; + u32 pl4_watts = NO_BATTERY_PL4_WATTS_LIMIT; soc_config = variant_get_soc_power_limit_config(); if (soc_config == NULL) @@ -43,16 +46,22 @@ void variant_devtree_update(void) * settings. */ if (!google_chromeec_is_battery_present_and_above_critical_threshold()) { - /* Use fixed value when we cannot get the current PD power */ - if (!get_pd_power_watts(&watts)) - watts = DEFAULT_NO_BATTERY_POWER_LIMIT_WATTS; + /* Adjust PL2/PL4 values according to current PD power */ + if (get_pd_power_watts(&watts)) { + if (watts < NO_BATTERY_PL2_WATTS_LIMIT) + pl2_watts = watts; - printk(BIOS_INFO, "override PL2 and PL4 settings to %d watts\n", watts); + if (watts < NO_BATTERY_PL4_WATTS_LIMIT) + pl4_watts = watts; + } - if (soc_config->tdp_pl2_override > watts) - soc_config->tdp_pl2_override = watts; + printk(BIOS_INFO, "override PL2/PL4 settings to %d/%d watts\n", + pl2_watts, pl4_watts); - if (soc_config->tdp_pl4 > watts) - soc_config->tdp_pl4 = watts; + if (soc_config->tdp_pl2_override > pl2_watts) + soc_config->tdp_pl2_override = pl2_watts; + + if (soc_config->tdp_pl4 > pl4_watts) + soc_config->tdp_pl4 = pl4_watts; } } -- cgit v1.2.3