summaryrefslogtreecommitdiff
path: root/src/mainboard/google/rex/variants/rex0/variant.c
blob: a7e26e69e5d7b349131f5e70cc807740698d92ac (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
37
38
39
40
41
42
43
44
45
46
47
/* SPDX-License-Identifier: GPL-2.0-only */

#include <acpi/acpigen.h>
#include <baseboard/variants.h>
#include <fw_config.h>
#include <sar.h>
#include <variant/gpio.h>

#define TCP2_AUX_SHIFT		4
#define TCP_AUX_MASK		0x03
#define TCP_AUX_FOLLOW_CC1	0x01

const char *get_wifi_sar_cbfs_filename(void)
{
	return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI));
}

void variant_generate_s0ix_hook(enum s0ix_entry entry)
{
	if (entry == S0IX_ENTRY) {
		if (fw_config_probe(FW_CONFIG(UFC, UFC_USB)))
			acpigen_soc_clear_tx_gpio(GPP_B09);
	} else if (entry == S0IX_EXIT) {
		if (fw_config_probe(FW_CONFIG(UFC, UFC_USB)))
			acpigen_soc_set_tx_gpio(GPP_B09);
	}
}

void variant_update_soc_chip_config(struct soc_intel_meteorlake_config *config)
{
	if (fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_I2S)) ||
	    fw_config_probe(FW_CONFIG(AUDIO, MAX98363_CS42L42_SNDW)) ||
	    fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_DISCRETE_I2S_BT))) {
		config->cnvi_bt_audio_offload = true;
	}

	if (fw_config_probe(FW_CONFIG(DB_USB, USB4_KB8010)) ||
	    fw_config_probe(FW_CONFIG(DB_USB, USB4_ANX7452)) ||
	    fw_config_probe(FW_CONFIG(DB_USB, USB4_ANX7452_V2))) {
		/*
		 * Configure TCP2 for
		 * "SBU orientation not handled by external retimer"
		 */
		config->tcss_aux_ori &= ~(TCP_AUX_MASK << TCP2_AUX_SHIFT);
		config->tcss_aux_ori |= TCP_AUX_FOLLOW_CC1 << TCP2_AUX_SHIFT;
	}
}