Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3963855
[nrf fromlist] modules: hal_nordic: align paths to BSP
magp-nordic Sep 10, 2025
9f7edaa
[nrf fromlist] soc: nordic: align paths to BSP
magp-nordic Sep 10, 2025
94cdd42
[nrf fromlist] samples: nordic: nrfx_prs: remove deprecated UARTE API
mstasiaknordic Sep 17, 2025
ab98978
[nrf fromlist] modules: hal_nordic: align to changes in GPPI drv
masz-nordic Sep 29, 2025
967af51
[nrf fromlist] modules: hal_nordic: align errata enable macros to nrf…
nomo-nordic Sep 19, 2025
d493448
[nrf fromlist] nrfx: align errata checks to nrfx 4.0
nomo-nordic Sep 19, 2025
ac54f26
[nrf fromlist] soc: nordic: remove nRF52 Series anomaly 58 workaround
nomo-nordic Sep 24, 2025
bdefc2d
[nrf fromtree] drivers: i2s: nrfx: Allow MCK bypass for proper LRCK a…
standalone-tech Sep 6, 2025
b8e79b1
[nrf fromlist] drivers: i2s: nrfx_i2s: introduce prescaler calculation
mstasiaknordic Sep 29, 2025
130cbbd
[nrf fromlist] dt-bindings: adc: nrf-saadc: Remove platform dependencies
jaz1-nordic Jul 22, 2025
744c0e9
[nrf fromlist] dts: nordic: Switch saadc pin definitions for generic …
jaz1-nordic Jul 22, 2025
531f05b
[nrf fromlist] drivers: adc: nrfx_saadc: Remove platform dependencies
jaz1-nordic Jul 22, 2025
65ee201
[nrf fromlist] drivers: comparator: nordic: Remove platform dependencies
jaz1-nordic Jul 22, 2025
e35f9f1
[nrf noup] dts: nordic: Switch saadc pin definitions for generic ones
jaz1-nordic Oct 13, 2025
053fe55
[nrf fromlist] drivers: audio: dmic_nrfx_pdm: introduce prescaler cal…
mstasiaknordic Sep 29, 2025
68d424d
[nrf fromlist] drivers: spi: spi_nrfx_spim: use standard instantiation
mstasiaknordic Sep 9, 2025
bb47ceb
[nrf fromlist] modules: hal_nordic: remove SPIM symbols
mstasiaknordic Sep 30, 2025
bb63ff3
[nrf fromlist] samples: nordic: nrfx_prs: align to spi_nrfx_spim rework
mstasiaknordic Sep 30, 2025
f753b14
[nrf fromlist] modules: hal_nordic: add new errno error handling
mstasiaknordic Sep 30, 2025
a6bf77f
[nrf fromlist] drivers: spi: spi_nrfx_spis: use standard instantiation
mstasiaknordic Oct 13, 2025
9ab7da0
[nrf fromlist] modules: hal_nordic: remove SPIS symbols
mstasiaknordic Oct 13, 2025
fb7c10d
[nrf noup] treewide: align to nrfx paths rework
masz-nordic Oct 3, 2025
6780fee
[nrf noup] modules: hal_nordic: cleanup nrfx_config
masz-nordic Feb 21, 2025
f386059
[nrf noup] drivers: timer: align to nrfx 4.0
masz-nordic Oct 22, 2025
e6fe99b
[nrf fromlist] drivers: clock_control: Compatibility patch for nrfx H…
mif1-nordic Oct 28, 2025
d52a464
[nrf fromlist] drivers: nrf: Replace MDK symbols with new _HAS_ defines
mib1-nordic Oct 27, 2025
faf01a4
[nrf fromlist] soc: nordic: Remove I2S instances from Kconfigs
jaz1-nordic Oct 16, 2025
4695619
[nrf fromlist] drivers: i2s: nrfx: Align to driver without cb
jaz1-nordic Oct 17, 2025
845a7e4
[nrf fromlist] soc: nordic: Remove PDM instances from Kconfigs
jaz1-nordic Oct 20, 2025
cf62bc9
[nrf fromlist] drivers: audio: pdm: Align to driver without cb
jaz1-nordic Oct 20, 2025
be91d3c
[nrf fromtree] modules: hal_nordic: remove QDEC symbols
kl-cruz Oct 21, 2025
63ec0c3
[nrf fromtree] drivers: sensor: qdec_nrfx: use standard instantiation
kl-cruz Oct 21, 2025
6fc96b1
[nrf fromlist] drivers: watchdog: wdt_nrfx: use standard instantiation
mstasiaknordic Sep 30, 2025
926aedc
[nrf fromlist] drivers: watchdog: wdt_nrfx: use symbol for maximum re…
mstasiaknordic Sep 30, 2025
f2a7a5b
[nrf fromlist] modules: hal_nordic: remove WDT symbols
mstasiaknordic Sep 30, 2025
08b679b
[nrf fromlist] tests: drivers: watchdog: align to wdt_nrfx rework
mstasiaknordic Sep 30, 2025
99f4580
[nrf fromlist] modules: hal_nordic: remove UARTE symbols
mstasiaknordic Oct 20, 2025
ef83d42
[nrf fromlist] samples: nordic: nrfx_prs: align to nrfx_uarte rework
mstasiaknordic Oct 20, 2025
d66a62a
[nrf fromlist] soc: nordic: align to new location of nrfx_coredep
masz-nordic Oct 28, 2025
1998131
[nrf fromlist] modules: hal_nordic: align to new location of nrfx_cor…
masz-nordic Oct 28, 2025
951911f
[nrf fromlist] modules: hal_nordic: Add sources for nrfx XO clk separ…
jaz1-nordic Oct 29, 2025
20b44c4
[nrf fromlist] drivers: pwm: pwm_nrfx: use standard instantiation
mib1-nordic Oct 1, 2025
da55265
[nrf fromlist] modules: hal_nordic: remove PWM symbols
mib1-nordic Oct 1, 2025
2a2f1a8
[nrf fromlist] drivers: pwm: pwm_nrfx: Align anomaly 109 handling mec…
mib1-nordic Oct 13, 2025
81a6741
[nrf fromtree] samples: usb: uac2: Support High-Speed operation
tmon-nordic Jun 25, 2025
37efc41
[nrf fromtree] samples: usb: uac2: explicit: Fix SOF offset integer c…
tmon-nordic Aug 21, 2025
016528b
[nrf fromtree] drivers: serial: nrfx_uarte: Remove redundant pinctrl …
nordic-krch Sep 29, 2025
7756489
[nrf fromlist] modules: hal_nordic: remove TIMER config symbols
mib1-nordic Oct 3, 2025
6cf360b
[nrf fromlist] tests: drivers: uart: remove TIMER config symbols
mib1-nordic Oct 3, 2025
b3c3c0d
[nrf fromlist] samples: usb: uac2: align feedback_nrf to changes in nrfx
mib1-nordic Oct 1, 2025
c3a9e37
[nrf fromlist] drivers: serial: uart_nrfx_uarte: align to changes in …
mib1-nordic Oct 1, 2025
e4c2486
[nrf fromlist] drivers: i2c: i2c_nrfx_twim: use standard instantiation
adamkondraciuk Oct 13, 2025
9600222
[nrf fromlist] drivers: i2c: i2c_nrfx_twim: use standard instantiation
adamkondraciuk Oct 13, 2025
f85d8d8
[nrf fromlist] drivers: i2c: i2c_nrfx_twis: use standard instantiation
adamkondraciuk Oct 13, 2025
2ca04b3
[nrf fromlist] drivers: i2c: i2c_nrfx_twis: use standard instantiation
adamkondraciuk Oct 13, 2025
011d521
[nrf fromlist] drivers: i2c: i2c_nrfx_twim: Align shim to new error h…
adamkondraciuk Oct 13, 2025
6d834fe
[nrf fromlist] drivers: i2c: i2c_nrfx_twis: Align shim to new error h…
adamkondraciuk Oct 13, 2025
396af55
[nrf fromlist] tests: i2c: Align tests to I2C API changes
adamkondraciuk Oct 17, 2025
abb5bcf
[nrf fromlist] modules: hal_nordic: nrfx: Add description for NRFX_QD…
kl-cruz Oct 30, 2025
f96d441
[nrf fromlist] modules: hal_nordic: nrfx: Add description for NRFX_PW…
kl-cruz Oct 31, 2025
a0dc125
[nrf noup] drivers: serial: nrfx_uarte: Adapt to the new GPPI API
nordic-krch Oct 27, 2025
f48a5ed
[nrf fromlist] modules: hal_nordic: nrfx: Align to changes in GPPI
nordic-krch Oct 23, 2025
a7d8505
[nrf fromlist] drivers: counter: nrfx_rtc: Use GPPI instead of DPPI/PPI
nordic-krch Oct 27, 2025
b9e3a31
[nrf fromlist] soc: nordic: nrf53: sync_rtc: Use gppi instead of dppi
nordic-krch Oct 27, 2025
9b9f96c
[nrf fromlist] samples: subsys: usb: explicit_feedback: Use new GPPI API
nordic-krch Oct 27, 2025
60c890a
[nrf fromlist] samples: subsys: usb: implicit_feedback: Use new GPPI API
nordic-krch Oct 27, 2025
fdf79c6
[nrf fromlist] drivers: display: nrf_led_matrix: Align to use GPPI API
nordic-krch Oct 27, 2025
32e6396
[nrf fromlist] drivers: pwm: pwm_nrf_sw: Align to use new GPPI API
nordic-krch Oct 27, 2025
8de05bf
[nrf fromlist] soc: nordic: nrf53: Align to the new GPPI API
nordic-krch Oct 27, 2025
525344c
[nrf fromlist] drivers: timer: nrf_rtc_timer: Align to use GPPI API
nordic-krch Oct 27, 2025
78b8ec4
[nrf fromlist] drivers: serial: nrfx_uarte: Use new GPPI API
nordic-krch Oct 27, 2025
4e89856
[nrf fromlist] samples: boards: nordic: nrfx: Align to the new GPPI API
nordic-krch Oct 27, 2025
8acf85b
[nrf fromlist] soc: nordic: nrf54l: Add initialization of GPPI resources
nordic-krch Oct 24, 2025
401aeee
[nrf fromlist] soc: nordic: Add gppi initialization
nordic-krch Oct 30, 2025
e06eb08
[nrf fromlist] soc: nordic: common: add helper macro for GPIOTE node …
nika-nordic Oct 30, 2025
fead398
[nrf fromlist] soc: nordic: common: add nrfx gpiote instantiation com…
nika-nordic Oct 29, 2025
f80b73d
[nrf fromlist] drivers: gpio: nrf: align to nrfx_gpiote extracted con…
nika-nordic Oct 15, 2025
27c6fe6
[nrf fromlist] drivers: spi: nrf: align to nrfx_gpiote with extracted…
nika-nordic Oct 28, 2025
825e286
[nrf fromlist] drivers: pwm: pwm_nrf_sw: align to nrfx_gpiote with ex…
nika-nordic Oct 29, 2025
6f48b01
[nrf fromlist] drivers: display: nrf_led_matrix: align to nrfx_gpiote…
nika-nordic Oct 29, 2025
eb8b652
[nrf fromlist] samples: uac2_explicit_feedback: align to nrfx_gpiote …
nika-nordic Oct 30, 2025
d47ceef
[nrf fromlist] subsys: bluetooth: nordic: align to nrfx_gpiote with e…
nika-nordic Oct 30, 2025
2108b3d
[nrf fromlist] samples: boards: nordic: nrfx: align to nrfx_gpiote wi…
nika-nordic Oct 30, 2025
0ce1acb
[nrf fromlist] tests: boards: nrf: i2c_slave: fix incorrect error code
nika-nordic Oct 31, 2025
2f01373
[nrf fromlist] drivers: pwm: pwm_nrf_sw: fix gpiote reference
nika-nordic Oct 31, 2025
2f91ae1
[nrf noup] manifest: integrate nrfx 4.0-rc1 using sdk-hal_nordic
nika-nordic Oct 31, 2025
5cbaffa
[nrf noup] manifest: change hal_nordic url to have updated samples
mib1-nordic Nov 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/native/nrf_bsim/soc/soc_secure.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


