dts: Include ADC DT binding headers from nRF SoC dtsi files

Add inclusions of header files with devicetree related ADC definitions
to the nRF SoC dtsi files so that those definitions can be used also
for nRF SoC based boards.
Provide definitions of nRF ADC and SAADC analog inputs suitable
for use in devicetree.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2022-02-21 16:08:54 +01:00 committed by Marti Bolivar
commit 77edc2c852
4 changed files with 63 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#define ADC_CONTEXT_USES_KERNEL_TIMER
#include "adc_context.h"
#include <nrfx_adc.h>
#include <zephyr/dt-bindings/adc/nrf-adc.h>
#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL
#include <zephyr/logging/log.h>
@ -14,6 +15,17 @@ LOG_MODULE_REGISTER(adc_nrfx_adc);
#define DT_DRV_COMPAT nordic_nrf_adc
/* Ensure that definitions in nrf-adc.h match MDK. */
BUILD_ASSERT((NRF_ADC_AIN0 == NRF_ADC_CONFIG_INPUT_0) &&
(NRF_ADC_AIN1 == NRF_ADC_CONFIG_INPUT_1) &&
(NRF_ADC_AIN2 == NRF_ADC_CONFIG_INPUT_2) &&
(NRF_ADC_AIN3 == NRF_ADC_CONFIG_INPUT_3) &&
(NRF_ADC_AIN4 == NRF_ADC_CONFIG_INPUT_4) &&
(NRF_ADC_AIN5 == NRF_ADC_CONFIG_INPUT_5) &&
(NRF_ADC_AIN6 == NRF_ADC_CONFIG_INPUT_6) &&
(NRF_ADC_AIN7 == NRF_ADC_CONFIG_INPUT_7),
"Definitions from nrf-adc.h do not match those from nrf_adc.h");
struct driver_data {
struct adc_context ctx;

View file

@ -7,6 +7,7 @@
#define ADC_CONTEXT_USES_KERNEL_TIMER
#include "adc_context.h"
#include <hal/nrf_saadc.h>
#include <zephyr/dt-bindings/adc/nrf-adc.h>
#define LOG_LEVEL CONFIG_ADC_LOG_LEVEL
#include <zephyr/logging/log.h>
@ -14,6 +15,21 @@ LOG_MODULE_REGISTER(adc_nrfx_saadc);
#define DT_DRV_COMPAT nordic_nrf_saadc
BUILD_ASSERT((NRF_SAADC_AIN0 == NRF_SAADC_INPUT_AIN0) &&
(NRF_SAADC_AIN1 == NRF_SAADC_INPUT_AIN1) &&
(NRF_SAADC_AIN2 == NRF_SAADC_INPUT_AIN2) &&
(NRF_SAADC_AIN3 == NRF_SAADC_INPUT_AIN3) &&
(NRF_SAADC_AIN4 == NRF_SAADC_INPUT_AIN4) &&
(NRF_SAADC_AIN5 == NRF_SAADC_INPUT_AIN5) &&
(NRF_SAADC_AIN6 == NRF_SAADC_INPUT_AIN6) &&
(NRF_SAADC_AIN7 == NRF_SAADC_INPUT_AIN7) &&
(NRF_SAADC_AIN7 == NRF_SAADC_INPUT_AIN7) &&
#if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5)
(NRF_SAADC_VDDHDIV5 == NRF_SAADC_INPUT_VDDHDIV5) &&
#endif
(NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD),
"Definitions from nrf-adc.h do not match those from nrf_saadc.h");
struct driver_data {
struct adc_context ctx;