Commit graph

635 commits

Author SHA1 Message Date
Zhaoxiang Jin db87c6c0ff drivers: adc: Support regulator output as reference to LPADC
Support regulator output different voltage as reference to LPADC
the regulator output voltage can be set through property
zephyr,vref-mv

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-05-15 17:28:38 +02:00
Karol Lasończyk 3ca3131a7d drivers: adc: Update adc driver to support nRF54L15 device
Expands driver to cover nRF54L15 features like AIN as GPIO configuration,
new reference voltage, different set of supported gain options.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2024-05-15 15:33:41 +01:00
Declan Snyder b9e89ef688 drivers: adc: Add NXP GAU ADC Driver
Add driver for NXP GAU ADC using MCUX HAL.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-05-14 18:23:22 -04:00
Benjamin Cabé 30ce8b1b18 drivers: fix bad SPDX-License-Identifier header
fix typo in SPDX header

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-08 09:23:16 -04:00
cyliang tw 0190ed2713 drivers: adc: support Nuvoton numaker m2l31x
Update m2l31x.dtsi for adc support and update adc_numaker.c
to support acquisition time in 0~255 ADC ticks.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-05-02 09:58:43 +01:00
Caspar Friedrich 666a89221b drivers: adc: tla2021: Fix reference voltage
This fixes the problem that `adc_raw_to_millivolts` only returns half of
the actual voltage.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2024-04-25 15:12:14 +02:00
François Baldassari 4fe9909949 ADC: kb1200: start_read returns uninitialzed value
Found via static analyis. When `adc_kb1200_start_read` succeeds, no
value is set for `error` so it is still uninitialized when it is
returned.

Signed-off-by: François Baldassari <francois@memfault.com>
2024-04-25 11:06:11 +00:00
Lukasz Madej 71e7a77e99 drivers: adc: adc_ad559x: improve adc read
Use information encoded in conversion result value to validate it.
Check if MSB bit is set to zero.
Check if channel number included in the result matches channel
number selected for conversion.
Use bitmask to extract converted value instead of math calculations.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Lukasz Madej f565f4cae7 drivers: adc: adc_ad559x: fix driver init
k_thread_name_set() function returns an error if CONFIG_THREAD_NAME is
not enabled which may make the driver not functional.

Fix the issue by adding a check against CONFIG_THREAD_NAME avaliability
before calling k_thread_name_set() function so the driver can operate
properly with CONFIG_THREAD_NAME disabled.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Lukasz Madej 55235712fb drivers: adc: adc_ad559x: add invernal vref value
Add configuration of internal refference voltage value so raw ADC
readings can be converted to mV utilizing adc_raw_to_millivolts()
ADC API function.

Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
2024-04-25 12:15:19 +02:00
Zhaoxiang Jin fefb472700 drivers: lpadc/adc_mcux_lpadc/: enable nxp lpadc acquisition time feature
Enable nxp lpadc driver acquisition time feature

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2024-04-18 11:16:45 +02:00
Jan Kubiznak ba90f160b9 drivers: adc: adc_ads1119: Fix configuration register access.
The adc_ads1119 driver is unable to overwrite the configuration register,
the chip therefore always works with its default settings. Register access
macros are fixed by this commit.

Fixes: #70091

Signed-off-by: Jan Kubiznak <jan.kubiznak@deveritec.com>
2024-04-11 09:09:20 +02:00
Lucas Tamborrino fe57a12cf2 drivers: esp32: update to hal_espressif v5.1
Modify necessary drivers to meet updated hal.

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-04-05 13:39:53 +02:00
Jeppe Odgaard 17b1912bc3 drivers: ad559x: add i2c bus support
Rename ad5592 files in dts, driver and include to ad559x and add support
for I2C bus which is required for AD5593.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-04-01 12:18:47 -05:00
Steven Chang 7d12798a22 drivers: adc: initial device driver for ENE KB1200
Add adc driver for ENE KB1200

Signed-off-by: Steven Chang <steven@ene.com.tw>
2024-03-15 09:39:48 +00:00
Guillaume Gautier 3b50237699 drivers: adc: stm32: use correct macros for dma transfer
Use the correct dedicated macros for enabling DMA transfer for STM32H7 and
U5.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-03-12 19:28:54 -04:00
Guillaume Gautier 5d2558bdad drivers: adc: stm32: dma fixes
Add a blank define for the case where DMA channels are defined in ADC node
of the dts but STM32_ADC_DMA is not enabled. Otherwise compilation fails.
Also fix the way the DMA channel is configured by using a standard DT
macro, otherwise it doesn't work for dma-v2bis DMA types.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-03-12 19:28:54 -04:00
Guillaume Gautier e91860d8c7 drivers: adc: stm32: disable dma before calibration
For some STM32 series, DMA has to be disabled before starting ADC
calibration.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-03-12 10:41:55 +01:00
Benedikt Schmidt b47c66e3f2 drivers: adc: implement voltage biasing for ADS114s08
Implement voltage biasing on the inputs of the ADC ADS114s08.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-03-11 19:34:34 -04:00
Benedikt Schmidt d03778f9e6 drivers: adc: reset data ready signal for ADS114s0x
Reset the data ready signal for a new read operation
with a ADS114s0x.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-03-11 17:23:54 +01:00
Alexandre Poizat 0195f774ba drivers: adc: stm32: disable ADC before writing oversampling bits for g0
Added the STM32G0X SOC series to the list of SOC that need to disable the
ADC while setting the oversampling bits to prevent writing over the
CKMODE bits.

