Debian Codegraph @

src/mainboard/starlabs/starbook/variants/adl_n/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 105
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_4core =
20 &cfg->power_limits_config[ADL_N_041_6W_CORE];
21
22 struct device *gna_dev = pcidev_on_root(0x08, 0);
23
24 uint8_t performance_scale = 100;
25
26 /* Set PL4 to 1.0C */
27 soc_conf_4core->tdp_pl4 = 65;
28
29 /* Set PL1 to 50% of PL2 */
30 soc_conf_4core->tdp_pl1_override = (soc_conf_4core->tdp_pl2_override / 2) & ~1;
31
32 /* Scale PL1 & PL2 based on CMOS settings */
33 switch (get_power_profile(PP_POWER_SAVER)) {
34 case PP_POWER_SAVER:
35 performance_scale -= 50;
36 cfg->tcc_offset = TCC(80);
37 break;
38 case PP_BALANCED:
39 performance_scale -= 25;
40 cfg->tcc_offset = TCC(90);
41 break;
42 case PP_PERFORMANCE:
43 /* Use the Intel defaults */
44 cfg->tcc_offset = TCC(100);
45 break;
46 }
47
48 soc_conf_4core->tdp_pl1_override = (soc_conf_4core->tdp_pl1_override * performance_scale) / 100;
49 soc_conf_4core->tdp_pl2_override = (soc_conf_4core->tdp_pl2_override * performance_scale) / 100;
50
51 /* Enable/Disable Bluetooth based on CMOS settings */
52 if (get_uint_option("wireless", 1) == 0)
53 cfg->usb2_ports[9].enable = 0;
54
55 /* Enable/Disable Webcam based on CMOS settings */
56 if (get_uint_option("webcam", 1) == 0)
57 cfg->usb2_ports[CONFIG_CCD_PORT].enable = 0;
58
59 /* Enable/Disable Card Reader based on CMOS Settings */
60 if (get_uint_option("card_reader", 1) == 0)
61 cfg->usb2_ports[3].enable = 0;
62
63 /* Enable/Disable GNA based on CMOS settings */
64 if (get_uint_option("gna", 0) == 0)
65 gna_dev->enabled = 0;
66 }