#include <stdint.h>
#include <nrf.h>
#include <nrfx.h>
#include <hal/nrf_ficr.h>

static inline void soc_secure_read_deviceid(uint32_t deviceid[2])
Expand Down
216 changes: 33 additions & 183 deletions drivers/adc/adc_nrfx_saadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

#include "adc_context.h"
#include <nrfx_saadc.h>
#include <zephyr/dt-bindings/adc/nrf-saadc-v3.h>
#include <zephyr/dt-bindings/adc/nrf-saadc-nrf54l.h>
#include <zephyr/dt-bindings/adc/nrf-saadc-haltium.h>
#include <zephyr/dt-bindings/adc/nrf-saadc.h>
#include <zephyr/linker/devicetree_regions.h>
#include <zephyr/logging/log.h>
#include <zephyr/irq.h>
Expand All @@ -22,91 +20,22 @@

#define DT_DRV_COMPAT nordic_nrf_saadc

#if (NRF_SAADC_HAS_AIN_AS_PIN)

#if defined(CONFIG_NRF_PLATFORM_HALTIUM)
static const uint32_t saadc_psels[NRF_SAADC_AIN13 + 1] = {
[NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1),
[NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1),
[NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1),
[NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1),
[NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1),
[NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1),
[NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1),
[NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1),
[NRF_SAADC_AIN8] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 9),
[NRF_SAADC_AIN9] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 9),
[NRF_SAADC_AIN10] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 9),
[NRF_SAADC_AIN11] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 9),
[NRF_SAADC_AIN12] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 9),
[NRF_SAADC_AIN13] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 9),
};
#elif defined(CONFIG_SOC_NRF54L05) || defined(CONFIG_SOC_NRF54L10) || defined(CONFIG_SOC_NRF54L15)
static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = {
[NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1),
[NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1),
[NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1),
[NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1),
[NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1),
[NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1),
[NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(13U, 1),
[NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(14U, 1),
[NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD,
[NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD,
[NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD,
};
#elif defined(NRF54LM20A_ENGA_XXAA)
static const uint32_t saadc_psels[NRF_SAADC_DVDD + 1] = {
[NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1),
[NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(31U, 1),
[NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(30U, 1),
[NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(29U, 1),
[NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1),
[NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1),
[NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1),
[NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1),
[NRF_SAADC_VDD] = NRF_SAADC_INPUT_VDD,
[NRF_SAADC_AVDD] = NRF_SAADC_INPUT_AVDD,
[NRF_SAADC_DVDD] = NRF_SAADC_INPUT_DVDD,
};
#elif defined(NRF54LV10A_ENGA_XXAA)
static const uint32_t saadc_psels[NRF_SAADC_AIN7 + 1] = {
[NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(0U, 1),
[NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(1U, 1),
[NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(2U, 1),
[NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(3U, 1),
[NRF_SAADC_AIN4] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1),
[NRF_SAADC_AIN5] = NRF_PIN_PORT_TO_PIN_NUMBER(10U, 1),
[NRF_SAADC_AIN6] = NRF_PIN_PORT_TO_PIN_NUMBER(11U, 1),
[NRF_SAADC_AIN7] = NRF_PIN_PORT_TO_PIN_NUMBER(12U, 1),
};
#elif defined(NRF54LS05B_ENGA_XXAA)
static const uint32_t saadc_psels[NRF_SAADC_AIN3 + 1] = {
[NRF_SAADC_AIN0] = NRF_PIN_PORT_TO_PIN_NUMBER(4U, 1),
[NRF_SAADC_AIN1] = NRF_PIN_PORT_TO_PIN_NUMBER(5U, 1),
[NRF_SAADC_AIN2] = NRF_PIN_PORT_TO_PIN_NUMBER(6U, 1),
[NRF_SAADC_AIN3] = NRF_PIN_PORT_TO_PIN_NUMBER(7U, 1),
};
BUILD_ASSERT((NRF_SAADC_AIN0 == NRFX_ANALOG_EXTERNAL_AIN0) &&
(NRF_SAADC_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) &&
(NRF_SAADC_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) &&
(NRF_SAADC_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) &&
(NRF_SAADC_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) &&
(NRF_SAADC_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) &&
(NRF_SAADC_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) &&
(NRF_SAADC_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) &&
#if NRF_SAADC_HAS_INPUT_VDDHDIV5
(NRF_SAADC_VDDHDIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) &&
#endif

#else
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) &&
#if defined(SAADC_CH_PSELP_PSELP_VDDHDIV5)
(NRF_SAADC_VDDHDIV5 == NRF_SAADC_INPUT_VDDHDIV5) &&
#endif
#if defined(SAADC_CH_PSELP_PSELP_VDD)
(NRF_SAADC_VDD == NRF_SAADC_INPUT_VDD) &&
#if NRF_SAADC_HAS_INPUT_VDD
(NRF_SAADC_VDD == NRFX_ANALOG_INTERNAL_VDD) &&
#endif
1,
"Definitions from nrf-adc.h do not match those from nrf_saadc.h");
#endif
"Definitions from nrf-saadc.h do not match those from nrfx_analog_common.h");

Check notice on line 38 in drivers/adc/adc_nrfx_saadc.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/adc/adc_nrfx_saadc.c:38 - (NRF_SAADC_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && - (NRF_SAADC_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && - (NRF_SAADC_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && - (NRF_SAADC_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && - (NRF_SAADC_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && - (NRF_SAADC_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && - (NRF_SAADC_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && + (NRF_SAADC_AIN1 == NRFX_ANALOG_EXTERNAL_AIN1) && + (NRF_SAADC_AIN2 == NRFX_ANALOG_EXTERNAL_AIN2) && + (NRF_SAADC_AIN3 == NRFX_ANALOG_EXTERNAL_AIN3) && + (NRF_SAADC_AIN4 == NRFX_ANALOG_EXTERNAL_AIN4) && + (NRF_SAADC_AIN5 == NRFX_ANALOG_EXTERNAL_AIN5) && + (NRF_SAADC_AIN6 == NRFX_ANALOG_EXTERNAL_AIN6) && + (NRF_SAADC_AIN7 == NRFX_ANALOG_EXTERNAL_AIN7) && #if NRF_SAADC_HAS_INPUT_VDDHDIV5 - (NRF_SAADC_VDDHDIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && + (NRF_SAADC_VDDHDIV5 == NRFX_ANALOG_INTERNAL_VDDHDIV5) && #endif #if NRF_SAADC_HAS_INPUT_VDD - (NRF_SAADC_VDD == NRFX_ANALOG_INTERNAL_VDD) && -#endif - 1, + (NRF_SAADC_VDD == NRFX_ANALOG_INTERNAL_VDD) && +#endif + 1,

struct driver_data {
struct adc_context ctx;
Expand Down Expand Up @@ -188,96 +117,46 @@
return 0;
}

static int input_assign(nrf_saadc_input_t *pin_p,
nrf_saadc_input_t *pin_n,
const struct adc_channel_cfg *channel_cfg)
{
#if (NRF_SAADC_HAS_AIN_AS_PIN)
if (channel_cfg->input_positive > ARRAY_SIZE(saadc_psels) ||
channel_cfg->input_positive < NRF_SAADC_AIN0) {
LOG_ERR("Invalid analog positive input number: %d", channel_cfg->input_positive);
return -EINVAL;
}

*pin_p = saadc_psels[channel_cfg->input_positive];

#if NRF_GPIO_HAS_RETENTION_SETCLEAR
nrf_gpio_pin_retain_disable(saadc_psels[channel_cfg->input_positive]);
#endif

if (channel_cfg->differential) {
if (channel_cfg->input_negative > ARRAY_SIZE(saadc_psels) ||
(IS_ENABLED(CONFIG_NRF_PLATFORM_HALTIUM) &&
(channel_cfg->input_positive > NRF_SAADC_AIN7) !=
(channel_cfg->input_negative > NRF_SAADC_AIN7))) {
LOG_ERR("Invalid analog negative input number: %d",
channel_cfg->input_negative);
return -EINVAL;
}
*pin_n = channel_cfg->input_negative == NRF_SAADC_GND ?
NRF_SAADC_INPUT_DISABLED :
saadc_psels[channel_cfg->input_negative];

#if NRF_GPIO_HAS_RETENTION_SETCLEAR
if (channel_cfg->input_negative != NRF_SAADC_GND) {
nrf_gpio_pin_retain_disable(saadc_psels[channel_cfg->input_negative]);
}
#endif
} else {
*pin_n = NRF_SAADC_INPUT_DISABLED;
}
#else
*pin_p = channel_cfg->input_positive;
*pin_n = (channel_cfg->differential && (channel_cfg->input_negative != NRF_SAADC_GND))
? channel_cfg->input_negative
: NRF_SAADC_INPUT_DISABLED;
#endif
LOG_DBG("ADC positive input: %d", *pin_p);
LOG_DBG("ADC negative input: %d", *pin_n);

return 0;
}

static int gain_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_gain gain)
{
#if NRF_SAADC_HAS_CH_GAIN
switch (gain) {
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_6)
#if NRF_SAADC_HAS_GAIN_1_6
case ADC_GAIN_1_6:
ch_cfg->gain = NRF_SAADC_GAIN1_6;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_5)
#if NRF_SAADC_HAS_GAIN_1_5
case ADC_GAIN_1_5:
ch_cfg->gain = NRF_SAADC_GAIN1_5;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_4) || defined(SAADC_CH_CONFIG_GAIN_Gain2_8)
#if NRF_SAADC_HAS_GAIN_1_4
case ADC_GAIN_1_4:
ch_cfg->gain = NRF_SAADC_GAIN1_4;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain2_7)
#if NRF_SAADC_HAS_GAIN_2_7
case ADC_GAIN_2_7:
ch_cfg->gain = NRF_SAADC_GAIN2_7;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_3) || defined(SAADC_CH_CONFIG_GAIN_Gain2_6)
#if NRF_SAADC_HAS_GAIN_1_3
case ADC_GAIN_1_3:
ch_cfg->gain = NRF_SAADC_GAIN1_3;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain2_5)
#if NRF_SAADC_HAS_GAIN_2_5
case ADC_GAIN_2_5:
ch_cfg->gain = NRF_SAADC_GAIN2_5;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain1_2) || defined(SAADC_CH_CONFIG_GAIN_Gain2_4)
#if NRF_SAADC_HAS_GAIN_1_2
case ADC_GAIN_1_2:
ch_cfg->gain = NRF_SAADC_GAIN1_2;
break;
#endif
#if defined(SAADC_CH_CONFIG_GAIN_Gain2_3)
#if NRF_SAADC_HAS_GAIN_2_3
case ADC_GAIN_2_3:
ch_cfg->gain = NRF_SAADC_GAIN2_3;
break;
Expand All @@ -288,15 +167,15 @@
case ADC_GAIN_2:
ch_cfg->gain = NRF_SAADC_GAIN2;
break;
#if defined(SAADC_CH_CONFIG_GAIN_Gain4)
#if NRF_SAADC_HAS_GAIN_4
case ADC_GAIN_4:
ch_cfg->gain = NRF_SAADC_GAIN4;
break;
#endif
default:
#else
if (gain != ADC_GAIN_1) {
#endif /* defined(NRF_SAADC_HAS_CH_GAIN) */
#endif /* NRF_SAADC_HAS_CH_GAIN */
LOG_ERR("Selected ADC gain is not valid");
return -EINVAL;
}
Expand All @@ -307,17 +186,17 @@
static int reference_set(nrf_saadc_channel_config_t *ch_cfg, enum adc_reference reference)
{
switch (reference) {
#if defined(SAADC_CH_CONFIG_REFSEL_Internal)
#if NRF_SAADC_HAS_REFERENCE_INTERNAL
case ADC_REF_INTERNAL:
ch_cfg->reference = NRF_SAADC_REFERENCE_INTERNAL;
break;
#endif
#if defined(SAADC_CH_CONFIG_REFSEL_VDD1_4)
#if NRF_SAADC_HAS_REFERENCE_VDD4
case ADC_REF_VDD_1_4:
ch_cfg->reference = NRF_SAADC_REFERENCE_VDD4;
break;
#endif
#if defined(SAADC_CH_CONFIG_REFSEL_External)
#if NRF_SAADC_HAS_REFERENCE_EXTERNAL
case ADC_REF_EXTERNAL0:
ch_cfg->reference = NRF_SAADC_REFERENCE_EXTERNAL;
break;
Expand Down Expand Up @@ -346,7 +225,12 @@
.burst = NRF_SAADC_BURST_DISABLED,
#endif
},
.channel_index = channel_cfg->channel_id,

Check notice on line 228 in drivers/adc/adc_nrfx_saadc.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/adc/adc_nrfx_saadc.c:228 - .channel_config = { + .channel_config = + { #if NRF_SAADC_HAS_CH_CONFIG_RES - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, + .resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, #endif #if NRF_SAADC_HAS_CH_BURST - .burst = NRF_SAADC_BURST_DISABLED, -#endif - }, + .burst = NRF_SAADC_BURST_DISABLED, +#endif + },
.pin_p = channel_cfg->input_positive,
.pin_n = (channel_cfg->differential &&
(channel_cfg->input_negative != NRF_SAADC_GND))
? channel_cfg->input_negative
: NRF_SAADC_AIN_DISABLED,
};

if (channel_cfg->channel_id >= SAADC_CH_NUM) {
Expand All @@ -356,11 +240,6 @@

ch_cfg = &cfg.channel_config;

err = input_assign(&cfg.pin_p, &cfg.pin_n, channel_cfg);
if (err != 0) {
return err;
}

err = gain_set(ch_cfg, channel_cfg->gain);
if (err != 0) {
return err;
Expand Down Expand Up @@ -833,38 +712,9 @@
#ifdef CONFIG_ADC_ASYNC
.read_async = adc_nrfx_read_async,
#endif
#if defined(NRF54LV10A_ENGA_XXAA)
.ref_internal = 1300,
#elif defined(CONFIG_SOC_COMPATIBLE_NRF54LX)
.ref_internal = 900,
#elif defined(CONFIG_NRF_PLATFORM_HALTIUM)
.ref_internal = 1024,
#else
.ref_internal = 600,
#endif
.ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE,
};

Check notice on line 716 in drivers/adc/adc_nrfx_saadc.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/adc/adc_nrfx_saadc.c:716 - .read = adc_nrfx_read, + .read = adc_nrfx_read, #ifdef CONFIG_ADC_ASYNC - .read_async = adc_nrfx_read_async, -#endif - .ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE, + .read_async = adc_nrfx_read_async, +#endif + .ref_internal = NRFX_SAADC_REF_INTERNAL_VALUE,

#if defined(CONFIG_NRF_PLATFORM_HALTIUM)
/* AIN8-AIN14 inputs are on 3v3 GPIO port and they cannot be mixed with other
* analog inputs (from 1v8 ports) in differential mode.
*/
#define CH_IS_3V3(val) (val >= NRF_SAADC_AIN8)

#define MIXED_3V3_1V8_INPUTS(node) \
(DT_NODE_HAS_PROP(node, zephyr_input_negative) && \
(CH_IS_3V3(DT_PROP_OR(node, zephyr_input_negative, 0)) != \
CH_IS_3V3(DT_PROP_OR(node, zephyr_input_positive, 0))))
#else
#define MIXED_3V3_1V8_INPUTS(node) false
#endif

#define VALIDATE_CHANNEL_CONFIG(node) \
BUILD_ASSERT(MIXED_3V3_1V8_INPUTS(node) == false, \
"1v8 inputs cannot be mixed with 3v3 inputs");

/* Validate configuration of all channels. */
DT_FOREACH_CHILD(DT_DRV_INST(0), VALIDATE_CHANNEL_CONFIG)

NRF_DT_CHECK_NODE_HAS_REQUIRED_MEMORY_REGIONS(DT_DRV_INST(0));

PM_DEVICE_DT_INST_DEFINE(0, saadc_pm_handler);
Expand Down
4 changes: 1 addition & 3 deletions drivers/audio/Kconfig.dmic_pdm_nrfx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ config AUDIO_DMIC_NRFX_PDM
bool "nRF PDM nrfx driver"
default y
depends on DT_HAS_NORDIC_NRF_PDM_ENABLED
select NRFX_PDM0 if HAS_HW_NRF_PDM0
select NRFX_PDM20 if HAS_HW_NRF_PDM20
select NRFX_PDM21 if HAS_HW_NRF_PDM21
select NRFX_PDM
select PINCTRL
help
Enable support for nrfx PDM driver for nRF MCU series.
Loading
Loading