Angelo Dureghello [Mon, 28 Oct 2024 21:45:28 +0000 (22:45 +0100)]
dt-bindings: iio: dac: ad3552r: add iio backend support
There is a version of AXI DAC IP block (for FPGAs) that provides
a physical QSPI bus for AD3552R and similar chips, so supporting
spi-controller functionalities.
For this case, the binding is modified to include some additional
properties.
Vasileios Amoiridis [Wed, 30 Oct 2024 23:54:24 +0000 (00:54 +0100)]
iio: chemical: bme680: use s16 variable for temp value to avoid casting
Use local s16 variable for the temperature channel to avoid casting it
later before passing it to the bme680_read_temp() function. This way,
possible endianness and initialization issues are avoided.
Andy Shevchenko [Wed, 30 Oct 2024 16:19:19 +0000 (18:19 +0200)]
iio: adc: pac1921: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.
Andy Shevchenko [Wed, 30 Oct 2024 16:19:18 +0000 (18:19 +0200)]
iio: adc: ad4000: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.
Justin Weiss [Sun, 27 Oct 2024 17:20:25 +0000 (10:20 -0700)]
iio: imu: bmi270: Add support for BMI260
Adds support for the Bosch BMI260 6-axis IMU to the Bosch BMI270
driver. Setup and operation is nearly identical to the Bosch BMI270,
but has a different chip ID and requires different firmware.
Firmware is requested and loaded from userspace.
Adds ACPI ID BMI0160, used by several devices including the GPD Win
Mini, Aya Neo AIR Pro, and OXP Mini Pro.
GPD Win Mini:
Device (BMI2)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "BMI0160") // _HID: Hardware ID
Name (_CID, "BMI0160") // _CID: Compatible ID
Name (_DDN, "Accelerometer") // _DDN: DOS Device Name
Name (_UID, One) // _UID: Unique ID
Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
{
Name (RBUF, ResourceTemplate ()
{
I2cSerialBusV2 (0x0068, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.I2CB",
0x00, ResourceConsumer, , Exclusive,
)
GpioInt (Edge, ActiveLow, Exclusive, PullDefault, 0x0000,
"\\_SB.GPIO", 0x00, ResourceConsumer, ,
)
{ // Pin list
0x008B
}
})
Return (RBUF) /* \_SB_.I2CB.BMI2._CRS.RBUF */
}
...
}
Justin Weiss [Sun, 27 Oct 2024 17:20:24 +0000 (10:20 -0700)]
dt-bindings: iio: imu: bmi270: Add Bosch BMI260
The BMI260's register map, configuration, and capabilities are nearly
identical to the BMI270, but the devices have different chip IDs and
require different initialization firmware.
Remove the IIO specific scaling measurement units from the read functions
and add them inside the ->read_raw() function to keep the read_*() generic.
This way they can be used in other parts of the driver.
Javier Carrasco [Wed, 23 Oct 2024 18:59:59 +0000 (20:59 +0200)]
iio: light: add support for veml3235
The Vishay veml3235 is a low-power ambient light sensor with I2C
interface. It provides a minimum detectable intensity of
0.0021 lx/cnt, configurable integration time and gain, and an additional
white channel to distinguish between different light sources.
Javier Carrasco [Wed, 23 Oct 2024 18:59:58 +0000 (20:59 +0200)]
dt-bindings: iio: light: veml6030: add veml3235
The veml3235 is another Vishay ambient light sensor that shares similar
properties with the other sensors covered by this bindings. In this
case, only the compatible, reg, and vdd-supply properties are required,
and the device does not have an interrupt line, like the already
supported veml7700.
Andy Shevchenko [Thu, 24 Oct 2024 19:05:12 +0000 (22:05 +0300)]
iio: light: ltr501: Add LTER0303 to the supported devices
It has been found that the (non-vendor issued) ACPI ID for Lite-On
LTR303 is present in Microsoft catalog. Add it to the list of the
supported devices.
Andy Shevchenko [Thu, 24 Oct 2024 19:05:11 +0000 (22:05 +0300)]
iio: light: ltr501: Drop most likely fake ACPI IDs
The commits in question do not proove that ACPI IDs exist.
Quite likely it was a cargo cult addition while doing that
for DT-based enumeration. Drop most likely fake ACPI IDs.
The to be removed IDs has been checked against the following resources:
1) DuckDuckGo
2) Google
3) MS catalog: https://www.catalog.update.microsoft.com/Search.aspx
This gives no useful results in regard to DSDT, moreover, the official
vendor ID in the registry for Lite-On is LCI.
Andy Shevchenko [Thu, 24 Oct 2024 19:05:10 +0000 (22:05 +0300)]
iio: light: isl29018: drop ACPI_PTR() and CONFIG_ACPI guards
The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also drop now unneeded linux/acpi.h include and
added linux/mod_devicetable.h for struct acpi_device_id definition.
Andy Shevchenko [Thu, 24 Oct 2024 19:05:05 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: drop ACPI_PTR() and move ID out of CONFIG_ACPI guards
The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. This example was doing it correctly
but I am proposing dropping this so as to reduce chance of cut and paste
where it is done wrong. Also added linux/mod_devicetable.h for
struct acpi_device_id definition.
Andy Shevchenko [Thu, 24 Oct 2024 19:05:03 +0000 (22:05 +0300)]
iio: accel: kxcjk-1013: Get rid of enum kx_chipset
Instead of using enum, out of which only a couple of values
are being actually used, make a comparisons against pointer
to the respective chip_info structures.
Andy Shevchenko [Thu, 24 Oct 2024 19:04:57 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Switch from CONFIG_PM guards to pm_ptr() etc
Letting the compiler remove these functions when the kernel is built
without CONFIG_PM support is simpler and less error prone than the
use of #ifdef based config guards.
Removing instances of this approach from IIO also stops them being
copied into new drivers.
Andy Shevchenko [Thu, 24 Oct 2024 19:04:56 +0000 (22:04 +0300)]
iio: accel: kxcjk-1013: Revert "Add support for KX022-1020"
The mentioned change effectively broke the ODR startup timeouts
settungs for KX023-1025 case. Let's revert it for now and see
how we can handle it with the better approach after switching
the driver to use data structure instead of enum.
Andy Shevchenko [Thu, 24 Oct 2024 19:04:52 +0000 (22:04 +0300)]
iio: imu: inv_mpu6050: Replace strange way of checking type of enumeration
When device is enumerated via ACPI the respective device node is of
ACPI device type. Use that to check for ACPI enumeration, rather than
calling for full match which is O(n) vs. O(1) for the regular check.
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20241024191200.229894-4-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Andy Shevchenko [Thu, 24 Oct 2024 19:04:51 +0000 (22:04 +0300)]
iio: adc: pac1934: Replace strange way of checking type of enumeration
When device is enumerated via ACPI the respective device node is of
ACPI device type. Use that to check for ACPI enumeration, rather than
calling for full match which is O(n) vs. O(1) for the regular check.
Alexandru Ardelean [Fri, 25 Oct 2024 09:59:39 +0000 (12:59 +0300)]
iio: adc: ad7606: add support for AD760{7,8,9} parts
The AD7607, AD7608 and AD7609 are some older parts of the AD7606 family.
They are hardware-only, meaning that they don't have any registers
accessible via SPI or Parallel interface.
They are more similar to the AD7605-4 part, which is supported by the
'ad7606' driver, and are configurable via GPIOs.
Like the AD7605-4 part, all 3 parts have 2 CONVST (Conversion Start) pins
(CONVST A and CONVST B). But in practice, these should be tied together to
make reading of samples easier via a serial line.
The AD7607 has an 14-bit resolution and AD7608 & AD7609 have an 18-bit
resolution. The main difference between the AD7608 & AD7609 is that the
AD7609 has a larger range (±10V & ±20V) vs the ±5V & ±10V ranges for AD7608.
However, unlike AD7605-4 part, these 3 parts have oversampling which is
configurable (like for the AD7606 in HW-mode) via GPIOs.
Alexandru Ardelean [Fri, 25 Oct 2024 09:59:37 +0000 (12:59 +0300)]
iio: adc: ad7606: rework scale-available to be static
The main driver for this change is the AD7607 part, which has a scale of
"1.220703" for the ±10V range. The AD7607 has a resolution of 14-bits.
So, just adding the scale-available list for that part would require some
quirks to handle just that scale value.
But to do it more neatly, the best approach is to rework the scale
available lists to have the same format as it is returned to userspace.
That way, we can also get rid of the allocation for the 'scale_avail_show'
array.
Alexandru Ardelean [Fri, 25 Oct 2024 09:59:36 +0000 (12:59 +0300)]
iio: adc: ad7606: use realbits for sign-extending in scan_direct
Currently the 'ad7606' driver supports parts with 18 and 16 bits
resolutions.
But when adding support for AD7607 (which has a 14-bit resolution) we
should check for the 'realbits' field, to be able to sign-extend correctly.
When the mutexes were reworked to guards, the caching of the
oversampling_ratio values was removed by accident.
The main effect of this change is that, after setting the
oversampling_ratio value, reading it back would result in the initial value
(of 1).
The value would get sent to the device correctly though.
Fixes 2956979dbd0d: ("iio: adc: ad7606: switch mutexes to guard")
Jonathan Cameron [Sun, 20 Oct 2024 18:07:20 +0000 (19:07 +0100)]
iio: accel: replace s64 __aligned(8) with aligned_s64
e4ca0e59c394 ("types: Complement the aligned types with signed 64-bit one")
introduced aligned_s64. Use it for all IIO accelerometer drivers.
Reviewed-by: Nuno Sa <nuno.sa@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com> Link: https://patch.msgid.link/20241020180720.496327-1-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Emil Gedenryd [Thu, 3 Oct 2024 12:22:16 +0000 (14:22 +0200)]
dt-bindings: iio: light: opt3001: add compatible for opt3002
The opt3002 is a Light-to-Digital Sensor by TI with support for wide-range
spectrum light. It shares most properties with their opt3001 model with
the exception of having a wide spectral bandwidth, ranging from 300 nm
to 1000 nm.
Ramona Alexandra Nechita [Mon, 14 Oct 2024 14:32:00 +0000 (17:32 +0300)]
drivers: iio: adc: add support for ad777x family
Add support for AD7770, AD7771, AD7779 ADCs. The device is capable of
sending out data both on DOUT lines interface,as on the SDO line.
The driver currently implements only the SDO data streaming mode. SPI
communication is used alternatively for accessing registers and streaming
data. Register accesses are protected by crc8.
Ramona Alexandra Nechita [Mon, 14 Oct 2024 14:31:59 +0000 (17:31 +0300)]
Documentation: ABI: added filter mode doc in sysfs-bus-iio
The filter mode / filter type property is used for ad4130
and ad7779 drivers, therefore the ABI doc file for ad4130
was removed, merging both of them in the sysfs-bus-iio.
Since one of the drivers is available from 6.1, the version
has been set to 6.1 for these attributes.
Ramona Alexandra Nechita [Mon, 14 Oct 2024 14:31:58 +0000 (17:31 +0300)]
dt-bindings: iio: adc: add ad7779 doc
Add dt bindings for AD7779 8-channel, simultaneous sampling ADC
family with eight full Σ-Δ ADCs on chip and ultra-low input
current to allow direct sensor connection.
Guillaume Stols [Tue, 15 Oct 2024 13:56:21 +0000 (13:56 +0000)]
iio: adc: ad7606: Disable PWM usage for non backend version
Since the pwm was introduced before backend, there was a mock use, with
a GPIO emulation. Now that iio backend is introduced, the mock use can
be removed.
Guillaume Stols [Tue, 15 Oct 2024 13:56:20 +0000 (13:56 +0000)]
iio: adc: ad7606: Add iio-backend support
- Basic support for iio backend.
- Supports IIO_CHAN_INFO_SAMP_FREQ R/W.
- Only hardware mode is available, and that IIO_CHAN_INFO_RAW is not
supported if iio-backend mode is selected.
Guillaume Stols [Tue, 15 Oct 2024 13:56:19 +0000 (13:56 +0000)]
iio: adc: ad7606: Introduce num_adc_channels
This variable determines how many hardware channels has the chip,
oppositely to the num_channels that can contain more channels, e.g a
timestamp channel in our case. Introducing this variable avoids
decreasing the former num_channels variable when reading the ADC's
channels, and clarifies a bit the code.
Guillaume Stols [Tue, 15 Oct 2024 13:56:18 +0000 (13:56 +0000)]
iio: adc: ad7606: Add compatibility to fw_nodes
On the parallel version, the current implementation is only compatible
with id tables and won't work with fw_nodes, this commit intends to fix
it.
Doing so required to declare ad7606_chip_info structures in the .h file
so to make them accessible to all the driver files that can set a
pointer to the corresponding chip as the driver data.
Guillaume Stols [Tue, 15 Oct 2024 13:56:17 +0000 (13:56 +0000)]
iio: adc: ad7606: Add PWM support for conversion trigger
Until now, the conversion were triggered by setting high the GPIO
connected to the convst pin. This commit gives the possibility to
connect the convst pin to a PWM.
Connecting a PWM allows to have a better control on the samplerate,
but it must be handled with care, as it is completely decorrelated of
the driver's busy pin handling.
Hence it is not recommended to be used "as is" but must be exploited
in conjunction with IIO backend, and for now only a mock functionality
is enabled, i.e PWM never swings, but is used as a GPIO, i.e duty_cycle
== period equals high state, duty_cycle == 0 equals low state.
This mock functionality will be disabled after the IIO backend usecase
is introduced.
Add the required properties for iio-backend support, as well as an
example and the conditions to mutually exclude interruption and
conversion trigger with iio-backend.
The iio-backend's function is to controls the communication, and thus the
interruption pin won't be available anymore.
As a consequence, the conversion pin must be controlled externally since
we will miss information about when every single conversion cycle (i.e
conversion + data transfer) ends, hence a PWM is introduced to trigger
the conversions.
Guillaume Stols [Tue, 15 Oct 2024 13:56:14 +0000 (13:56 +0000)]
dt-bindings: iio: adc: ad7606: Remove spi-cpha from required
The documentation is erroneously stating that spi-cpha is required, and
the example is erroneously setting both spi-cpol and spi-cpha. According
to the datasheet, only cpol should be set.
On zedboard for instance, setting the devicetree as in the example will
simply not work.
Fixes: 416f882c3b40 ("dt-bindings: iio: adc: Migrate AD7606 documentation to yaml") Fixes: 6e33a125df66 ("dt-bindings: iio: adc: Add docs for AD7606 ADC") Reviewed-by: Rob Herring (Arm) <robh@kernel.org> Signed-off-by: Guillaume Stols <gstols@baylibre.com> Link: https://patch.msgid.link/20241015-ad7606_add_iio_backend_support-v5-1-654faf1ae08c@baylibre.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Nuno Sa [Wed, 16 Oct 2024 14:22:00 +0000 (16:22 +0200)]
iio: addac: ad74413r: use devm_regulator_get_enable_read_voltage()
It's highly unlikely for the converter ref voltage to change at runtime.
Hence, let's read the voltage and save it (instead of the regulator
struct). While at it, simplify the code by using
devm_regulator_get_enable_read_voltage().
Nuno Sa [Wed, 16 Oct 2024 14:21:59 +0000 (16:21 +0200)]
iio: addac: ad74413r: drop reset_gpio from struct ad74413r_state
We just need the reset gpio during probe so there's no need to keep it
in our state struct. Hence, move devm_gpiod_get_optional() into
ad74413r_reset() and use a local struct gpio_desc.
While at it, request the gpio in the asserted state (GPIOD_OUT_HIGH) so
that we already perform the reset while requesting the gpio saving us a
call to gpiod_set_value_cansleep().
Also, explicitly include <gpio/consumer.h> for
devm_gpiod_get_optional().
Javier Carrasco [Thu, 17 Oct 2024 21:39:26 +0000 (23:39 +0200)]
iio: light: veml6070: use field to set integration time
Define the integration time within the configuration register as a field
to easy its handling as an index, preparing the driver to support
configurable integration times.
Vasileios Amoiridis [Thu, 17 Oct 2024 23:30:19 +0000 (01:30 +0200)]
iio: pressure: bmp280: Use sleep and forced mode for oneshot captures
Add forced mode support in sensors BMP28x, BME28x, BMP3xx and BMP58x.
Sensors BMP18x and BMP085 are old and do not support this feature so
their operation is not affected at all.
Essentially, up to now, the rest of the sensors were used in normal mode
all the time. This means that they are continuously doing measurements
even though these measurements are not used. Even though the sensor does
provide PM support, to cover all the possible use cases, the sensor needs
to go into sleep mode and wake up whenever necessary.
The idea is that the sensor is by default in sleep mode, wakes up in
forced mode when a oneshot capture is requested, or in normal mode
when the buffer is enabled. The difference lays in the fact that in
forced mode, the sensor does only one conversion and goes back to sleep
while in normal mode, the sensor does continuous measurements with the
frequency that was set in the ODR registers.
The bmpX_chip_config() functions which are responsible for applying
the requested configuration to the sensor, are modified accordingly
in order to set the sensor by default in sleep mode.
DEEP STANDBY, Low Power NORMAL and CONTINUOUS modes, supported only by
the BMP58x version, are not added.
Andy Shevchenko [Fri, 18 Oct 2024 14:58:05 +0000 (17:58 +0300)]
iio: magnetometer: bmc150_magn: Drop most likely fake ACPI IDs
The commits in question do not proove that ACPI IDs exist.
Quite likely it was a cargo cult addition while doing that
for DT-based enumeration. Drop most likely fake ACPI IDs.
The to be removed IDs has been checked against the following resources:
1) DuckDuckGo
2) Google
3) MS catalog: https://www.catalog.update.microsoft.com/Search.aspx
This gives no useful results in regard to DSDT, moreover, the official
vendor IDs in the registry for Bosh are BSG and BOSC.
Andy Shevchenko [Fri, 18 Oct 2024 14:57:32 +0000 (17:57 +0300)]
iio: gyro: bmg160: Drop most likely fake ACPI IDs
The commits in question do not proove that ACPI IDs exist.
Quite likely it was a cargo cult addition while doing that
for DT-based enumeration. Drop most likely fake ACPI IDs.
The to be removed IDs has been checked against the following resources:
1) DuckDuckGo
2) Google
3) MS catalog: https://www.catalog.update.microsoft.com/Search.aspx
This gives no useful results in regard to DSDT, moreover, the official
vendor IDs in the registry for Bosh are BSG and BOSC.
Shen Jianping [Fri, 18 Oct 2024 13:52:34 +0000 (15:52 +0200)]
iio: imu: smi240: add driver
add the iio driver for bosch imu smi240. The smi240 is a combined
three axis angular rate and three axis acceleration sensor module
with a measurement range of +/-300°/s and up to 16g. A synchronous
acc and gyro sampling can be triggered by setting the capture bit
in spi read command.
Implemented features:
* raw data access for each axis through sysfs
* tiggered buffer for continuous sampling
* synchronous acc and gyro data from tiggered buffer