boards: circuitdojo_feather_nrf9160: use regulator for 3V3 supply

Many board peripherals are enabled by turning on a 3V3 buck-boost
converter, controller by P0.31 (NRF_PS_EN). Use the regulator framework
instead of custom init code.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-03-22 14:26:27 +01:00 committed by Maureen Helm
commit d7405647df
5 changed files with 14 additions and 35 deletions

View file

@ -1,4 +0,0 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_sources(board.c)

View file

@ -1,31 +0,0 @@
/*
* Copyright (c) 2020 Circuit Dojo LLC
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <init.h>
#include <drivers/gpio.h>
#define GPIO0 DT_LABEL(DT_NODELABEL(gpio0))
#define POWER_LATCH_PIN 31
static int board_circuitdojo_feather_nrf9160_init(const struct device *dev)
{
ARG_UNUSED(dev);
/* Get the device binding */
const struct device *gpio = device_get_binding(GPIO0);
if (gpio == NULL) {
return -ENODEV;
}
/* Configure latch pin as output. */
gpio_pin_configure(gpio, POWER_LATCH_PIN, GPIO_OUTPUT_HIGH);
return 0;
}
/* needs to be done after GPIO driver init */
SYS_INIT(board_circuitdojo_feather_nrf9160_init, POST_KERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -75,6 +75,14 @@
<1 0 &gpio0 14 0>, /* ADC1 = AIN2 */
<0 0 &gpio0 13 0>; /* ADC0 = AIN1 */
};
nrf-ps-en {
compatible = "regulator-fixed-sync", "regulator-fixed";
label = "nrf_ps_en";
regulator-name = "nrf_ps_en";
enable-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
};
};
&adc {

View file

@ -23,4 +23,7 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# required to enable 3V3 power rail
CONFIG_REGULATOR=y
CONFIG_PINCTRL=y

View file

@ -26,4 +26,7 @@ CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# required to enable 3V3 power rail
CONFIG_REGULATOR=y
CONFIG_PINCTRL=y