summaryrefslogtreecommitdiff
path: root/src/mainboard/google/poppy/variants/nocturne/mainboard.c
blob: 1482b3458f224cde27dab707003b9be877f1b1d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0-only */

#include <baseboard/variants.h>
#include <chip.h>
#include <device/device.h>
#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <intelblocks/power_limit.h>

/* PL2 limit in watts for AML and KBL */
#define PL2_AML	18
#define PL2_KBL	15

static uint32_t get_pl2(void)
{
	struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD);
	uint16_t id;

	id = pci_read_config16(igd_dev, PCI_DEVICE_ID);
	/* Assume we only have KLB-Y and AML-Y SKUs */
	if (id == PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM)
		return PL2_KBL;

	return PL2_AML;
}

/* Override dev tree settings per board */
void variant_devtree_update(void)
{
	struct soc_power_limits_config *soc_conf;
	config_t *cfg = config_of_soc();

	soc_conf = &cfg->power_limits_config;
	/* Update PL2 based on CPU */
	soc_conf->tdp_pl2_override = get_pl2();
}