From 7333901701c4549a6bbe3d85f7ed7834cb9f63c8 Mon Sep 17 00:00:00 2001 From: Mark Hsieh Date: Tue, 1 Aug 2023 19:16:36 +0800 Subject: mb/google/nissa/var/joxer: support DPTF oem_variables 1. Joxer uses dptf.dv to distinguish 6W/15W by setting OEM variable. 2. Update passive policy and critical policy. BUG=b:285477026, b:293540179 TEST=emerge-nissa coreboot and check the OEM variable. Signed-off-by: Mark Hsieh Change-Id: I4e52ac624f7d7628cce3035a2bac67fc527bc167 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76773 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai Reviewed-by: Sumeet R Pawnikar Reviewed-by: Derek Huang Reviewed-by: Ivan Chen --- .../google/brya/variants/joxer/overridetree.cb | 24 +++++++++++++------- src/mainboard/google/brya/variants/joxer/variant.c | 26 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 8 deletions(-) (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/brya/variants/joxer/overridetree.cb b/src/mainboard/google/brya/variants/joxer/overridetree.cb index bab93f6434e6..f5118b7e6ee9 100644 --- a/src/mainboard/google/brya/variants/joxer/overridetree.cb +++ b/src/mainboard/google/brya/variants/joxer/overridetree.cb @@ -1,4 +1,8 @@ fw_config + field THERMAL 2 2 + option THERMAL_FANLESS 0 + option THERMAL_FAN 1 + end field WIFI_SAR_ID 6 6 option WIFI_GFP2_SAR_ID_0 0 option WIFI_GFP2_SAR_ID_1 1 @@ -88,22 +92,22 @@ chip soc/intel/alderlake ## Passive Policy register "policies.passive" = "{ [0] = DPTF_PASSIVE(CPU, CPU, 95, 5000), - [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 75, 5000), - [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 75, 5000), - [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 75, 5000), + [1] = DPTF_PASSIVE(CPU, TEMP_SENSOR_0, 65, 5000), + [2] = DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 65, 5000), + [3] = DPTF_PASSIVE(CPU, TEMP_SENSOR_2, 65, 5000), }" ## Critical Policy register "policies.critical" = "{ [0] = DPTF_CRITICAL(CPU, 105, SHUTDOWN), - [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 85, SHUTDOWN), - [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 85, SHUTDOWN), - [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 85, SHUTDOWN), + [1] = DPTF_CRITICAL(TEMP_SENSOR_0, 75, SHUTDOWN), + [2] = DPTF_CRITICAL(TEMP_SENSOR_1, 75, SHUTDOWN), + [3] = DPTF_CRITICAL(TEMP_SENSOR_2, 75, SHUTDOWN), }" register "controls.power_limits" = "{ .pl1 = { - .min_power = 3000, + .min_power = 6000, .max_power = 6000, .time_window_min = 28 * MSECS_PER_SEC, .time_window_max = 32 * MSECS_PER_SEC, @@ -126,7 +130,11 @@ chip soc/intel/alderlake [3] = { 8, 500 } }" - device generic 0 on end + register "oem_data.oem_variables" = "{ + [1] = 0x1 + }" + + device generic 0 alias dptf_policy on end end end device ref i2c1 on diff --git a/src/mainboard/google/brya/variants/joxer/variant.c b/src/mainboard/google/brya/variants/joxer/variant.c index 3c23dd1ab67f..e371ada63d4f 100644 --- a/src/mainboard/google/brya/variants/joxer/variant.c +++ b/src/mainboard/google/brya/variants/joxer/variant.c @@ -3,10 +3,34 @@ #include #include #include +#include +#include #include #include #include +WEAK_DEV_PTR(dptf_policy); + +static void update_oem_variables(void) +{ + const struct device *policy_dev = DEV_PTR(dptf_policy); + struct drivers_intel_dptf_config *config = policy_dev->chip_info; + + if (fw_config_probe(FW_CONFIG(THERMAL, THERMAL_FANLESS))) { + config->oem_data.oem_variables[0] = 0; + config->oem_data.oem_variables[1] = 1; + printk(BIOS_INFO, "Set OEM Variable [0] to 0.\n"); + printk(BIOS_INFO, "Set OEM Variable [1] to 1.\n"); + } + + if (fw_config_probe(FW_CONFIG(THERMAL, THERMAL_FAN))) { + config->oem_data.oem_variables[0] = 1; + config->oem_data.oem_variables[1] = 0; + printk(BIOS_INFO, "Set OEM Variable [0] to 1.\n"); + printk(BIOS_INFO, "Set OEM Variable [1] to 0.\n"); + } +} + const char *get_wifi_sar_cbfs_filename(void) { return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI_SAR_ID)); @@ -18,6 +42,8 @@ void variant_devtree_update(void) struct device *ufs = DEV_PTR(ufs); struct device *ish = DEV_PTR(ish); + update_oem_variables(); + if (!fw_config_is_provisioned()) { printk(BIOS_INFO, "fw_config unprovisioned so enable all storage devices\n"); return; -- cgit v1.2.3