Commit graph

863 commits

Author SHA1 Message Date
Guillaume Gautier
625e2acda8 drivers: adc: stm32: Rename sequencer and oversampler and fix macro issue
In STM32 ADC binding, rename the possible values of the sequencer and
oversampler properties to use lowercase string, similar to the internal
regulator.

Adapts the driver and the dtsi with the new values.

Fixes a macro issue in the driver. Since the value from the dtsi didn't
start with internal_regulator_, the reconstruction of the defines by
the macro ANY_ADC_INTERNAL_REGULATOR_TYPE_IS was missing this prefix and
the comparison failed. Add a new argument to the IS_EQ_STRING_PROP to be
able to insert such a prefix.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-16 17:11:12 +03:00
Guillaume Gautier
88735a4aa1 drivers: adc: stm32: remove useless check of internal regulator state
Disabling the internal regulator is immediate so there is no need to check
the state of the Enable bit in the register.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Guillaume Gautier
67906ce049 drivers: adc: stm32: use the new differential support property
Use the new differential support property instead of relying on the series
name to determine if the ADC supports differential input channels.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Guillaume Gautier
7acd045e62 drivers: adc: stm32: use the new channel preselection property
Use the new channel preselection property instead of relying on the series
name to determine if the ADC channels need to be preselecting.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Guillaume Gautier
77be4b72eb drivers: adc: stm32: use the new deep powerdown property
Use the new deep powerdown property instead of relying on the series name
to determine if the ADC needs to be be put out or into deep powerdown mode.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Guillaume Gautier
7c719cefd5 drivers: adc: stm32: use the new internal regulator property
Use the new internal regulator property instead of relying on series name
to determine if the regulator should be enabled, and how to check that it
is ready.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Guillaume Gautier
a0cadb03c7 drivers: adc: stm32: relies on a ll define rather than series names
For managing the CCRDY flag, rely on the presence of the LL constant
LL_ADC_FLAG_CCRDY rather than a list of series.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-10-13 11:27:22 -04:00
Martin Hoff
c2835ab6a9 drivers: adc: silabs: unify silabs adc kconfig
To reduce the number of Kconfig files and improve maintainability,
we are merging the three different Kconfig files from Silabs for ADC.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-10-09 12:42:56 -04:00
Martin Hoff
be9df47f33 drivers: adc: add DMA support for Silabs IADC
This commit introduces DMA support for the Silabs IADC driver.
A new Kconfig option is added to enable DMA support, ensuring
compatibility with the existing ADC configuration.

DMA can be used for synch/asynch operation.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-10-09 12:42:56 -04:00
Martin Hoff
4d3b459d24 drivers: adc: silabs: removed the old IADC driver
iadc_gecko driver has been replaced by adc_silabs_iadc.c.
The old files and bindings are removed.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-10-09 12:42:56 -04:00
Martin Hoff
766dbf738c drivers: adc: add IADC support for silabs series 2 boards
This commit introduces a new driver for the silabs Incremental ADC (IADC).

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-10-09 12:42:56 -04:00
Michał Bainczyk
20932639cb drivers: nrf: Add missing SoC header includes to adc and i2s
Add missing SoC header include required by memory region assertion
to adc_nrfx_saadc and i2s_nrf_tdm shims.

Signed-off-by: Michał Bainczyk <michal.bainczyk@nordicsemi.no>
2025-10-09 12:37:58 -04:00
Marcio Ribeiro
e8c6695f08 drivers: adc: esp32: split adc_esp32.c between 2 files
Splits driver source code between adc_esp32.c and adc_esp32_dma.c to
improve maintenance

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2025-10-08 17:47:42 +03:00
Marcio Ribeiro
a96e18de97 drivers: adc: esp32: enable adc dma on non gdma socs
Enables adc dma on:
- esp32
- esp32-s2

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2025-10-08 17:47:42 +03:00
Torbjørn Biering Tvermosegaard
863a7668b3 drivers: adc: ad599x: Fix async logic error and driver breakdown
The general ADC documentation states, that it is possible to use the
adc_read_async function with third parameter (k_poll_signal *async) set to
NULL, in which case the callback is called when all channels have been
converted. This change fixes this issue as it now also checks if a callback
has been set.

