diff options
-rw-r--r-- | zephyr/program/brya/gpio.dts | 22 | ||||
-rw-r--r-- | zephyr/program/brya/kblight_hooks.c | 14 |
2 files changed, 19 insertions, 17 deletions
diff --git a/zephyr/program/brya/gpio.dts b/zephyr/program/brya/gpio.dts index 6c6a2ac054..ff9f895ec1 100644 --- a/zephyr/program/brya/gpio.dts +++ b/zephyr/program/brya/gpio.dts @@ -26,17 +26,15 @@ charger_vap_otg_en { gpios = <&gpio7 3 GPIO_OUTPUT_LOW>; }; - gpio_ec_batt_pres_odl: ec_batt_pres_odl { - gpios = <&gpioa 3 GPIO_INPUT>; - enum-name = "GPIO_BATT_PRES_ODL"; - }; + /* - * Same GPIO as gpio_ec_batt_pres_odl, - * but only enabled for board id 1. + * Board ID 1 repurposes the gpio_ec_batt_pres_odl pin as + * an output signal. The board code switches the pin + * pin configuration to an output when board ID 1 is detected. */ - gpio_id_1_ec_kb_bl_en: id_1_ec_kb_bl_en { - gpios = <&gpioa 3 GPIO_OUTPUT_LOW>; - no-auto-init; + gpio_id_1_ec_kb_bl_en: gpio_ec_batt_pres_odl: ec_batt_pres_odl { + gpios = <&gpioa 3 GPIO_INPUT>; + enum-name = "GPIO_BATT_PRES_ODL"; }; gpio_id_1_ec_batt_pres_odl: id_1_ec_batt_pres_odl { gpios = <&gpioe 1 GPIO_INPUT>; @@ -260,12 +258,6 @@ id_1_usb_c0_c2_tcpc_rst_odl { gpios = <&gpio3 4 GPIO_ODR_LOW>; }; - usb_c0_int_odl { - gpios = <&gpiob 1 GPIO_INPUT>; - }; - usb_c2_int_odl { - gpios = <&gpio4 1 GPIO_INPUT>; - }; usb_c0_rt_int_odl: usb_c0_rt_int_odl { gpios = <&gpiob 1 GPIO_INPUT>; }; diff --git a/zephyr/program/brya/kblight_hooks.c b/zephyr/program/brya/kblight_hooks.c index 8716537f5d..a9b1b64a5c 100644 --- a/zephyr/program/brya/kblight_hooks.c +++ b/zephyr/program/brya/kblight_hooks.c @@ -52,6 +52,9 @@ static void board_backlight_handler(struct ap_power_ev_callback *cb, static void set_board_id_1_gpios(void) { static struct ap_power_ev_callback cb; + const struct gpio_dt_spec *ec_kb_bl_en = + GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en); + gpio_flags_t flags = ec_kb_bl_en->dt_flags; /* * Add a callback for suspend/resume to @@ -63,7 +66,14 @@ static void set_board_id_1_gpios(void) if (get_board_id() != 1) return; - gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_id_1_ec_kb_bl_en), - GPIO_OUTPUT_LOW); + + /* + * Note, use gpio_pin_configure() instead of gpio_pin_configure_dt() + * because gpio_pin_configure_dt() only sets additional flags, and + * cannot clear flags. + */ + flags &= ~GPIO_INPUT; + flags |= GPIO_OUTPUT_LOW; + gpio_pin_configure(ec_kb_bl_en->port, ec_kb_bl_en->pin, flags); } DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST); |