28 Feb, 2018

1 commit

  • commit 511051d509ec54642dd6d30fdf2caa33c23619cc upstream.

    Functions for triggered buffer support are needed by this module.
    If they are not defined accidentally by another driver, there's an error
    thrown out while linking.

    Add a select of IIO_BUFFER and IIO_TRIGGERED_BUFFER in the Kconfig file.

    Signed-off-by: Andreas Klinger
    Fixes: a83195937151 ("iio: srf08: add triggered buffer support")
    Cc:
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Andreas Klinger
     

25 Feb, 2018

1 commit

  • [ Upstream commit e53111ad5deaef98d8c18a9933ef1f5624c5979d ]

    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
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     

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
     

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
     

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


31 Dec, 2016

1 commit


24 Oct, 2016

1 commit

  • Remove pm_runtime_mark_last_busy() call that wasn't need in the probe
    since the device should be put to sleep.

    Clarification from Matt:
    Basically it going to be suspended once pm_runtime_idle() is called,
    and setting the last busy is useless and not needed.
    Clearly this doesn't affect the device running but just makes the code
    more consistent with other uses.

    Signed-off-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Matt Ranostay
     

15 Sep, 2016

1 commit

  • …iio into staging-next

    Jonathan writes:

    Second set of iio new device support, features and cleanups for the 4.9 cycle.

    New device support
    * ad8801 dac
    - new driver supporting ad8801 and ad8803 DACs.
    * adc12138
    - new driver supporting TI adc12130/adc12132 and adc12138 ADCs.
    * ltc2485 adc
    - new driver
    * mxc6255
    - add support for the mxc6225 part name and fixup the ID check so it works.
    * vz89x VOC sensor
    - add support for the vz89te part which drops the voc_short channel and adds
    CRCs compared to other supported parts.

    New features
    * core
    - immutable triggers. These effectively grant exclusive control over a
    trigger. The typical usecase is a device representing an analog part
    (perhaps a MUX) that needs to control the sampling of a downstream
    ADC.
    - resource managed trigger registration and triggered_buffer_init.
    - iio_push_event now protected against case of the event interface
    registration not having yet occured. Only matters if an interrupt
    can occur during this window - might happen on shared interrupt lines.
    - helper to let a driver query if the trigger it is using is provided by
    itself (using the convention of both device and trigger having the same
    parent).
    * tools
    - iio-utils. Used channel modifier scaling in preference to generic scaling
    when both exist.
    * at91-adc
    - Add support for touchscreen switches closure time needed by some newer
    parts.
    * stx104
    - support the ADC channels on this ADC/DAC board. As these are the primary
    feature of the board also move the driver to the iio/adc directory.
    * sx9500
    - device tree bindings.

    Cleanups / Fixes
    * ad5755
    - fix an off-by-one on devnr limit check (introduced earlier this cycle)
    * ad7266
    - drop NULL check on devm_regulator_get_optional as it can't return NULL.
    * ak8974
    - avoid an unused functional warning due to rework in PM core code.
    - remove .owner field setting as done by i2c_core.
    * ina2xx
    - clear out a left over debug field from chip global data.
    * hid-sensors
    - avoid an unused functional warning due to rework in PM core code.
    * maxim-thermocouple
    - fix non static symbol warnings.
    * ms5611
    - fetch and enable regulators unconditionally when they aren't optional.
    * sca3000
    - whitespace cleanup.
    * st_sensors
    - fetch and enable regulators unconditionally rather than having them
    supported as optional regulators (missunderstanding on my part amongst
    others a while back)
    - followup to previous patch fixes error checking on the regulators.
    - mark symbols static where possible.
    - use the 'is it my trigger' help function. This prevents the odd case
    of another device triggering from the st-sensors trigger whilst the
    st-sensors trigger is itself not using it but rather using say an hrtimer.
    * ti-ads1015
    - add missing of_node_put.
    * vz89x
    - rework to all support of new devices.
    - prevent reading of a corrupted buffer.
    - fixup a return value of 0/1 in a bool returning function.

    Address updates
    - Vlad Dogaru email address change.

    Greg Kroah-Hartman
     

