Debian Codegraph @

src/mainboard/starlabs/starbook/variants/cml/devtree.c

raw symbols SCIP
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 <static.h>
9 #include <types.h>
10 #include <variants.h>
11
12 #define TJ_MAX 100
13 #define TCC(temp) (TJ_MAX - temp)
14
15 void devtree_update(void)
16 {
17 config_t *cfg = config_of_soc();
18
19 struct soc_power_limits_config *soc_conf = &cfg->power_limits_config;
20
21 struct device *nic_dev = pcidev_on_root(0x14, 3);
22
23 uint8_t performance_scale = 100;
24
25 /* Set PL4 to 1.0C */
26 soc_conf->tdp_pl4 = 45;
27
28 /* Set PL1 to 50% of PL2 */
29 soc_conf->tdp_pl1_override = (soc_conf->tdp_pl2_override / 2) & ~1;
30
31 /* Scale PL1 & PL2 based on CMOS settings */
32 switch (get_power_profile(PP_POWER_SAVER)) {
33 case PP_POWER_SAVER:
34 performance_scale -= 50;
35 cfg->tcc_offset = TCC(80);
36 break;
37 case PP_BALANCED:
38 performance_scale -= 25;
39 cfg->tcc_offset = TCC(90);
40 break;
41 case PP_PERFORMANCE:
42 /* Use the Intel defaults */
43 cfg->tcc_offset = TCC(100);
44 break;
45 }
46
47 soc_conf->tdp_pl1_override = (soc_conf->tdp_pl1_override * performance_scale) / 100;
48 soc_conf->tdp_pl2_override = (soc_conf->tdp_pl2_override * performance_scale) / 100;
49
50 /* Enable/Disable Wireless based on CMOS settings */
51 if (get_uint_option("wireless", 1) == 0)
52 nic_dev->enabled = 0;
53
54 /* Enable/Disable Webcam based on CMOS settings */
55 cfg->usb2_ports[CONFIG_CCD_PORT].enable = get_uint_option("webcam", 1);
56
57 /* Enable/Disable Card Reader based on CMOS Settings */
58 if (get_uint_option("card_reader", 1) == 0)
59 cfg->usb2_ports[3].enable = 0;
60 }