mb/google/octopus: Clean up LTE power off function

All octopus board share the same power off sequence.
Move to smihandler.c instead variant.c.

BUG=b:168075958
BRANCH=octopus
TEST=build image and verify on the DUT with LTE DB.

Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com>
Change-Id: I2be5a656fb42fff99c56d21aaa73ed9140caad37
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45436
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Eric Lai 2020-09-16 11:21:08 +08:00 committed by Patrick Georgi
parent 3da27ab681
commit fa0080d187
6 changed files with 39 additions and 117 deletions

View File

@ -3,15 +3,22 @@
#include <acpi/acpi.h>
#include <baseboard/variants.h>
#include <cpu/x86/smm.h>
#include <delay.h>
#include <ec/google/chromeec/ec.h>
#include <ec/google/chromeec/smm.h>
#include <elog.h>
#include <gpio.h>
#include <intelblocks/smihandler.h>
#include <soc/pm.h>
#include <soc/gpio.h>
#include <variant/ec.h>
#include <variant/gpio.h>
struct gpio_with_delay {
gpio_t gpio;
unsigned int delay_msecs;
};
void mainboard_smi_gpi_handler(const struct gpi_status *sts)
{
if (gpi_status_get(sts, EC_SMI_GPI))
@ -54,3 +61,27 @@ void __weak variant_smi_sleep(u8 slp_typ)
{
/* Leave for the variant to implement if necessary. */
}
void power_off_lte_module(void)
{
const struct gpio_with_delay lte_power_off_gpios[] = {
{
GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
30,
},
{
GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
100
},
{
GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
0
}
};
for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) {
gpio_output(lte_power_off_gpios[i].gpio, 0);
mdelay(lte_power_off_gpios[i].delay_msecs);
}
}

View File

@ -50,4 +50,8 @@ bool no_touchscreen_sku(uint32_t sku_id);
/* allow each variants to customize smi sleep flow. */
void variant_smi_sleep(u8 slp_typ);
/* LTE power off sequence:
* GPIO_161 -> 30ms -> GPIO_117 -> 100ms -> GPIO_67 */
void power_off_lte_module(void);
#endif /* BASEBOARD_VARIANTS_H */

View File

@ -16,34 +16,6 @@ enum {
SKU_40_DROID = 40, /* LTE + Touch + KB backlight*/
};
struct gpio_with_delay {
gpio_t gpio;
unsigned int delay_msecs;
};
static void power_off_lte_module(u8 slp_typ)
{
const struct gpio_with_delay lte_power_off_gpios[] = {
{
GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
30,
},
{
GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
100
},
{
GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
0
}
};
for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) {
gpio_output(lte_power_off_gpios[i].gpio, 0);
mdelay(lte_power_off_gpios[i].delay_msecs);
}
}
const char *get_wifi_sar_cbfs_filename(void)
{
const char *filename = NULL;
@ -68,7 +40,7 @@ void variant_smi_sleep(u8 slp_typ)
case SKU_38_DROID:
case SKU_39_DROID:
case SKU_40_DROID:
power_off_lte_module(slp_typ);
power_off_lte_module();
return;
default:
return;

View File

@ -16,35 +16,6 @@ enum {
SKU_4_WIFI_2CAM = 4, /* Wifi + dual camera */
};
struct gpio_with_delay {
gpio_t gpio;
unsigned int delay_msecs;
};
static void power_off_lte_module(u8 slp_typ)
{
const struct gpio_with_delay lte_power_off_gpios[] = {
{
GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
30,
},
{
GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
100
},
{
GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
0
}
};
for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) {
gpio_output(lte_power_off_gpios[i].gpio, 0);
mdelay(lte_power_off_gpios[i].delay_msecs);
}
}
void variant_smi_sleep(u8 slp_typ)
{
/* Currently use cases here all target to S5 therefore we do early return
@ -55,7 +26,7 @@ void variant_smi_sleep(u8 slp_typ)
switch (google_chromeec_get_board_sku()) {
case SKU_1_LTE:
case SKU_3_LTE_2CAM:
power_off_lte_module(slp_typ);
power_off_lte_module();
return;
default:
return;

View File

@ -6,34 +6,6 @@
#include <delay.h>
#include <gpio.h>
struct gpio_with_delay {
gpio_t gpio;
unsigned int delay_msecs;
};
static void power_off_lte_module(u8 slp_typ)
{
const struct gpio_with_delay lte_power_off_gpios[] = {
{
GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
30,
},
{
GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
100
},
{
GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
0
}
};
for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) {
gpio_output(lte_power_off_gpios[i].gpio, 0);
mdelay(lte_power_off_gpios[i].delay_msecs);
}
}
void variant_smi_sleep(u8 slp_typ)
{
/* Currently use cases here all target to S5 therefore we do early return
@ -41,5 +13,5 @@ void variant_smi_sleep(u8 slp_typ)
if (slp_typ != ACPI_S5)
return;
power_off_lte_module(slp_typ);
power_off_lte_module();
}

View File

@ -9,34 +9,6 @@
#include <gpio.h>
#include <variant/sku.h>
struct gpio_with_delay {
gpio_t gpio;
unsigned int delay_msecs;
};
static void power_off_lte_module(u8 slp_typ)
{
const struct gpio_with_delay lte_power_off_gpios[] = {
{
GPIO_161, /* AVS_I2S1_MCLK -- PLT_RST_LTE_L */
30,
},
{
GPIO_117, /* PCIE_WAKE1_B -- FULL_CARD_POWER_OFF */
100
},
{
GPIO_67, /* UART2-CTS_B -- EN_PP3300_DX_LTE_SOC */
0
}
};
for (int i = 0; i < ARRAY_SIZE(lte_power_off_gpios); i++) {
gpio_output(lte_power_off_gpios[i].gpio, 0);
mdelay(lte_power_off_gpios[i].delay_msecs);
}
}
const char *mainboard_vbt_filename(void)
{
uint32_t sku_id;
@ -64,7 +36,7 @@ void variant_smi_sleep(u8 slp_typ)
switch (google_chromeec_get_board_sku()) {
case SKU_17_LTE:
case SKU_18_LTE_TS:
power_off_lte_module(slp_typ);
power_off_lte_module();
return;
default:
return;