Debian Codegraph @

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