Commit graph

130 commits

Author SHA1 Message Date
Benjamin Cabé
005377b4c5 drivers: dac: adopt SHELL_HELP
Adopt SHELL_HELP macro for dac_shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-16 14:03:57 -04:00
Benjamin Cabé
25dc5fe968 drivers: dac: esp32: avoid out-of-range channel ID
Fix channel ID check in dac_esp32_channel_setup as it was allowing to
set up a channel with ID greater than the number of channels.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-11 08:19:09 +02:00
Benjamin Cabé
e37631eea7 drivers: dac: max22017: return negative errno
Changed the return value for unsupported channel from ENOTSUP to -ENOTSUP

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-10 13:30:33 +02:00
Florijan Plohl
7692e3db3f drivers: dac: add driver for the NXP DAC12
Add driver shim for the NXP Digital-to-Analog (DAC12) module.

Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
2025-05-13 03:20:29 +02:00
Jeppe Odgaard
0dffe7cc7e drivers: dac: Add TI DAC161S997 driver
Initial DAC driver for TI DAC161S997. This is a 1 channel 16 bit
DAC designed for 4-20 mA loops.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-04-02 12:53:03 +02:00
Khoa Nguyen
9093598d86 drivers: dac: Update Renesas DAC driver to support for RA4
Update Renesas DAC driver to support DAC for RA4

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-03-25 22:13:12 +01:00
Khoa Nguyen
9c67002ef9 drivers: dac: Initial DAC driver support for Renesas RA
Initial DAC driver support for Renesas RA

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-02-11 11:44:40 +00:00
Pieter De Gendt
e574b019ce drivers: dac: dac_dam: Fix samx7x builds
Commit a21e9f02e6 introduced a regression for Atmel SAMX7X series.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-10 18:55:35 +01:00
Ibe Van de Veire
a21e9f02e6 drivers: dac: Add support for the SAM4S soc series
Add support for the SAM4S soc in the DACC driver.

Signed-off-by: Ibe Van de Veire <ibe.vandeveire@basalte.be>
2025-02-06 10:43:17 +01:00
Benjamin Cabé
74cccfa1dc drivers: dac: sam: Fix typo in BUILD_ASSERT
Fixed a typo in BUILD_ASSERT macro causing driver to effectively fail to
compile as seen in:
west twister -p sam_v71_xult/samv71q21b -s drivers.dac.api

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-31 21:43:45 +01:00
Pieter De Gendt
f1c4760304 drivers: Update APIs to use DEVICE_API macro
Some drivers APIs were not wrapped using the DEVICE_API macro.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-01-24 01:15:19 +01:00
Fabio Baltieri
11b5e1f8f5 dac_shell: add device filtering
Add shell device name filtering using DEVICE_API_IS.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-01-22 05:40:11 +01:00
Guillaume Ranquet
31510fb3bf drivers: dac: Add support for MAX22017 DAC
The MAX22017 is a two-channel industrial-grade software-configurable
analog output device that can be used in either voltage or current output
mode.

Signed-off-by: Guillaume Ranquet <granquet@baylibre.com>
2025-01-21 07:07:33 +01:00
Henrik Brix Andersen
7fec3d7f12 soc: atmel: samx7x: refactor SoC support for the Atmel SAM E70/V71
Refactor and merge the SoC support files for the Atmel SAM E70 and SAM V71
product series. These SoCs are part of a larger product family (SAM
E70/S70/V70/V71) and share a common set of peripherals.

Support for the two remaining product series (SAM S70/V70) is not part of
this refactoring as these will require further additions to the Atmel HAL.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-01-16 22:39:25 +01:00
Gerson Fernando Budke
ea7922195b clocks: atmel: sam0: Fix gclk and mclk clock bindings
The Atmel SAM0 SoC enable peripherals clocks in distinct places: PM and
MCLK. The old devices had defined the peripheral clock enable bit at PM.
On the newer devices this was extracted on a dedicated memory section
called Master Clock (MCLK). This change excludes the dedicated bindings
in favor of a generic approach that cover all cases.

