Debian Codegraph @

src/mainboard/google/poppy/variants/nocturne/mainboard.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <chip.h>
5 #include <device/device.h>
6 #include <device/pci_ids.h>
7 #include <device/pci_ops.h>
8 #include <intelblocks/power_limit.h>
9 #include <static.h>
10
11 /* PL2 limit in watts for AML and KBL */
12 #define PL2_AML 18
13 #define PL2_KBL 15
14
15 static uint32_t get_pl2(void)
16 {
17 struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD);
18 uint16_t id;
19
20 id = pci_read_config16(igd_dev, PCI_DEVICE_ID);
21 /* Assume we only have KLB-Y and AML-Y SKUs */
22 if (id == PCI_DID_INTEL_KBL_GT2_SULXM)
23 return PL2_KBL;
24
25 return PL2_AML;
26 }
27
28 /* Override dev tree settings per board */
29 void variant_devtree_update(void)
30 {
31 struct soc_power_limits_config *soc_conf;
32 config_t *cfg = config_of_soc();
33
34 soc_conf = &cfg->power_limits_config;
35 /* Update PL2 based on CPU */
36 soc_conf->tdp_pl2_override = get_pl2();
37 }