Biju Das [Thu, 26 Mar 2026 11:06:38 +0000 (11:06 +0000)]
clk: renesas: r9a08g046: Add GBETH clocks and resets
Add clock and reset entries for the Gigabit Ethernet Interfaces (GBETH
0-1) IPs found on the RZ/G3L SoC. This includes various dividers and
mux clocks needed by these two GBETH IPs. Also add the tx, tx-180, rx,
rx-180, rmii, rmii-tx and rmii-rx clocks to the r9a08g046_no_pm_mod_clk
table to avoid enabling both normal and RMII clocks by the PM framework.
Biju Das [Thu, 26 Mar 2026 11:06:36 +0000 (11:06 +0000)]
clk: renesas: rzg2l: Add support for enabling PLLs
Add support for enabling PLL clocks in the RZ/G3L CPG driver to turn off
some PLLs, if they are not in use (e.g. PLL6, PLL7).
Introduce .is_enabled() and .enable() callbacks to handle PLL state
transitions. With the .enable() callback, the PLL will be turned ON
only when the PLL consumer device is enabled; otherwise, it will remain
off. Define new macros for PLL standby and monitor registers to
facilitate this process.
My Outlook email address often sends emails from kernel devs to the junk
folder. Also, emails from some addresses (eg suse.de) are not received
at all. Update the email to my alternate Proton Mail address.
Ravi Singh [Wed, 22 Apr 2026 07:39:59 +0000 (07:39 +0000)]
xfs: flush delalloc blocks on ENOSPC in xfs_trans_alloc_icreate
xfs_trans_alloc_icreate() can fail with ENOSPC when delalloc
reservations have consumed most of the available block count
(fdblocks). xfs_trans_alloc() already retries internally with
xfs_blockgc_flush_all(), but that only trims post-EOF speculative
preallocation and may not free enough space for the transaction
reservation.
Add a retry with xfs_flush_inodes() when xfs_trans_alloc() returns
ENOSPC. This forces writeback of all dirty inodes via
sync_inodes_sb(), converting delalloc reservations to real
allocations and freeing the over-reserved portion back to fdblocks.
This fixes all callers of xfs_trans_alloc_icreate() and removes
the existing caller-level retry from xfs_create(), which is now
handled centrally.
Signed-off-by: Ravi Singh <ravising@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
display_get_pci_dev_of() gets a referenced PCI device via
pci_get_device(). Drop that reference when pci_enable_device() fails and
release it during the managed teardown path after pci_disable_device().
Without that, ofdrm leaks the pci_dev reference on both the error path
and the normal cleanup path.
Fixes: c8a17756c425 ("drm/ofdrm: Add ofdrm for Open Firmware framebuffers") Co-developed-by: Myeonghun Pak <mhun512@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Co-developed-by: Taegyu Kim <tmk5904@psu.edu> Signed-off-by: Taegyu Kim <tmk5904@psu.edu> Signed-off-by: Yuho Choi <dbgh9129@gmail.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20260420002513.216-1-dbgh9129@gmail.com
drm/gem: Fix inconsistent plane dimension calculation in drm_gem_fb_init_with_funcs()
drm_gem_fb_init_with_funcs() computes sub-sampled plane dimensions
using plain integer division:
unsigned int width = mode_cmd->width / (i ? info->hsub : 1);
unsigned int height = mode_cmd->height / (i ? info->vsub : 1);
However, the ioctl-level framebuffer_check() in drm_framebuffer.c uses
drm_format_info_plane_width/height() which round up dimensions via
DIV_ROUND_UP(). This inconsistency corrupts the subsequent GEM object
size check for certain pixel format and dimension combinations.
For example, with NV12 (vsub=2) and a 1-pixel-tall framebuffer the
GEM size validation path sees height=0 instead of height=1. The
expression (height - 1) then wraps to UINT_MAX as an unsigned int,
causing min_size to overflow and wrap back to a small value. A tiny
GEM object therefore passes the size guard, yet when the GPU accesses
the chroma plane it will read or write memory beyond the object's
bounds.
Fix by replacing the open-coded divisions with drm_format_info_plane_width()
and drm_format_info_plane_height(), which use DIV_ROUND_UP() and match
the calculation already used in framebuffer_check().
pinctrl: renesas: rzg2l: Handle PUPD for RZ/V2H(P) dedicated pins in PM
On RZ/V2H(P), dedicated pins support pull-up/pull-down configuration
via PIN_CFG_PUPD. Add PUPD handling for dedicated pins in the PM
save/restore path.
pinctrl: renesas: rzg2l: Handle RZ/V2H(P) IOLH configuration in PM cache
Include PIN_CFG_IOLH_RZV2H in the IOLH capability checks when saving
and restoring pin configuration registers.
On RZ/V2H(P), RZ/V2N, and RZ/G3E, the IOLH configuration is defined by
the PIN_CFG_IOLH_RZV2H capability. The previous implementation did not
account for this, causing the IOLH registers to be skipped during PM
save/restore.
Store SMT register cache per bank instead of using a single array.
On RZ/V2H(P), RZ/V2N, and RZ/G3E, the SMT register is split across two
32-bit registers: bits 0/8/16/24 control pins 0-3, while pins 4-7 are
controlled by the corresponding bits in the next register. The previous
implementation cached only a single SMT register, leading to incomplete
save/restore of SMT state.
Convert cache->smt to a per-bank array and allocate storage for both
halves. Update suspend/resume handling to save and restore both SMT
registers when present.
Fixes: 837afa592c623 ("pinctrl: renesas: rzg2l: Add suspend/resume support for Schmitt control registers") Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260413182456.811543-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Biju Das [Sat, 28 Mar 2026 09:05:45 +0000 (09:05 +0000)]
pinctrl: renesas: rzg2l: Fix incorrect PUPD register offset for high pins during suspend/resume
When saving/restoring pull-up/down register state during suspend/resume,
the second PUPD register access was incorrectly using the same base offset
as the first, effectively reading/writing the same register twice instead
of the adjacent one.
Add the correct + 4 byte offset to the second RZG2L_PCTRL_REG_ACCESS32
call so that pupd[1][port] is properly saved and restored from the next
32-bit register in the PUPD register pair, covering pins 4–7 of ports
with 4 or more pins.
Fixes: b2bd65fbb617 ("pinctrl: renesas: rzg2l: Add suspend/resume support for pull up/down") Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20260328090548.84124-1-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Matthew Rosato [Fri, 24 Apr 2026 19:39:00 +0000 (15:39 -0400)]
KVM: s390: pci: Fix aisb calculation
The current implementation of aisb calculation will erroneously index
via an unsigned long * as well as multiply by 8B for every 64-bits in
the offset; only one or the other is required. This throws off aisb
calculations once the number of devices exceeds 64, and can result
in out-of-bounds access as well as failure to indicate summary bits
associated with those devices in guests.
Fix this by converting to a physical address before applying the
offset, as is already done in arch/s390/pci/pci_irq.c.
Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding") Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com> Reviewed-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
arm64: dts: renesas: r9a09g056: Add #mux-state-cells to usb20phyrst
The renesas,rzv2h-usb2phy-reset binding schema defines #mux-state-cells
as a required property. Add it to the usb20phyrst node to fix the
following warnings:
arch/arm64/boot/dts/renesas/r9a09g056n48-rzv2n-evk.dtb: usb20phy-reset@15830000 (renesas,r9a09g056-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g056n48-rzv2n-evk-cn15-emmc.dtb: usb20phy-reset@15830000 (renesas,r9a09g056-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g056n48-rzv2n-evk-cn15-sd.dtb: usb20phy-reset@15830000 (renesas,r9a09g056-usb2phy-reset): '#mux-state-cells' is a required property
arm64: dts: renesas: r9a09g057: Add #mux-state-cells to usb2{0,1}phyrst
The renesas,rzv2h-usb2phy-reset binding schema defines #mux-state-cells
as a required property. Add it to the usb20phyrst and usb21phyrst nodes
to fix the following warnings:
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk.dtb: usb20phy-reset@15830000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk.dtb: usb21phy-reset@15840000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk-cn15-emmc.dtb: usb20phy-reset@15830000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk-cn15-emmc.dtb: usb21phy-reset@15840000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk-cn15-sd.dtb: usb20phy-reset@15830000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
arch/arm64/boot/dts/renesas/r9a09g057h44-rzv2h-evk-cn15-sd.dtb: usb21phy-reset@15840000 (renesas,r9a09g057-usb2phy-reset): '#mux-state-cells' is a required property
Marek Vasut [Fri, 27 Mar 2026 23:42:11 +0000 (00:42 +0100)]
ARM: dts: renesas: rskrza1: Drop superfluous cells
Drop superfluous address-cells and size-cells to fix DTC W=1 warning:
arch/arm/boot/dts/renesas/r7s72100-rskrza1.dts:32.17-72.4: Warning (avoid_unnecessary_addr_size): /flash@18000000: unnecessary #address-cells/#size-cells without "ranges", "dma-ranges" or child "reg" or "ranges" property
Marek Vasut [Fri, 27 Mar 2026 23:42:10 +0000 (00:42 +0100)]
ARM: dts: renesas: genmai: Drop superfluous cells
Drop superfluous address-cells and size-cells to fix DTC W=1 warning:
arch/arm/boot/dts/renesas/r7s72100-genmai.dts:28.17-55.4: Warning (avoid_unnecessary_addr_size): /flash@18000000: unnecessary #address-cells/#size-cells without "ranges", "dma-ranges" or child "reg" or "ranges" property
Marek Vasut [Thu, 26 Mar 2026 04:24:01 +0000 (05:24 +0100)]
arm64: dts: renesas: rz-smarc-du-adv7513-smarc: Fix missing cells and reg in DU subnode
Add missing cells and reg DT property in the DU subnode to fix the
following DTC W=1 warning:
arch/arm64/boot/dts/renesas/rz-smarc-du-adv7513.dtsi:29.10-33.5: Warning (unit_address_vs_reg): /fragment@1/__overlay__/ports/port@0: node has a unit name, but no reg or ranges property
Marek Vasut [Thu, 26 Mar 2026 04:24:00 +0000 (05:24 +0100)]
arm64: dts: renesas: rz-smarc-cru-csi-ov5645: Fix missing cells and reg in CSI2 subnode
Add missing cells and reg DT property in the CSI2 subnode to fix the
following DTC W=1 warning:
arch/arm64/boot/dts/renesas/rz-smarc-cru-csi-ov5645.dtsi:49.10-55.5: Warning (unit_address_vs_reg): /fragment@2/__overlay__/ports/port@0: node has a unit name, but no reg or ranges property
Marek Vasut [Thu, 26 Mar 2026 04:23:59 +0000 (05:23 +0100)]
arm64: dts: renesas: salvator-panel: Fix missing cells and reg in DTO
Add missing cells and reg DT property in the Salvator-X panel DTO to fix
the following DTC W=1 warning:
arch/arm64/boot/dts/renesas/salvator-panel-aa104xd12.dtso:30.10-34.5: Warning (unit_address_vs_reg): /fragment@2/__overlay__/ports/port@1: node has a unit name, but no reg or ranges property
Marek Vasut [Thu, 26 Mar 2026 04:23:58 +0000 (05:23 +0100)]
arm64: dts: renesas: draak/ebisu-panel: Fix missing cells and reg in DTO
Add missing cells and reg DT property in the Draak/Ebisu panel DTO to
fix the following DTC W=1 warning:
arch/arm64/boot/dts/renesas/draak-ebisu-panel-aa104xd12.dtso:30.10-34.5: Warning (unit_address_vs_reg): /fragment@2/__overlay__/ports/port@1: node has a unit name, but no reg or ranges property
fuse: don't block in fuse_get_dev() for non-sync_init case
Commit a8dd5f1b73bc ("fuse: create fuse_dev on /dev/fuse open instead of
mount") changed behavior so that fuse_get_dev() now unconditionally
blocks waiting for a connection, even in the case where sync_init was
not set. Previously, non-sync_init opens returned -EPERM immediately.
Restore the previous behavior of returning -EPERM.
Fixes: a8dd5f1b73bc ("fuse: create fuse_dev on /dev/fuse open instead of mount") Reported-by: Mark Brown <broonie@kernel.org> Closes: https://lore.kernel.org/all/3c9f8396-41f4-4c88-b883-34bede72b427@sirena.org.uk/ Cc: <stable@vger.kernel.org> Signed-off-by: Joanne Koong <joannelkoong@gmail.com> Tested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
The APDS990x driver in misc lacks DeviceTree support, and no mainline
pre-DT board files configured this device using apds990x_platform_data.
This driver belongs to a legacy group of ambient light sensor drivers in
drivers/misc/ that predates the migration to DT and the standard IIO ABI.
Since the Avago APDS9900/9901 ALS/Proximity sensor is now supported by
the tsl2772 IIO driver and there are no active users in the kernel tree,
remove this old implementation.
iio: tsl2772: Add support for Avago APDS9900/9901 ALS/Proximity sensor
The Avago APDS9900/9901 has a similar register layout to the
TAOS/AMS TSL2772 but features a unique set of configurations. Add support
for the APDS9900/9901 into the TSL2772 driver by adding the required
device-specific configurations.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: proximity: srf08: Replace sprintf() with sysfs_emit()
Replace sprintf() function calls with sysfs_emit() and
sysfs_emit_at(). While the current code is fine, sysfs_emit() is
preferred over sprintf(), and will help modernize the driver.
Signed-off-by: Maxwell Doose <m32285159@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad7280a: use cleanup helpers guard() and scoped_guard() for mutex locking
Replace open-coded mutex_lock/unlock pairs with the cleanup-based
guard() and scoped_guard() helpers in ad7280a_write_thresh(),
ad7280_show_balance_timer(), ad7280_store_balance_sw(),
ad7280_store_balance_timer() and ad7280_read_raw().
This removes the need for the err_unlock label and explicit
mutex_unlock() calls, as the lock is now automatically released
when the function returns or the guarded scope exits, regardless
of the exit path.
Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com> Co-developed-by: Matheus Giarola <matheusgiarola@usp.br> Signed-off-by: Matheus Giarola <matheusgiarola@usp.br> Co-developed-by: Felipe Ribeiro de Souza <felipers@usp.br> Signed-off-by: Felipe Ribeiro de Souza <felipers@usp.br> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad7280a: Extract chan->address bit fields into named local variables
Extract the upper and lower bytes of chan->address into named local
variables devaddr and ch across ad7280_read_raw(),
ad7280_show_balance_timer() and ad7280_store_balance_timer() to improve
readability and avoid inline bit manipulation in function calls.
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Lucas Ivars Cadima Ciziks <lucas@ciziks.com> Co-developed-by: Matheus Giarola <matheusgiarola@usp.br> Signed-off-by: Matheus Giarola <matheusgiarola@usp.br> Co-developed-by: Felipe Ribeiro de Souza <felipers@usp.br> Signed-off-by: Felipe Ribeiro de Souza <felipers@usp.br> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: qcom: Unify user-visible "Qualcomm" name
Various names for Qualcomm as a company are used in user-visible config
options: QCOM, Qualcomm and Qualcomm Technologies. Switch to unified
"Qualcomm" so it will be easier for users to identify the options when
for example running menuconfig.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Santos [Wed, 1 Apr 2026 11:58:50 +0000 (08:58 -0300)]
iio: adc: ad4130: add new supported parts
Add support for AD4129-4/8, AD4130-4, and AD4131-4/8 variants.
The AD4129 series supports the same FIFO interface as the AD4130 but with
reduced resolution (16-bit). The AD4131 series lacks FIFO support, so
triggered buffer functionality is introduced.
The 4-channel variants feature fewer analog inputs, GPIOs, and sparse pin
mappings for VBIAS, analog inputs, and excitation currents. The driver now
handles these differences with chip-specific configurations, including pin
mappings and GPIO counts.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Santos [Wed, 1 Apr 2026 11:58:34 +0000 (08:58 -0300)]
iio: adc: ad4130: introduce chip info for future multidevice support
Introduce a chip_info structure to abstract device-specific parameters
and prepare the driver for supporting multiple AD4130 family variants.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Santos [Wed, 1 Apr 2026 11:58:22 +0000 (08:58 -0300)]
iio: adc: ad4130: Add SPI device ID table
Add SPI device ID table to enable non-device tree based device binding.
The id_table provides a fallback matching mechanism when of_match_table
cannot be used, which is required for proper SPI driver registration.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ti-ads7924: Use guard(mutex) in ADC read helper
Replace mutex_lock()/mutex_unlock() pair with guard(mutex)()
and move the lock into ads7924_get_adc_result(). Keeping the guard
in the helper makes the locking scope match the operation being protected.
Suggested-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Kevin Tung [Mon, 20 Apr 2026 12:52:52 +0000 (20:52 +0800)]
iio: adc: rtq6056: add i2c_device_id support
Add i2c_device_id table to support legacy I2C instantiation.
Update probe to use i2c_get_match_data() so device data can be
retrieved consistently for both OF and legacy I2C instantiation.
Signed-off-by: Kevin Tung <kevin.tung.openbmc@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad4170: use lookup table for gpio mask selection
Both ad4170_gpio_direction_input() and
ad4170_gpio_direction_output() duplicate the same switch
statement to map a GPIO offset to its corresponding mask.
Replace the switch with a static lookup table, simplifying the code
and avoiding duplication. This also makes future extensions easier.
No functional change intended.
Signed-off-by: Guilherme Ivo Bozi <guilherme.bozi@usp.br> Acked-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Jonathan Santos [Wed, 1 Apr 2026 11:58:12 +0000 (08:58 -0300)]
dt-bindings: iio: adc: ad4130: Add new supported parts
Extend binding support for AD4129-4/8, AD4130-4, and AD4131-4/8 ADC
variants.
Dropped a reference to driver in the binding whilst here.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The Data Ready/FIFO interrupt has a special behavior that inverts the
IRQ polarity when devices with FIFO support enter FIFO mode, while using
normal polarity for data ready.
Document the interrupts property to clarify this special behavior for
users.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: nxp-sar-adc: use field_get() for EOC bit check
Use field_get() here now that runtime-mask support exists, and drop
the obsolete TODO. Since NXP_SAR_ADC_EOC_CH(c) is BIT(c), the
resulting !-test is semantically identical.
No functional change.
Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Piyush Patle <piyushpatle228@gmail.com> Acked-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
David Lechner [Sat, 11 Apr 2026 22:13:33 +0000 (17:13 -0500)]
iio: adc: ti-ads7950: use spi_optimize_message()
Use spi_optimize_message() to reduce CPU usage during buffered reads.
On hardware with support for SPI_CS_WORD, this reduced the CPU usage
of the threaded interrupt by about 5%. On hardware without support, this
should reduce CPU usage even more since it won't have to split the SPI
transfers each time the interrupt handler is called.
The .update_scan_mode() callback hand to be moved to the buffer preenable
callback since the SPI transfer mode can't be changed after
spi_optimize_message() has been called. (The buffer postenable callback
can't be used because it happens after the trigger is enabled, so the
SPI message needs to be optimized before that.)
The indent of the pointer to ti_ads7950_read_raw() in the assignment
is changed since there is no longer anything else in the struct to
align with since removal of use of the pointer to
ti_ads7950_update_scan_mode().
Signed-off-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad799x: convert to fully managed resources and drop remove()
Convert the driver's remaining manual resource management to use the
devm_ infrastructure, allowing for the complete removal of the
ad799x_remove() function and the simplification of the probe error paths.
Specifically:
- Initialize the mutex using devm_mutex_init() and move it to the top
of probe() (before IRQ registration) to prevent a race condition where
an interrupt could attempt to take an uninitialized lock.
- Use devm_add_action_or_reset() to ensure that the VCC and VREF
regulators are disabled safely and in the correct order during driver
teardown or probe failure.
- Refactor the optional VREF error handling path for better readability.
- Convert iio_triggered_buffer_setup() and iio_device_register() to
their devm_ variants.
Because all resources are now managed by the devm core, the unwinding
order is guaranteed to follow the reverse order of allocation. All manual
error handling goto labels in ad799x_probe() have been removed.
Suggested-by: Jonathan Cameron <jic23@kernel.org> Suggested-by: David Lechner <dlechner@baylibre.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Archit Anant <architanant5@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad799x: cache regulator voltages during probe
Since the reference voltage for this ADC is not expected to
change at runtime, determine the active reference voltage (either VREF
or VCC) during probe() and cache it in a single variable in the state
structure.
Suggested-by: Jonathan Cameron <jic23@kernel.org> Suggested-by: David Lechner <dlechner@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Archit Anant <architanant5@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad799x: use a static buffer for scan data
Currently, rx_buf is dynamically allocated using kmalloc() every time
ad799x_update_scan_mode() is called. This can lead to memory leaks if
the scan mask is updated multiple times.
Drop the dynamic allocation and replace it with a static buffer at the
end of the state structure using IIO_DECLARE_BUFFER_WITH_TS().
This eliminates the allocation overhead, prevents leaks, and removes
the need for manual kfree() on driver removal.
Suggested-by: David Lechner <dlechner@baylibre.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Archit Anant <architanant5@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: adc: ad799x: use local device pointer in probe
Introduce a local device pointer 'dev' in ad799x_probe() and use it
throughout the function instead of accessing &client->dev repeatedly.
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Archit Anant <architanant5@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: vcnl4000: register an IIO device with a device-managed function
Use a device-managed counterpart of iio_device_register() and remove the
redundant iio_device_unregister() call in driver remove function,
allowing us to remove vcnl4000_remove() function altogether.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: vcnl4000: drop enum id table in favor of chip structs
Instead of creating an enum table with chip IDs, store pointers to
structs directly. This drops the association between chip structs and
enum IDs and allows for easier addition or removal of new devices.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: light: vcnl4000: validate device by prod ID instead of table ID
Add a new field for vcnl4000_chip_spec and check if we have the right
device by that instead of the index from enum table. This leaves the
enum table being used only for picking the right vcnl4000_chip_spec,
allowing us to drop it later on.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for configuring the DAC gain using the GA bit
The MCP4821 supports two gain settings:
- 1x gain → 2.048V full-scale
- 2x gain → 4.096V full-scale
Scale write support is added in the IIO interface. Only scale
values advertised via the scale_available attribute are accepted,
ensuring consistency between the configured gain and exposed
scale values.
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cleanup include headers by removing proxy kernel.h header and
unnecessary list.h, interrupt.h, workqueue.h and slab.h headers. Added
additional headers that were previously included from kernel.h.
Verified using the include-what-you-use tool.
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Gabriel Rondon [Mon, 30 Mar 2026 18:15:27 +0000 (19:15 +0100)]
iio: adc: ti-ads8688: use read_avail for available attributes
Convert the in_voltage_scale_available and in_voltage_offset_available
attributes from legacy IIO_DEVICE_ATTR with custom show functions to the
IIO framework's read_avail callback. This uses the framework's built-in
support for _available attributes, removing the need for manual sysfs
formatting.
Precompute the available scale values at probe time since they depend on
the reference voltage which does not change after initialization.
Reviewed-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Gabriel Rondon <grondon@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>