30 May, 2016

1 commit

  • commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded
    ("iio: st_sensors: verify interrupt event to status") caused
    a regression when reading ST sensors from a HRTimer trigger
    rather than the intrinsic interrupts: the HRTimer may
    trigger faster than the sensor provides new values, and
    as the check against new values available as a cause of
    the interrupt trigger was done in the poll function,
    this would bail out of the HRTimer interrupt with
    IRQ_NONE.

    So clearly we need to only check the new values available
    from the proper interrupt handler and not from the poll
    function, which should rather just read the raw values
    from the registers, put them into the buffer and be happy.

    To achieve this: switch the ST Sensors over to using a true
    threaded interrupt handler.

    In the interrupt thread, check if new values are available,
    else yield to the (potential) next device on the same
    interrupt line to check the registers. If the interrupt
    was ours, proceed to poll the values.

    Instead of relying on iio_trigger_generic_data_rdy_poll() as
    a top half to wake up the thread that polls the sensor for
    new data, have the thread call iio_trigger_poll_chained()
    after determining that is is the proper source of the
    interrupt. This is modelled on drivers/iio/accel/mma8452.c
    which is already using a properly threaded interrupt handler.

    In order to get the same precision in timestamps as
    previously, where samples would be timestamped in the
    poll function pf->timestamp when calling
    iio_trigger_generic_data_rdy_poll() we introduce a
    local timestamp in the sensor data, set it in the top half
    (fastpath) of the interrupt handler and provide that to the
    core when calling iio_push_to_buffers_with_timestamp().

    Additionally: if the active scanmask is not set for the
    sensor no IRQs should be enabled and we need to bail out
    with IRQ_NONE. This can happen if spurious IRQs fire when
    installing the threaded interrupt handler.

    Tested with hard interrupt triggers on LIS331DL, then also
    tested with hrtimers on the same sensor by creating a 75Hz
    HRTimer and using it to poll the sensor.

    Signed-off-by: Linus Walleij
    Cc: Giuseppe Barba
    Cc: Denis Ciocca
    Reported-by: Crestez Dan Leonard
    Tested-by: Crestez Dan Leonard
    Tested-by: Jonathan Cameron
    Fixes: 97865fe41322 ("iio: st_sensors: verify interrupt event to status")
    Signed-off-by: Jonathan Cameron

    Linus Walleij
     

29 May, 2016

1 commit

  • Temperature channels report scaled samples in Celsius although expected as
    milli degree Celsius in Documentation/ABI/testing/sysfs-bus-iio.
    Gains are not implemented at all for LPS001WP pressure and temperature
    channels.

    This patch ensures that proper offsets and scales are exposed to userpace
    for both pressure and temperature channels.
    Also fix a NULL pointer exception when userspace reads content of sysfs
    scale attribute when gains are not defined.

    Signed-off-by: Gregor Boirie
    Cc:
    Signed-off-by: Jonathan Cameron

    Gregor Boirie
     

15 May, 2016

1 commit

  • The bmp280 driver also supports BMP180 which has a different chip id
    with BMP280. The probe routine verifies that the device reports the
    correct chip id but the error message is confusing as if BMP280's chip
    id is always expected.

    Reported-by: Matt Ranostay
    Signed-off-by: Akinobu Mita
    Cc: Matt Ranostay
    Cc: Vlad Dogaru
    Cc: Christoph Mair
    Cc: Jonathan Cameron
    Cc: Hartmut Knaack
    Cc: Lars-Peter Clausen
    Cc: Peter Meerwald
    Signed-off-by: Jonathan Cameron

    Akinobu Mita
     

26 Apr, 2016

2 commits


24 Apr, 2016

1 commit


20 Apr, 2016

2 commits

  • Some types of ST Sensors can be connected to the same IRQ line
    as other peripherals using open drain. Add a device tree binding
    and a sensor data property to flip the right bit in the interrupt
    control register to enable open drain mode on the INT line.

    If the line is set to be open drain, also tag on IRQF_SHARED
    to the IRQ flags when requesting the interrupt, as the whole
    point of using open drain interrupt lines is to share them with
    more than one peripheral (wire-or).

    Cc: devicetree@vger.kernel.org
    Cc: Giuseppe Barba
    Cc: Denis Ciocca
    Acked-by: Rob Herring
    Signed-off-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Linus Walleij
     
  • This makes all ST sensor drivers check that they actually have
    new data available for the requested channel(s) before claiming
    an IRQ, by reading the status register (which is conveniently
    the same for all ST sensors) and check that the channel has new
    data before proceeding to read it and fill the buffer.

    This way sensors can share an interrupt line: it can be flaged
    as shared and then the sensor that did not fire will return
    NO_IRQ, and the sensor that fired will handle the IRQ and
    return IRQ_HANDLED.

    Cc: Giuseppe Barba
    Cc: Denis Ciocca
    Signed-off-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Linus Walleij
     

