Debian Codegraph @

src/mainboard/starlabs/starbook/variants/rpl/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_6core =
20 &cfg->power_limits_config[RPL_P_282_242_142_15W_CORE];
21
22 struct soc_power_limits_config *soc_conf_12core =
23 &cfg->power_limits_config[RPL_P_682_482_282_28W_CORE];
24
25 struct device *tbt_pci_dev = pcidev_on_root(0x07, 0);
26 struct device *tbt_dma_dev = pcidev_on_root(0x0d, 2);
27 struct device *gna_dev = pcidev_on_root(0x08, 0);
28
29 uint8_t performance_scale = 100;
30
31 /* Set PL4 to 1.0C */
32 soc_conf_6core->tdp_pl4 = 65;
33 soc_conf_12core->tdp_pl4 = 65;
34
35 /* Set PL1 to 50% of PL2 */
36 soc_conf_6core->tdp_pl1_override = (soc_conf_6core->tdp_pl2_override / 2) & ~1;
37 soc_conf_12core->tdp_pl1_override = (soc_conf_12core->tdp_pl2_override / 2) & ~1;
38
39 /* Scale PL1 & PL2 based on CMOS settings */
40 switch (get_power_profile(PP_POWER_SAVER)) {
41 case PP_POWER_SAVER:
42 performance_scale -= 50;
43 cfg->tcc_offset = TCC(80);
44 break;
45 case PP_BALANCED:
46 performance_scale -= 25;
47 cfg->tcc_offset = TCC(90);
48 break;
49 case PP_PERFORMANCE:
50 /* Use the Intel defaults */
51 cfg->tcc_offset = TCC(100);
52 break;
53 }
54
55 soc_conf_6core->tdp_pl1_override = (soc_conf_6core->tdp_pl1_override * performance_scale) / 100;
56 soc_conf_6core->tdp_pl2_override = (soc_conf_6core->tdp_pl2_override * performance_scale) / 100;
57
58 soc_conf_12core->tdp_pl1_override = (soc_conf_12core->tdp_pl1_override * performance_scale) / 100;
59 soc_conf_12core->tdp_pl2_override = (soc_conf_12core->tdp_pl2_override * performance_scale) / 100;
60
61 /* Enable/Disable Bluetooth based on CMOS settings */
62 if (get_uint_option("wireless", 1) == 0)
63 cfg->usb2_ports[9].enable = 0;
64
65 /* Enable/Disable Webcam based on CMOS settings */
66 if (get_uint_option("webcam", 1) == 0)
67 cfg->usb2_ports[CONFIG_CCD_PORT].enable = 0;
68
69 /* Enable/Disable Fingerprint Reader based on CMOS Settings */
70 if (get_uint_option("fingerprint_reader", 1) == 0)
71 cfg->usb2_ports[5].enable = 0;
72
73 /* Enable/Disable Card Reader based on CMOS Settings */
74 if (get_uint_option("card_reader", 1) == 0)
75 cfg->usb2_ports[3].enable = 0;
76
77 /* Enable/Disable Thunderbolt based on CMOS settings */
78 if (get_uint_option("thunderbolt", 1) == 0) {
79 tbt_pci_dev->enabled = 0;
80 tbt_dma_dev->enabled = 0;
81 }
82
83 /* Enable/Disable GNA based on CMOS settings */
84 if (get_uint_option("gna", 0) == 0)
85 gna_dev->enabled = 0;
86 }