Sean Rhodes | e96ade6 | 2021-10-18 21:07:20 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <chip.h> |
| 4 | #include <cpu/intel/turbo.h> |
| 5 | #include <device/device.h> |
| 6 | #include <device/pci_def.h> |
| 7 | #include <option.h> |
| 8 | #include <types.h> |
| 9 | #include <variants.h> |
| 10 | |
| 11 | void devtree_update(void) |
| 12 | { |
| 13 | config_t *cfg = config_of_soc(); |
| 14 | |
| 15 | struct soc_power_limits_config *soc_conf = &cfg->power_limits_config; |
| 16 | |
| 17 | struct device *nic_dev = pcidev_on_root(0x14, 3); |
| 18 | |
| 19 | /* Update PL1 & PL2 based on CMOS settings */ |
Sean Rhodes | 99d2d62 | 2022-05-26 21:04:10 +0100 | [diff] [blame] | 20 | switch (get_power_profile(PP_POWER_SAVER)) { |
| 21 | case PP_POWER_SAVER: |
Sean Rhodes | e96ade6 | 2021-10-18 21:07:20 +0100 | [diff] [blame] | 22 | disable_turbo(); |
Sean Rhodes | 99d2d62 | 2022-05-26 21:04:10 +0100 | [diff] [blame] | 23 | soc_conf->tdp_pl1_override = 15; |
| 24 | soc_conf->tdp_pl2_override = 15; |
Sean Rhodes | 5700a1e | 2023-07-06 12:21:27 +0100 | [diff] [blame] | 25 | cfg->tcc_offset = 30; |
Sean Rhodes | 99d2d62 | 2022-05-26 21:04:10 +0100 | [diff] [blame] | 26 | break; |
| 27 | case PP_BALANCED: |
| 28 | soc_conf->tdp_pl1_override = 17; |
| 29 | soc_conf->tdp_pl2_override = 20; |
Sean Rhodes | 5700a1e | 2023-07-06 12:21:27 +0100 | [diff] [blame] | 30 | cfg->tcc_offset = 25; |
Sean Rhodes | 99d2d62 | 2022-05-26 21:04:10 +0100 | [diff] [blame] | 31 | break; |
| 32 | case PP_PERFORMANCE: |
| 33 | soc_conf->tdp_pl1_override = 20; |
| 34 | soc_conf->tdp_pl2_override = 25; |
Sean Rhodes | 5700a1e | 2023-07-06 12:21:27 +0100 | [diff] [blame] | 35 | cfg->tcc_offset = 20; |
Sean Rhodes | e96ade6 | 2021-10-18 21:07:20 +0100 | [diff] [blame] | 36 | break; |
| 37 | } |
| 38 | |
| 39 | /* Enable/Disable Wireless based on CMOS settings */ |
| 40 | if (get_uint_option("wireless", 1) == 0) |
| 41 | nic_dev->enabled = 0; |
| 42 | |
| 43 | /* Enable/Disable Webcam based on CMOS settings */ |
Sean Rhodes | 2eb2dce | 2022-05-26 20:56:14 +0100 | [diff] [blame] | 44 | cfg->usb2_ports[CONFIG_CCD_PORT].enable = get_uint_option("webcam", 1); |
Sean Rhodes | e96ade6 | 2021-10-18 21:07:20 +0100 | [diff] [blame] | 45 | } |