Debian Codegraph @

src/mainboard/starlabs/starlite_adl/variants/mk_v/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 *nic_dev = pcidev_on_root(0x14, 3);
23 struct device *touchscreen_dev = pcidev_on_root(0x15, 2);
24 struct device *accelerometer_dev = pcidev_on_root(0x15, 0);
25 struct device *gna_dev = pcidev_on_root(0x08, 0);
26
27 uint8_t performance_scale = 100;
28
29 /* Set PL4 to 1.0C */
30 soc_conf_4core->tdp_pl4 = 37;
31
32 /* Set PL1 to 50% of PL2 */
33 soc_conf_4core->tdp_pl1_override = (soc_conf_4core->tdp_pl2_override / 2) & ~1;
34
35 /* Scale PL1 & PL2 based on CMOS settings */
36 switch (get_power_profile(PP_POWER_SAVER)) {
37 case PP_POWER_SAVER:
38 performance_scale -= 50;
39 cfg->tcc_offset = TCC(70);
40 break;
41 case PP_BALANCED:
42 performance_scale -= 25;
43 cfg->tcc_offset = TCC(80);
44 break;
45 case PP_PERFORMANCE:
46 /* Use the Intel defaults */
47 cfg->tcc_offset = TCC(90);
48 break;
49 }
50
51 soc_conf_4core->tdp_pl1_override = (soc_conf_4core->tdp_pl1_override * performance_scale) / 100;
52 soc_conf_4core->tdp_pl2_override = (soc_conf_4core->tdp_pl2_override * performance_scale) / 100;
53
54 /* Enable/Disable Bluetooth based on CMOS settings */
55 if (get_uint_option("wireless", 1) == 0) {
56 cfg->usb2_ports[9].enable = 0;
57 nic_dev->enabled = 0;
58 }
59
60 /* Enable/Disable Webcam/Camera based on CMOS settings */
61 if (get_uint_option("webcam", 1) == 0)
62 cfg->usb2_ports[CONFIG_CCD_PORT].enable = 0;
63
64 /* Enable/Disable Touchscreen based on CMOS settings */
65 if (get_uint_option("touchscreen", 1) == 0)
66 touchscreen_dev->enabled = 0;
67
68 /* Enable/Disable Accelerometer based on CMOS settings */
69 if (get_uint_option("accelerometer", 1) == 0)
70 accelerometer_dev->enabled = 0;
71
72 /* Enable/Disable GNA based on CMOS settings */
73 if (get_uint_option("gna", 0) == 0)
74 gna_dev->enabled = 0;
75 }