16 Apr, 2016

1 commit


03 Apr, 2016

1 commit


20 Mar, 2016

1 commit


05 Mar, 2016

2 commits

  • Add support for setting and retrieving OverSampling Rate independently for
    each of the temperature and pressure channels. This allows userspace to
    fine tune hardware sampling process according to the following tradeoffs :
    * the higher the OSR, the finer the resolution ;
    * the higher the OSR, the lower the noise ;
    BUT:
    * the higher the OSR, the larger the drift ;
    * the higher the OSR, the longer the response time, i.e. less samples per
    unit of time.

    Signed-off-by: Gregor Boirie
    Signed-off-by: Jonathan Cameron

    Gregor Boirie
     
  • Add device-tree ID tables and document bindings.

    Signed-off-by: Gregor Boirie
    Acked-by: Rob Herring
    Signed-off-by: Jonathan Cameron

    Grégor Boirie
     

28 Feb, 2016

1 commit


25 Feb, 2016

3 commits


18 Feb, 2016

1 commit

  • The ms5611 driver started using the IIO_TRIGGERED_BUFFER infrastructure
    which in turn depend on IIO_BUFFER, and it produces a build error now
    if that is not enabled:

    warning: (... && MS5611 && ...) selects IIO_TRIGGERED_BUFFER which has unmet direct dependencies (IIO && IIO_BUFFER)
    buffer/industrialio-triggered-buffer.c: In function 'iio_triggered_buffer_setup':
    buffer/industrialio-triggered-buffer.c:58:2: error: implicit declaration of function 'iio_device_attach_buffer' [-Werror=implicit-function-declaration]
    pressure/ms5611_core.c: In function 'ms5611_trigger_handler':
    pressure/ms5611_core.c:193:2: error: implicit declaration of function 'iio_push_to_buffers_with_timestamp' [-Werror=implicit-function-declaration]

    This adds the second select.

    Signed-off-by: Arnd Bergmann
    Fixes: 713bbb4efb9d ("iio: pressure: ms5611: Add triggered buffer support")
    Acked-by: Daniel Baluta
    Signed-off-by: Jonathan Cameron

    Arnd Bergmann
     

15 Feb, 2016

1 commit

  • …iio into staging-next

    Jonathan writes:

    2nd round of new IIO device support, features and cleanups for the 4.6 cycle.

    New Device Support
    * Apex stx104 DAC
    - new driver for this PC104 board. Right now DAC support only.
    * ADI ad5064
    - Add support for ad5625, ad5627, ad5645, ad5665, ad5667 DACs.
    - Add support for Linear Technology ltc2606, ltc2607, ltc2609, ltc2616,
    ltc2617, ltc2619, ltc2626, ltc2627 and ltc2629.
    * ADI ad7192
    - add support for the ad7193
    * Invensense mpu6050
    - substantial rework of driver to use regmap allowing SPI support extending
    the now split driver to cover the MPU6000.
    * TI adc0832
    - new driver supporting ADC0831, ADC0832, ADC0834 and ADC0838 ADCs.
    * TI ads1015
    - new driver, note that there is an existing hwmon driver. The long term
    intention is to probably remove the hwmon driver but for now we just have
    guards in place to ensure this driver is not built if that one is enabled.
    * TI afe4403
    - new driver for this heart rate monitor / pulse oximeter front end chip.
    * TI afe4404
    - new driver for this heart rate monitor / pulse oximeter front end chip.

    Staging Graduations
    * mxs-lradc
    - A combined general purpose and touch screen (input) device driver.
    Originally held in staging to allow reworking into and MFD but as
    that wasn't happening and isn't an absolute requirement we are moving
    it out of staging.

    Driver new features
    * ms5611
    - triggered buffer support
    - IIO_CHAN_INFO_SCALE to aid the triggered buffer support.

    Driver cleanups / reworks / fixes
    * ad5064
    - Use an enum for the register map layout to allow support of additional
    chips (precursor to the new support listed above).
    - Structural driver changes to allow support of the slightly different
    handling for the ltc parts above.
    * ad5933
    - drop an exceptional & unnecessary for a function pointer.
    * ad7606
    - Cleanup the repeated copies of pm ops.
    - consolidate the various channels specs via a sport of rearranging so only
    one version is needed.
    * atlas ph sensor
    - add select IRQ_WORK
    * hmc8543 (soon to move out of staging)
    - Comment style fixes
    - functionality of suspend and resume was swapped.
    * spear-adc
    - use devm_clk_dev instead of managing the clk lifetime by hand.

    Core
    * Use new dmaengine_terminate_sync call to avoid a theoretical race.
    * Fix docs for mlock in struct iio_dev as it is correctly taken in some
    drivers (docs used to say for core only).
    * Add a helper function for calculating the scan index storage size within
    the core cutting out some cut and paste versions of the same code.

    Greg Kroah-Hartman
     

