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