Skip to content

linux-v6.12.y-2026r1 : ad4052 backport for release branch#3187

Draft
gastmaier wants to merge 13 commits intoxlnx/release/linux-v6.12.y-2026r1from
staging/2026_R1/ad4052
Draft

linux-v6.12.y-2026r1 : ad4052 backport for release branch#3187
gastmaier wants to merge 13 commits intoxlnx/release/linux-v6.12.y-2026r1from
staging/2026_R1/ad4052

Conversation

@gastmaier
Copy link
Collaborator

@gastmaier gastmaier commented Mar 13, 2026

PR Description

Backports ad4052.c from linux 7.0 (not upstream) to 6.12.
Changes needed are added as fixup commits with clean autosquash.

Pre-autosquash edition: 54bc53d

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

andy-shev and others added 3 commits March 13, 2026 17:28
This helper converts the given bits per word to bytes. The result
will always be power-of-two, e.g.,

    ===============    =================
    Input (in bits)    Output (in bytes)
    ===============    =================
            5                   1
            9                   2
            21                  4
            37                  8
    ===============    =================

It will return 0 for the 0 input.

There are a couple of cases in SPI that are using the same approach
and at least one more (in IIO) would benefit of it. Add a helper
for everyone.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250417152529.490582-2-andriy.shevchenko@linux.intel.com
Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Add dt-bindings for AD4052 family, devices AD4050/AD4052/AD4056/AD4058,
low-power with monitor capabilities SAR ADCs. Each variant of the family
differs in speed and resolution, reflected in word size and frequency
for SPI messages. The device contains one input (cnv) and two outputs
(gp0, gp1). The outputs can be configured for range of options, such as
threshold and data ready. The spi-max-frequency refers to the
configuration mode maximum access speed. The ADC mode speed depends on
the vio input voltage.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
This adds a new page to document how to use the ad4052 ADC driver.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
@gastmaier gastmaier force-pushed the staging/2026_R1/ad4052 branch from 66e3542 to 54bc53d Compare March 13, 2026 18:32
@gastmaier gastmaier changed the title Staging/2026 r1/ad4052 linux-v6.12.y-2026r1 : ad4052 backport for release branch Mar 13, 2026
The AD4052/AD4058/AD4050/AD4056 are versatile, 16-bit/12-bit, successive
approximation register (SAR) analog-to-digital converter (ADC) that
enables low-power, high-density data acquisition solutions without
sacrificing precision. This ADC offers a unique balance of performance
and power efficiency, plus innovative features for seamlessly switching
between high-resolution and low-power modes tailored to the immediate
needs of the system. The AD4052/AD4058/AD4050/AD4056 are ideal for
battery-powered, compact data acquisition and edge sensing applications.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Changes:
- PM_RUNTIME_ACQUIRE -> pm_runtime_resume_and_get
Explain the AD4052 support for the SPI Engine Offload.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Support SPI offload with appropriate FPGA firmware. Since the SPI-Engine
offload module always sends 32-bit data to the DMA engine, the
scantype.storagebytes is set to 32-bit and the SPI transfer length is
based on the scantype.realbits. This combination allows to optimize the
SPI to transfer only 2 or 3 bytes (depending on the granularity and
mode), while the number of samples are computed correctly by tools on
top of the iio scantype.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Changes:
- MODULE_IMPORT_NS : Remove quotes from "IIO_DMAENGINE_BUFFER"
Explain the AD4052 monitoring support by exposing as an IIO event.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
The AD4052 family supports autonomous monitoring readings for threshold
crossings. Add support for catching the GPIO interrupt and expose as an IIO
event. The device allows to set either, rising and falling directions. Only
either threshold crossing is implemented.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Changes:
- PM_RUNTIME_ACQUIRE -> pm_runtime_resume_and_get
- ad4052_write_event_config.state : bool -> int
Explains the GPIO controller support with emphasis on the mask
depending on which GPs are exposed.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
When gp0 or gp1 is not taken as an interrupt, expose them as GPO if
gpio-contoller is set in the devicetree. gpio-regmap is not used
because the GPO static low is 'b101 and static high is 0b110; low state
requires setting bit 0, not fitting the abstraction of low=0 and
high=mask.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Changes:
- ad4052_gpio_set : int -> void
dd entry for the AD4052 driver.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Add device tree for using AD4050 on CoraZ7.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
Add device tree for using AD4052 on CoraZ7.

Signed-off-by: Jorge Marques <jorge.marques@analog.com>
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.

2 participants