Signed-off-by: Torbjørn Biering Tvermosegaard <tbt@foss.dk>
2025-10-08 08:45:08 +02:00
Ali Hozhabri
f9655654ab drivers: Fix the improper use of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC
Fix the improper use of CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC for STM32WB0
drivers due to the misunderstanding of its definition.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2025-10-03 21:15:08 -04:00
Bjarki Arge Andreasen
5fd26a6cb7 drivers: adc: nrfx_saadc: implement PM device runtime
The NRFX SAADC device driver needs to implement PM DEVICE for it
to work with power domains, which is required for some SoCs. Inline
PM device runtime "self get/put" pm has been implemented for the
normal sync read API.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-10-02 21:58:14 +02:00
Declan Snyder
570b445a61 drivers: Convert to use SPI macro without delay parameters
Convert all drivers and other consumers to use SPI macros without the
delay parameters.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-10-01 14:39:36 +03:00
Pisit Sawangvonganan
f05f886a70 drivers: adc: remove '&' when assigning adc_xxx_init
Remove address-of operator ('&') when assigning `adc_xxx_init`
function pointer in `DEVICE_DT_INST_DEFINE` and `DEVICE_DT_DEFINE` macro.

This change aims to maintain consistency among the drivers in
`drivers/adc`, ensuring that all function pointer assignments
follow the same pattern.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-10-01 08:22:28 +02:00
Lin Yu-Cheng
1c902e5ac1 adc: rts5912: implement power management
Reduce RTS5912 ADC power consumption

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-09-30 22:05:32 +02:00
Zhaoxiang Jin
bf12516cb4 drivers: adc16: Enhance ADC16 driver.
1. Add new 'has-differential-mode' property to indicate
whether the ADC16 instance supports differential mode.
2. Enabled ADC16 differential mode.
3. Enabled ADC16 reference voltage selection.
4. Enabled ADC16 acquisition time configuration.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-09-25 09:21:18 +02:00
Zhaoxiang Jin
ece35a420b drivers: adc: Add DT properties to lpadc binding
Introduce new binding properties for the LPADC DT
and update the driver to consume them.
Users can use these properties to obtain the opamp
device bound to the ADC and dynamically adjust the
opamp gain so that the opamp output is within the
ADC ideal sample range.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2025-09-24 19:18:11 -04:00
Dimitrije Lilic
0c4c305c9a drivers: adc: max32: Support for RTIO stream
Updated MAX32 driver with RTIO  stream functionality.

Signed-off-by: Dimitrije Lilic <dimitrije.lilic@orioninc.com>
2025-09-23 17:50:25 -04:00
Vladislav Pejic
bc0683b6a2 driver: adc: ad405x: Add RTIO stream
Added support for RTIO stream.
Also added sampling_period property to the DTS. This is for setting the
sampling period when streaming is used.
Hardware or kernel timer can be
used for this.
To use hardware timer you need to add it to the DTS. Example:

{
	chosen {
		zephyr,adc-clock = &counter0;
	};
};

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-09-23 17:50:25 -04:00
Vladislav Pejic
1d02d57413 driver: adc: Added stream APIs for ADC
Introduce a streaming APIs for ADC devices.
Two new APIs are added to the adc_driver_api: submit and get_decoder.
Added decoder following APIs: get_frame_count, get_size_info, decode,
has_trigger.

Supported triggers are:
- ADC_TRIG_DATA_READY
- ADC_TRIG_FIFO_WATERMARK
- ADC_TRIG_FIFO_FULL
Supported operations to be done on trigger:
- include - whatever data is associated with the trigger
- nop - do nothing with data associated with the trigger
- drop - clear data associated with the trigger

Some changes to the linker scripts were needed to add decoder APIs.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2025-09-23 17:50:25 -04:00
Khaoula Bidani
18484fb7a2 drivers: adc: stm32: Add unit check for acquisition_time
Add an explicit check to ensure that the acquisition_time
parameter is encoded with the ADC_ACQ_TIME macro and uses
the TICKS unit, as required by the API.
If the unit is not correct, log an error and return -EINVAL.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-09-23 12:04:29 -04:00
Jamie McCrae
8498c39e13 drivers: Fix some Kconfig bleeds
Fixes instances of Kconfig options appearing for completely
irrelevant builds

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-09-18 13:50:33 -04:00
Qiang Zhao
1e890b2d68 drivers: adc: add support sar adc driver
Add driver for the SAR ADC

