blob: 6985c67d163ae23202db210e6f4abe61bf15cabf [file] [log] [blame]
Sean Rhodese96ade62021-10-18 21:07:20 +01001/* 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
11void 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 Rhodes99d2d622022-05-26 21:04:10 +010020 switch (get_power_profile(PP_POWER_SAVER)) {
21 case PP_POWER_SAVER:
Sean Rhodese96ade62021-10-18 21:07:20 +010022 disable_turbo();
Sean Rhodes99d2d622022-05-26 21:04:10 +010023 soc_conf->tdp_pl1_override = 15;
24 soc_conf->tdp_pl2_override = 15;
Sean Rhodes5700a1e2023-07-06 12:21:27 +010025 cfg->tcc_offset = 30;
Sean Rhodes99d2d622022-05-26 21:04:10 +010026 break;
27 case PP_BALANCED:
28 soc_conf->tdp_pl1_override = 17;
29 soc_conf->tdp_pl2_override = 20;
Sean Rhodes5700a1e2023-07-06 12:21:27 +010030 cfg->tcc_offset = 25;
Sean Rhodes99d2d622022-05-26 21:04:10 +010031 break;
32 case PP_PERFORMANCE:
33 soc_conf->tdp_pl1_override = 20;
34 soc_conf->tdp_pl2_override = 25;
Sean Rhodes5700a1e2023-07-06 12:21:27 +010035 cfg->tcc_offset = 20;
Sean Rhodese96ade62021-10-18 21:07:20 +010036 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 Rhodes2eb2dce2022-05-26 20:56:14 +010044 cfg->usb2_ports[CONFIG_CCD_PORT].enable = get_uint_option("webcam", 1);
Sean Rhodese96ade62021-10-18 21:07:20 +010045}