Signed-off-by: Alexandre Poizat <apoizat@kalrayinc.com>
2024-03-11 14:21:13 +01:00
Benedikt Schmidt c08b66cfee drivers: adc: set name for acquisition thread of MCP320x
Set the name of the acquisition thread for the ADC MCP320x.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-03-07 21:37:54 +00:00
Henrik Brix Andersen 79d5857e9f drivers: adc: max1125x: use K_KERNEL_STACK_SIZEOF()
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.

Fixes: #69129

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-19 12:52:52 -06:00
Henrik Brix Andersen ad85283906 drivers: adc: ad5592: use K_KERNEL_STACK_SIZEOF()
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.

Fixes: #69133

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-19 12:52:52 -06:00
Henrik Brix Andersen 4274d1b365 drivers: adc: ads7052: use K_KERNEL_STACK_SIZEOF()
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.

Fixes: #69132

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-19 12:52:52 -06:00
Henrik Brix Andersen 0e321ecc90 drivers: adc: lmp90xxx: use K_KERNEL_STACK_SIZEOF()
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.

Fixes: #69131

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-19 12:52:52 -06:00
Henrik Brix Andersen ae81429a81 drivers: adc: mcp320x: use K_KERNEL_STACK_SIZEOF()
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.

Fixes: #69130

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-02-19 12:52:52 -06:00
Guillaume Gautier 02219189d0 drivers: adc: stm32: add dma support for stm32f4 adc
Add ADC DMA support for STM32F4 (and similar series F2, F7 and L1)

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-02-12 12:19:56 +01:00
Dino Li a059da947c soc/it8xxx2: add support for raising EC bus to 24MHz
This change was made to reduce read/write EC registers latency.
Without enabling CONFIG_SOC_IT8XXX2_EC_BUS_24MHZ:
- Read EC register 64 times takes 80us latency.
- Write EC register 64 times takes 60us latency.
With enabling CONFIG_SOC_IT8XXX2_EC_BUS_24MHZ:
- Read EC register 64 times takes 40us latency.
- Write EC register 64 times takes 30us latency.

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2024-01-31 16:43:46 +00:00
Guillaume Gautier 62f1105550 drivers: adc: stm32: do not disable adc after measurement
Do not disable the ADC after the end of the measurement to avoid systematic
enabling which is time-consuming in case the configuration is unchanged.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-01-30 14:13:28 +00:00
Bartosz Bilas a4f004e654 drivers: adc: ad5592: add missing static keyword
Add the missing static keyword for driver data structure.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2024-01-26 09:32:49 +00:00
Guillaume Gautier 276fc569d6 drivers: adc: stm32: prevent suspend to ram while measure in progress
Prevents the system to go in Suspend to RAM low power mode while ADC
measurement is in progress.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-01-25 08:55:02 +01:00
Guillaume Gautier 14839e80d5 drivers: adc: stm32: add support for two sampling time common channels
For series that have two sampling time common channels, only one was used.
This commit add the support for the second one. The first two different
acquisition time values are used for the sequence and all further values
must match either of them, otherwise generating an error.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-01-24 12:44:59 +00:00
Caspar Friedrich 8a2a44f9e9 drivers: adc: tla2021: Raise default initialization priority
The TLA2021 driver depends on it's i2c controller and therefore needs
to be initialized later. ADC_INIT_PRIORITY by default equals
KERNEL_INIT_PRIORITY_DEVICE which should be used by independent devices.
Using this by default causing projects to fail where this driver is
enabled implicitly through board configuration and the priority is not
explicitly set.

Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
2024-01-24 08:22:33 +01:00
Michael R Rosen 193ad777f4 driver: adc: stm32: combine shared and separate irqs
Several STM32 variants include both shared IRQs for some ADCs and
separate IRQs for others (for example, STM32G473 has 5 ADCs, ADC1 and
ADC2 share one IRQ while ADC3, ADC4 and ADC5 each have unique
IRQs). The STM32 ADC driver however previously only supported either
separate IRQ lines for each operational ADC in the devicetree or a
single shared IRQ for all operational ADCs in the devicetree which
prevented all ADCs from being usable at the same time when the variant
contained a mix of both shared and separate ADC IRQ lines (only either
all the shared or all the separate and one of the shared might be used
at most for one application).

