1 /* 2 * Copyright (c) 2019 Linaro Ltd. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/drivers/gpio.h> 8 #include <zephyr/init.h> 9 rf_init(void)10static int rf_init(void) 11 { 12 const struct gpio_dt_spec rf1 = 13 GPIO_DT_SPEC_GET(DT_NODELABEL(rf_switch), rf1_gpios); 14 const struct gpio_dt_spec rf2 = 15 GPIO_DT_SPEC_GET(DT_NODELABEL(rf_switch), rf2_gpios); 16 const struct gpio_dt_spec rf3 = 17 GPIO_DT_SPEC_GET(DT_NODELABEL(rf_switch), rf3_gpios); 18 19 20 /* configure RFSW8001 GPIOs (110: RF1/RF2 coexistence mode) */ 21 if (!gpio_is_ready_dt(&rf1) || 22 !gpio_is_ready_dt(&rf2) || 23 !gpio_is_ready_dt(&rf3)) { 24 return -ENODEV; 25 } 26 27 (void)gpio_pin_configure_dt(&rf1, GPIO_OUTPUT_HIGH); 28 (void)gpio_pin_configure_dt(&rf2, GPIO_OUTPUT_HIGH); 29 (void)gpio_pin_configure_dt(&rf3, GPIO_OUTPUT_LOW); 30 31 return 0; 32 } 33 34 /* Need to be initialised after GPIO driver */ 35 SYS_INIT(rf_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); 36