Debian Codegraph @

src/mainboard/google/brya/variants/teliks/variant.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <chip.h>
5 #include <fw_config.h>
6 #include <sar.h>
7 #include <soc/gpio_soc_defs.h>
8 #include <intelblocks/graphics.h>
9 #include <drivers/intel/gma/opregion.h>
10 #include <console/console.h>
11 #include <ec/google/chromeec/ec.h>
12
13 /* Per-pipe DDI Function Control 2 */
14 #define TRANS_DDI_FUNC_CTL2_A 0x60404
15 #define TRANS_DDI_AUDIO_MUTE_OVERRIDE_BITS_FIELDS (3 << 6)
16
17 const char *get_wifi_sar_cbfs_filename(void)
18 {
19 return get_wifi_sar_fw_config_filename(FW_CONFIG_FIELD(WIFI));
20 }
21
22 static const struct pad_config wifi_pcie_enable_pad[] = {
23 /* H20 : IMGCLKOUT1 ==> WLAN_PERST_L */
24 PAD_CFG_GPO(GPP_H20, 1, DEEP),
25 /* B11 : NC ==> EN_PP3300_WLAN_X*/
26 PAD_CFG_GPO(GPP_B11, 1, DEEP),
27 };
28
29 void variant_update_soc_chip_config(struct soc_intel_alderlake_config *config)
30 {
31 if (!fw_config_probe(FW_CONFIG(WIFI, WIFI_6E))) {
32 printk(BIOS_INFO, "CNVi bluetooth disabled by fw_config\n");
33 config->cnvi_bt_core = false;
34 printk(BIOS_INFO, "CNVi bluetooth audio offload disabled by fw_config\n");
35 config->cnvi_bt_audio_offload = false;
36 }
37 }
38
39 void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
40 {
41 if (fw_config_probe(FW_CONFIG(WIFI, WIFI_6_7921))
42 || fw_config_probe(FW_CONFIG(WIFI, WIFI_6_8852))) {
43 printk(BIOS_INFO, "Enable PCie based Wifi GPIO pins.\n");
44 gpio_padbased_override(padbased_table, wifi_pcie_enable_pad,
45 ARRAY_SIZE(wifi_pcie_enable_pad));
46 }
47 }
48
49 void variant_finalize(void)
50 {
51 /*
52 * Panel CSOT MNB601LS1-3 will flicker once during enter Chrome login screen,
53 * it is because it inserts 12 blank frames if it receives the unmute in VB-ID.
54 *
55 * Always override the mute in VB-ID to avoid Tcon EC detected the
56 * audiomute_flag change.
57 */
58 graphics_gtt_rmw(TRANS_DDI_FUNC_CTL2_A, ~TRANS_DDI_AUDIO_MUTE_OVERRIDE_BITS_FIELDS,
59 TRANS_DDI_AUDIO_MUTE_OVERRIDE_BITS_FIELDS);
60 }
61
62 static int get_ssfc(uint32_t *val)
63 {
64 static uint32_t known_value;
65 static enum {
66 SSFC_NOT_READ,
67 SSFC_AVAILABLE,
68 } ssfc_state = SSFC_NOT_READ;
69
70 if (ssfc_state == SSFC_AVAILABLE) {
71 *val = known_value;
72 return 0;
73 }
74
75 /*
76 * If SSFC field is not in the CBI then the value of SSFC will be 0 for
77 * further processing later since 0 of each bits group means default
78 * component in a variant. For more detail, please refer to cbi_ssfc.h.
79 */
80 if (google_chromeec_cbi_get_ssfc(&known_value) != 0) {
81 printk(BIOS_DEBUG, "SSFC not set in CBI\n");
82 return -1;
83 }
84
85 ssfc_state = SSFC_AVAILABLE;
86 *val = known_value;
87 printk(BIOS_INFO, "SSFC 0x%x.\n", known_value);
88 return 0;
89 }
90
91 const char *mainboard_vbt_filename(void)
92 {
93 uint32_t ssfc;
94 if (get_ssfc(&ssfc)) {
95 printk(BIOS_INFO, "Failed to read SSFC, using default vbt-teliks.bin\n");
96 return "vbt-teliks.bin";
97 }
98
99 /*
100 * Determine if the panel is 11 inches based on the SSFC register.
101 *
102 * Bit 6 of the SSFC register indicates the panel size:
103 * 0: 12.2 inch panel
104 * 1: 11.6 inch panel
105 */
106 bool is_panel_11_inch = (ssfc >> 6) & 0x1;
107
108 if (is_panel_11_inch) {
109 printk(BIOS_INFO, "Bit 6 of SSFC is 1, use vbt-teliks_panel_11_inch.bin\n");
110 return "vbt-teliks_panel_11_inch.bin";
111 }
112
113 printk(BIOS_INFO, "Bit 6 of SSFC is 0, use vbt-teliks.bin\n");
114 return "vbt-teliks.bin";
115 }