Enable WLAN at power_on() instead of board_init()
If the board is on AC power when powered off the EC will not reset, and
WLAN power will not be enabled on next boot. Move enabling WLAN from
`board_init()` to `power_on()`.
Fixes: be4659a0cb ("Set wireless power at init and power off")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
			
			
This commit is contained in:
		
				
					committed by
					
						 Tim Crawford
						Tim Crawford
					
				
			
			
				
	
			
			
			
						parent
						
							be4659a0cb
						
					
				
				
					commit
					2a8befc195
				
			| @@ -4,7 +4,6 @@ | ||||
| #include <board/gpio.h> | ||||
| #include <board/kbc.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
|  | ||||
| extern uint8_t main_cycle; | ||||
| @@ -22,8 +21,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -5,7 +5,6 @@ | ||||
| #include <board/gpio.h> | ||||
| #include <board/kbc.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -20,8 +19,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -21,8 +20,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -182,6 +182,9 @@ void power_init(void) { | ||||
| } | ||||
|  | ||||
| void power_on(void) { | ||||
|     // Configure WLAN GPIOs before powering on | ||||
|     wireless_power(true); | ||||
|  | ||||
|     DEBUG("%02X: power_on\n", main_cycle); | ||||
|  | ||||
|     // See Figure 12-19 in Whiskey Lake Platform Design Guide | ||||
| @@ -258,8 +261,6 @@ void power_on(void) { | ||||
| void power_off(void) { | ||||
|     DEBUG("%02X: power_off\n", main_cycle); | ||||
|  | ||||
|     wireless_power(false); | ||||
|  | ||||
| #if HAVE_PCH_PWROK_EC | ||||
|     // De-assert SYS_PWROK | ||||
|     GPIO_SET_DEBUG(PCH_PWROK_EC, false); | ||||
| @@ -296,6 +297,9 @@ void power_off(void) { | ||||
| #endif // HAVE_PCH_DPWROK_EC | ||||
|     tPCH14; | ||||
|  | ||||
|     // Configure WLAN GPIOs after powering off | ||||
|     wireless_power(false); | ||||
|  | ||||
|     update_power_state(); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| #include <board/board.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
|  | ||||
| void board_init(void) { | ||||
|     // Allow CPU to boot | ||||
| @@ -17,8 +16,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) {} | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/espi.h> | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -22,8 +21,6 @@ void board_init(void) { | ||||
|     // Assert SMI# and SWI# | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/board.h> | ||||
| #include <board/espi.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| void board_init(void) { | ||||
| @@ -22,8 +21,6 @@ void board_init(void) { | ||||
|     // Assert SMI# and SWI# | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| #include <board/board.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
|  | ||||
| void board_init(void) { | ||||
|     // Allow CPU to boot | ||||
| @@ -17,8 +16,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) {} | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -27,8 +26,6 @@ void board_init(void) { | ||||
|     // Assert SMI# and SWI# | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/board.h> | ||||
| #include <board/espi.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| void board_init(void) { | ||||
| @@ -18,8 +17,6 @@ void board_init(void) { | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
|  | ||||
|     // Make sure charger is in off state, also enables PSYS | ||||
|     battery_charger_disable(); | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -17,8 +16,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -20,8 +19,6 @@ void board_init(void) { | ||||
|     gpio_set(&BKL_EN, true); | ||||
|     // Enable camera | ||||
|     gpio_set(&CCD_EN, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -20,8 +19,6 @@ void board_init(void) { | ||||
|     gpio_set(&BKL_EN, true); | ||||
|     // Enable camera | ||||
|     gpio_set(&CCD_EN, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -20,8 +19,6 @@ void board_init(void) { | ||||
|     gpio_set(&BKL_EN, true); | ||||
|     // Enable camera | ||||
|     gpio_set(&CCD_EN, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -6,7 +6,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -20,8 +19,6 @@ void board_init(void) { | ||||
|     gpio_set(&BKL_EN, true); | ||||
|     // Enable camera | ||||
|     gpio_set(&CCD_EN, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/espi.h> | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -23,8 +22,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/board.h> | ||||
| #include <board/espi.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
|  | ||||
| @@ -24,8 +23,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|  | ||||
| #include <board/board.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
|  | ||||
| void board_init(void) { | ||||
|     // Allow CPU to boot | ||||
| @@ -17,8 +16,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_on_ac(bool ac) { /* Fix unused variable */ ac = ac; } | ||||
|   | ||||
| @@ -3,7 +3,6 @@ | ||||
| #include <board/board.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
|  | ||||
| void board_init(void) { | ||||
| @@ -19,8 +18,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -21,8 +20,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -21,8 +20,6 @@ void board_init(void) { | ||||
|     gpio_set(&SCI_N, true); | ||||
|     gpio_set(&SMI_N, true); | ||||
|     gpio_set(&SWI_N, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -5,7 +5,6 @@ | ||||
| #include <board/gctrl.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/power.h> | ||||
| #include <board/wireless.h> | ||||
| #include <common/debug.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| @@ -16,8 +15,6 @@ void board_init(void) { | ||||
|     gpio_set(&BKL_EN, true); | ||||
|     // Enable camera | ||||
|     gpio_set(&CCD_EN, true); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
| @@ -4,7 +4,6 @@ | ||||
| #include <board/board.h> | ||||
| #include <board/espi.h> | ||||
| #include <board/gpio.h> | ||||
| #include <board/wireless.h> | ||||
| #include <ec/ec.h> | ||||
|  | ||||
| void board_init(void) { | ||||
| @@ -19,8 +18,6 @@ void board_init(void) { | ||||
|     gpio_set(&CCD_EN, true); | ||||
|     // Enable USB port power | ||||
|     gpio_set(&USB_PWR_EN_N, false); | ||||
|  | ||||
|     wireless_power(true); | ||||
| } | ||||
|  | ||||
| void board_event(void) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user