Now the clocks properties is complemented by the atmel,assigned-clocks
property. It gives the liberty to user to customize the clock source
from a generic clock or configure the direct connections.

All peripherals drivers were reworked with the newer solution.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2025-01-14 20:49:03 +01:00
Martin Jäger
075cb211e5 drivers: dac: dacx3608: Fix bad shift operation
The parameter provided to the `BIT()` macro must be checked so that
the shift operation does not overflow the variable.

Fixes #81990

Signed-off-by: Martin Jäger <martin@libre.solar>
2025-01-07 11:51:39 +01:00
Yishai Jaffe
1b4cef325b shell: use shell_device_get_binding
Use shell_device_get_binding() instead of device_get_binding() so that
we get the device based on its name and in addition by its label.

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2024-12-18 15:32:10 +01:00
Pieter De Gendt
454cc58246 drivers: dac: Place API into iterable section
Add wrapper DEVICE_API macro to all dac_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 22:05:33 +00:00
Jeppe Odgaard
c6aafd7eb5 drivers: dac: ad559x: implement double range option
Optionally write to ad559x register bit which increases DAC output range
from 0V to 2 x Vref.

The functionality has been tested on AD5593r.
The voltage at 4095 has been measured to 5.01 volts.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-11-25 12:17:00 +01:00
Gerson Fernando Budke
0cc8f93e8a soc: atmel: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.sam*.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:43:26 -06:00
Gerson Fernando Budke
52d21d7bf0 soc: gd32: Drop PINCTRL from Kconfig.defconfig
This Kconfig has wrongly been added to defconfig files. It is not the
right place for it. It has never been the right place for it. Drivers
that need it should select the symbol in their Kconfig entries. Drop
PINCTL from Kconfig.defconfig and add proper select at Kconfig.gd32.

Fixes #78619

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2024-11-04 13:40:42 -06:00
Ben Booher
4a8a035bd7 drivers: sensor: dacx3608: add broadcast register for synchronized output
The dacx3608 line supports a broadcast register so all configured channels
can output a singular value, simultaneously. This drastically reduces I2C
overhead when using multi-channel control. An API addition was necessary
to support a global broadcast channel number. The API addition does not
break the write_value() implementation for other DAC drivers in the repo.
This change is based on an out-of-tree driver developed internally to
handle this use case.

Alternative to the API change, could be a KConfig option or device tree
entry. Also, no support for the Broadcast channel was added to the
channel_setup() implementation - this may or may not be confusing. I
believe it makes sense to maintain explicit setup calls for each channel
intended to be configured.

Signed-off-by: Ben Booher <benbooher@pull-repo.com>
2024-10-26 03:59:35 +01:00
TOKITA Hiroshi
1f30346d4f drivers: dac: Add dummy driver for vnd,dac
Add dummy driver for "vnd,dac" to use in build_all tests.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2024-10-02 09:51:19 +02:00
Martin Jäger
46922b51ce drivers: dac: dac_shell: consider buffered and internal options
The buffered and internal options were not assigned in the channel_cfg,
so they would end up at a random state.

The cfg struct is now properly zero-initialized and both options can
be set using optional parameters -b and -i.

Fixes #75884

Signed-off-by: Martin Jäger <martin@libre.solar>
2024-09-23 13:21:11 -05:00
Corey Wharton
d80174fadf drivers: dac: add checks for internal channel config
Return -ENOTSUP if these flags are specified but not supported.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2024-09-17 05:23:56 -04:00
Corey Wharton
2b9ed72f9e drivers: dac_stm32: make pinctrl config in the device tree optional
Now that we support internally connected channels we should make the
pinctrl configuration optional.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2024-09-17 05:23:56 -04:00
Corey Wharton
834cc98f39 drivers: dac_stm32: add support for internally connected channels
Adds support for configuring the STM32 DAC channel mode for internal
connections. This is only enabled for SOCs that support it.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2024-09-17 05:23:56 -04:00
Erwan Gouriou
d13f9d9b9b drivers: stm32: Select PINCTRL when required
Select PINCTRL subsystem by drivers which require it.
Prevent the need from enabling this symbol at board or soc level.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2024-09-03 14:40:55 +01:00
Marcio Ribeiro
0705aaeb81 drivers: dac: esp32: clock initialization fix
Fixed ESP32 DAC clock initialization

