Commit Graph

1444110 Commits

Author SHA1 Message Date
Giorgi Tchankvetadze
c09f950fd8 iio: adc: ad7625: fix type mismatch in clamp() macro
clamp() expects compatible operand types. The period calculation uses
nanosecond constants, while the local target variable was narrower than
the upper bound expression.

Make target unsigned long and use unsigned long bounds, including
NSEC_PER_USEC for the upper limit. This keeps the operands naturally
aligned without adding casts.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:32 +01:00
Sanjay Chitroda
74c3923344 iio: ssp_sensors: cleanup codestyle warning
Reported by checkpatch:
FILE: drivers/iio/common/ssp_sensors/ssp_dev.c

WARNING: Prefer __packed over __attribute__((__packed__))
+} __attribute__((__packed__));

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:32 +01:00
Antoniu Miclaus
370461ac8d iio: adc: ad4080: add support for AD4880 dual-channel ADC
Add support for the AD4880, a dual-channel 20-bit 40MSPS SAR ADC with
integrated fully differential amplifiers (FDA).

The AD4880 has two independent ADC channels, each with its own SPI
configuration interface. The driver uses spi_new_ancillary_device() to
create an additional SPI device for the second channel, allowing both
channels to share the same SPI bus with different chip selects.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:32 +01:00
Antoniu Miclaus
80cc6d13d1 dt-bindings: iio: adc: ad4080: add AD4880 support
Add support for the AD4880, a dual-channel 20-bit 40MSPS SAR ADC
with integrated fully differential amplifiers (FDA).

The AD4880 has two independent ADC channels, each with its own SPI
configuration interface. This requires:
- Two entries in reg property for primary and secondary channel
  chip selects
- Two io-backends entries for the two data channels

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:32 +01:00
Antoniu Miclaus
129c549981 iio: backend: add devm_iio_backend_get_by_index()
Add a new function to get an IIO backend by its index in the
io-backends device tree property. This is useful for multi-channel
devices that have multiple backends, where looking up by index is
more straightforward than using named backends.

Extract __devm_iio_backend_fwnode_get_by_index() from the existing
__devm_iio_backend_fwnode_get(), taking the index directly as a
parameter. The new public API devm_iio_backend_get_by_index() uses
the index to find the backend reference in the io-backends property,
avoiding the need for io-backend-names.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:32 +01:00
Vishwas Rajashekar
793e056d44 dt-bindings: iio: gyroscope: add mount-matrix for bmg160
The mount-matrix property supplies a 3x3 matrix that is used
to transform the values from the gyroscope to get vector
values that are relative to the way the sensor has been mounted
on the device. When the property is not specified, the identity
matrix is used.

This change adds mount-matrix as an optional property to the
dt-bindings for the bmg160 gyroscope.

Signed-off-by: Vishwas Rajashekar <vishwas.dev@vrajashkr.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-05-31 10:59:31 +01:00
Svyatoslav Ryhel
9c48294623 misc: Remove old APDS990x driver
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.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:24 +01:00
Svyatoslav Ryhel
2f640a4d0f 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>
2026-04-27 09:58:24 +01:00
Svyatoslav Ryhel
1a5fc4b5dd dt-bindings: iio: light: Document Avago APDS9900/9901 ALS/Proximity sensor
Document Avago APDS-9900/9901 combined ALS/IR-LED/Proximity sensor.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:24 +01:00
Maxwell Doose
2450368e2e 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>
2026-04-27 09:58:24 +01:00
Ariana Lazar
96aa96c029 dt-bindings: iio: dac: mcp47feb02: fix example indentation
Correct inconsistent indentation in the example and use consistent 4-space
indentation.

Signed-off-by: Ariana Lazar <ariana.lazar@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:24 +01:00
Ariana Lazar
6d78ab5687 dt-bindings: iio: dac: mcp47feb02: fix reg property value bounds
Replace minItems/maxItems with minimum/maximum to describe the reg
property as a single channel number with 8 possible values (0-7)

Signed-off-by: Ariana Lazar <ariana.lazar@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:24 +01:00
Ariana Lazar
fde18a8a1d dt-bindings: iio: dac: mcp47feb02: Fix I2C address in example
Change example reg value from 0 to 0x60 in order to use a valid I2C address

