[Feature][T8TSK-47][TCAM_T800_SW_0257] add wifi power control in spm offered by mtk
Change-Id: I7df14b7b31e9cbf81f00b3e2b38e15aaa4b66d69
diff --git a/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/drivers/spm/mt_spm_suspend.c b/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/drivers/spm/mt_spm_suspend.c
index 1a3263f..581114c 100644
--- a/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/drivers/spm/mt_spm_suspend.c
+++ b/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/drivers/spm/mt_spm_suspend.c
@@ -20,6 +20,9 @@
#include <uart.h>
#include <plat_uart.h>
#include <mt_spm_vcorefs.h>
+//you.chen@2022-07-15 add for shutdown wifi power when suspend begin
+#include <plat_private.h>
+//you.chen@2022-07-15 add for shutdown wifi power when suspend end
#define SPM_SUSPEND_SLEEP_PCM_FLAG ( \
(SPM_FLAG_DISABLE_INFRA_PDN) | \
@@ -329,6 +332,18 @@
/* Control GPIO1 for turn off WIFI chip */
gpio_set(GPIO18, GPIO_OUT_ZERO);
#endif
+
+ //you.chen@2022-07-15 add for shutdown wifi power when suspend begin
+ console_init(gteearg.atf_log_port, MT2735_UART_CLOCK, MT2735_BAUDRATE);
+ ERROR("mt_spm_suspend_enter console_init finish\n");
+#if defined(MTK_GSW_WG870_GPIO_PWR_RST)
+ /* Control GPIO1 for turn off WIFI chip */
+ ERROR("gpio set 202 0\n");
+ gpio_set(202, GPIO_OUT_ZERO);
+ gpio_set(182, GPIO_OUT_ZERO);
+#endif
+ console_uninit();
+ //you.chen@2022-07-15 add for shutdown wifi power when suspend end
return spm_conservation(state_id, ext_opand,
&__spm_suspend, reosuce_req);
}
@@ -343,6 +358,22 @@
/* Waiting for WIFI chip done*/
mdelay(WIFI_CHIP_DONE_MS);
#endif
+ //you.chen@2022-07-15 add for shutdown wifi power when suspend begin
+ console_init(gteearg.atf_log_port, MT2735_UART_CLOCK, MT2735_BAUDRATE);
+ ERROR("mt_spm_suspend_resume console_init finish\n");
+#if defined(MTK_GSW_WG870_GPIO_PWR_RST)
+ /* Control GPIO18 for turn on WIFI chip */
+ ERROR("gpio set 202 1\n");
+ gpio_set(182, GPIO_OUT_ONE);
+ mdelay(1);
+ gpio_set(202, GPIO_OUT_ONE);
+
+ /* Waiting for WIFI chip done*/
+ mdelay(WIFI_CHIP_DONE_MS);
+ INFO("mt_spm_suspend_resume\n");
+#endif
+ console_uninit();
+ //you.chen@2022-07-15 add for shutdown wifi power when suspend end
spm_conservation_finish(state_id, ext_opand, &__spm_suspend, status);
/* switch vcoredvfs table for AP + MD */
diff --git a/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/platform.mk b/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/platform.mk
index f57e030..4e6b92a 100644
--- a/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/platform.mk
+++ b/src/bsp/trustzone/atf/v1.6/mt2xxx/plat/mediatek/mt2735/platform.mk
@@ -192,6 +192,10 @@
# Platform config to determine the platform
CONFIG_MACH_MT2735 := 1
$(eval $(call add_define,CONFIG_MACH_MT2735))
+#you.chen@2022-07-15 add for shutdown wifi power when suspend begin
+MTK_GSW_WG870_GPIO_PWR_RST := 1
+$(eval $(call add_define,MTK_GSW_WG870_GPIO_PWR_RST))
+#you.chen@2022-07-15 add for shutdown wifi power when suspend end
# check if MACHINE_ARCH in BUILD_BASE is for fpga
CONFIG_MACH_FPGA := $(if $(findstring fpga, $(BUILD_BASE)),1,0)