Signed-off-by: Qiang Zhao <qiang.zhao@nxp.com>
2025-09-18 13:48:15 -04:00
Benjamin Cabé
1ee48cf421 drivers: adc: adopt new sys_count_bits util function
Adopt new sys_count_bits helper from util.h and avoid
having conflicting definition

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2025-09-09 17:27:15 +02:00
Michał Stasiak
2939ccdf42 drivers: adc: adc_nrfx_saadc: add nRF54LS05B analog pins
Added array of analong pins for nRF54LS05B.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2025-08-28 13:59:34 +02:00
Aksel Skauge Mellbye
af4cbdcf31 drivers: adc: gecko: Fix error return values
Enable the adc_error_cases test on Series 2 devices and change
the return values in the driver for unsupported configurations
to what the test expects.

Ensure that the resolution configuration in the test is valid
such that the invalid buffer test correctly receives -ENOMEM.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2025-08-28 00:39:57 +02:00
Jakub Zymelka
20cb820648 drivers: adc: nrfx_saadc: Fix for negative samples correction
Increment pointer only when channel was selected.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-08-22 12:37:06 +02:00
Sylvio Alves
34eb58c043 espressif: fix Kconfig style issues
Fix Kconfig style issues in Espressif files.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-08-21 18:41:52 +02:00
Minh Tang
3f13f25752 drivers: adc: Initial support for ADC driver on RX130
Add driver code and devicetree for 12-bit ADC on
RX130 MCU

Signed-off-by: Minh Tang <minh.tang.ue@bp.renesas.com>
2025-08-19 14:15:41 +02:00
Jakub Zymelka
138f977704 drivers: adc: nrfx: enable negative values for single-ended ADC readings
The ADC driver API already supports ADC readings which can return signed
values, these are differential readings. In Nordic's datasheet, we have
a mode called "single ended", but its just a name. "Single ended" is a
differential reading, with the negative channel tied to GND. This is not
compatible with zephyrs definition of a single ended reading.

To support Nordic's "single ended" mode, the user must configure
a differential reading, with the negative input tied to ground, which
the saadc driver can then use to configure the reading as Nordic SAADC
"single ended", and return negative values as expected.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-08-19 13:02:21 +02:00
Keith Packard
469d54e227 drivers/adc/adc_stm32: Check both single-ended and differential defines
The stm32u3x header files defines LL_ADC_SINGLE_ENDED but not
LL_ADC_DIFFERENTIAL as the device doesn't support differential mode. The
driver only checked for LL_ADC_SINGLE_ENDED and assumed that when that was
defined, LL_ADC_DIFFERENTIAL would also be defined.

Check for both when figuring out which calibration type will be required.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-08-18 22:01:08 +02:00
Jakub Zymelka
376b34ca63 drivers: adc: nrfx_saadc: Add support for SAADC internal sampling timer
The SAMPLERATE register can be used as a local timer instead
of triggering individual SAMPLE tasks. When SAMPLERATE.MODE is set
to Timers, it is sufficient to trigger SAMPLE task only once in order
to start the SAADC and triggering the STOP task will stop sampling.
The SAMPLERATE.CC field controls the sample rate.

The SAMPLERATE timer should not be combined with SCAN mode and
only one channel should be enabled when using the internal timer.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-08-18 21:59:50 +02:00
Phuc Pham
371f2925dc drivers: adc: Add ADC support for Renesas RZ/A3UL, T2M, N2L, V2L
Add ADC driver support for Renesas RZ/A3UL, T2M, N2L, V2L

Signed-off-by: Phuc Pham <phuc.pham.xr@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-08-18 11:56:47 +02:00
Declan Snyder
5e3a432fed adc: Remove CONFIG_ADC_MCUX_ETC
This Kconfig does not belong in the ADC folder, because there is not
actually a zephyr ADC driver for this. Also, remove HAS_MCUX_ADC_ETC as
well because it is a useless config.