Signed-off-by: Ariana Lazar <ariana.lazar@microchip.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:24 +01:00
Lucas Ivars Cadima Ciziks
9d5129c73b 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>
2026-04-27 09:58:24 +01:00
Lucas Ivars Cadima Ciziks
d7117c14cd 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>
2026-04-27 09:58:24 +01:00
Krzysztof Kozlowski
af6dd359cd 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>
2026-04-27 09:58:23 +01:00
Jonathan Santos
ec98c3b501 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>
2026-04-27 09:58:23 +01:00
Jonathan Santos
71c1a1b376 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>
2026-04-27 09:58:23 +01:00
Jonathan Santos
2c5ebb7708 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>
2026-04-27 09:58:23 +01:00
Giorgi Tchankvetadze
0179a95bbb 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>
2026-04-27 09:58:23 +01:00
Kevin Tung
ce80292ead 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>
2026-04-27 09:58:23 +01:00
Joshua Crofts
d01d624c28 iio: magnetometer: hid-sensor-magn-3d: prefer 'u32' type
Use 'u32' instead of bare 'unsigned' to resolve checkpatch.pl warnings
and correct type use as defined in the struct hid_sensor_hub_callbacks.

No functional change.

Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:23 +01:00
Guilherme Ivo Bozi
1ebc22b9b3 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>
2026-04-27 09:58:23 +01:00
Jonathan Santos
277a2d241c 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>
2026-04-27 09:58:23 +01:00
Jonathan Santos
77fb0dc772 dt-bindings: iio: adc: ad4130: Document interrupts property
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>
2026-04-27 09:58:22 +01:00
David Carlier
8eedc312f1 iio: addac: ad74115: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
be186094ee iio: dac: ltc2664: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
81227f33a8 iio: dac: ad5686: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
e7394ce0e5 iio: dac: ad5755: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
b8c15f8589 iio: dac: ad5758: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
de960173ae iio: dac: ad7303: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Carlier
e15c8934e6 iio: dac: ad3552r: Use devm_mutex_init()
Use devm_mutex_init() which is helpful with CONFIG_DEBUG_MUTEXES.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
Piyush Patle
6cc18c0dc2 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>
2026-04-27 09:58:22 +01:00
Piyush Patle
1619d52fce iio: dac: ad3552r: use field_get() for power-down bit read
Use field_get() for the per-channel DAC power-down bit instead of an
open-coded mask-and-shift sequence.

No functional change.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:22 +01:00
David Lechner
e0c6843248 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>
2026-04-27 09:58:21 +01:00
Archit Anant
99d7099872 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>
2026-04-27 09:58:21 +01:00
Archit Anant
97c3fae0db 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>
2026-04-27 09:58:21 +01:00
Archit Anant
21450969a7 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>
2026-04-27 09:58:21 +01:00
Archit Anant
fa2d96d289 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>
2026-04-27 09:58:21 +01:00
Archit Anant
d4c8667bc9 iio: adc: ad799x: sort headers alphabetically
Reorder header includes to maintain proper alphabetical ordering.

No functional changes.

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>
2026-04-27 09:58:21 +01:00
Erikas Bitovtas
de1cbc4b21 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>
2026-04-27 09:58:21 +01:00
Erikas Bitovtas
de1839edfe iio: light: vcnl4000: make pm_runtime_enable() device-managed
Replace pm_runtime_set_active() and pm_runtime_enable() with their
device-managed counterpart to remove them from vcnl4000_remove().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:21 +01:00
Erikas Bitovtas
857cb79df0 iio: light: vcnl4000: move power state function into device-managed action
Move power state setting into a device-managed action to get rid of
fail_poweroff goto label and remove it from vcnl4000_remove() function.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:21 +01:00
Erikas Bitovtas
8078daf886 iio: light: vcnl4000: move device tree entries into one line
Make device tree entries one line each to save space and LOC.

Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:21 +01:00
Erikas Bitovtas
b2362b824f 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>
2026-04-27 09:58:20 +01:00
Erikas Bitovtas
4617091a76 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>
2026-04-27 09:58:20 +01:00
Nikhil Gautam
416e983c91 iio: dac: mcp4821: add configurable gain support
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>
2026-04-27 09:58:20 +01:00
Nikhil Gautam
090839ecff iio: dac: mcp4821: move state initialization outside switch
Move the iio_priv() call outside the switch statement in
mcp4821_read_raw() to avoid repeating it in multiple cases.

No functional change.

Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:20 +01:00
Nikhil Gautam
f4d618c618 iio: dac: mcp4821: fix spelling mistake in enum name
Fix a typo in the enum name mcp4821_supported_drvice_ids
by renaming it to mcp4821_supported_device_ids.

This improves code readability and consistency.

Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:20 +01:00
Sanjay Chitroda
a9ecd9a121 iio: ssp_sensors: cleanup codestyle check
Reported by checkpatch:
FILE: drivers/iio/common/ssp_sensors/ssp_spi.c

CHECK: Macro argument '...' may be better as '(...)'
to avoid precedence issues

Signed-off-by: Sanjay Chitroda <sanjayembeddedse@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2026-04-27 09:58:20 +01:00