21 May, 2019

1 commit


14 Apr, 2019

2 commits


05 Apr, 2019

2 commits

  • Add I2CXL-MaxSonar ultrasonic distance sensors of types mb1202, mb1212,
    mb1222, mb1232, mb1242, mb7040, mb7137 using an i2c interface

    Implemented functionality:
    - reading the distance via in_distance_raw
    - buffered mode with trigger
    - make use of interrupt to announce completion of ranging

    Add mb1232 driver to Kconfig and Makefile

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     
  • This driver's probe() uses a mix of devm_ and non-devm_ functions. This
    means that the remove order will not be the exact opposite of the probe
    order.

    Remove order:
    1. remove() executes:
    iio_device_unregister
    iio_triggered_buffer_cleanup
    iio_trigger_unregister
    (A)
    2. core frees devm resources in reverse order:
    free_irq
    iio_trigger_free
    iio_device_free

    In (A) the trigger has been unregistered, but the irq handler is still
    registered and active, so the trigger may still be touched via
    interrupt -> as3935_event_work. This is a potential use-after-unregister.

    Given that the delayed work is never canceled explicitly, it may run even
    after iio_device_free. This is a potential use-after-free.

    Solution: convert all probe functions to their devm_ equivalents.
    Add a devm callback, called by the core on remove right after irq_free,
    which explicitly cancels the delayed work. This will guarantee that all
    resources are freed in the correct order.

    As an added bonus, some boilerplate code can be removed.

    Signed-off-by: Sven Van Asbroeck
    Signed-off-by: Jonathan Cameron

    Sven Van Asbroeck
     

22 Sep, 2018

1 commit

  • This driver was originally written by ST in 2016 as a misc input device
    driver, and hasn't been maintained for a long time. I grabbed some code
    from it's API and reformed it into an iio proximity device driver.
    This version of driver uses i2c bus to talk to the sensor and
    polling for measuring completes, so no irq line is needed.
    It can be tested with reading from
    /sys/bus/iio/devices/iio:deviceX/in_distance_input

    Signed-off-by: Song Qiang
    Reviewed-by: Rob Herring
    Signed-off-by: Jonathan Cameron

    Song Qiang
     

02 Sep, 2018

1 commit

  • With gcc 4.1.2:

    drivers/iio/proximity/isl29501.c: In function ‘isl29501_register_write’:
    drivers/iio/proximity/isl29501.c:235: warning: ‘msb’ may be used uninitialized in this function

    While this is a false positive, it can easily be avoided by removing the
    "msb" intermediate variable.
    Remove the "lsb" intermediate variable for consistency.

    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Jonathan Cameron

    Geert Uytterhoeven
     

24 Jul, 2018

1 commit


14 Mar, 2018

