Skip to content

Conversation

@dlech
Copy link
Collaborator

@dlech dlech commented Oct 23, 2025

We recently did some backports from upstream for the ad7124 driver. These got automatically copied to the rpi-6.12.y branch. However, there are some devicetree overlays that only exist in the rpi branch. So we need one more patch to fix those up.

PR Description

The upstream devicetree binding deprecated using clock-names = "mclk"; as this is an internal clock, not an external one. Remove this from the AD7124 overlays since the ad7124 driver no longer requires it.

Also use generic node names for the adc nodes while we are cleaning things up.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

gastmaier and others added 30 commits August 5, 2025 12:02
Add if hdl tag is present in devicetree. Compile common defconfig and
devicetrees.

Signed-off-by: Jorge Marques <[email protected]>
False positives.

Signed-off-by: Jorge Marques <[email protected]>
Reduce podman-bias, to avoid users installing it if already using other
container-engine.

Signed-off-by: Jorge Marques <[email protected]>
Add flow for rpi branches, with rpi defconfigs.
For testing, it is usual to open a pr against a ci/* branch,
while staging branches the pr is open against targets, in this
case, just the base or source branch must have the ci files.

Signed-off-by: Jorge Marques <[email protected]>
fix path to point in the right folder for uploading artifacs.

Signed-off-by: Andreea Andrisan <[email protected]>
create a version file that includes information useful for the boot
partition folder.

Signed-off-by: Andreea Andrisan <[email protected]>
Signed-off-by: Jorge Marques <[email protected]>
So we can show a pretty red X on the GUI, by returning error codes from
the bash methods, beyond the fail environment variable.

Signed-off-by: Jorge Marques <[email protected]>
Meant to fail individual steps, can be captured with || true

Signed-off-by: Jorge Marques <[email protected]>
About merging err and fail into one for individual step failure.

Signed-off-by: Jorge Marques <[email protected]>
Use trap ERR to catch any exit error and set the step as fail.

Signed-off-by: Jorge Marques <[email protected]>
We already have our own CI stuff in place so remove the one we get from
upstream RPI. We might want to take some ideas from it and adapt to our
own workflow but for now, let's just remove the whole thing.

The dtoverlaycheck also looks interesting but before it's useful, we
have to fix all our overlays to comply with it.

Signed-off-by: Nuno Sá <[email protected]>
Clear reset status flag, to keep error status register clean after reset
(ad3552r manual, rev B table 38).

Reset error flag was left to 1, so debugging registers, the "Error
Status Register" was dirty (0x01). It is important to clear this bit, so
if there is any reset event over normal working mode, it is possible to
detect it.

Fixes: 8f2b548 ("drivers:iio:dac: Add AD3552R driver support")
Signed-off-by: Angelo Dureghello <[email protected]>
Link: https://patch.msgid.link/20250125-wip-bl-ad3552r-clear-reset-v2-1-aa3a27f3ff8c@baylibre.com
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit e17b9f2)
Apply a mask to the raw value received over the SPI bus for unsigned
direct reads. As we found recently, SPI controllers may not set unused
bits to 0 when reading with bits_per_word != {8,16,32}. The ad7944 uses
bits_per_word of 14 and 18, so we need to mask the value to be sure we
returning the correct value to userspace during a direct read.

Fixes: d1efcf8 ("iio: adc: ad7944: add driver for AD7944/AD7985/AD7986")
Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Link: https://patch.msgid.link/20250505-iio-adc-ad7944-max-high-bits-on-direct-read-v1-1-b173facceefe@baylibre.com
Cc: <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 7cdfbc0)
The sinc4 filter has a factor 0.23 between Output Data Rate and f_{3dB}
and for sinc3 the factor is 0.272 according to the data sheets for
ad7124-4 (Rev. E.) and ad7124-8 (Rev. F).

Fixes: cef2760 ("iio: adc: ad7124: add 3db filter")
Signed-off-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Marcelo Schmitt <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 8712e49)
There are several issues with the function that implements writing to
the filter_low_pass_3db_frequency property:

 - The sinc3 factor should be 0.272 not 0.262 (this is fixed for the
   reading side in the previous patch).
 - For freq > 1 the if condition is always true so the sinc4 filter is
   hardly ever chosen.
 - In the nearly always taken if branch the filter is set to sinc3, but
   the frequency is set for sinc4. (And vice versa in the else branch.)

This is broken enough to justify the claim that there isn't any serious
user. Also it it counter-intuitive that setting the 3db frequency
modifies the sample frequency and the filter type.

So drop the ability to write that property.

Signed-off-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Marcelo Schmitt <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 7dd17a4)
Some drivers are tristates of other symbols, for example:

  config DEVICE
       tristate "Device support"

  config DEVICE_SPI
       depends on SPI
       selects DEVICE

  config DEVICE_I2C
       depends on I2C
       selects DEVICE

In this case, touching device.c, infers CONFIG_DEVICE, but this symbol
is selected by DEVICE_SPI | DEVICE_I2C. Extend the inferring script to
look for symbols that selects it, limited at the same Kconfig.

Signed-off-by: Jorge Marques <[email protected]>
Collect compile_gcc_fanalyzer errors to warnings bucket, to not fail the
CI, mostly for existing errors not worth fixing.

Signed-off-by: Jorge Marques <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace direct access with the iio_get_masklength() helper function
to align with this change and to avoid warnings from the sparse
checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace direct access with the iio_get_masklength() helper function
to align with this change and to avoid warnings from the sparse
checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace direct access with the iio_get_masklength() helper function
to align with this change and to avoid warnings from the sparse
checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace direct access with the iio_get_masklength() helper function
to align with this change and to avoid warnings from the sparse
checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace the for_each_set_bit loop with the
iio_for_each_active_channel() helper function and direct access
to indio_dev->masklength with iio_get_masklength() to align with this
change and to avoid warnings from the sparse checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace the for_each_set_bit loop with the
iio_for_each_active_channel() helper function to align with this
change and to avoid warnings from the sparse checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace the for_each_set_bit loop with the
iio_for_each_active_channel() helper function and direct access
to indio_dev->masklength with iio_get_masklength() to align with this
change and to avoid warnings from the sparse checker.

Signed-off-by: Nuno Sá <[email protected]>
Upstream has removed direct access to indio_dev->masklength.
Replace direct access with the iio_get_masklength() helper function
to align with this change and to avoid warnings from the sparse
checker.

Signed-off-by: Nuno Sá <[email protected]>
The format property set to 'spdif' has no meaning on these DTs as that
interface type is handled by the generic hdmi-sound driver.

Signed-off-by: Nuno Sá <[email protected]>
dlech and others added 17 commits October 16, 2025 15:33
Add a boolean debugfs attribute to allow disabling the SINGLE_CYCLE
bit in the FILTER registers.

This causes data to be read on every conversion instead of doing the
usual 3 or 4 conversions per sample (depending on the filter). This is
only needed for very specific use cases, such as validating the
performance of the ADC. So we just expose this feature through debugfs
for the rare cases where it is needed by people who really know what
they are doing.

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 017c7fa)
Inline ad7124_enable_channel() at the only call site. This simplifies
the code by avoiding a bit of extra indirection.

ch->nr is replaced by address as that is the same value and avoids more
indirection.

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 021eef2)
Remove the unused `nr` field from the `ad7124_channel` struct. There
are no more users of this field (it is only assigned to but never read)
so can be removed.

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit bd93170)
Use AD7124_MAX_CHANNELS macro instead of hardcoding 16 in
ad7124_disable_all(). We already have the macro, so we should use it.

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit f6fbdbc)
Use devm_mutex_init() to initialize the mutex to handle automatically
freeing in debug builds.

Signed-off-by: David Lechner <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 9bbf038)
Remove __ad7124_set_channel() wrapper function. This just added an
unnecessary layer of indirection with an extra call to container_of().

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 6e83fb6)
Use the same .ext_info for the temperature channel as for the voltage
channels. In the ADC, these all go though a mux to select the source
and otherwise operate the same.

These attributes probably won't be used much, but since it is trivial
to add this, we might as well include them.

Signed-off-by: David Lechner <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit bcdb38b)
Change the allocation strategy of the 8 SETUP registers from a least-
recently-used (LRU) to a first-come-first-served basis.

The AD7124 chips can have up to 16 channels enabled at a time in the
sequencer for buffered reads, but only have 8 SETUP configurations
(namely the OFFSET, GAIN, CONFIG and FILTER registers) that must be
shared among the 16 channels.  This means some of the channels must use
the exact same configuration parameters so that they can share a single
SETUP group of registers.  The previous LRU strategy did not keep track
of how many different configurations were requested at the same time,
so if there were more than 8 different configurations requested, some
channels would end up using the incorrect configuration because the slot
assigned to them would also be assigned to a different configuration
that wrote over it later.

Adding such tracking to solve this would make an already complex
algorithm even more complex.  Instead we can replace it with a simpler
first-come-first-serve strategy.  This makes it easy to track how many
different configurations are being requested at the same time.  This
comes at the expense of slightly longer setup times for buffered reads
since all setup registers must be written each time when a buffered read
is enabled.  But this is generally not considered a hot path where
performance is critical, so should be acceptable.

This new strategy also makes hardware debugging easier since SETUPs are
now assigned in a deterministic manner and in a logical order.

Signed-off-by: David Lechner <[email protected]>
Reviewed-by: Nuno Sá <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
(cherry picked from commit 0a77002)
Add a new .dts file for the Analog Devices EVAL-AD7124-4ASDZ board
connected to a DE10-Nano board.

Signed-off-by: David Lechner <[email protected]>
(cherry picked from commit a3463e1)
- Fix channel matching pattern.
- Fix adi,power-up-frequency data type.
- Remove unnecessary maxItems constraints.

Signed-off-by: David Lechner <[email protected]>
(cherry picked from commit d58704c)
Add guard(mutex) to ad9081_status_show() and ad9081_fir_bin_write()
to ensure proper locking when accessing converter state. This prevents
potential race conditions during debugfs interactions.

Signed-off-by: Michael Hennerich <[email protected]>
Ensure the return value of sysfs_emit() is properly checked in
ad9081_ext_info_read() to catch cases where no data is written or
an error occurs. This prevents misleading success returns when the
buffer emission fails.
Set ret = -EINVAL if sysfs_emit() returns zero or a negative value,
aligning with expected error handling practices in sysfs attribute reads.

Signed-off-by: Michael Hennerich <[email protected]>
Convert all instances of for_each_child_of_node() to
for_each_child_of_node_scoped() in the ad9081_parse_dt_tx() and
ad9081_parse_dt_rx() functions. This ensures proper reference
counting and automatic cleanup of child nodes, reducing the risk of
memory leaks or dangling references.
This change also removes redundant of_node_put() calls for child nodes,
as for_each_child_of_node_scoped() handles cleanup automatically.

Signed-off-by: Michael Hennerich <[email protected]>
The sample rate configuration logic following the call to
ad9081_set_sample_rate() was unreachable due to an early return.
This patch removes the dead code block that attempted to round and set
the clock rate, which is now obsolete and no longer executed.
Cleaning up this unreachable code improves readability and avoids
confusion about the actual sample rate handling path.

Signed-off-by: Michael Hennerich <[email protected]>
The intention of the commit 3580444 was
to also upload the .dtb files present in overlays/ folder.

By using .dtb* regex, unnecessary files found their way into the
artifacts. Use explicit regex in order to upload only files ending in
.dtb or .dtbo.

Signed-off-by: Alisa-Dariana Roman <[email protected]>
Add item to emphasise that the user should compile their changes, including
documentation. Remove "(if there is the case)", rely on common-sense.
Add item to require to add links for lore, when applicable.

Signed-off-by: Jorge Marques <[email protected]>
The upstream devicetree binding deprecated using `clock-names = "mclk";`
as this is an internal clock, not an external one. Remove this from the
AD7124 overlays since the ad7124 driver no longer requires it.

Also use generic node names for the adc nodes while we are cleaning
things up.

Signed-off-by: David Lechner <[email protected]>
@nunojsa
Copy link
Collaborator

nunojsa commented Oct 31, 2025

@dlech, Unfortunately we had to force push the rpi branch (I know, I know...) . Could you please update this PR on top of it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.