summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* MAINTAINERS: update current-sense-amplifier.yaml referenceMauro Carvalho Chehab2021-04-071-1/+1
| | | | | | | | | | | | | Changeset fbac26b9ad21 ("dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.") renamed: Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.txt to: Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml. Update its cross-reference accordingly. Fixes: fbac26b9ad21 ("dt-bindings:iio:afe:current-sense-amplifier: txt to yaml conversion.") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/d0008b06f8ca65108eb1e7734ec6e3e32ec28172.1617279355.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* MAINTAINERS: update envelope-detector.yaml referenceMauro Carvalho Chehab2021-04-071-1/+1
| | | | | | | | | | | | | Changeset 66a6dcc20e63 ("dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.") renamed: Documentation/devicetree/bindings/iio/adc/envelope-detector.txt to: Documentation/devicetree/bindings/iio/adc/envelope-detector.yaml. Update its cross-reference accordingly. Fixes: 66a6dcc20e63 ("dt-bindings:iio:adc:envelope-detector: txt to yaml conversion.") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/d4ccc625ccb89730c03204b7aae98fd94ea97fc2.1617279355.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* MAINTAINERS: update dpot-dac.yaml referenceMauro Carvalho Chehab2021-04-071-1/+1
| | | | | | | | | | | | | Changeset 06d2ff6fe11e ("dt-bindings:iio:dac:dpot-dac: yaml conversion.") renamed: Documentation/devicetree/bindings/iio/dac/dpot-dac.txt to: Documentation/devicetree/bindings/iio/dac/dpot-dac.yaml. Update its cross-reference accordingly. Fixes: 06d2ff6fe11e ("dt-bindings:iio:dac:dpot-dac: yaml conversion.") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/efda999adce3332dc1b5c20a998f3824c1cc1b0f.1617279355.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* MAINTAINERS: update st,hts221.yaml referenceMauro Carvalho Chehab2021-04-071-1/+1
| | | | | | | | | | | | | Changeset 9a6ac3138258 ("dt-bindings:iio:humidity:st,hts221 yaml conversion.") renamed: Documentation/devicetree/bindings/iio/humidity/hts221.txt to: Documentation/devicetree/bindings/iio/humidity/st,hts221.yaml. Update its cross-reference accordingly. Fixes: 9a6ac3138258 ("dt-bindings:iio:humidity:st,hts221 yaml conversion.") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/a83cf29bbd27b26eb22e0046c41efebf488e7e4d.1617279355.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* MAINTAINERS: update adi,ad5758.yaml referenceMauro Carvalho Chehab2021-04-071-1/+1
| | | | | | | | | | | | | Changeset 1e6536ee349b ("dt-bindings:iio:dac:adi,ad5758 yaml conversion") renamed: Documentation/devicetree/bindings/iio/dac/ad5758.txt to: Documentation/devicetree/bindings/iio/dac/adi,ad5758.yaml. Update its cross-reference accordingly. Fixes: 1e6536ee349b ("dt-bindings:iio:dac:adi,ad5758 yaml conversion") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/ca35b929c098163cfda9682ce791572629b763e2.1617279355.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:cdc:ad7150: Move driver out of staging.Jonathan Cameron2021-04-077-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | This capacitance to digital converter (CDC) driver is compliant with the IIO ABI. Note, not all features supported (e.g. window event modes) but the driver should be in a useful functional state. The cleanup was done against QEMU emulation of the device rather than actual hardware. Whilst this was a bit of an experiment, it made it easy to confirm that the driver remained in a consistent working state through the various refactors. If it worked in the first place, it should still be working after this cleanup. Given some IIO drivers require expensive hardware setups, (not particularly true with this one) the use of QEMU may provide a viable way forward for providing testing during code changes where previously we'd had to rely on sharp eyes and crossed fingers. Note, no explicit MAINTAINERS entry as it will be covered by the generic catch-alls for ADI and IIO drivers which are sufficient. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-25-jic23@kernel.org
* dt-bindings:iio:cdc:adi,ad7150 binding docJonathan Cameron2021-04-071-0/+69
| | | | | | | | | | | | | | | Binding covering the ad7150, ad7151 and ad7156 capacitance to digital convertors. The only difference between these is how many channels they have (1 or 2) Whilst it is clearly necessary to provide power to the part, we don't need to know the voltage or anything so if it is always on, there should be no need to have it specified in the binding. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20210314181511.531414-24-jic23@kernel.org
* staging:iio:cdc:ad7150: Add copyright notice given substantial changes.Jonathan Cameron2021-04-071-0/+1
| | | | | | | | | It seems to me that the changes made to get this ready to move out of staging are substantial enough to warant a copyright notice addition. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-23-jic23@kernel.org
* iio:Documentation:ABI Add missing elements as used by the adi,ad7150Jonathan Cameron2021-04-071-0/+33
| | | | | | | | | | | | Main additions are around thresh_adaptive. This has been supported by the core of IIO for a long time, but no driver that uses it has previously graduated from staging, hence we are missing Docs. Otherwise, just new entries in existing lists. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210314181511.531414-22-jic23@kernel.org
* staging:iio:cdc:ad7150: Add of_match_tableJonathan Cameron2021-04-071-0/+8
| | | | | | | | | | | Rather than using the fallback path in the i2c subsystem and hoping for no clashes across vendors, lets put in an explicit table for matching. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon> Link: https://lore.kernel.org/r/20210314181511.531414-21-jic23@kernel.org
* staging:iio:cdc:ad7150: Really basic regulator support.Jonathan Cameron2021-04-071-0/+21
| | | | | | | | | Given DT docs will include regulators, lets just turn them on and off with driver probe() and remove(). Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-20-jic23@kernel.org
* staging:iio:cdc:ad7150: Add scale and offset to info_mask_shared_by_typeJonathan Cameron2021-04-071-0/+16
| | | | | | | | | | The datasheet provides these two values on the assumption they are applied to unshift raw value. Hence shift both the offset and scale by 4 to compensate. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-19-jic23@kernel.org
* staging:iio:cdc:ad7150: Shift the _raw readings by 4 bits.Jonathan Cameron2021-04-071-1/+1
| | | | | | | | | | | | | Every other register related to raw value on the datasheet is described as correpsonding to the 12MSB of the actual data registers + the bottom 4 bits are 0. So lets treat this as what it actually is, which is a 12 bit value. Note that we will have to be a little careful to compensate for the offset and scale values. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-18-jic23@kernel.org
* staging:iio:cdc:ad7150: Drop unnecessary block comments.Jonathan Cameron2021-04-071-9/+1
| | | | | | | | | | | | These have a habit of not getting updated with driver reorganizations and don't add much info so drop them. Also fix a minor comment syntax issue. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-17-jic23@kernel.org
* staging:iio:cdc:ad7150: Tidy up local variable positioning.Jonathan Cameron2021-04-071-7/+7
| | | | | | | | | | | Where there is no other basis on which to order declarations let us prefer reverse xmas tree. Also reduce scope where sensible. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-16-jic23@kernel.org
* staging:iio:cdc:ad7150: Reorganize headers.Jonathan Cameron2021-04-071-4/+4
| | | | | | | | | | Whilst not important, it's nice to have the general headers in alphabetical order. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-15-jic23@kernel.org
* staging:iio:cdc:ad7150: More consistent register and field namingJonathan Cameron2021-04-071-68/+61
| | | | | | | | | | Add _REG postfix to register addresses to avoid confusion with fields. Also add additional field defines and use throughout the driver in place of magic numbers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-14-jic23@kernel.org
* staging:iio:cdc:ad7150: Rework interrupt handling.Jonathan Cameron2021-04-071-105/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note this doesn't support everything the chip can do as we ignore window mode for now (in window / out of window). * Given the chip doesn't have any way of disabling the threshold pins, use disable_irq() etc to mask them except when we actually want them enabled (previously events were always enabled). Note there are race conditions, but using the current state from the status register and disabling interrupts across changes in type of event should mean those races result in interrupts, but no events to userspace. * Correctly reflect that there is one threshold line per channel. * Only take notice of rising edge. If anyone wants the other edge then they should set the other threshold (they are available for rising and falling directions). This isn't perfect but it makes it a lot simpler. * If insufficient interrupts are specified in firnware, don't support events. * Adaptive events use the same pos/neg values of thrMD as non adaptive ones. Tested against qemu based emulation. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210314181511.531414-13-jic23@kernel.org
* staging:iio:cdc:ad7150: Change timeout units to seconds and use core supportJonathan Cameron2021-04-071-107/+52
| | | | | | | | | | Now we have core support for timeouts related to adaptive events, let us use it. Note the units of that attribute are seconds, so we also need to scale the cycles value by the period of each sample. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-12-jic23@kernel.org
* iio:event: Add timeout event info typeJonathan Cameron2021-04-072-0/+2
| | | | | | | | | | | | | | For adaptive threshold events, the current value is compared with a (typically) low pass filtered version of the same signal that slowly tracks large scale changes. However, sometimes a step change can result in a large lag before the low pass filtered version begins to track the signal again. Timeouts can be used to made an instantaneous 'correction'. Documentation of this attribute is added in a later patch. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-11-jic23@kernel.org
* staging:iio:cdc:ad7150: Add sampling_frequency supportJonathan Cameron2021-04-071-0/+6
| | | | | | | | Device uses a fixed sampling frequency. Let us expose it to userspace. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-10-jic23@kernel.org
* staging:iio:cdc:ad7150: Drop noisy print in probeJonathan Cameron2021-04-071-11/+2
| | | | | | | | | | | Also * drop i2c_set_client_data() as now unused. * white space cleanups Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-9-jic23@kernel.org
* staging:iio:cdc:ad7150: Simplify event handling by only using rising direction.Jonathan Cameron2021-04-071-1/+0
| | | | | | | | | | | | | | The event line is active high and not maskable within the device. It indicates current state directly. The device supports separate rising and falling thresholds so rather than trying to using each bound to detect in both directions just use IRQF_TRIGGER_RISING. If a user wants to detect the value falling back below the threshold, then set the falling threshold appropriately. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-8-jic23@kernel.org
* staging:iio:cdc:ad7150: Handle variation in chan_spec across device and irq ↵Jonathan Cameron2021-04-071-8/+63
| | | | | | | | | | | | | | present or not The driver supports devices with different numbers of channels and also can function without provision of an IRQ (with reduced features), so this patch handles this cleanly by having multiple chan_spec arrays and iio_info structures to pick between depending on what we have. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-7-jic23@kernel.org
* staging:iio:cdc:ad7150: Drop platform data supportJonathan Cameron2021-04-071-14/+0
| | | | | | | | | There are no mainline board files using this driver so lets drop the platform_data support in favour of devicetree and similar. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-6-jic23@kernel.org
* staging:iio:cdc:ad7150: Timeout register covers both directions so both need ↵Jonathan Cameron2021-04-071-2/+16
| | | | | | | | | | | | | updating The timeout is treated as one single value, but the datasheet describes it as two 4 bit values, one for each direction of event. As such change the driver to support the separate directions. Also add limit checking to ensure it fits within the 4 bits. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-5-jic23@kernel.org
* staging:iio:cdc:ad7150: Refactor event parameter updateJonathan Cameron2021-04-071-15/+17
| | | | | | | | | | | | | Original code was ordered in a fairly unituitive fashion with the non adaptive threshold handling returning from the switch statement, whilst the adapative path did the actual writes outside the switch. Make it more readable by bringing everything within the switch statement cases and reducing scope of local variables as appropriate. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-4-jic23@kernel.org
* staging:iio:cdc:ad7150: Remove magnitude adaptive eventsJonathan Cameron2021-04-071-56/+0
| | | | | | | | | | | | | | The devices support window detection, but that corresponds to being outside of a range defined by a lower an uppper bound rather than being related to magnitude as such. Hence drop this interface in the interests of making the driver ABI compliant. We may bring back support for the window mode at somepoint in the future but it will be in an ABI compliant fashion. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20210314181511.531414-3-jic23@kernel.org
* staging:iio:cdc:ad7150: use swapped reads/writes for i2c rather than open codingJonathan Cameron2021-04-071-9/+11
| | | | | | | | | | Reduces boilerplate and chances of getting the error handling wrong. No functional change. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon> Link: https://lore.kernel.org/r/20210314181511.531414-2-jic23@kernel.org
* iio: inv_mpu6050: Make interrupt optionalLars-Peter Clausen2021-04-071-19/+32
| | | | | | | | | | | | | | The inv_mpu6050 driver requires an interrupt for buffered capture. But non buffered reading for measurements works just fine without an interrupt connected. Make the interrupt optional to support this case. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210325131046.13383-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: inv_mpu6050: Remove superfluous indio_dev->modes assignmentLars-Peter Clausen2021-04-071-1/+0
| | | | | | | | | | | | | The inv_mpu6050 driver manually assigns the indio_dev->modes property. But this is not necessary since it will be setup in iio_trigger_buffer_setup(). Remove the manual assignment. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210325131046.13383-1-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: buffer: return 0 for buffer getfd ioctl handlerAlexandru Ardelean2021-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | As Lars pointed out, we could either return the FD vs memcpy-ing it to the userspace data object. However, this comment exposed a bug. We should return 0 or negative from these ioctl() handlers. Because an ioctl() handler can also return IIO_IOCTL_UNHANDLED (which is positive 1), which means that the ioctl() handler doesn't support this ioctl number. Positive 1 could also be a valid FD number in some corner cases. The reason we did this is to be able to differentiate between an error code and an unsupported ioctl number; for unsupported ioctl numbers, the main loop should keep going. Maybe we should change this to a higher negative number, to avoid such cases when/if we add more ioctl() handlers. Cc: Lars-Peter Clausen <lars@metafoo.de> Fixes: f73f7f4da5818 ("iio: buffer: add ioctl() to support opening extra buffers for IIO device") Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210322084135.17536-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: Fix iio_read_channel_processed_scale()Linus Walleij2021-04-071-1/+1
| | | | | | | | | | | The code was checking if (ret) from the processed channel readout, not smart, we need to check if (ret < 0) as this will likely be something like IIO_VAL_INT. Fixes: 635ef601b238 ("iio: Provide iio_read_channel_processed_scale() API") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210323122705.1326362-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ad7923: register device with devm_iio_device_registerLucas Stankus2021-03-291-13/+1
| | | | | | | | | | | | Registers the device using the devm variant. This is the final step of converting the ad7923 to only use devm routines, meaning that the ad7923_remove() function is no longer needed to release resources on device detach. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/b0146465d52f4e259f5f95c83c71e72f065093da.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ad7923: use device-managed function for triggered bufferLucas Stankus2021-03-291-12/+3
| | | | | | | | | | | | Converts the iio_triggered_buffer_setup() call to its device-managed counterpart. With this, the error handling routine in the ad7923_probe() function becomes unnecessary as well as the iio_triggered_buffer_cleanup() call. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/fe46a45caaa788f333d78367968272de728f4a6e.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: adc: ad7923: use devm_add_action_or_reset for regulator disableLucas Stankus2021-03-291-6/+12
| | | | | | | | | | | | Adds a device-managed action to handle disabling the driver's regulator on device detach. This slightly simplifies deinitialization and enables further conversion of the driver to device-managed routines without breaking the init order. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/49a7c0436ca1186313dbccf3d810d0cf38cb5b37.1616966903.git.lucas.p.stankus@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: dac: Rudimentary typo fixBhaskar Chowdhury2021-03-291-1/+1
| | | | | | | | | s/concurent/concurrent/ Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://lore.kernel.org/r/20210323012215.451075-1-unixbhaskar@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: imu: inv_mpu6050: Use as standalone triggerLinus Walleij2021-03-291-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It may happen that the MPU6050 is the only hardware trigger available on your system such as this: > lsiio Device 003: hscdtd008a Device 001: mpu6050 Device 002: gp2ap002 Device 000: ab8500-gpadc Trigger 000: mpu6050-dev1 And when you want to use it to read periodically from your magnetometer like this: > iio_generic_buffer -a -c 100 -n hscdtd008a -t mpu6050-dev1 Then the following happens: [ 209.951334] Internal error: Oops: 5 [#1] SMP ARM (...) [ 209.981969] Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support) [ 209.988925] PC is at inv_scan_query_mpu6050+0x8/0xb8 [ 209.993914] LR is at inv_mpu6050_set_enable+0x40/0x194 This is because since we are not using any channels from the same device, the indio_dev->active_scan_mask is NULL. Just checking for that and bailing out is however not enough: we have to enable some kind of FIFO for the readout to work. So enable the temperature as a dummy FIFO and all works fine. Not suitable for backporting to stable. It is an odd corner case and does not represent a regression. Fixes: 09a642b78523 ("Invensense MPU6050 Device Driver.") Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210322132408.1003443-1-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:accel:adis16201: Fix wrong axis assignment that prevents loadingJonathan Cameron2021-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | Whilst running some basic tests as part of writing up the dt-bindings for this driver (to follow), it became clear it doesn't actually load currently. iio iio:device1: tried to double register : in_incli_x_index adis16201 spi0.0: Failed to create buffer sysfs interfaces adis16201: probe of spi0.0 failed with error -16 Looks like a cut and paste / update bug. Fixes tag obviously not accurate but we don't want to bother carry thing back to before the driver moved out of staging. Fixes: 591298e54cea ("Staging: iio: accel: adis16201: Move adis16201 driver out of staging") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: <Stable@vger.kernel.org> Cc: Himanshu Jha <himanshujha199640@gmail.com> Cc: Nuno Sá <nuno.sa@analog.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210321182956.844652-1-jic23@kernel.org
* iio: dac: Convert powerdown read callbacks to sysfs_emit()Lars-Peter Clausen2021-03-2919-23/+23
| | | | | | | | | | | | Update DAC drivers powerdown attribute show callback to use the new sysfs_emit() function. sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-5-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: __iio_format_value(): Convert to sysfs_emit_at()Lars-Peter Clausen2021-03-291-26/+26
| | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Convert __iio_format_value() and related functions to use this new interface. This conversion involves changing the signature of __iio_format_value() so that it similar to sysfs_emit_at() and takes the buffers start address and an offset where to write within the buffer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-4-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: iio_enum_available_read(): Convert to sysfs_emit_at()Lars-Peter Clausen2021-03-291-1/+1
| | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. Convert the iio_enum_available_read() function to use sysfs_emit_at() instead of scnprintf(). The conversion is straight forward, the only difference is that sysfs_emit_at() takes the buffers start address and an offset as parameters and already knows about the buffer's size limit. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-3-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: core: Use sysfs_emit() (trivial bits)Lars-Peter Clausen2021-03-294-21/+21
| | | | | | | | | | | | | | | | | sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in sanity checks. This patch converts the places in the iio core that follow the pattern of return s*printf(...) to return sysfs_emit(...) Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210320071405.9347-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:imu:mpu6050: Modify matricies to matricesGuoqing Chi2021-03-291-1/+1
| | | | | | | | | | The plural of "matrix" is "matrices". Signed-off-by: Guoqing Chi <chiguoqing@yulong.com> Acked-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Link: https://lore.kernel.org/r/20210322013024.1849-1-chi962464zy@163.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Merge tag 'iio-for-5.13a' of ↵Greg Kroah-Hartman2021-03-26212-2277/+5949
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 1st set of IIO/counter device support, features and cleanup in the 5.13 cycle Big set in here from Alexandru Ardelean enabling multiple buffer support. This includes providing a new directory per buffer that combines what was previously in buffer/ and scan_elements/. Old interfaces still in place for compatiblity. Note immuatable branch for scmi patches to allow for some significant rework going on in that subsystem. Merge required updating to reflect some changes in IIO. Late rebase to fix some wrong fixes tags due to some earlier rebases made necessary by messing up the immutable branch. IIO New Device Support * adi,ad5686 - Add info to support AD5673R and AD5677R * bosch,bmi088 - New driver supporting this accelerometer + gyroscope * cros_ec_mkbp - New driver for this proximity sensor that exposes a 'front' sensor. Very simple switch like device, but driver allows it to share interface with more sophisticated proximity sensors. * iio_scmi - New driver to support ARM SCMI protocol to expose underlying accelerometers and gyroscopes via this firmware interface. * st,st_magn - Add ID for IISMDC magnetometer. * ti,ads131e0 - New driver supporting ads131e04, ads131e06 and ads131e08 24 bit ADCs Counter New Device Support * IRQ or GPIO based counter - New driver for a conceptually simple counter that uses interrupts to perform the count. Features * core - Dual buffer supprt including: Various helpers to centralize handling of bufferer related elements. Document existing and new IOCTLs Register the IIO chrdev only if it can actually be used for anything. Rework attribute group creation in the core (lots of patches) Merge buffer/ and scan_elements/ entries into one list + maintain backwards compatible set. Introduce the internal logic and IOCTL to allow multiple buffers + access to an anon FD per buffer to actually read from it. Tidy up tools/iio/iio_generic_buffer and switch to new interfaces. Update ABI docs. A few follow up fixes, unsuprising as this was a huge bit of rework. - Move common case setting of trig->parent to the core. - Provide an iio_read_channel_processed_scale() to avoid loss of precision from iio_read_channel_processed() then applying integer scale. Use it in ntc_thermistor driver in hwmon. - Allow drivers to specify labels from elsewhere than DT. Use it for bmc150 and kxcjk-1013 labels related to position on 2 in one tablets. - Document label usage for proximity and accelerometer sensors. - Some local variable renames for consistency tools - Add -a parameter to iio_event_monitor to allow autoenabling of events. * acpi_als - Add trigger support for devices that don't support notification method. * adi,ad7124 - Allow more than 8 channels. This is a complex little device, but is capable of supporting up to 16 channels if the share certain configuration settings. * hrtimer-trigger - Support sampling frequency below 1Hz. * mediatek,mt8195-auxadc - Add compatible to binding docs (always also includes mt8173) * st,stm32-adc - Enable timetamps when not using DMA. * vishay,vcnl3020 - Sampling frequency control. Cleanup and minor fixes: * treewide - Use some getter and setter functions instead of opencoding. - Set of fixes for pointless casts in various drivers. - Avoid wrong kernel-doc marking on comment blocks. - Fix various other minor kernel-doc issues shown by W=1 * core - Use a signed temporary for IIO_VAL_FRACTIONAL_LOG2 to avoid odd casts. - Fix IIO_VAL_FRACTIONAL_LOG2 for values between -1.0 and 0.0 - Add unit tests for iio_format_value() * docs - Fix formatting/typos in iio_configfs.rst and buffers.rst - Add documentation of index in buffers.rst - Fix scan element description - Avoid some issues with HTML generation from ABI docs by moving duplicated defintions to more generic files. - Drop reference to long dead mailing list. * 104-quad - Remove left over deprecated IIO counter ABI. * adi,adi-axi-adc - Fix wrong bit of docs. * adi,ad5791 - Typos * adi,ad9834 - Switch to device managed functions in probe. * adi,adis* - Add and use helpers for locking to reduced duplication. * adi,adis16480 - Fix calculation of sampling frequency when using pulse per second input. * adi,adis16475 - Calculate the IMU scaled internal sampling rate and runtime depending on sysfs based configuration rather than getting from DT. Drop now unnecessary property from DT bindings doc. * cros_ec - Fix result of a series of recent changes that means extended buffer attributes turn up in the wrong place. Too complex to revert the various patches unfortunately so this is a bit messy. * fsl,mma3452 - Indentation cleanup. * hid-sensors - Size of storage needs to increase for some parts when using quaternions. - Move the get sensistivity attribute to hid-sensors-common to reduce duplication. Enable it for more device types. - Correctly handle relative sensitivity if reported that way including documenting the new ABI. * maxim,max517 - Use device managed functions in probe. * mediatek,mt6360-adc - Use asm/unaligned.h instead of directly including unaligned/be_byteshift.h * novuton,npcm-adc - Local lock instead of missusing mlock. * semtech,sx9500 - Typos * st,sensor - typo fix * st,spear-adc - Local lock instead of missusing mlock. * st,stm32-adc - Long standing HAS_IOMEM dependency fix. * st,stm32-counter - Remove left over deprecated IIO counter ABI. * ti,palmas-adc - Local lock instead of missusing mlock. * ti,tmp007 - Switch to device managed functions in probe. Other * MAINTAINERS - Move Peter Meerwald-Stadler to Credits at his request * tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (119 commits) iio: acpi_als: Add trigger support iio: acpi_als: Add local variable dev in probe iio: acpi_als: Add timestamp channel iio: adc: ad7292: Modify the bool initialization assignment iio: cros: unify hw fifo attributes without API changes iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant iio: event_monitor: Enable events before monitoring dt-bindings: iio: adc: Add compatible for Mediatek MT8195 iio:magnetometer: Add Support for ST IIS2MDC dt-bindings: iio: st,st-sensors add IIS2MDC. staging: iio: ad9832: kernel-doc fixes iio:dac:max517.c: Use devm_iio_device_register() iio:cros_ec_sensors: Fix a wrong function name in kernel doc. iio: buffer: kfifo_buf: kernel-doc, typo in function name. iio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names. iio: adc: adi-axi-adc: Drop false marking for kernel-doc iio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name iio: dac: ad5504: fix wrong part number in kernel-doc structure name. iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name iio: adc: ti-adc084s021: kernel-doc fixes, missing function names ...
| * Merge remote-tracking branch 'local/ib-iio-scmi-5.12-rc2-take3' into togregJonathan Cameron2021-03-267-1/+704
| |\ | | | | | | | | | | | | | | | | | | | | | Updated to use devm_iio_kfifo_buffer_setup() in place of now removed devm_iio_kfifo_allocate() Take3 branch because first 2 versions including wrong version of patch.
| | * iio/scmi: Adding support for IIO SCMI Based SensorsJyoti Bhayana2021-03-137-1/+715
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change provides ARM SCMI Protocol based IIO device. This driver provides support for Accelerometer and Gyroscope using SCMI Sensor Protocol extensions added in the SCMIv3.0 ARM specification Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jyoti Bhayana <jbhayana@google.com> Link: https://lore.kernel.org/r/20210212172235.507028-2-jbhayana@google.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20210309231259.78050-2-jbhayana@google.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add trigger supportGwendal Grignou2021-03-251-28/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As some firmware does not notify on illuminance changes, add a trigger to be able to query light via software (sysfs-trigger or hrtrigger). Add a hardware trigger set as the default trigger to maintain backward compatibility. Check iio_info reports the sensor as buffer capable: iio:device0: acpi-als (buffer capable) To test, check we can get data on demand on an Intel based chromebook: IIO_DEV="iio:device0" echo 1 > iio_sysfs_trigger/add_trigger cat trigger2/name > ${IIO_DEV}/trigger/current_trigger for i in ${IIO_DEV}/scan_elements/*_en ${IIO_DEV}/buffer/enable ; do echo 1 > $i done od -x /dev/${IIO_DEV} & echo 1 > trigger2/trigger_now Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-4-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add local variable dev in probeGwendal Grignou2021-03-251-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use dev = &device->dev in probe routine for clarity. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-3-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
| * | iio: acpi_als: Add timestamp channelGwendal Grignou2021-03-251-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add timestamp channel in list of channel, to allow retrieving timestamps when events are produced. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210317074012.2336454-2-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>