To allow for all ADCs in an STM32 variant to be usable in a single
application, generate an ISR and initialization function for each
unique IRQn as defined in the devicetree and give the task of
initialization to the first ADC which connects to that particular
IRQ. Each ISR function will generate code to call the ISR for each ADC
associated with that IRQn as was previously done for
CONFIG_ADC_STM32_SHARED_IRQS, allowing an ISR to be shared for the
ADCs sharing an IRQ while simultaneously providing separate ISRs for
each IRQ. Thus, the only information required to have ADCs either
share an ISR or not is provided by the devicetree.

Signed-off-by: Michael R Rosen <mrrosen@alumni.cmu.edu>
2024-01-23 15:21:55 +00:00
Paulo Santos 92af172159 drivers: adc: iadc_gecko: fix sample bits reading
The current driver initializes the IADC with the default configuration
(IADC_INITSINGLE_DEFAULT), which aligns the data to the right.
To correctly read the 12-bit sample, it should be masked from the right
instead.

Signed-off-by: Paulo Santos <pauloroberto.santos@edge.ufal.br>
2024-01-15 14:08:11 -05:00
Henrik Brix Andersen 24b68fa67f drivers: adc: shell: update list of compatibles
Update the list of ADC compatibles based on the compatibles from
dts/bindings/adc/*.yaml.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-12 12:09:53 +00:00
Henrik Brix Andersen 0cd776e7dd drivers: adc: shell: sort the list of compatibles
Sort the list of supported ADC compatibles alphabetically.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-12 12:09:53 +00:00
Brian Juel Folkmann 06b57926a2 drivers: adc: stm32: Fix race condition with internal channels
When using one of the internal channels (die_temp, vbat, vref) the
channels are enabled in the individual drivers and disabled again
whenever an adc conversion is complete.

This creates a race condition if the ADC is used from multiple threads.

This commit moves the disabling of the channels to the individual
drivers.

Signed-off-by: Brian Juel Folkmann <bju@trackunit.com>
2024-01-11 13:53:17 +01:00
Jakub Zymelka ade49f081d modules: hal_nordic: nrfx: update API version to 3.2.0
Updated API version enables multi-instance GPIOTE driver.
Additionally obsolete symbol that was used to specify
API version in the past was removed.
Affected drivers have been adjusted and appropriate changes
in affected files have been made.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-01-08 11:19:37 +01:00
cyliang tw 9ad8e1ab74 drivers: adc: support Nuvoton numaker series
Add Nuvoton numaker series adc controller, including async read feature.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-01-02 10:10:27 +01:00
TOKITA Hiroshi 90976db5a3 drivers: adc: rpi_pico: Turn on clock and reset device on init
Turning on clock via clock controller and
resetting ADC device via reset controller on initializing.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2023-12-20 11:14:24 +01:00
HaiLong Yang 640a493c1d drivers: adc: stm32 adc support h7 dual core lines
For STM32H7 dual core lines, M4 can not access to linear calib addr
ADC_LINEAR_CALIB_REG_1_ADDR.

Signed-off-by: HaiLong Yang <hailong.yang@brainco.cn>
2023-12-18 09:29:17 +01:00
Guillaume Gautier 20fd6a10e1 drivers: adc: stm32: prevent pm while measurement in progress
Prevent PM while ADC measurement in progress.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2023-12-01 14:31:05 +01:00
Benedikt Schmidt 08bf74a825 drivers: adc: cleanup whitespaces in ADS114s0x
Cleanup the whitespaces with clang-format in the driver of the ADS114s0x.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-01 10:51:05 +00:00
Benedikt Schmidt 640b6911d6 drivers: adc: improve logging of ADS114s0x
Improve the logging of the ADC driver ADS114s0x.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-12-01 10:51:05 +00:00
Francois Ramu de1bfd6a6e drivers: adc: stm32 adc fixing calibration for the stm32F1 serie
Configure the sw trigger just after calibration
So the conversion can start on regular channel on the
software control bit.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-11-30 12:22:46 +01:00
Hein Wessels a257bcb735 drivers: adc: stm32: add dma support for other mcus
This commit adds support for more STM32 CPUs that has
a different DMA interface. This was tested only for
the nucleo_l476rg.

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-11-23 10:00:50 +01:00
Hein Wessels f27e45473a drivers: adc: stm32: driver now agnostic of actual dma name
Previously the STM32 DMA driver was dependent on a very specific
name for the DMA in the DTS. This hidden requirement has caused
a bit of confusion. This commit changes the driver to instead
always use the first DMA listed in the ADC node's dma property.

Should fix: #65387

Signed-off-by: Hein Wessels <heinwessels93@gmail.com>
2023-11-23 10:00:50 +01:00
Henrik Brix Andersen c0c8952739 shell: do not enable subsystem/driver shell modules by default
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.

The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.

This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-11-20 09:21:40 +01:00