The cmake line to pull in this driver from the SDK in the zephyr repo is
totally unnecessary. If a user wants to use this SDK driver they can add
it to their build like any other SDK driver or any other
external code module. Zephyr should not be a cesspool of random build
glue for random pieces of code.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-15 10:10:32 +03:00
Declan Snyder
5ae654eeef modules: hal_nxp: Removed unused HAS_MCUX_* configs
Remove the configs that are not actually used for anything anymore or
never were, or that are redundant with other configs, and don't have any
code changes outside of Kconfig to remove.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-08-15 10:10:32 +03:00
Jakub Zymelka
fe0b6b3b55 drivers: adc: nrfx: Temporary fix for SAADC power consumption
This is temporary fix for SAADC power consumption. Need to be
removed after hal_nrfx version upgrade.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-08-14 10:44:43 +01:00
Jakub Zymelka
c535d6e5d1 drivers: adc: nrfx_saadc: Add support for DMM
Add support for DMM which manages cache and dedicated memory spaces.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-08-12 12:35:48 +02:00
Yunshao Chiang
db02fdc8ef drivers: adc: it51xxx: fix the ADC channels sampling flow
The original code process causes the following two issues:

1. The first sample is always 0 because the `ctx` sequence in `data` is
   assigned the input sequence until the `adc_context_start_read`. As a
   result, the `while (channels) { ... }` loop is not executed, and
   `adc_enable_measurement` is not called.

2. Since the `ctx` sequence in `data` is assigned in
   `adc_context_start_read`, which occurs after the `while (channels) {
   ... }` loop, the ADC samples the previously set channel.

Signed-off-by: Yunshao Chiang <Yunshao.Chiang@ite.com.tw>
2025-08-06 12:16:30 +03:00
Luna Pes
d299ce35d5 drivers: adc: ad7124: fix io control reg len
The IO_CONTROL_1 register is 3 bytes long according to the datasheet.
This fixes the register not being written to correctly.

Signed-off-by: Luna Pes <zephyr@orangemurker.com>
2025-08-05 13:20:41 -04:00
Michał Bainczyk
2e06c4ed20 drivers: nrf: add build asserts for memory-regions property
Add build asserts for "memory-regions" property in nrf drivers which is
required on targets with DMM for saadc, pdm, pwm, twim, twim_rtio, twis,
tdm, uarte, spim and spis. On targets where the property is not required
the assertion macro expands to nothing.

Signed-off-by: Michał Bainczyk <michal.bainczyk@nordicsemi.no>
2025-07-28 04:27:25 -04:00
Nikodem Kastelik
04f7fc5095 drivers: adc: nrfx_saadc: remove VDD and DVDD inputs for nRF54LV10A
MDK 8.72.1 does not specify VDD and DVDD internal analog inputs
for this SoC.

Signed-off-by: Nikodem Kastelik <nikodem.kastelik@nordicsemi.no>
2025-07-25 08:20:09 -04:00
Matt Rodgers
56621fa1de drivers: adc: stm32: add support for differential mode
Differential mode support consists of:
- If differential mode is supported by the underlying hardware AND at
  least one differential channel is enabled in the devicetree for this
  ADC instance, then perform a differential mode calibration in addition
  to the usual single ended calibration during initialisation.
- Set channels to the appropriate differential or single ended mode
  during channel setup.

Currently the N6 series is not supported even though the underlying
hardware supports differential mode, due to complications in the
calibration procedure.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Co-authored-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-07-21 07:25:30 -04:00
Julien Panis
afc5b6cb0d drivers: adc: cc23x0: Add power management
Add PM support to cc23x0 ADC module.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-07-19 15:31:37 -04:00
Hao Luo
0407185d43 drivers: adc: ambiq: fixed the error that caused adc_api test to fail
This commit fixed the failure of test_adc_asynchronous_call

Signed-off-by: Hao Luo <hluo@ambiq.com>
2025-07-19 13:49:14 -04:00
Jakub Zymelka
35044b64e4 drivers: adc: nrfx_saadc: Fix SAADC shim for nRF54LV10A
GAIN field is not present on LV10A, so instead we need to
check the input value to the function.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2025-07-19 13:40:29 -04:00