1 /*
2  * Copyright (c) 2021 Sateesh Kotapati
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/init.h>
8 #include <zephyr/drivers/gpio.h>
9 #include <zephyr/sys/printk.h>
10 #include <zephyr/logging/log.h>
11 
12 LOG_MODULE_REGISTER(efr32xg24_dk2601b, CONFIG_BOARD_EFR32MG24_LOG_LEVEL);
13 
efr32xg24_dk2601b_init(void)14 static int efr32xg24_dk2601b_init(void)
15 {
16 	int ret;
17 
18 	static struct gpio_dt_spec wake_up_gpio_dev =
19 		GPIO_DT_SPEC_GET(DT_NODELABEL(wake_up_trigger), gpios);
20 
21 
22 	if (!gpio_is_ready_dt(&wake_up_gpio_dev)) {
23 		LOG_ERR("Wake-up GPIO device was not found!\n");
24 		return -ENODEV;
25 	}
26 	ret = gpio_pin_configure_dt(&wake_up_gpio_dev, GPIO_OUTPUT_ACTIVE);
27 	if (ret < 0) {
28 		return ret;
29 	}
30 
31 	return 0;
32 }
33 
34 /* needs to be done after GPIO driver init */
35 SYS_INIT(efr32xg24_dk2601b_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
36