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 <sh_.kim@samsung.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83479
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: YH Lin <yueherngl@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Sumeet R Pawnikar <sumeet.r.pawnikar@intel.com>
This commit is contained in:
Seunghwan Kim
2024-07-16 17:12:54 +09:00
committed by Felix Held
parent 0c1897e4fd
commit 24eee9bcb0

View File

@@ -9,7 +9,8 @@
#include <ec/google/chromeec/ec.h>
#include <intelblocks/power_limit.h>
#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;
}
}