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 */ |
| 20 | switch (get_uint_option("power_profile", 0)) { |
| 21 | case 1: |
| 22 | soc_conf->tdp_pl1_override = 17; |
| 23 | soc_conf->tdp_pl2_override = 20; |
| 24 | break; |
| 25 | case 2: |
| 26 | soc_conf->tdp_pl1_override = 20; |
| 27 | soc_conf->tdp_pl2_override = 25; |
| 28 | break; |
| 29 | default: |
| 30 | disable_turbo(); |
| 31 | soc_conf->tdp_pl1_override = 15; |
| 32 | soc_conf->tdp_pl2_override = 15; |
| 33 | break; |
| 34 | } |
| 35 | |
| 36 | /* Enable/Disable Wireless based on CMOS settings */ |
| 37 | if (get_uint_option("wireless", 1) == 0) |
| 38 | nic_dev->enabled = 0; |
| 39 | |
| 40 | /* Enable/Disable Webcam based on CMOS settings */ |
| 41 | if (get_uint_option("webcam", 1) == 0) |
| 42 | cfg->usb2_ports[3].enable = 0; |
| 43 | } |