diff options
-rw-r--r-- | src/mainboard/starlabs/labtop/include/variants.h | 9 | ||||
-rw-r--r-- | src/mainboard/starlabs/labtop/mainboard.c | 6 | ||||
-rw-r--r-- | src/mainboard/starlabs/labtop/variants/tgl/devtree.c | 20 |
3 files changed, 25 insertions, 10 deletions
diff --git a/src/mainboard/starlabs/labtop/include/variants.h b/src/mainboard/starlabs/labtop/include/variants.h index c95d15bd72..0dd41c062c 100644 --- a/src/mainboard/starlabs/labtop/include/variants.h +++ b/src/mainboard/starlabs/labtop/include/variants.h @@ -5,6 +5,15 @@ #include <soc/gpio.h> +enum cmos_power_profile { + PP_POWER_SAVER = 0, + PP_BALANCED = 1, + PP_PERFORMANCE = 2, +}; +#define NUM_POWER_PROFILES 3 + +enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback); + /* * The next set of functions return the gpio table and fill in the number of * entries for each table. diff --git a/src/mainboard/starlabs/labtop/mainboard.c b/src/mainboard/starlabs/labtop/mainboard.c index 60e65ee8c4..d394f2579d 100644 --- a/src/mainboard/starlabs/labtop/mainboard.c +++ b/src/mainboard/starlabs/labtop/mainboard.c @@ -5,6 +5,12 @@ #include <option.h> #include <variants.h> +enum cmos_power_profile get_power_profile(enum cmos_power_profile fallback) +{ + const unsigned int power_profile = get_uint_option("power_profile", fallback); + return power_profile < NUM_POWER_PROFILES ? power_profile : fallback; +} + static void init_mainboard(void *chip_info) { const struct pad_config *pads; diff --git a/src/mainboard/starlabs/labtop/variants/tgl/devtree.c b/src/mainboard/starlabs/labtop/variants/tgl/devtree.c index 42a5aff366..09d26e8ecc 100644 --- a/src/mainboard/starlabs/labtop/variants/tgl/devtree.c +++ b/src/mainboard/starlabs/labtop/variants/tgl/devtree.c @@ -24,26 +24,26 @@ void devtree_update(void) /* Update PL1 & PL2 based on CMOS settings */ - switch (get_uint_option("power_profile", 0)) { - case 1: + switch (get_power_profile(PP_POWER_SAVER)) { + case PP_POWER_SAVER: + disable_turbo(); + soc_conf_2core->tdp_pl1_override = 15; + soc_conf_4core->tdp_pl1_override = 15; + soc_conf_2core->tdp_pl2_override = 15; + soc_conf_4core->tdp_pl2_override = 15; + break; + case PP_BALANCED: soc_conf_2core->tdp_pl1_override = 15; soc_conf_4core->tdp_pl1_override = 15; soc_conf_2core->tdp_pl2_override = 25; soc_conf_4core->tdp_pl2_override = 25; break; - case 2: + case PP_PERFORMANCE: soc_conf_2core->tdp_pl1_override = 28; soc_conf_4core->tdp_pl1_override = 28; soc_conf_2core->tdp_pl2_override = 40; soc_conf_4core->tdp_pl2_override = 40; break; - default: - disable_turbo(); - soc_conf_2core->tdp_pl1_override = 15; - soc_conf_4core->tdp_pl1_override = 15; - soc_conf_2core->tdp_pl2_override = 15; - soc_conf_4core->tdp_pl2_override = 15; - break; } /* Enable/Disable Wireless based on CMOS settings */ |