1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <baseboard/variants.h>
4 #include <cpu/x86/smm.h>
6 #include <ec/google/chromeec/ec.h>
7 #include <ec/google/chromeec/smm.h>
10 #include <intelblocks/smihandler.h>
12 #include <variant/ec.h>
13 #include <variant/gpio.h>
15 struct gpio_with_delay
{
17 unsigned int delay_msecs
;
20 void mainboard_smi_gpi_handler(const struct gpi_status
*sts
)
22 if (gpi_status_get(sts
, EC_SMI_GPI
))
23 chromeec_smi_process_events();
26 void mainboard_smi_sleep(u8 slp_typ
)
28 const struct pad_config
*pads
;
31 pads
= variant_sleep_gpio_table(&num
, slp_typ
);
32 gpio_configure_pads(pads
, num
);
34 variant_smi_sleep(slp_typ
);
36 chromeec_smi_sleep(slp_typ
, MAINBOARD_EC_S3_WAKE_EVENTS
,
37 MAINBOARD_EC_S5_WAKE_EVENTS
);
40 int mainboard_smi_apmc(u8 apmc
)
42 chromeec_smi_apmc(apmc
, MAINBOARD_EC_SCI_EVENTS
,
43 MAINBOARD_EC_SMI_EVENTS
);
47 void mainboard_smi_espi_handler(void)
49 chromeec_smi_process_events();
52 void elog_gsmi_cb_mainboard_log_wake_source(void)
54 google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS
|
55 MAINBOARD_EC_S0IX_WAKE_EVENTS
);
58 void __weak
variant_smi_sleep(u8 slp_typ
)
60 /* Leave for the variant to implement if necessary. */
63 void power_off_lte_module(void)
65 const struct gpio_with_delay lte_power_off_gpios
[] = {
67 GPIO_161
, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
71 GPIO_117
, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
75 GPIO_67
, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
80 for (int i
= 0; i
< ARRAY_SIZE(lte_power_off_gpios
); i
++) {
81 gpio_output(lte_power_off_gpios
[i
].gpio
, 0);
82 mdelay(lte_power_off_gpios
[i
].delay_msecs
);