Fixes: #70295

Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
2024-08-29 16:11:57 -04:00
Brett Witherspoon
f320535f84 drivers: dac: dac_ad569x: Add bit shift for 14/12-bit variants
The 14/12-bit variants (AD5692R/AD5691R) require the data to be in the
upper bits of the two byte data field of the write command. See table 12
and the associated footnotes in the AD5693R/AD5692R/AD5691R/AD5693
datasheet.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-11 09:37:12 +02:00
Brett Witherspoon
cb8db004d7 drivers: dac: dac_ad569x: Fix reset error return
The intention here appears to be to return an error. Use an early return
to implement this.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-09 19:43:23 -04:00
Brett Witherspoon
97190d76ec drivers: dac: dac_ad56xx: Fix channel range check
An off by one error in the channel range check results in an out of
bound access to the channel lookup array.

Signed-off-by: Brett Witherspoon <brett@witherspoon.engineering>
2024-07-09 15:31:58 -04:00
Yong Cong Sin
bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Declan Snyder
fa990a7639 drivers: dac: Add driver for NXP GAU DAC
Add driver for NXP GAU DAC 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
Jan Kubiznak
030a8b1830 drivers: dac: dac_ad569x: Support for AD569x DACs.
Added support for Analog Devices AD5691 / AD5692 / AD5693 DACs.

Signed-off-by: Jan Kubiznak <jan.kubiznak@deveritec.com>
2024-04-22 06:50:01 -07:00
Eran Gal
e58dfac374 drivers: dac: Add TI DACx0501 driver
Adds a DAC driver for Texas Instruments DACx0501 family of devices

Signed-off-by: Eran Gal <erang@google.com>
Co-authored-by: Martin Jäger <17674105+martinjaeger@users.noreply.github.com>
2024-04-17 14:37:21 +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
Kyle Kotowick
0d53af4aa1 drivers: dacx0508: fix for multiple DACs of the same type
Presently, this driver cannot handle multiple
DACs of the same type without throwing a
compile error due to a missing line ending.
This PR fixes that issue by adding the missing
line ending.

Signed-off-by: Kyle Kotowick <kotowick@invictonlabs.com>
2024-03-11 17:22:56 +01:00
Jeppe Odgaard
398d297519 drivers: dac: stm32: add dac value range check
Compare value and DAC resolution in `dac_write_value` and return -EINVAL
if the value is above supported resolution.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2024-02-26 12:07:22 +01:00
Sylvio Alves
a79c54dc43 drivers: dac: esp32: fix clock control subsys argument
Current cfg->clock_subsys is passed as address and is
causing driver assertion.

Fixes #69198

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-02-25 20:49:01 -05:00
Gaetan Perrot
82cd7ad9b6 drivers: dac: sam: Add max value check
Add max size check to dac sam and sam0
There is no size check in dac_sam_write_value and dac_sam0_write_value.
Besides, the ret value should also be different.
Fixes #65021

signed-off-by: Gaetan Perrot <gaetanperrotpro@gmail.com>
2023-12-28 12:08:27 +00: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
Bartosz Bilas
2c09999d24 drivers: dac: add driver for AD5592
Add MFD subdriver for the built-in DAC controller
in AD5592 chip.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-11-08 10:07:41 +01:00
Anas Nashif
a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
56fddd805a syscall: rename z_user_from_copy -> k_usermode_from_copy
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif
4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Albort Xue
2ffead788b drivers: dac: Add driver for mcux lpdac
Create dac_mcxu_lpdac.c file to implement mcux lpdac, add binding for
the mcux lpdac, update Kconfig.mcux and CMakeLists.txt file to support
mcux lpdac.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2023-09-11 19:55:26 +02:00