08 Feb, 2016

1 commit


07 Feb, 2016

2 commits


31 Jan, 2016

4 commits

  • Clearly a high degree of cut and paste has gone on in this file, propogating
    a particularly random combination of tabs and spaces. This patch at least
    should make it all consistent going forward.

    Signed-off-by: Jonathan Cameron

    Jonathan Cameron
     
  • mpl115 driver currently supports i2c interface (MPL115A2).
    There is also SPI version (MPL115A1). The difference between them
    is only physical transport so we can easily support both while sharing
    most of the code.

    Split the driver into a core support module and one module each for I2C
    and SPI support.

    Signed-off-by: Akinobu Mita
    Cc: Jonathan Cameron
    Cc: Hartmut Knaack
    Cc: Lars-Peter Clausen
    Cc: Peter Meerwald
    Cc: linux-iio@vger.kernel.org
    Signed-off-by: Jonathan Cameron

    Akinobu Mita
     
  • mpl115 sets i2c clientdata, but it is not used anywhere. So remove it.

    Signed-off-by: Akinobu Mita
    Cc: Jonathan Cameron
    Cc: Hartmut Knaack
    Cc: Lars-Peter Clausen
    Cc: Peter Meerwald
    Cc: linux-iio@vger.kernel.org
    Signed-off-by: Jonathan Cameron

    Akinobu Mita
     
  • According to the datasheet, the resolusion of temperature sensor is
    -5.35 counts/C. Temperature ADC is 472 counts at 25C.
    (https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
    NOTE: This is older revision, but this information is removed from the
    latest datasheet from nxp somehow)

    Temp [C] = (Tadc - 472) / -5.35 + 25
    = (Tadc - 605.750000) * -0.186915888

    So the correct offset is -605.750000.

    Signed-off-by: Akinobu Mita
    Acked-by: Peter Meerwald-Stadler
    Cc:
    Signed-off-by: Jonathan Cameron

    Akinobu Mita
     

10 Jan, 2016

1 commit

  • Most ST MEMS Sensors that support interrupts can also handle sending
    an active low interrupt, i.e. going from high to low on data ready
    (or other interrupt) and thus triggering on a falling edge to the
    interrupt controller.

    Set up logic to inspect the interrupt line we get for a sensor: if
    it is triggering on rising edge, leave everything alone, but if it
    triggers on falling edges, set up active low, and if unsupported
    configurations appear: warn with errors and reconfigure the interrupt
    to a rising edge, which all interrupt generating sensors support.

    Create a local header for st_sensors_core.h to share functions
    between the sensor core and the trigger setup code.

    Cc: Giuseppe Barba
    Cc: Denis Ciocca
    Signed-off-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Linus Walleij
     

06 Nov, 2015

1 commit

  • Pull spi updates from Mark Brown:
    "Quite a lot of activity in SPI this cycle, almost all of it in drivers
    with a few minor improvements and tweaks in the core.

    - Updates to pxa2xx to support Intel Broxton and multiple chip selects.
    - Support for big endian in the bcm63xx driver.
    - Multiple slave support for the mt8173
    - New driver for the auxiliary SPI controller in bcm2835 SoCs.
    - Support for Layerscale SoCs in the Freescale DSPI driver"

    * tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits)
    spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
    spi: pxa2xx: Add support for Intel Broxton
    spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
    spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
    spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
    spi: Add DSPI support for layerscape family
    spi: ti-qspi: improve ->remove() callback
    spi/spi-xilinx: Fix race condition on last word read
    spi: Drop owner assignment from spi_drivers
    spi: Add THIS_MODULE to spi_driver in SPI core
    spi: Setup the master controller driver before setting the chipselect
    spi: dw: replace magic constant by DW_SPI_DR
    spi: mediatek: mt8173 spi multiple devices support
    spi: mediatek: handle controller_data in mtk_spi_setup
    spi: mediatek: remove mtk_spi_config
    spi: mediatek: Update document devicetree bindings to support multiple devices
    spi: fix kernel-doc warnings about missing return desc in spi.c
    spi: fix kernel-doc warnings about missing return desc in spi.h
    spi: pxa2xx: Align a few defines
    spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select
    ...

    Linus Torvalds
     

