diff --git a/src/board/system76/addw1/board.c b/src/board/system76/addw1/board.c index 61de57f..3bbfb8e 100644 --- a/src/board/system76/addw1/board.c +++ b/src/board/system76/addw1/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include extern uint8_t main_cycle; @@ -15,16 +16,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/addw2/board.c b/src/board/system76/addw2/board.c index 0234d9a..8a5aade 100644 --- a/src/board/system76/addw2/board.c +++ b/src/board/system76/addw2/board.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -15,13 +16,12 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/addw2/include/board/gpio.h b/src/board/system76/addw2/include/board/gpio.h index 356495d..83ee931 100644 --- a/src/board/system76/addw2/include/board/gpio.h +++ b/src/board/system76/addw2/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code DD_ON; diff --git a/src/board/system76/bonw14/board.c b/src/board/system76/bonw14/board.c index ed2921c..ae89aa0 100644 --- a/src/board/system76/bonw14/board.c +++ b/src/board/system76/bonw14/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -14,16 +15,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable USB port power? gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/common/common.mk b/src/board/system76/common/common.mk index 12c6b47..563c74c 100644 --- a/src/board/system76/common/common.mk +++ b/src/board/system76/common/common.mk @@ -25,6 +25,7 @@ board-common-y += scratch.c board-common-y += smbus.c board-common-y += smfi.c board-common-y += stdio.c +board-common-y += wireless.c # Set log level # 0 - NONE diff --git a/src/board/system76/common/include/board/wireless.h b/src/board/system76/common/include/board/wireless.h new file mode 100644 index 0000000..3dd1245 --- /dev/null +++ b/src/board/system76/common/include/board/wireless.h @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-3.0-only + +#ifndef _BOARD_WIRELESS_H +#define _BOARD_WIRELESS_H + +#include + +void wireless_power(bool); + +#endif // _BOARD_WIRELESS_H diff --git a/src/board/system76/common/power.c b/src/board/system76/common/power.c index 0411997..9bb0149 100644 --- a/src/board/system76/common/power.c +++ b/src/board/system76/common/power.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -257,6 +258,8 @@ 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); diff --git a/src/board/system76/common/wireless.c b/src/board/system76/common/wireless.c new file mode 100644 index 0000000..e898473 --- /dev/null +++ b/src/board/system76/common/wireless.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-3.0-only + +#include +#include + +#ifndef HAVE_BT_EN + #define HAVE_BT_EN 1 +#endif +#ifndef HAVE_WLAN_EN + #define HAVE_WLAN_EN 1 +#endif +#ifndef HAVE_WLAN_PWR_EN + #define HAVE_WLAN_PWR_EN 1 +#endif + +/** + * Set the WLAN card power state. + */ +void wireless_power(bool enable) { +#if HAVE_BT_EN + gpio_set(&BT_EN, enable); +#endif +#if HAVE_WLAN_EN + gpio_set(&WLAN_EN, enable); +#endif +#if HAVE_WLAN_PWR_EN + gpio_set(&WLAN_PWR_EN, enable); +#endif +} diff --git a/src/board/system76/darp5/board.c b/src/board/system76/darp5/board.c index de66e2b..ca0be72 100644 --- a/src/board/system76/darp5/board.c +++ b/src/board/system76/darp5/board.c @@ -2,6 +2,7 @@ #include #include +#include void board_init(void) { // Allow CPU to boot @@ -10,16 +11,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) {} diff --git a/src/board/system76/darp7/board.c b/src/board/system76/darp7/board.c index 8491dc4..a03a9d9 100644 --- a/src/board/system76/darp7/board.c +++ b/src/board/system76/darp7/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -16,14 +17,13 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI# and SWI# gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/darp7/include/board/gpio.h b/src/board/system76/darp7/include/board/gpio.h index 40caab8..e87303d 100644 --- a/src/board/system76/darp7/include/board/gpio.h +++ b/src/board/system76/darp7/include/board/gpio.h @@ -13,7 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; -extern struct Gpio __code BT_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; diff --git a/src/board/system76/darp8/board.c b/src/board/system76/darp8/board.c index 1c88148..4846d30 100644 --- a/src/board/system76/darp8/board.c +++ b/src/board/system76/darp8/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include void board_init(void) { @@ -18,12 +19,11 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Assert SMI# and SWI# gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/darp8/include/board/gpio.h b/src/board/system76/darp8/include/board/gpio.h index 910e578..03a28c5 100644 --- a/src/board/system76/darp8/include/board/gpio.h +++ b/src/board/system76/darp8/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; diff --git a/src/board/system76/galp3-c/board.c b/src/board/system76/galp3-c/board.c index de66e2b..ca0be72 100644 --- a/src/board/system76/galp3-c/board.c +++ b/src/board/system76/galp3-c/board.c @@ -2,6 +2,7 @@ #include #include +#include void board_init(void) { // Allow CPU to boot @@ -10,16 +11,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) {} diff --git a/src/board/system76/galp5/board.c b/src/board/system76/galp5/board.c index 14c2b35..c86e86a 100644 --- a/src/board/system76/galp5/board.c +++ b/src/board/system76/galp5/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -21,14 +22,13 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI# and SWI# gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/galp5/include/board/gpio.h b/src/board/system76/galp5/include/board/gpio.h index a4e285f..66999cc 100644 --- a/src/board/system76/galp5/include/board/gpio.h +++ b/src/board/system76/galp5/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; diff --git a/src/board/system76/galp6/board.c b/src/board/system76/galp6/board.c index 8fcbcf8..8d86aea 100644 --- a/src/board/system76/galp6/board.c +++ b/src/board/system76/galp6/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include void board_init(void) { @@ -13,13 +14,12 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Assert SMI# and SWI# 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(); } diff --git a/src/board/system76/galp6/include/board/gpio.h b/src/board/system76/galp6/include/board/gpio.h index 35da3bf..02e19e4 100644 --- a/src/board/system76/galp6/include/board/gpio.h +++ b/src/board/system76/galp6/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; diff --git a/src/board/system76/gaze15/board.c b/src/board/system76/gaze15/board.c index d9614e1..df2df6d 100644 --- a/src/board/system76/gaze15/board.c +++ b/src/board/system76/gaze15/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -12,14 +13,12 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/gaze16-3050/board.c b/src/board/system76/gaze16-3050/board.c index e793470..bfdf948 100644 --- a/src/board/system76/gaze16-3050/board.c +++ b/src/board/system76/gaze16-3050/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,8 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/gaze16-3050/gpio.c b/src/board/system76/gaze16-3050/gpio.c index 90e5606..07ae151 100644 --- a/src/board/system76/gaze16-3050/gpio.c +++ b/src/board/system76/gaze16-3050/gpio.c @@ -30,6 +30,8 @@ struct Gpio __code SLP_SUS_N = GPIO(H, 3); struct Gpio __code SUSB_N_PCH = GPIO(H, 6); struct Gpio __code SUSC_N_PCH = GPIO(H, 1); struct Gpio __code VA_EC_EN = GPIO(J, 4); +struct Gpio __code WLAN_EN = GPIO(G, 1); +struct Gpio __code WLAN_PWR_EN = GPIO(A, 3); struct Gpio __code XLP_OUT = GPIO(B, 4); void gpio_init() { @@ -47,8 +49,7 @@ void gpio_init() { GCR21 = BIT(2); // Set GPIO data - // WLAN_PWR_EN - GPDRA = BIT(3); + GPDRA = 0; // SWI#, XLP_OUT, PWR_SW# GPDRB = BIT(5) | BIT(4) | BIT(3); GPDRC = 0; @@ -57,8 +58,8 @@ void gpio_init() { GPDRE = 0; // CC_EN GPDRF = BIT(7); - // H_PROCHOT_EC, WLAN_EN - GPDRG = BIT(6) | BIT(1); + // H_PROCHOT_EC + GPDRG = BIT(6); // AIRPLAN_LED# GPDRH = BIT(7); GPDRI = 0; diff --git a/src/board/system76/gaze16-3050/include/board/gpio.h b/src/board/system76/gaze16-3050/include/board/gpio.h index 28ed278..268c533 100644 --- a/src/board/system76/gaze16-3050/include/board/gpio.h +++ b/src/board/system76/gaze16-3050/include/board/gpio.h @@ -12,6 +12,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -37,6 +38,8 @@ extern struct Gpio __code SLP_SUS_N; extern struct Gpio __code SUSB_N_PCH; extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code VA_EC_EN; +extern struct Gpio __code WLAN_EN; +extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; #endif // _BOARD_GPIO_H diff --git a/src/board/system76/gaze16-3060/board.c b/src/board/system76/gaze16-3060/board.c index e793470..bfdf948 100644 --- a/src/board/system76/gaze16-3060/board.c +++ b/src/board/system76/gaze16-3060/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,8 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/gaze16-3060/gpio.c b/src/board/system76/gaze16-3060/gpio.c index a7af071..2fe1346 100644 --- a/src/board/system76/gaze16-3060/gpio.c +++ b/src/board/system76/gaze16-3060/gpio.c @@ -31,6 +31,8 @@ struct Gpio __code SLP_SUS_N = GPIO(I, 6); struct Gpio __code SUSB_N_PCH = GPIO(H, 6); struct Gpio __code SUSC_N_PCH = GPIO(H, 1); struct Gpio __code VA_EC_EN = GPIO(J, 4); +struct Gpio __code WLAN_EN = GPIO(G, 1); +struct Gpio __code WLAN_PWR_EN = GPIO(A, 3); struct Gpio __code XLP_OUT = GPIO(B, 4); void gpio_init() { @@ -48,8 +50,7 @@ void gpio_init() { GCR21 = BIT(2); // Set GPIO data - // WLAN_PWR_EN - GPDRA = BIT(3); + GPDRA = 0; // SWI#, XLP_OUT, PWR_SW# GPDRB = BIT(5) | BIT(4) | BIT(3); GPDRC = 0; @@ -57,8 +58,8 @@ void gpio_init() { GPDRD = BIT(5) | BIT(4) | BIT(3); GPDRE = 0; GPDRF = 0; - // H_PROCHOT#_EC, WLAN_EN - GPDRG = BIT(6) | BIT(1); + // H_PROCHOT#_EC + GPDRG = BIT(6); // AIRPLAN_LED# GPDRH = BIT(7); GPDRI = 0; diff --git a/src/board/system76/gaze16-3060/include/board/gpio.h b/src/board/system76/gaze16-3060/include/board/gpio.h index 8b769f5..50af040 100644 --- a/src/board/system76/gaze16-3060/include/board/gpio.h +++ b/src/board/system76/gaze16-3060/include/board/gpio.h @@ -12,6 +12,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -37,6 +38,8 @@ extern struct Gpio __code SLP_SUS_N; extern struct Gpio __code SUSB_N_PCH; extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code VA_EC_EN; +extern struct Gpio __code WLAN_EN; +extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; #endif // _BOARD_GPIO_H diff --git a/src/board/system76/gaze17-3050/board.c b/src/board/system76/gaze17-3050/board.c index e793470..bfdf948 100644 --- a/src/board/system76/gaze17-3050/board.c +++ b/src/board/system76/gaze17-3050/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,8 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/gaze17-3050/gpio.c b/src/board/system76/gaze17-3050/gpio.c index f2a869f..1b9c309 100644 --- a/src/board/system76/gaze17-3050/gpio.c +++ b/src/board/system76/gaze17-3050/gpio.c @@ -30,6 +30,8 @@ struct Gpio __code SLP_SUS_N = GPIO(J, 4); struct Gpio __code SUSB_N_PCH = GPIO(H, 6); struct Gpio __code SUSC_N_PCH = GPIO(H, 1); struct Gpio __code VA_EC_EN = GPIO(H, 7); +struct Gpio __code WLAN_EN = GPIO(G, 1); +struct Gpio __code WLAN_PWR_EN = GPIO(A, 3); struct Gpio __code XLP_OUT = GPIO(B, 4); void gpio_init() { @@ -45,8 +47,7 @@ void gpio_init() { GCR20 = 0; // Set GPIO data - // WLAN_PWR_EN - GPDRA = BIT(3); + GPDRA = 0; // XLP_OUT GPDRB = BIT(4); GPDRC = 0; @@ -55,8 +56,8 @@ void gpio_init() { GPDRE = BIT(3); // CC_EN GPDRF = BIT(7); - // H_PROCHOT#_EC, WLAN_EN - GPDRG = BIT(6) | BIT(1); + // H_PROCHOT#_EC + GPDRG = BIT(6); GPDRH = 0; GPDRI = 0; // KBC_MUTE# diff --git a/src/board/system76/gaze17-3050/include/board/gpio.h b/src/board/system76/gaze17-3050/include/board/gpio.h index 3bd764a..e6a325f 100644 --- a/src/board/system76/gaze17-3050/include/board/gpio.h +++ b/src/board/system76/gaze17-3050/include/board/gpio.h @@ -12,6 +12,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -38,6 +39,8 @@ extern struct Gpio __code SLP_SUS_N; extern struct Gpio __code SUSB_N_PCH; extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code VA_EC_EN; +extern struct Gpio __code WLAN_EN; +extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; #endif // _BOARD_GPIO_H diff --git a/src/board/system76/gaze17-3060/board.c b/src/board/system76/gaze17-3060/board.c index e793470..bfdf948 100644 --- a/src/board/system76/gaze17-3060/board.c +++ b/src/board/system76/gaze17-3060/board.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,8 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/gaze17-3060/gpio.c b/src/board/system76/gaze17-3060/gpio.c index fab4e9a..40f5d6d 100644 --- a/src/board/system76/gaze17-3060/gpio.c +++ b/src/board/system76/gaze17-3060/gpio.c @@ -30,6 +30,8 @@ struct Gpio __code SLP_SUS_N = GPIO(J, 7); struct Gpio __code SUSB_N_PCH = GPIO(H, 6); struct Gpio __code SUSC_N_PCH = GPIO(H, 1); struct Gpio __code VA_EC_EN = GPIO(J, 4); +struct Gpio __code WLAN_EN = GPIO(G, 1); +struct Gpio __code WLAN_PWR_EN = GPIO(D, 3); struct Gpio __code XLP_OUT = GPIO(B, 4); void gpio_init() { @@ -49,13 +51,12 @@ void gpio_init() { // XLP_OUT GPDRB = BIT(4); GPDRC = 0; - // WLAN_PWR_EN - GPDRD = BIT(3); + GPDRD = 0; // USB_PWR_EN GPDRE = BIT(3); GPDRF = 0; - // H_PROCHOT_EC, WLAN_EN - GPDRG = BIT(6) | BIT(1); + // H_PROCHOT_EC + GPDRG = BIT(6); GPDRH = 0; GPDRI = 0; // KBC_MUTE# diff --git a/src/board/system76/gaze17-3060/include/board/gpio.h b/src/board/system76/gaze17-3060/include/board/gpio.h index 3bd764a..e6a325f 100644 --- a/src/board/system76/gaze17-3060/include/board/gpio.h +++ b/src/board/system76/gaze17-3060/include/board/gpio.h @@ -12,6 +12,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -38,6 +39,8 @@ extern struct Gpio __code SLP_SUS_N; extern struct Gpio __code SUSB_N_PCH; extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code VA_EC_EN; +extern struct Gpio __code WLAN_EN; +extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; #endif // _BOARD_GPIO_H diff --git a/src/board/system76/lemp10/board.c b/src/board/system76/lemp10/board.c index 2d7893a..4e74a8c 100644 --- a/src/board/system76/lemp10/board.c +++ b/src/board/system76/lemp10/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -16,16 +17,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/lemp11/board.c b/src/board/system76/lemp11/board.c index 9428134..d9050f7 100644 --- a/src/board/system76/lemp11/board.c +++ b/src/board/system76/lemp11/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include @@ -19,14 +20,12 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/lemp9/board.c b/src/board/system76/lemp9/board.c index 2e4d5c3..24be56b 100644 --- a/src/board/system76/lemp9/board.c +++ b/src/board/system76/lemp9/board.c @@ -2,6 +2,7 @@ #include #include +#include void board_init(void) { // Allow CPU to boot @@ -10,16 +11,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable right USB port gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# 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; } diff --git a/src/board/system76/oryp5/board.c b/src/board/system76/oryp5/board.c index aaf0596..f668968 100644 --- a/src/board/system76/oryp5/board.c +++ b/src/board/system76/oryp5/board.c @@ -3,6 +3,7 @@ #include #include #include +#include #include void board_init(void) { @@ -12,16 +13,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable USB power gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/oryp6/board.c b/src/board/system76/oryp6/board.c index ed2921c..ae89aa0 100644 --- a/src/board/system76/oryp6/board.c +++ b/src/board/system76/oryp6/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -14,16 +15,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&BT_EN, true); - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable USB port power? gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/oryp7/board.c b/src/board/system76/oryp7/board.c index 05ac1d8..ae89aa0 100644 --- a/src/board/system76/oryp7/board.c +++ b/src/board/system76/oryp7/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -14,15 +15,14 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_EN, true); - gpio_set(&WLAN_PWR_EN, true); // Enable USB port power? gpio_set(&USB_PWR_EN_N, false); // Assert SMI#, SCI#, and SWI# gpio_set(&SCI_N, true); gpio_set(&SMI_N, true); gpio_set(&SWI_N, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/oryp7/include/board/gpio.h b/src/board/system76/oryp7/include/board/gpio.h index 845b00a..f432b9b 100644 --- a/src/board/system76/oryp7/include/board/gpio.h +++ b/src/board/system76/oryp7/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code DD_ON; diff --git a/src/board/system76/oryp8/board.c b/src/board/system76/oryp8/board.c index 2b577ee..e97a381 100644 --- a/src/board/system76/oryp8/board.c +++ b/src/board/system76/oryp8/board.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -15,6 +16,8 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/oryp8/gpio.c b/src/board/system76/oryp8/gpio.c index 4816b71..dd5243d 100644 --- a/src/board/system76/oryp8/gpio.c +++ b/src/board/system76/oryp8/gpio.c @@ -29,6 +29,8 @@ struct Gpio __code SLP_SUS_N = GPIO(D, 4); struct Gpio __code SUSB_N_PCH = GPIO(H, 6); struct Gpio __code SUSC_N_PCH = GPIO(H, 1); struct Gpio __code VA_EC_EN = GPIO(J, 4); // renamed to EC_SLP_SUS# +struct Gpio __code WLAN_EN = GPIO(G, 1); +struct Gpio __code WLAN_PWR_EN = GPIO(H, 4); struct Gpio __code XLP_OUT = GPIO(B, 4); void gpio_init() { @@ -46,7 +48,7 @@ void gpio_init() { GCR21 = BIT(2); // Set GPIO data - // WLAN_PWR_EN + // DDS_EC_PWM GPDRA = BIT(3); // SWI#, XLP_OUT, PWR_SW# GPDRB = BIT(5) | BIT(4) | BIT(3); @@ -56,10 +58,9 @@ void gpio_init() { GPDRE = 0; // BL_PWM_EN_EC, PCH_DPWROK_EC GPDRF = BIT(7) | BIT(3); - // H_PROCHOT#_EC, WLAN_EN - GPDRG = BIT(6) | BIT(1); - // WLAN_PWR_EN - GPDRH = BIT(4); + // H_PROCHOT#_EC + GPDRG = BIT(6); + GPDRH = 0; // PLVDD_RST_EC, EC_AMP_EN GPDRI = BIT(6) | BIT(5); GPDRJ = 0; diff --git a/src/board/system76/oryp8/include/board/gpio.h b/src/board/system76/oryp8/include/board/gpio.h index 63c0f35..a244e5c 100644 --- a/src/board/system76/oryp8/include/board/gpio.h +++ b/src/board/system76/oryp8/include/board/gpio.h @@ -12,6 +12,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -37,6 +38,8 @@ extern struct Gpio __code SLP_SUS_N; extern struct Gpio __code SUSB_N_PCH; extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code VA_EC_EN; +extern struct Gpio __code WLAN_EN; +extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; #endif // _BOARD_GPIO_H diff --git a/src/board/system76/oryp9/board.c b/src/board/system76/oryp9/board.c index a0972f3..a23c759 100644 --- a/src/board/system76/oryp9/board.c +++ b/src/board/system76/oryp9/board.c @@ -4,6 +4,7 @@ #include #include #include +#include #include void board_init(void) { @@ -16,10 +17,10 @@ void board_init(void) { gpio_set(&BKL_EN, true); // Enable camera gpio_set(&CCD_EN, true); - // Enable wireless - gpio_set(&WLAN_PWR_EN, true); // Enable USB port power gpio_set(&USB_PWR_EN_N, false); + + wireless_power(true); } void board_event(void) { diff --git a/src/board/system76/oryp9/include/board/gpio.h b/src/board/system76/oryp9/include/board/gpio.h index 6236960..10b338c 100644 --- a/src/board/system76/oryp9/include/board/gpio.h +++ b/src/board/system76/oryp9/include/board/gpio.h @@ -13,6 +13,7 @@ extern struct Gpio __code ACIN_N; extern struct Gpio __code AC_PRESENT; extern struct Gpio __code ALL_SYS_PWRGD; extern struct Gpio __code BKL_EN; +#define HAVE_BT_EN 0 extern struct Gpio __code BUF_PLT_RST_N; extern struct Gpio __code CCD_EN; extern struct Gpio __code CPU_C10_GATE_N; @@ -43,6 +44,7 @@ extern struct Gpio __code SUSC_N_PCH; extern struct Gpio __code SWI_N; extern struct Gpio __code USB_PWR_EN_N; extern struct Gpio __code VA_EC_EN; +#define HAVE_WLAN_EN 0 extern struct Gpio __code WLAN_PWR_EN; extern struct Gpio __code XLP_OUT; // clang-format on