1 commit

  • …/iio into staging-next

    Jonathan writes:

    Second set of new device support, features and cleanup for IIO in the 4.17 cycle

    The uptick in staging cleanup is partly due to GSoC Applications
    process being underway and one of Daniel's tasks being to try
    cleaning up an IIO driver to move out of staging.
    Naturally there is some normal staging cleanup progress in here
    as well.

    New device support
    * Microchip mcp4018
    - New driver supproting MCP4017, MCP4018 and MCP4019 digital pots.
    * On Semiconductor lv0104cs
    - New driver to support this ambient light sensor.

    Cleanup
    * axp20x_adc
    - remove a !! in favour of clear ternary operator.
    * ad2s1210 (staging cleanup)
    - Reorganise to avoid ending a line with [
    - Remove some unnecessary defines.
    - Remove unsed variable.
    * ad5380
    - Replace magic 0 with IIO_CHAN_INFO_RAW
    * ad5764
    - Replace magic 0 with IIO_CHA_INFO_RAW
    * ad7150 (staging cleanup)
    - Align arguements with parenthesis.
    * ad7152 (staging cleanup)
    - Align arguements.
    * ad7746 (staging cleanup)
    - Align arguements.
    * ad7816
    - Remove pointless void pointer cast.
    * ade7753
    - Replace IIO_DEV_ATTR_CH_OFF with equivalent to avoid confusing
    checkpatch (this macro didn't really help anyway). Also drop the
    macro from the meter.h header.
    * ade7754 (staging cleanup)
    - Add names to funciton definition arguements.
    - Align arguements with open parenthesis where possible.
    * ade7758 (staging cleanup)
    - Remove __func__ from dev_dbg statements as provided by dynamic
    debug anyway.
    - Align arguements with open parenthesis where possible.
    * ade7759 (staging cleanup)
    - Replace IIO_DEV_ATTR_CH_OFF with equiavalent to avoid confusing
    checkpatch.
    * adis16201 (staging cleanup)
    - Headers in alphabetical order.
    - Blank lines before returns.
    * adis16209 (staging cleanup)
    - Headers in alphabetical order
    - Change some definition names to make them more meaningful (2 rounds
    of this).
    - Add explicit _REG prefix to register names to make them
    obviously different from fields within those registers.
    - Remove some superflous comments and group definitions better.
    - Use a switch statement to make it semantically obvious that we
    only have two options (rather than an unlimited 'else').
    - Use sign_extent32 instead of open coding.
    * adt7316 (staging cleanup)
    - Move an export next to symbol.
    * bmc150
    - drop redundant __func__ in dynamic debug.
    * ccs811
    - Rename varaible to better reflect what it does.
    * cros_ec
    - Reduce sampling frequency before suspending to avoid preventing
    suspend.
    * dummy
    - Correct whitespace in Kconfig.
    - Add extra description in Kconfig.
    * ds1803
    - Remove a VLA which we always know is 2 long.
    * hid-sensor-accel
    - Replace magic number 0 by IIO_CHAN_INFO_RAW.
    * hid-sensor-gyro
    - Replace magic number 0 by IIO_CHAN_INFO_RAW.
    * hid-sensor-light
    - Replace magic number 0 by IIO_CHAN_INFO_RAW.
    * hid-sensor-magn
    - Replace magic number 0 by IIO_CHAN_INFO_RAW.
    * lm3533
    - Replace magic number 0 by IIO_CHAN_INFO_RAW
    * mlx90632
    - Squash a smatch warning - no runtime effect.
    * stm32_dfsdm:
    - Cleanup the dt bindings.
    * sx9500
    - Add GPIO ACPI mapping table to behave correctly when firmware
    doesn't provide the mapping.
    * tsl2x7x (staging cleanup)
    - Fix the proximity sensor functionality.
    - Remove platform data provided power functions. There are much
    better ways to do this these days.
    - Introduce some common functions to avoid various repititions.
    - Stop using mutex_trylock when mutex_lock and wait a bit is fine.
    - Improve error handling in various places.
    - Drop some 'Camel case' (which wasn't actually strickly camel case
    but was a bit odd.
    - Drop some _available sysfs attributes for things that don't exist
    (for particular supported parts).

    Greg Kroah-Hartman
     

03 Mar, 2018

1 commit

  • In order to satisfy GPIO ACPI library requirements convert users of
    gpiod_get_index() to correctly behave when there no mapping is provided
    by firmware.

    Here we add explicit mapping between _CRS GpioIo() resources and
    their names used in the driver.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Jonathan Cameron

    Andy Shevchenko
     

26 Feb, 2018

1 commit


18 Feb, 2018

1 commit


04 Feb, 2018

1 commit


06 Dec, 2017

1 commit


02 Dec, 2017

2 commits

  • The commit 0f0796509c07

    ("iio: remove gpio interrupt probing from drivers that use a single interrupt")

    removed custom IRQ assignment for the drivers which are enumerated via
    ACPI or OF. Unfortunately, some ACPI tables have IRQ line defined as
    GpioIo() resource and thus automatic IRQ allocation will fail.

    Partially revert the commit 0f0796509c07 to restore original behaviour.

    Signed-off-by: Andy Shevchenko
    Acked-by: Mika Westerberg
    Signed-off-by: Jonathan Cameron

    Andy Shevchenko
     
  • Add new ACPI ID for sx9500 as had been found on prototype board.

    Signed-off-by: Andy Shevchenko
    Signed-off-by: Jonathan Cameron

    Andy Shevchenko
     

14 Nov, 2017

1 commit

  • Pull staging and IIO updates from Greg KH:
    "Here is the "big" staging and IIO driver update for 4.15-rc1.

    Lots and lots of little changes, almost all minor code cleanups as the
    Outreachy application process happened during this development cycle.
    Also happened was a lot of IIO driver activity, and the typec USB code
    moving out of staging to drivers/usb (same commits are in the USB tree
    on a persistent branch to not cause merge issues.)

    Overall, it's a wash, I think we added a few hundred more lines than
    removed, but really only a few thousand were modified at all.

    All of these have been in linux-next for a while. There might be a
    merge issue with Al's vfs tree in the pi433 driver (take his changes,
    they are always better), and the media tree with some of the odd
    atomisp cleanups (take the media tree's version)"

    * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits)
    staging: lustre: add SPDX identifiers to all lustre files
    staging: greybus: Remove redundant license text
    staging: greybus: add SPDX identifiers to all greybus driver files
    staging: ccree: simplify ioread/iowrite
    staging: ccree: simplify registers access
    staging: ccree: simplify error handling logic
    staging: ccree: remove dead code
    staging: ccree: handle limiting of DMA masks
    staging: ccree: copy IV to DMAable memory
    staging: fbtft: remove redundant initialization of buf
    staging: sm750fb: Fix parameter mistake in poke32
    staging: wilc1000: Fix bssid buffer offset in Txq
    staging: fbtft: fb_ssd1331: fix mirrored display
    staging: android: Fix checkpatch.pl error
    staging: greybus: loopback: convert loopback to use generic async operations
    staging: greybus: operation: add private data with get/set accessors
    staging: greybus: loopback: Fix iteration count on async path
    staging: greybus: loopback: Hold per-connection mutex across operations
    staging: greybus/loopback: use ktime_get() for time intervals
    staging: fsl-dpaa2/eth: Extra headroom in RX buffers
    ...

    Linus Torvalds
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

23 Oct, 2017

1 commit


15 Oct, 2017

1 commit


26 Sep, 2017

1 commit

  • Most applications are too noisy to allow the default noise and
    watchdog settings, and thus need to be configurable via DT
    properties.

    Also default settings to POR defaults on a reset, and register
    distuber interrupts as noise since it prevents proper usage.

    Cc: devicetree@vger.kernel.org
    Signed-off-by: Matt Ranostay
    Acked-by: Rob Herring
    Signed-off-by: Jonathan Cameron

    Matt Ranostay
     

23 Aug, 2017

1 commit


18 Aug, 2017

4 commits

  • srf02 added with support for i2c interface

    Attributes for setting max range or sensitivity are omitted for the case of
    srf02 type sensor, because they are not supported by the hardware.

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     
  • Ultrasonic sensor srf10 is quite similar to srf08 and now also supported by
    the driver as device tree compatible string.

    It was necessary to prepare the source for supplementary sensors. This is
    done by enum srf08_sensor_type.

    The most significiant difference between srf08 and srf10 is another range
    and values of register gain (in the driver it's call sensitivity).
    Therefore the array of it is extended and dependent of the sensor type.

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     
  • Add support for triggered buffers.

    Data format is quite simple:
    distance 16 Bit
    alignment 48 Bit
    timestamp 64 Bit

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     
  • Added MODULE_DEVICE_TABLE for device tree bindings.

    It used to work without it by using the i2c_device_id table, but adding the
    table makes everything clear and documented.

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     

26 Jun, 2017

1 commit

  • …/iio into staging-next

    Jonathan writes:

    Second set of IIO new device support, features and cleanups for the 4.13 cycle.

    A few reverts here. One was a general failure to notice a device was already
    supported by another driver. The second is due to a review comment pointing
    out that the original patch was a bad idea and would break existing systems.

    Reverts
    * bma180
    - Revert addition of support for the BMA250E it is already supported by
    the bmc150-accel and better supported at that. Oops.
    * hi8435
    - The fix for cleanup of the reset gpio stuff isn't a good way to go. It
    breaks systems where an inverting level convertor is used. The right fix
    is to make the original devicetree correct - even if it involves patching
    the devicetree in kernel.

    New Device Support
    * stm32-adc
    - STM32H7 support and bindings.

    Features
    * core
    - add a hardware triggered operating mode for systems in which the actual
    trigger is never seen by the kernel. This is typically only used when
    a device 'can' use other triggers, but if a particular magic one is
    enabled the interrupt is effectively handled in hardware and we never see
    it.
    * st-lsm6dsx
    - support active low interrupts.
    * stm32-adc
    - Make the core adc clock optional as not all hardware supported requires it.
    - Make the bus clock optional in the per instance driver as it may be shared
    by all instances of the ADC and is handled by the core.
    - Rework to have a data structure representing the device type specific
    elements.
    * stm32-trigger (and counter)
    - Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
    - Add an attribute to configure device modes for quadrature counting etc.

    Clean ups and minor fixes
    * IIO core.
    - use __sysfs_match_string() helper rather than open coding the same.
    * ad7791
    - use sysfs_match_string() helper rather than open coding the same.
    * aspeed-adc
    - handle return value of clk_prepare_enable
    * cpcap
    - Fix default register values and ensure the battery thermistor is enabled
    correctly.
    - Fix the reported die temperature where we can - docs are lacking.
    - Remove the hung interrupt quirk as no longer happens due to fix in the
    mfd driver.
    * hi8435
    - Remove &s from hi8435_info definition as unneeded and inconsistent.
    * hid-sensor-trgger
    - Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
    * ina2xx
    - Make the use of iio_info_mask* elements consistent for all channels.
    This doesn't have any visible effect, but acts as clear documentation of
    which channels various resulting attributes apply to.
    * lpc32xx
    - handle the return value of clk_prepare_enable.
    * meson-saradc
    - NULL instead of 0 for pointer.
    * mma9551
    - use NULL for GPIO connection ID to aid implementation fo ACPI support.
    Here the connection ID doesn't actually tell us anything and it is much
    easier to deal with the driver if it's not there.
    * mpu6050
    - Fix lock issues through use of a local mux.
    - Replace sprintf with scnprintf as appropriate.
    - Check whoami against all known values. This allows for a small number of
    boards where we are really fishing for the part not being present at all.
    It is unfortunately common to have undescribed changes to use newer chips.
    We paper over this but just emitting a warning for those cases as long as
    we know about.
    * mxs-lradc
    - Fix some non static warnings.
    * rcar-adc
    - Part of making the naming for this part consistent across the kernel.
    * st_accel
    - drop some spi_device_id entries for variants with no SPI support
    * st_magn
    - drop some spi_device_id entries for variants with no SPI support.
    * sx9500
    - Use devm_gpiod_get instead of indexed value with an index of 0 on all
    occasions.
    * twl4030
    - Drop unused twl4030_get_madc_conversion as callers removed now throughout
    kernel.
    - Unexport twl4030_madc_conversion() as no used only within this driver.
    - Drop twl4030_madc_user_params as not used now.
    - Drop twl4030_madc_request.func_cb as not used now.
    - Fold the twl4030-madc.h header into the driver as no longer used anywhere
    else in the kernel.
    * xilinx
    - Handle the return value of clk_prepare_enable

    Greg Kroah-Hartman
     

12 Jun, 2017

1 commit


11 Jun, 2017

1 commit


07 May, 2017

1 commit

  • Using iio_trigger_poll() can oops when multiple interrupts
    happen before the first is handled.

    Use iio_trigger_poll_chained() instead and use the timestamp
    when processed, since it will be in theory be 2 ms max latency.

    Fixes: 24ddb0e4bba4 ("iio: Add AS3935 lightning sensor support")
    Cc: stable@vger.kernel.org
    Signed-off-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Matt Ranostay
     

27 Apr, 2017

2 commits


26 Apr, 2017

1 commit

  • According to the datasheet the RCO must be recalibrated
    on every power-on-reset. Also remove mutex locking in the
    calibration function since callers other than the probe
    function (which doesn't need it) will have a lock.

    Fixes: 24ddb0e4bba4 ("iio: Add AS3935 lightning sensor support")
    Cc: George McCollister
    Signed-off-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Matt Ranostay
     

19 Apr, 2017

1 commit

  • …/jic23/iio into staging-next

    Jonathan writes:

    Fifth set of IIO fixes for the 4.11 cycle.

    As these are rather late in the cycle, they may sneak over into 4.12.
    There is a fix for a regression caused by another fix (hid sensors
    hardware seems to vary a lot in how various corner cases are handled).

    * ad7303
    - fix channel description. Numeric values were being passed as characters
    presumably leading to garbage from the userspace interface.
    * as3935
    - the write data macro was wrong so fix it.
    * bmp280
    - incorrect handling of negative values as being unsigned broke humidity
    calculation.
    * hid-sensor
    - Restore the poll and hysteresis values after resume as some hardware
    doesn't do it.
    * stm32-trigger
    - buglet in reading the sampling frequency

    Greg Kroah-Hartman
     

14 Apr, 2017

1 commit


01 Apr, 2017

1 commit

  • Check for attribute_group structures that are only stored in the
    attrs filed of iio_info structure. As the attrs field of iio_info
    structures is constant, so these attribute_group structures can also be
    declared constant.
    Done using coccinelle:

    @r1 disable optional_qualifier @
    identifier i;
    position p;
    @@
    static struct attribute_group i@p = {...};

    @ok1@
    identifier r1.i;
    position p;
    struct iio_info x;
    @@
    x.attrs=&i@p;

    @bad@
    position p!={r1.p,ok1.p};
    identifier r1.i;
    @@
    i@p

    @depends on !bad disable optional_qualifier@
    identifier r1.i;
    @@
    static
    +const
    struct attribute_group i={...};

    @depends on !bad disable optional_qualifier@
    identifier r1.i;
    @@
    +const
    struct attribute_group i;

    File size before:
    text data bss dec hex filename
    4037 288 0 4325 10e5 drivers/iio/proximity/as3935.o

    File size after:
    text data bss dec hex filename
    4101 256 0 4357 1105 drivers/iio/proximity/as3935.o

    Signed-off-by: simran singhal
    Signed-off-by: Jonathan Cameron

    simran singhal
     

19 Feb, 2017

1 commit


04 Feb, 2017

1 commit

  • This patch adds support for the ultrasonic ranger srf04 of devantech.

    This device is measuring the distance of objects in a range between 1 cm
    and 3 meters and a theoretical resolution of 3 mm.

    There are two GPIOs used:
    - trigger: set as output to the device when the measurement should start
    - echo: set by the device when the ultrasonic wave is sent out and reset
    when the echo is recognized; this needs to be an interrupt input

    The time between setting and resetting the echo pin is the time the
    waveform needed for one round trip. This time is recorded in the interrupt
    handler.

    The distance is calculated in the read function by using the ultrasonic
    speed at 20 degrees celsius which is about 343 m/s.

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     

29 Jan, 2017

1 commit

  • This is the IIO driver for devantech srf08 ultrasonic ranger which can be
    used to measure the distances to an object.

    The sensor supports I2C with some registers.

    Supported Features include:
    - read the distance in ranging mode in centimeters
    - output of the driver is directly the read value
    - together with the scale the driver delivers the distance in meters
    - only the first echo of the nearest object is delivered
    - set sensitivity as analog value in the range of 0-31 means setting
    gain register on device
    - set range registers; userspace enters max. range in millimeters in
    43 mm steps

    Features not supported by this driver:
    - ranging mode in inches or in microseconds
    - ANN mode
    - change I2C address through this driver
    - light sensor

    The driver was added in the directory "proximity" of the iio subsystem and
    the menu in den config is now called "Proximity and distance sensors"

    Signed-off-by: Andreas Klinger
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     

21 Jan, 2017

1 commit