28 Oct, 2015

1 commit


11 Oct, 2015

2 commits


16 Aug, 2015

1 commit


24 Jul, 2015

1 commit


12 Jul, 2015

1 commit


05 Jul, 2015

2 commits


21 Jun, 2015

1 commit


25 May, 2015

1 commit

  • …/iio into staging-next

    Jonathan writes:

    Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle.

    Core functionality
    * i and q modifiers from quadrature channels.
    * IIO_CHAN_INFO_OVERSAMPLING_RATIO added.
    * High pass filter attributes added to mirror the existing low pass filter
    ones.

    Core cleanups
    * Make IIO tools building more cross compiler friendly.
    * Substantial rework of the function __iio_update_buffers to greatly simplify
    a hideously evolved function.

    New drivers and support
    * ACPI0008 ambient light sensor driver. This one has been around a long time to
    will be good to finally get it into mainline.
    * Berlin SOC ADC support.
    * BMC150 magnetometer. The accelerometer in the same package has been supported
    for quite some time, so good to have this half as well.
    * m62332 DAC driver
    * MEMSIC MMC35420 magnetometer.
    * ROHM BH1710 and similar ambient light sensors.
    * Sensortek STK3310 light sensor.
    * Sensortek STK8312 accelerometer.
    * Sensortek STK8BA50 accelerometer.
    * ti-adc128s052 gains support form the adc122s021 2 channel ADC.

    Driver cleanups and functionality.
    * Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled.
    * bmc150 - decouple trigger from buffer to allow other triggers to be used.
    * bmg160 - decouple trigger from buffer to allow other triggers to be used.
    Fix a trivial unused field.
    * Constify a load of platform_device_id structures.
    * inv_mpu6050 - device tree bindings.
    * hid-sensors - fix a memory leak during probe if certain errors occur.
    * ltr501 - illuminance channel derived (in an non obvious fashion) from the
    intensity channels.
    * ltr501 - fix a boundary check on the proximity threshold.
    * mlx90614 - drop a pointless return.
    * mma8452 - Debugfs register access and fix a bug that had no effect (by
    coincidence)
    * ti_am335x_adc - add device tree bindings for sample-delay, open-delay and
    averaging. The ideal settings for these tend to be board design specific.

    Greg Kroah-Hartman
     

17 May, 2015

1 commit


14 May, 2015

1 commit

  • …l/git/jic23/iio into staging-linus

    Jonathan writes:

    The usual mixed bag of fixes for IIO in the 4.1 cycle.

    Second version of this pull request as a small fix to a fix turned
    up before Greg pulled it for a cc10001 patch near the top of the tree.

    One core fix

    * Set updated for a iio kfifo was incorrectly set to false during a failed
    update, resulting in atttempts to repeat the failed operation appearing
    to succeed.

    This time I've decided to list the driver fixes in alphabetical order rather
    than 'randomly'.

    * axp288_adc - a recent change added a check for valid info masks when
    reading channels from consumer drivers.
    * bmp280 - temperature compensation was failing to read the tfine value, hence
    causing a temperature of 0 to always be returned and incorrect presure
    measurements.
    * cc10001 - Fix channel number mapping when some channels are reserved for
    remote CPUs. Fix an issue with the use of the power-up/power-down register
    (basically wrong polarity). Fix an issue due to the missinterpretting the
    return value from regulator_get_voltage. Add a delay before the start bit
    as recommended for the hardware to avoid data corruption.
    * hid pressure - fix channel spec of modfiied, but no modifier (which makes no
    sense!)
    * hid proximity - fix channel spec of modified, but no modifier (which makes
    no sense!). Fix a memory leak in the probe function.
    * mcp320x - occasional incorrect readings on dma using spi busses due to
    cacheline corruption. Fixed by forcing ___cacheline_aligned for the buffers.
    * mma9551 - buffer overrun fix (miss specified maximum length of buffers)
    * mma9553 - endian fix on status message. Add an enable element for activity
    channel. Input checking for activity period to avoid rather unpredictable
    results.
    * spmi-vadc - fix an overflow in the output value normalization seen on some
    boards.
    * st-snesors - oops due to use of a mutex that is not yet initialized during
    probe.
    * xilinx adc - Some wrong register addresses, a wrong address for vccaux
    channel, incorrect scale on VREFP and incorrect sign on VREFN.

    Greg Kroah-Hartman