05 Sep, 2016

1 commit


03 Sep, 2016

1 commit


16 Aug, 2016

1 commit

  • There is only one waiter for the completion, therefore there
    is no need to use complete_all(). Let's make that clear by
    using complete() instead of complete_all().

    The usage pattern of the completion is:

    waiter context waker context

    sx9500_read_proximity()
    sx9500_inc_chan_users()
    sx9500_inc_data_rdy_users()
    wait_for_completion_interruptible()

    s9500_irq_thread_handler()
    complete()

    reinit_completion()

    Signed-off-by: Daniel Wagner
    Signed-off-by: Jonathan Cameron

    Daniel Wagner
     

15 Aug, 2016

1 commit


01 Jul, 2016

1 commit

  • Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
    userspace to select a particular POSIX clock for buffered samples and
    events timestamping.

    Following clocks, as listed in clock_gettime(2), are supported:
    CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
    CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
    CLOCK_TAI.

    Signed-off-by: Gregor Boirie
    Acked-by: Sanchayan Maity
    Signed-off-by: Jonathan Cameron

    Gregor Boirie
     

30 Jun, 2016

1 commit

  • …iio into staging-next

    Jonathan writes:

    Second round of new iio device support, features and cleanups in the 4.8 cycle

    Firstly some contact detail updates:
    * NXP took over freescale. Update the mma8452 header to reflect this.
    * Martin Kepplinger email address change in mma8452 header.
    * Adriana Reus has changed email address. Update .mailmap.
    * Matt Ranostay has changed email address. Update .mailmap.

    New Device Support
    * max1363
    - add the missing i2c_device_ids for a couple of parts so they can actually
    be used.
    * ms5867
    - add device ids for ms5805 and ms5837 parts.

    New Features
    * ad5755
    - DT support. This one was a bit controversial and under review for a long
    time. Still no one could come up with a better solution.
    * stx104
    - add gpio support
    * ti-adc081c
    - Add ACPI device ID matching.

    Core changes
    * Refuse to register triggers with duplicate names. There is no way to
    distinguish between them so this makes no sense. A few drivers do not
    generate unique names for each instance of the device present. We can't
    fix this without changing ABI so leave them and wait for someone to
    actually take the rare step of two identical accelerometers on the same
    board.
    * buffer-dma
    - use ARRAY_SIZE in a few appropriate locations.

    Tools
    * Fix the fact that the --trigger-num option in generic_buffer didn't allow
    0 which is perfectly valid in the ABI.

    Cleanups
    * as3935
    - improve error reporting.
    - remove redundant zeroing of a field in iio_priv.
    * gp2ap020a00f
    - use the iio_device_claim_*_mode helpers rather than open coding locking
    around mode changes.
    * isl29125
    - use the iio_device_claim_*_mode helpers rather than open coding locking.
    * lidar
    - use the iio_device_claim_*_mode helpers rather than open coding locking.
    * mma8452
    - more detail in devices supported description in comments (addresses and
    similar)
    * sca3000
    - add a missing error check.
    * tcs3414
    - use the iio_device_claim_*_mode helpers rather than open coding locking.
    * tcs3472
    - use the iio_device_claim_*_mode helpers rather than open coding locking.

    Greg Kroah-Hartman
     

28 Jun, 2016

2 commits

  • This is redundant as the containing stucture is allocated as part of
    iio_device_alloc using kzalloc and hence is already 0.

    Signed-off-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Matt Ranostay
     
  • gcc warns about a potentially uninitialized variable use
    in as3935_event_work:

    drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’:
    drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

    This case specifically happens when spi_w8r8() fails with a
    negative return code. We check all other users of this function
    except this one.

    As the error is rather unlikely to happen after the device
    has already been initialized, this just adds a dev_warn().
    Another warning already exists in the same function, but is
    missing a trailing '\n' character, so I'm fixing that too.

    Signed-off-by: Arnd Bergmann
    Reviewed-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Arnd Bergmann
     

20 Jun, 2016

1 commit


12 Jun, 2016

1 commit


30 May, 2016

1 commit


23 May, 2016

3 commits


28 Feb, 2016

1 commit