diff --git a/boards/arm/nrf9160_innblue21/CMakeLists.txt b/boards/arm/nrf9160_innblue21/CMakeLists.txt deleted file mode 100644 index 8ba95b81ad8..00000000000 --- a/boards/arm/nrf9160_innblue21/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2020 InnBlue -# SPDX-License-Identifier: Apache-2.0 -zephyr_library() -zephyr_library_sources(innblue21_board_init.c) diff --git a/boards/arm/nrf9160_innblue21/Kconfig.defconfig b/boards/arm/nrf9160_innblue21/Kconfig.defconfig index 230422cbb2e..08d0409c9af 100644 --- a/boards/arm/nrf9160_innblue21/Kconfig.defconfig +++ b/boards/arm/nrf9160_innblue21/Kconfig.defconfig @@ -42,4 +42,7 @@ endif # BOARD_NRF9160_INNBLUE21_NS config BT_HCI_VS default y if BT +config REGULATOR + default y if SENSOR + endif # BOARD_NRF9160_INNBLUE21 || BOARD_NRF9160_INNBLUE21_NS diff --git a/boards/arm/nrf9160_innblue21/innblue21_board_init.c b/boards/arm/nrf9160_innblue21/innblue21_board_init.c deleted file mode 100644 index 8eb779bfebf..00000000000 --- a/boards/arm/nrf9160_innblue21/innblue21_board_init.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2020 InnBlue - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -#define VDD_3V3_PWR_CTRL_GPIO_PIN 12 /* ENABLE_3V3_SENSOR --> i2c sensors */ -#define VDD_5V0_PWR_CTRL_GPIO_PIN 21 /* ENABLE_5V0_BOOST --> speed sensor */ - -/* Configures the pin as output and sets them high. */ -static void config_pin(const struct device *gpio, int pin) -{ - int err; - - /* Configure this pin as output. */ - err = gpio_pin_configure(gpio, pin, GPIO_OUTPUT_ACTIVE); - if (err == 0) { - /* Write "1" to this pin. */ - err = gpio_pin_set(gpio, pin, 1); - } - - /* Wait for the rail to come up and stabilize. */ - k_sleep(K_MSEC(10)); -} - -static int pwr_ctrl_init(const struct device *dev) -{ - const struct device *gpio; - - /* Get handle of the GPIO device. */ - gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0)); - - if (!device_is_ready(gpio)) { - return -ENODEV; - } - - /* Configure the gpio pin. */ - config_pin(gpio, VDD_3V3_PWR_CTRL_GPIO_PIN); - config_pin(gpio, VDD_5V0_PWR_CTRL_GPIO_PIN); - - return 0; -} - -SYS_INIT(pwr_ctrl_init, POST_KERNEL, 70); diff --git a/boards/arm/nrf9160_innblue21/nrf9160_innblue21_common.dts b/boards/arm/nrf9160_innblue21/nrf9160_innblue21_common.dts index d8749f58c00..dea56dda187 100644 --- a/boards/arm/nrf9160_innblue21/nrf9160_innblue21_common.dts +++ b/boards/arm/nrf9160_innblue21/nrf9160_innblue21_common.dts @@ -45,6 +45,24 @@ }; }; + en_3v3_sensor: enable-3v3-sensor { + compatible = "regulator-fixed-sync", "regulator-fixed"; + label = "ENABLE_3V3_SENSOR"; + regulator-name = "en_3v3_sensor"; + enable-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + startup-delay-us = <10000>; + regulator-boot-on; + }; + + en_5v0_boost: enable-5v0-boost { + compatible = "regulator-fixed-sync", "regulator-fixed"; + label = "ENABLE_5V0_BOOST"; + regulator-name = "en_5v0_boost"; + enable-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; + startup-delay-us = <10000>; + regulator-boot-on; + }; + /* These aliases are provided for compatibility with samples */ aliases { led0 = &red_led;