All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/15] iio: adc: xilinx-xadc: Add I2C interface support for System Management Wizard
@ 2026-10-05  9:41 Dileep Kumar Nagavarapu
  2026-10-05  9:41 ` [PATCH v4 01/15] iio: adc: xilinx-xadc: Correct write edge in CFG Dileep Kumar Nagavarapu
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Dileep Kumar Nagavarapu @ 2026-10-05  9:41 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
	Michal Simek, Conall O'Griofa
  Cc: linux-iio, linux-arm-kernel, linux-kernel, git,
	Dileep Kumar Nagavarapu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="yes", Size: 9342 bytes --]

The existing driver only supported AXI memory-mapped access to the System
Management Wizard IP. This series extends the driver to support I2C-based
access, which is particularly useful for System Controller usecases.

Key Changes:
- Split the xilinx-xadc-core.c file into two files(xilinx-xadc-core.c and
  xilinx-xadc-platform.c)
- Add required helper functions and callbacks
- Add channel configuration via callback mechanism
- New I2C driver for UltraScale+ System Management Wizard for basic
  voltage and temperature monitoring

Note: We are working on x86 platform support where fixed channel
configuration is used(no DT support). The .setup_channels() function
pointer introduced in patch 2/4 enables different channel configuration
approaches for various platforms.

This series was originally posted by Sai Krishna Potthuri.

Link:https://lore.kernel.org/all/20260323074505.3853353-1-sai.krishna.potthuri@amd.com/

I will be maintaining the series going forward and posting updated
revisions.

Changes in v4:
-> Updated the sign-off email from uppercase letters to all lowercase
   letters
-> Dropped the commit message related to the binding YAML schema
   format from the cover letter, since it was sent separately
-> Dropped the MAINTAINERS entry from this patch series
-> Split the previous 1/6 "Modernize driver code" patch into 10 smaller,
   single-concern patches (2/15 - 10/15) as per the Joshua Crofts and 
   radhey review comments.
   the combined result is equivalent to v3's patch 1/6:
    2/15 - Fix coding style issues
    3/15 - Use kernel integer types
    4/15 - Drop unnecessary masking and dead code
    5/15 - Use bitfield helpers and bit macros
    6/15 - Use guard()/scoped_guard() for spinlock locking
    7/15 - Simplify common coding patterns
    8/15 - Add unit suffixes to macro names
    9/15 - Drop unused header files
    10/15 - Add clarifying comments
    11/15 - Refine Zynq read/write error handling on timeout/interrupt
-> Patches 2/6 - 5/6 from v3 carry forward and renumbered to
    11/15 - 15/15.
-> 1/15
    - Reworded the commit message and subject
    - Added stable@vger.kernel.org to after the Signed-off-by block
    - Added Co-developed-by: Conall O'Griofa immediately before
      his Signed-off-by line
    (Comments from David Lechner)
    - Moved patch 6/6 "Correct Write edge in CFG" to 1/15
    - Updated the Fixes tag and explaining a commit message
      for write edge configuration issue.
-> 3/15
    (Comments from Joshua Crofts)
    - Included <linux/types.h> header
-> 5/15
    - Dropped unused macros
-> 8/15
    - Reformatted the XADC_ZYNQ_TCK_RATE_MAX_HZ,
      XADC_ZYNQ_IGAP_DEFAULT_CYCLES, and XADC_ZYNQ_PCAP_RATE_MAX_HZ
      macro definitions to use the standard "#define NAME<TAB>VALUE"
      style, instead of the single-line run-together form.
-> 9/15
    - Replaced #include <linux/kernel.h> with the required headers
      array_size.h, bitops.h, and container_of.h
-> 11/15
    - Changed the timeout errno from -EIO to -ETIMEDOUT in both
      xadc_zynq_read_adc_reg() and xadc_zynq_write_adc_reg(), for
      a more precise error code on wait_for_completion timeout.
    - Kept propagating an interrupted wait's error instead of
      forcing ret = 0 (success) in both functions
    - Added xadc_read_reg after the
      wait_for_completion_interruptible_timeout, Now DFIFO read
      unconditional so it always runs immediately after the wait
      completes, regardless of whether it timed out, was
      interrupted, or succeeded — avoiding a stale response word
      being left for the next transaction.
-> 12/15
    - Reordered dev/xadc declarations in
      xadc_setup_buffer_and_triggers() (reverse christmas tree).
    - Dropped the unused dev parameter from xadc_device_configure(),
      keeping the header prototype and definition in sync.
    - Added a commit-message note that the bipolar_mask computation
      is also moved to run immediately after xadc_parse_dt().
    - Removed the error handling from xadc_zynq_write_adc_reg()
      in patch 2/6 of v3 and moved it to a separate error handling 
      patch 11/15 in v4.
-> 13/15
    - Changed the new xilinx-xadc-platform.c SPDX identifier from
      GPL-2.0 to GPL-2.0-only, for consistency with core.c and
      the header.
    - Tab-aligned XADC_MAX_SAMPLERATE_SPS, XADC_FLAGS_BUFFERED, and
      XADC_FLAGS_IRQ_OPTIONAL to match the XADC_AXI_* block below
      them.
    (Comments from Uwe Kleine-König)
    - Removed <linux/mod_devicetable.h> header file
-> 14/15(Comments from David Lechner)
    - Added a commit message explaining the export of xadc_parse_dt()
-> 15/15
    - Fixed missing spaces before opening parens in the commit
      message ("DRP(Dynamic" and 'string("xlnx,...")').
    - Consolidated the four redundant deferred-init rationale
      bullets into a single explanation.
    - Fixed the Kconfig typo "can also be build" -> "built" in the
      new XILINX_XADC_I2C entry.
    - Changed write_buffer/read_buffer from char to u8 in
      xadc_i2c_read_transaction()/xadc_i2c_write_transaction().
    - Added named defines for the DRP packet byte offsets
      (XADC_I2C_DRP_DATA_LOW etc.) instead of bare 0/1/2/3
      literals.
    - Dropped the redundant "xadc->clk = NULL;" in xadc_i2c_probe().
    - Fixed the devm_mutex_init(xadc->mutex) build error to
      devm_mutex_init(dev, &xadc->mutex).
    - Added the missing MODULE_IMPORT_NS("IIO_XADC").
    - Added Dileep Kumar Nagavarapu to MODULE_AUTHOR alongside
      Sai Krishna Potthuri.

Changes in v3:
-> 1/6 - Modernized the driver code with latest kernel coding styles
         and guidelines.
       - Restored one-variable-per-line declarations where no
         functional change  was intended.
       - Added unit suffixes to timing and clock-rate constants.
       - Replaced GENMASK() and FIELD_PREP() in appropriate places.
       - Added guard(spinlock_irq) helper to manage the spinlock
         automatically on scope exit.
       - Added MAINTAINERS entry for XILINX XADC driver.
-> 2/6 - Refactored the xadc_setup_buffer_and_triggers function
         with only two arguments.
       - Added xadc_device_setup() and xadc_device_configure() to handle
         device initialization and configuration separately.
-> 3/6 - Added IIO_XADC namespace to all exported symbols and
         imported the namespace in platform specific modulue.
       - Spliting the driver with modrern driver changes.
-> 4/6 - Added .setup_channels() to handle custom channel setup
         and configuration.
-> 5/6 - Replaced mutex initialization with devm_mutex_init()
       - Removed unused i2c_set_clientdata() usage.
       - Added comments describing the DRP packet layout used
         for I2C  transactions.
       - Added comment for hardware initialization check from xadc i2c
         write and read functions.
       - Wrapped Kconfig help text to conform to kernel style guidelines.
       - Switched device setup error handling to dev_err_probe().
-> 6/6 - Removed write edge default configuration in XADCIF_CFG register.
-> Dropped the binding to YAML conversion patch as this is already sent by
   Pramod Maurya and is in discussion.

Changes in v2:
-> 1/4 - Split the xilinx-xadc-core.c file into two files
         xilinx-xadc-core.c and xilinx-xadc-platform.c(comments from Andy).
-> 2/4 - Referred as .setup_channels instead of setup_channels.
-> 3/4 - Created separate functions for i2c read and write.
       - Created separate file for i2c interface handling.
-> 4/4(comments from Krzysztof)
       - Removed $defs and use it directly under xlnx,channels.
       - Documented the error information in the commit message due to
         vendor prefix properties.
       - Kept only one example as there is not much differences.


Dileep Kumar Nagavarapu (15):
  iio: adc: xilinx-xadc: Correct write edge in CFG
  iio: adc: xilinx-xadc: Fix coding style issues
  iio: adc: xilinx-xadc: Use kernel integer types
  iio: adc: xilinx-xadc: Drop unnecessary masking and dead code
  iio: adc: xilinx-xadc: Use bitfield helpers and bit macros
  iio: adc: xilinx-xadc: Use guard()/scoped_guard() for spinlock locking
  iio: adc: xilinx-xadc: Simplify common coding patterns
  iio: adc: xilinx-xadc: Add unit suffixes to macro names
  iio: adc: xilinx-xadc: Drop unused header files
  iio: adc: xilinx-xadc: Add clarifying comments
  iio: adc: xilinx-xadc: Refine Zynq read/write error handling on
    timeout/interrupt
  iio: adc: xilinx-xadc: Add helper functions for the device setup
  iio: adc: xilinx-xadc: Split driver into core and platform files
  iio: adc: xilinx-xadc: Add .setup_channels() to struct xadc_ops
  iio: adc: xilinx-xadc: Add I2C interface support

 drivers/iio/adc/Kconfig                       |   23 +-
 drivers/iio/adc/Makefile                      |    6 +-
 drivers/iio/adc/xilinx-xadc-core.c            |  894 +++-----------
 drivers/iio/adc/xilinx-xadc-events.c          |   55 +-
 drivers/iio/adc/xilinx-xadc-i2c.c             |  236 ++++
 ...inx-xadc-core.c => xilinx-xadc-platform.c} | 1064 ++---------------
 drivers/iio/adc/xilinx-xadc.h                 |  140 +--
 7 files changed, 615 insertions(+), 1803 deletions(-)
 create mode 100644 drivers/iio/adc/xilinx-xadc-i2c.c
 copy drivers/iio/adc/{xilinx-xadc-core.c => xilinx-xadc-platform.c} (32%)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2026-10-05 13:13 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05  9:41 [PATCH v4 00/15] iio: adc: xilinx-xadc: Add I2C interface support for System Management Wizard Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 01/15] iio: adc: xilinx-xadc: Correct write edge in CFG Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 02/15] iio: adc: xilinx-xadc: Fix coding style issues Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 03/15] iio: adc: xilinx-xadc: Use kernel integer types Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 04/15] iio: adc: xilinx-xadc: Drop unnecessary masking and dead code Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 05/15] iio: adc: xilinx-xadc: Use bitfield helpers and bit macros Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 06/15] iio: adc: xilinx-xadc: Use guard()/scoped_guard() for spinlock locking Dileep Kumar Nagavarapu
2026-10-05 13:13   ` Joshua Crofts
2026-10-05  9:41 ` [PATCH v4 07/15] iio: adc: xilinx-xadc: Simplify common coding patterns Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 08/15] iio: adc: xilinx-xadc: Add unit suffixes to macro names Dileep Kumar Nagavarapu
2026-10-05  9:41 ` [PATCH v4 09/15] iio: adc: xilinx-xadc: Drop unused header files Dileep Kumar Nagavarapu
2026-10-05 12:56   ` Joshua Crofts
2026-10-05  9:42 ` [PATCH v4 10/15] iio: adc: xilinx-xadc: Add clarifying comments Dileep Kumar Nagavarapu
2026-10-05 13:09   ` Joshua Crofts
2026-10-05  9:42 ` [PATCH v4 11/15] iio: adc: xilinx-xadc: Refine Zynq read/write error handling on timeout/interrupt Dileep Kumar Nagavarapu
2026-10-05  9:42 ` [PATCH v4 12/15] iio: adc: xilinx-xadc: Add helper functions for the device setup Dileep Kumar Nagavarapu
2026-10-05  9:42 ` [PATCH v4 13/15] iio: adc: xilinx-xadc: Split driver into core and platform files Dileep Kumar Nagavarapu
2026-10-05  9:42 ` [PATCH v4 14/15] iio: adc: xilinx-xadc: Add .setup_channels() to struct xadc_ops Dileep Kumar Nagavarapu
2026-10-05  9:42 ` [PATCH v4 15/15] iio: adc: xilinx-xadc: Add I2C interface support Dileep Kumar Nagavarapu
2026-10-05  9:58 ` [PATCH v4 00/15] iio: adc: xilinx-xadc: Add I2C interface support for System Management Wizard Joshua Crofts

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.