1. Apr 07, 2021
  2. Mar 29, 2021
  3. Mar 26, 2021
    • Greg Kroah-Hartman's avatar
      Merge tag 'iio-for-5.13a' of... · 9c15db92
      Greg Kroah-Hartman authored
      Merge tag 'iio-for-5.13a' of 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
        ...
      9c15db92
    • Jonathan Cameron's avatar
      Merge remote-tracking branch 'local/ib-iio-scmi-5.12-rc2-take3' into togreg · 1b33dfa5
      Jonathan Cameron authored
      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.
      1b33dfa5
    • Gwendal Grignou's avatar
      iio: acpi_als: Add trigger support · 24b84444
      Gwendal Grignou authored
      
      
      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: default avatarGwendal Grignou <gwendal@chromium.org>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Link: https://lore.kernel.org/r/20210317074012.2336454-4-gwendal@chromium.org
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      24b84444
    • Gwendal Grignou's avatar
    • Gwendal Grignou's avatar
      iio: acpi_als: Add timestamp channel · dbd7e992
      Gwendal Grignou authored
      
      
      Add timestamp channel in list of channel, to allow retrieving timestamps
      when events are produced.
      
      Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Link: https://lore.kernel.org/r/20210317074012.2336454-2-gwendal@chromium.org
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      dbd7e992
    • Guoqing Chi's avatar
    • Gwendal Grignou's avatar
      iio: cros: unify hw fifo attributes without API changes · 80346b2b
      Gwendal Grignou authored
      Commit 2e2366c2 ("iio: cros_ec: unify hw fifo attributes into the core file")
      should be reverted as it set buffer extended attributes at
      the wrong place. However, to revert it will requires to revert more
      commits:
      commit 165aea80 ("iio: cros_ec: use devm_iio_triggered_buffer_setup_ext()")
      commit 21232b44 ("iio: buffer: remove iio_buffer_set_attrs() helper")).
      and we would still have conflict with more recent development.
      commit ee708e6b ("iio: buffer: introduce support for attaching more IIO buffers")
      
      Instead, this commit reverts the first 2 commits without re-adding
      iio_buffer_set_attrs() and set the buffer extended attributes at the
      right place:
      
      1. Instead of adding has_fw_fifo, deduct it from the configuration:
      - EC must support FIFO (EC_FEATURE_MOTION_SENSE_FIFO) set.
      - sensors send data a regular interval (accelerometer, gyro,
        magnetomer, barometer, light sensor).
      - "Legacy accelerometer" is only present on EC without FIFO, so we don't
      need to set buffer attributes.
      
      2. devm_iio_triggered_buffer_setup_ext() does not need to be called when
      EC does not support FIFO, as there is no FIFO to manage.
      
      3. Use devm_iio_triggered_buffer_setup_ext() when EC has a FIFO to
      specify the buffer extended attributes.
      
      Fixes: 2e2366c2 ("iio: cros_ec: unify hw fifo attributes into the core file")
      Fixes: 165aea80
      
       ("iio: cros_ec: use devm_iio_triggered_buffer_setup_ext()")
      Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
      Reviewed-by: default avatarAlexandru Ardelean <ardeleanalex@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Link: https://lore.kernel.org/r/20210318184857.2679181-1-gwendal@chromium.org
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      80346b2b
    • Alexandru Ardelean's avatar
      iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant · 0a21526b
      Alexandru Ardelean authored
      This is similar to the {devm_}iio_triggered_buffer_setup_ext variants added
      via commit 5164c788
      
       ("iio: triggered-buffer: add
      {devm_}iio_triggered_buffer_setup_ext variants").
      
      These can be used to pass extra buffer attributes to the buffer object.
      This is a bit of temporary mechanism (hopefully) so that drivers that want
      to allocate a kfifo buffer with extra buffer attributes, don't need to
      include 'buffer_impl.h' directly. This can also become an API function (in
      it's own right, unfortunately), but it may be a little less bad vs drivers
      having to include 'buffer_impl.h'.
      
      So, far the drivers that want to pass buffer attributes, all have to do
      with some HW FIFO attributes, so there may be a chance of unifying them
      into IIO core somehow (as some standard API). But, until that happens, we
      just need to let them register their HW FIFO attributes directly (without
      having to let them include 'buffer_impl.h' directly).
      
      Signed-off-by: default avatarAlexandru Ardelean <aardelean@deviqon.com>
      Link: https://lore.kernel.org/r/20210311091042.22417-1-aardelean@deviqon.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      0a21526b
    • Linus Walleij's avatar
      iio: event_monitor: Enable events before monitoring · e1d392dc
      Linus Walleij authored
      
      
      After some painful sessions with a driver that register an
      enable/disable sysfs knob (gp2ap002) and manually going
      in and enabling the event before monitoring it:
      
        cd /sys/bus/iio/devices/iio\:device2/events
        # ls
        in_proximity_thresh_either_en
        # echo 1 > in_proximity_thresh_either_en
      
      I realized that it's better if the iio_event_monitor is
      smart enough to enable all events by itself and disable them
      after use, if passed the -a flag familiar from the
      iio_generic_buffer tool.
      
      Auto-enabling events depend on the hardware being able
      to handle all events at the same time which isn't
      necessarily the case, so a command line option is required
      for this.
      
      Cc: Bastien Nocera <hadess@hadess.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Link: https://lore.kernel.org/r/20210319135301.542911-1-linus.walleij@linaro.org
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      e1d392dc
    • Seiya Wang's avatar
      dt-bindings: iio: adc: Add compatible for Mediatek MT8195 · 346e19ec
      Seiya Wang authored
      
      
      This commit adds dt-binding documentation of auxadc for Mediatek MT8195 SoC
      Platform.
      
      Signed-off-by: default avatarSeiya Wang <seiya.wang@mediatek.com>
      Link: https://lore.kernel.org/r/20210319023427.16711-7-seiya.wang@mediatek.com
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      346e19ec
    • LI Qingwu's avatar
      iio:magnetometer: Add Support for ST IIS2MDC · c71cfe55
      LI Qingwu authored
      
      
      Add support for ST magnetometer IIS2MDC,
      an I2C/SPI interface 3-axis magnetometer.
      The patch was tested on the instrument with IIS2MDC via I2C interface.
      
      Signed-off-by: default avatarLI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
      Link: https://lore.kernel.org/r/20210317063902.19300-3-Qing-wu.Li@leica-geosystems.com.cn
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      c71cfe55
    • LI Qingwu's avatar
      dt-bindings: iio: st,st-sensors add IIS2MDC. · ac62f90c
      LI Qingwu authored
      
      
      Add support for ST magnetometer IIS2MDC,
      an I2C/SPI interface 3-axis magnetometer sensor.
      The patch was tested on the instrument with IIS2MDC via I2C interface.
      
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>
      Link: https://lore.kernel.org/r/20210317063902.19300-2-Qing-wu.Li@leica-geosystems.com.cn
      
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      ac62f90c