Skip to content

ADC stream API #90285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions boards/adi/apard32690/apard32690_max32690_m4.dts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
arduino_header: connector {
compatible = "arduino-header-r3";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map-mask = <0xffffffff 0xfffffe00>;
gpio-map-pass-thru = <0 0x1ff>;
gpio-map = <0 0 &gpio3 0 0>, /* A0 */
<1 0 &gpio3 1 0>, /* A1 */
<2 0 &gpio3 2 0>, /* A2 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,23 @@
io-channels = <&adc4052_eval_ad4052_ardz 0>;
};
};

&arduino_spi {
adc4052_eval_ad4052_ardz: adc4052@0 {
conversion-gpios = <&arduino_header 12 (GPIO_ACTIVE_HIGH | MAX32_GPIO_VSEL_VDDIOH)>;
};
};

&timer0 {
status = "okay";

counter0: counter {
status = "okay";
};
};

/ {
chosen {
zephyr,adc-clock = &counter0;
};
};
10 changes: 8 additions & 2 deletions boards/shields/eval_ad4052_ardz/eval_ad4052_ardz.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
* SPDX-License-Identifier: Apache-2.0
*/

/ {
aliases {
adc0 = &adc4052_eval_ad4052_ardz;
};
};

&arduino_spi {
status = "okay";

Expand All @@ -12,12 +18,12 @@
spi-max-frequency = <DT_FREQ_M(2)>;
gp1-gpios = <&arduino_header 14 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
gp0-gpios = <&arduino_header 15 (GPIO_PULL_DOWN)>;
conversion-gpios = <&arduino_header 12 (GPIO_ACTIVE_HIGH | MAX32_GPIO_VSEL_VDDIOH)>;
conversion-gpios = <&arduino_header 12 (GPIO_ACTIVE_HIGH)>;
#address-cells = <1>;
#size-cells = <0>;
#io-channel-cells = <1>;
status = "okay";
compatible = "adi,ad405x-adc";
compatible = "adi,ad4052-adc";

channel@0 {
reg = <0>;
Expand Down
4 changes: 4 additions & 0 deletions cmake/linker_script/common/common-rom.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ if(CONFIG_SENSOR_ASYNC_API)
zephyr_iterable_section(NAME sensor_decoder_api KVMA RAM_REGION GROUP RODATA_REGION)
endif()

if(CONFIG_ADC_STREAM)
zephyr_iterable_section(NAME adc_decoder_api KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if(CONFIG_MCUMGR)
zephyr_iterable_section(NAME mcumgr_handler KVMA RAM_REGION GROUP RODATA_REGION)
endif()
Expand Down
1 change: 1 addition & 0 deletions drivers/adc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ zephyr_library_sources_ifdef(CONFIG_ADC_MAX32 adc_max32.c)
zephyr_library_sources_ifdef(CONFIG_ADC_AD4114 adc_ad4114.c)
zephyr_library_sources_ifdef(CONFIG_ADC_AD7124 adc_ad7124.c)
zephyr_library_sources_ifdef(CONFIG_ADC_AD405X adc_ad405x.c)
zephyr_library_sources_ifdef(CONFIG_ADC_STREAM default_rtio_adc.c)
zephyr_library_sources_ifdef(CONFIG_ADC_AD4130 adc_ad4130.c)
zephyr_library_sources_ifdef(CONFIG_ADC_REALTEK_RTS5912 adc_realtek_rts5912.c)
zephyr_library_sources_ifdef(CONFIG_ADC_TI_AM335X adc_ti_am335x.c)
Expand Down
9 changes: 9 additions & 0 deletions drivers/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ config ADC_INIT_PRIORITY
help
ADC driver device initialization priority.

config ADC_STREAM
bool "ADC stream support"
select RTIO
select RTIO_SYS_MEM_BLOCKS
select RTIO_CONSUME_SEM
select RTIO_WORKQ
help
This option enables the stream API calls.

module = ADC
module-str = ADC
source "subsys/logging/Kconfig.template.log_config"
Expand Down
7 changes: 7 additions & 0 deletions drivers/adc/Kconfig.ad405x
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ config ADC_AD405X
help
Enable ADC driver for ADI AD405X.

config AD405X_STREAM
bool "Use FIFO to stream data"
select AD405X_TRIGGER
depends on SPI_RTIO
help
Use this configuration option to enable streaming ADC data via RTIO.

config AD405X_TRIGGER
bool "AD405X interrupts"
default n
Expand Down
7 changes: 7 additions & 0 deletions drivers/adc/Kconfig.max32
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ config ADC_MAX32
select PINCTRL
help
Enable ADC driver for ADI MAX32xxx MCUs.

config ADC_MAX32_STREAM
bool "Use FIFO to stream data"
select ADC_ASYNC
depends on HAS_ADC_MAX32_REVB_ME18
help
Use this configuration option to enable streaming ADC data via RTIO.
Loading
Loading