24 Aug, 2018

1 commit

  • [ Upstream commit 13399ff25f179811ce9c1df1523eb39f9e4a4772 ]

    According to IIO ABI relative humidity reading should be
    returned in milli percent.

    This patch addresses that by applying proper scaling and
    returning integer instead of fractional format type specifier.

    Note that the fixes tag is before the driver was heavily refactored
    to introduce spi support, so the patch won't apply that far back.

    Signed-off-by: Tomasz Duszynski
    Fixes: 14beaa8f5ab1 ("iio: pressure: bmp280: add humidity support")
    Acked-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Tomasz Duszynski
     

29 Mar, 2018

1 commit

  • commit 8b438686a001db64c21782d04ef68111e53c45d9 upstream.

    Commit 7383d44b added a pointer pdata which get set to the default
    platform_data when non was defined in the device. But it did not
    pass this pointer to the st_sensors_init_sensor call but still
    used the maybe uninitialized platform_data from dev.

    This breaks initialization when no platform_data is given and
    the optional st,drdy-int-pin devicetree option is not set.

    This commit fixes this.

    Cc: stable@vger.kernel.org
    Fixes: 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform data properly")
    Signed-off-by: Michael Nosthoff
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Greg Kroah-Hartman

    Michael Nosthoff
     

25 Dec, 2017

1 commit

  • [ Upstream commit e72a060151e5bb673af24993665e270fc4f674a7 ]

    Introduce register mask for data-ready status register since
    pressure sensors (e.g. LPS22HB) export just two channels
    (BIT(0) and BIT(1)) and BIT(2) is marked reserved while in
    st_sensors_new_samples_available() value read from status register
    is masked using 0x7.
    Moreover do not mask status register using active_scan_mask since
    now status value is properly masked and if the result is not zero the
    interrupt has to be consumed by the driver. This fix an issue on LPS25H
    and LPS331AP where channel definition is swapped respect to status
    register.
    Furthermore that change allows to properly support new devices
    (e.g LIS2DW12) that report just ZYXDA (data-ready) field in status register
    to figure out if the interrupt has been generated by the device.

    Fixes: 97865fe41322 (iio: st_sensors: verify interrupt event to status)
    Signed-off-by: Lorenzo Bianconi
    Reviewed-by: Linus Walleij
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lorenzo Bianconi
     

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

  • With gcc 4.1.2:

    drivers/iio/pressure/zpa2326.c: In function ‘zpa2326_wait_oneshot_completion’:
    drivers/iio/pressure/zpa2326.c:868: warning: ‘ret’ may be used uninitialized in this function

    When testing for "timeout < 0", timeout is already guaranteed to be
    strict negative, so the branch is always taken, and ret is thus always
    initialized. But (some version of) gcc is not smart enough to notice.

    Remove the check to fix this.
    As there is no other code in between assigning the error codes and
    returning them, the error codes can be returned immediately, and the
    intermediate variable can be dropped.
    Drop the "else" to please checkpatch.

    Fixes: e7215fe4d51e69c9 ("iio: pressure: zpa2326: report interrupted case as failure")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Jonathan Cameron

    Geert Uytterhoeven
     

25 Sep, 2017

1 commit

  • …/jic23/iio into staging-linus

    Jonathan writes:

    First round of IIO fixes for the 4.14 cycle

    Note this includes fixes from recent merge window. As such the tree
    is based on top of a prior staging/staging-next tree.

    * iio core
    - return and error for a failed read_reg debugfs call rather than
    eating the error.
    * ad7192
    - Use the dedicated reset function in the ad_sigma_delta library
    instead of an spi transfer with the data on the stack which
    could cause problems with DMA.
    * ad7793
    - Implement a dedicate reset function in the ad_sigma_delta library
    and use it to correctly reset this part.
    * bme280
    - ctrl_reg write must occur after any register writes
    for updates to take effect.
    * mcp320x
    - negative voltage readout was broken.
    - Fix an oops on module unload due to spi_set_drvdata not being called
    in probe.
    * st_magn
    - Fix the data ready line configuration for the lis3mdl. It is not
    configurable so the st_magn core was assuming it didn't exist
    and so wasn't consuming interrupts resulting in an unhandled
    interrupt.
    * stm32-adc
    - off by one error on max channels checking.
    * stm32-timer
    - preset should not be buffered - reorganising register writes avoids
    this.
    - fix a corner case in which write preset goes wrong when a timer is
    used first as a trigger then as a counter with preset. Odd case but
    you never know.
    * ti-ads1015
    - Fix setting of comparator polarity by fixing bitfield definition.
    * twl4030
    - Error path handling fix to cleanup in event of regulator
    registration failure.
    - Disable the vusb3v1 regulator correctly in error handling
    - Don't paper over a regulator enable failure.

    Greg Kroah-Hartman
     

24 Sep, 2017

1 commit

  • The ctrl_reg register needs to be written after any write to
    the humidity registers. The value written to the ctrl_reg register
    does not necessarily need to change, but a write operation must
    occur.

    The regmap_update_bits functions will not write to a register
    if the register value matches the value to be written. This saves
    unnecessary bus operations. The change in this patch forces a bus
    write during the chip_config operation by switching to
    regmap_write_bits.

    This will fix issues where the Humidity Sensor Oversampling bits
    are not updated after initialization.

    Signed-off-by: Colin Parker
    Acked-by: Andreas Klinger
    Cc:
    Signed-off-by: Jonathan Cameron

    Colin Parker
     

28 Aug, 2017

1 commit


21 Aug, 2017

1 commit

  • …/iio into staging-next

    Jonathan writes:

    Second set of IIO new device support, features and cleanup for the 4.14 cycle.

    New device support:
    * ak8974
    - support the AMI306.
    * st_magnetometer
    - add support for the LIS2MDL with bindings.
    * rockchip-saradc
    - add binding for rv1108 SoC (no driver change).
    * srf08
    - add srf02 (i2c only) and srf10 support.
    * stm32-timer
    - support for the STM32H7 to existing driver.

    Features:
    * tools
    - move over to the tools buildsystem rather than hand rolling.
    - add an install section to the build.
    * ak8974
    - use serial number to add device randomness.
    - add AMI306 calibration data output.
    * ccs811
    - triggered buffer support.
    * srf08
    - add a device tree table as the old style i2c probing is going away,
    - add triggered buffer support
    * st32-adc
    - add optional st,min-sample-time-nsecs binding to allow control of
    sampling against analog circuitry.
    * stm32-timer
    - add output compare triggers.
    * ti-ads1015
    - add threshold event support.
    * ti-ads7950
    - Allow use on ACPI platforms including providing a default reference
    voltage as there is no way to obtain this on ACPI currently.

    Cleanup and fixes:
    * ad7606
    - fix an error return code in probe.
    * ads1015
    - fix incorrect data rate setting update when capture in progress,
    - fix wrong scale information for the ADS1115,
    - make conversions work when CONFIG_PM is not set,
    - make sure we don't get a stale result after a runtime resume by
    ensuring we wait long enough,
    - avoid returning a false error form the buffer setup callbacks,
    - add enough wait time to get the correct conversion,
    - remove an unnecessary config register update,
    - add a helper to set conversion mode reducing repeated boilerplate,
    - use devm_iio_triggered_buffer_setup to simplify error and remove
    paths,
    - use iio_device_claim_direct_mode instead of opencoding the same.
    * ak8974
    - mark the INT_CLEAR register as precious to prevent debugfs access.
    * apds9300
    - constify the i2c_device_id.
    * at91-sama5 adc
    - add missing Kconfig dependency.
    * bma180 accel
    - constify the i2c_device_id.
    * rockchip_saradc
    - explicitly request exclusive reset control as part of the reset rework
    on going throughout the kernel.
    * st_accel
    - fix drdy configuration for a load of accelerometers that only have
    the int1 line. Fix is unimportant as presumably no deviec tree actually
    used the non existent hardware line.
    * st_pressure
    - fix drdy configuration for LPS22HB and LPS25H by dropping int2 support
    as they don't have this. Fix is unimportant as presumably no device tree
    actually used the non existent hardware line.
    * stm32-dac
    - explicitly request exclusive reset control (part of reset being reworked).
    * tsl2583
    - constify the i2c_device_id.
    * xadc
    - coding style fixes.

    Greg Kroah-Hartman
     

15 Aug, 2017

1 commit


12 Aug, 2017

1 commit


30 Jul, 2017

1 commit

  • If the device is not initialized at least once it happens that the humidity
    reading is skipped, which means the special value 0x8000 is delivered.

    For omitting this case the oversampling of the humidity must be set before
    the oversampling of the temperature und pressure is set as written in the
    datasheet of the BME280.

    Furthermore proper error detection is added in case a skipped value is read
    from the device. This is done also for pressure and temperature reading.
    Especially it don't make sense to compensate this value and treat it as
    regular value.

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

    Andreas Klinger
     

24 Jul, 2017

1 commit

  • …/jic23/iio into staging-linus

    Jonathan writes:

    First set of IIO fixes for the 4.13 cycle.

    * ad2s1210
    - Fix negative angular velocity reads (identified by a gcc 7 warning)
    * aspeed-adc
    - Wait for initialization sequence to finish before enabling channels.
    Without it no channels work.
    * axp288
    - Revert a patch that dropped some bogus register mods. No one is entirely
    sure why but it breaks charging on some devices.
    - Fix GPADC pin read returning 0. Turns out a small sleep is needed.
    * bmc150
    - Make sure device is restored to normal state after suspend / resume
    cycle. Otherwise, simple sysfs reads are broken.
    * tsl2563
    - fix wrong event code.
    * st-accel
    - add spi 3-wire support. Needed to fix the lsm303agr accelerometer
    which only had 3 wires in all cases. Side effect is to enable optional
    3-wire support for other devices.
    * st-pressure
    - disable multiread by default for LPS22HB (only effects SPI)
    * sun4i-gpadc-iio
    - fix unbalanced irq enable / disable
    * vf610
    - Fix VALT slection for REFSEL bits - ensures we are using the
    right reference pins.

    Greg Kroah-Hartman
     

07 Jul, 2017

1 commit


02 Jul, 2017

1 commit


01 Jul, 2017

2 commits


25 Jun, 2017

1 commit

  • Set multiread variable to false for LPS22HB pressure sensor since
    it is already enabled in CTRL_REG2. Previous configuration does not
    cause any issue in I2C communication since SUB Msb has no meaning
    whereas it breaks register address in SPI communication

    Fixes: e039e2f5b4da (iio:st_pressure:initial lps22hb sensor support)
    Signed-off-by: Lorenzo Bianconi
    Cc:
    Signed-off-by: Jonathan Cameron

    Lorenzo Bianconi
     

14 May, 2017

1 commit


26 Apr, 2017

1 commit

  • This patch fixes the sensor platform data initialisation for st_pressure
    and st_accel device drivers. Without this patch, the driver fails to
    register the sensors when the user removes and re-loads the driver.

    1. Unload the kernel modules for st_pressure
    $ sudo rmmod st_pressure_i2c
    $ sudo rmmod st_pressure

    2. Re-load the driver
    $ sudo insmod st_pressure
    $ sudo insmod st_pressure_i2c

    Signed-off-by: Jonathan Cameron
    Acked-by: Linus Walleij

    Shrirang Bagul
     

23 Apr, 2017

1 commit


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

  • While calculating the compensation of the humidity there are negative values
    interpreted as unsigned because of unsigned variables used. These values as
    well as the constants need to be casted to signed as indicated by the
    documentation of the sensor.

    Signed-off-by: Andreas Klinger
    Acked-by: Linus Walleij
    Reviewed-by: Matt Ranostay
    Cc:
    Signed-off-by: Jonathan Cameron

    Andreas Klinger
     

10 Apr, 2017

1 commit


02 Apr, 2017

2 commits


19 Mar, 2017

2 commits

  • The driver doesn't have a struct of_device_id table but supported devices
    are registered via Device Trees. This is working on the assumption that a
    I2C device registered via OF will always match a legacy I2C device ID and
    that the MODALIAS reported will always be of the form i2c:.

    But this could change in the future so the correct approach is to have an
    OF device ID table if the devices are registered via OF.

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Jonathan Cameron

    Javier Martinez Canillas
     
  • The driver doesn't have a struct of_device_id table but supported devices
    are registered via Device Trees. This is working on the assumption that a
    I2C device registered via OF will always match a legacy I2C device ID and
    that the MODALIAS reported will always be of the form i2c:.

    But this could change in the future so the correct approach is to have an
    OF device ID table if the devices are registered via OF.

    Signed-off-by: Javier Martinez Canillas
    Signed-off-by: Jonathan Cameron

    Javier Martinez Canillas
     

11 Feb, 2017

3 commits

  • …/jic23/iio into staging-next

    Jonathan writes:

    First set of IIO fixes for the 4.11 cycle. Regression fixes from 4.10.

    These are fixes that came in just to late for the 4.10 cycle.

    Two drivers made an accidental assumption of structure arrangement for
    struct iio_dev that are no longer true. It was a typo in the first place
    that happened to work until some elements were added to the structure.

    * mpl3115
    - don't rely on structure field ordering
    * mpl115
    - don't rely on structure field ordering.

    Greg Kroah-Hartman
     
  • Fixes a regression triggered by a change in the layout of
    struct iio_chan_spec, but the real bug is in the driver which assumed
    a specific structure layout in the first place. Hint: the three bits were
    not OR:ed together as implied by the indentation prior to this patch,
    there was a comma between the first two, which accidentally moved the
    ..._SCALE and ..._OFFSET bits to the next structure field. That field
    was .info_mask_shared_by_type before the _available attributes was added
    by commit 51239600074b ("iio:core: add a callback to allow drivers to
    provide _available attributes") and .info_mask_separate_available
    afterwards, and the regression happened.

    info_mask_shared_by_type is actually a better choice than the originally
    intended info_mask_separate for the ..._SCALE and ..._OFFSET bits since
    a constant is returned from mpl115_read_raw for the scale/offset. Using
    info_mask_shared_by_type also preserves the behavior from before the
    regression and is therefore less likely to cause other interesting side
    effects.

    The above mentioned regression causes unintended sysfs attibutes to
    show up that are not backed by code, in turn causing a NULL pointer
    defererence to happen on access.

    Fixes: 3017d90e8931 ("iio: Add Freescale MPL115A2 pressure / temperature sensor driver")
    Fixes: 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes")
    Signed-off-by: Peter Rosin
    Cc:
    Signed-off-by: Jonathan Cameron

    Peter Rosin
     
  • Fixes a regression triggered by a change in the layout of
    struct iio_chan_spec, but the real bug is in the driver which assumed
    a specific structure layout in the first place. Hint: the two bits were
    not OR:ed together as implied by the indentation prior to this patch,
    there was a comma between them, which accidentally moved the ..._SCALE
    bit to the next structure field. That field was .info_mask_shared_by_type
    before the _available attributes was added by commit 51239600074b
    ("iio:core: add a callback to allow drivers to provide _available
    attributes") and .info_mask_separate_available afterwards, and the
    regression happened.

    info_mask_shared_by_type is actually a better choice than the originally
    intended info_mask_separate for the ..._SCALE bit since a constant is
    returned from mpl3115_read_raw for the scale. Using
    info_mask_shared_by_type also preserves the behavior from before the
    regression and is therefore less likely to cause other interesting side
    effects.

    The above mentioned regression causes an unintended sysfs attibute to
    show up that is not backed by code, in turn causing the following NULL
    pointer defererence to happen on access.

    Segmentation fault

    Unable to handle kernel NULL pointer dereference at virtual address 00000000
    pgd = ecc3c000
    [00000000] *pgd=87f91831
    Internal error: Oops: 80000007 [#1] SMP ARM
    Modules linked in:
    CPU: 1 PID: 1051 Comm: cat Not tainted 4.10.0-rc5-00009-gffd8858-dirty #3
    Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
    task: ed54ec00 task.stack: ee2bc000
    PC is at 0x0
    LR is at iio_read_channel_info_avail+0x40/0x280
    pc : [] lr : [] psr: a0070013
    sp : ee2bdda8 ip : 00000000 fp : ee2bddf4
    r10: c0a53c74 r9 : ed79f000 r8 : ee8d1018
    r7 : 00001000 r6 : 00000fff r5 : ee8b9a00 r4 : ed79f000
    r3 : ee2bddc4 r2 : ee2bddbc r1 : c0a86dcc r0 : ee8d1000
    Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
    Control: 10c5387d Table: 3cc3c04a DAC: 00000051
    Process cat (pid: 1051, stack limit = 0xee2bc210)
    Stack: (0xee2bdda8 to 0xee2be000)
    dda0: ee2bddc0 00000002 c016d720 c016d394 ed54ec00 00000000
    ddc0: 60070013 ed413780 00000001 edffd480 ee8b9a00 00000fff 00001000 ee8d1018
    dde0: ed79f000 c0a53c74 ee2bde0c ee2bddf8 c0513c58 c06fbbe8 edffd480 edffd540
    de00: ee2bde3c ee2bde10 c0293474 c0513c40 c02933e4 ee2bde60 00000001 ed413780
    de20: 00000001 ed413780 00000000 edffd480 ee2bde4c ee2bde40 c0291d00 c02933f0
    de40: ee2bde9c ee2bde50 c024679c c0291ce0 edffd4b0 b6e37000 00020000 ee2bdf78
    de60: 00000000 00000000 ed54ec00 ed013200 00000817 c0a111fc edffd540 ed413780
    de80: b6e37000 00020000 00020000 ee2bdf78 ee2bded4 ee2bdea0 c0292890 c0246604
    dea0: c0117940 c016ba50 00000025 c0a111fc b6e37000 ed413780 ee2bdf78 00020000
    dec0: ee2bc000 b6e37000 ee2bdf44 ee2bded8 c021d158 c0292770 c0117764 b6e36004
    dee0: c0f0d7c4 ee2bdfb0 b6f89228 00021008 ee2bdfac ee2bdf00 c0101374 c0117770
    df00: 00000000 00000000 ee2bc000 00000000 ee2bdf34 ee2bdf20 c016ba04 c0171080
    df20: 00000000 00020000 ed413780 b6e37000 00000000 ee2bdf78 ee2bdf74 ee2bdf48
    df40: c021e7a0 c021d130 c023e300 c023e280 ee2bdf74 00000000 00000000 ed413780
    df60: ed413780 00020000 ee2bdfa4 ee2bdf78 c021e870 c021e71c 00000000 00000000
    df80: 00020000 00020000 b6e37000 00000003 c0108084 00000000 00000000 ee2bdfa8
    dfa0: c0107ee0 c021e838 00020000 00020000 00000003 b6e37000 00020000 0001a2b4
    dfc0: 00020000 00020000 b6e37000 00000003 7fffe000 00000000 00000000 00020000
    dfe0: 00000000 be98eb4c 0000c740 b6f1985c 60070010 00000003 00000000 00000000
    Backtrace:
    [] (iio_read_channel_info_avail) from [] (dev_attr_show+0x24/0x50)
    r10:c0a53c74 r9:ed79f000 r8:ee8d1018 r7:00001000 r6:00000fff r5:ee8b9a00
    r4:edffd480
    [] (dev_attr_show) from [] (sysfs_kf_seq_show+0x90/0x110)
    r5:edffd540 r4:edffd480
    [] (sysfs_kf_seq_show) from [] (kernfs_seq_show+0x2c/0x30)
    r10:edffd480 r9:00000000 r8:ed413780 r7:00000001 r6:ed413780 r5:00000001
    r4:ee2bde60 r3:c02933e4
    [] (kernfs_seq_show) from [] (seq_read+0x1a4/0x4e0)
    [] (seq_read) from [] (kernfs_fop_read+0x12c/0x1cc)
    r10:ee2bdf78 r9:00020000 r8:00020000 r7:b6e37000 r6:ed413780 r5:edffd540
    r4:c0a111fc
    [] (kernfs_fop_read) from [] (__vfs_read+0x34/0x118)
    r10:b6e37000 r9:ee2bc000 r8:00020000 r7:ee2bdf78 r6:ed413780 r5:b6e37000
    r4:c0a111fc
    [] (__vfs_read) from [] (vfs_read+0x90/0x11c)
    r8:ee2bdf78 r7:00000000 r6:b6e37000 r5:ed413780 r4:00020000
    [] (vfs_read) from [] (SyS_read+0x44/0x90)
    r8:00020000 r7:ed413780 r6:ed413780 r5:00000000 r4:00000000
    [] (SyS_read) from [] (ret_fast_syscall+0x0/0x1c)
    r10:00000000 r8:c0108084 r7:00000003 r6:b6e37000 r5:00020000 r4:00020000
    Code: bad PC value
    ---[ end trace 9c4938ccd0389004 ]---

    Fixes: cc26ad455f57 ("iio: Add Freescale MPL3115A2 pressure / temperature sensor driver")
    Fixes: 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes")
    Reported-by: Ken Lin
    Tested-by: Ken Lin
    Signed-off-by: Peter Rosin
    Cc:
    Signed-off-by: Jonathan Cameron

    Peter Rosin
     

28 Jan, 2017

1 commit


21 Jan, 2017

1 commit

  • Driver was checking for direct mode before changing oversampling
    ratios, but was not locking it. Use the claim/release helper
    functions to guarantee the device stays in direct mode while the
    oversampling ratios are being updated. Continue to use the drivers
    private state lock to protect against conflicting direct mode access
    of the state data.

    Signed-off-by: Alison Schofield
    Signed-off-by: Jonathan Cameron

    Alison Schofield
     

30 Dec, 2016

2 commits

  • Both devices are using the same iio_chan_spec to define which settings
    are exported with sysfs. Both are properly configured to set/get
    sampling frequency for pressure and temperature. They also properly
    export available sampling frequencies. The only missing thing is
    sampling_frequency sysfs file, which allows to set/get this property
    from userspace.

    Add sampling frequency to iio channel info mask, so sampling_frequency
    file is properly exported using sysfs.

    Signed-off-by: Marcin Niestroj
    Reviewed-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Marcin Niestroj
     
  • Datasheet of each device (lps331ap, lps25h, lps001wp, lps22hb) says that
    the pressure and temperature data is a 2's complement.

    I'm sending this the slow way, as negative pressures on these are pretty
    unusual and the nature of the fixing of multiple device introduction patches
    will make it hard to apply to older kernels - Jonathan.

    Fixes: 217494e5b780 ("iio:pressure: Add STMicroelectronics pressures driver")
    Fixes: 2f5effcbd097 ("iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor")
    Fixes: 7885a8ce6800 ("iio: pressure: st: Add support for new LPS001WP pressure sensor")
    Fixes: e039e2f5b4da ("iio:st_pressure:initial lps22hb sensor support")
    Signed-off-by: Marcin Niestroj
    Reviewed-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Marcin Niestroj
     

03 Dec, 2016

2 commits

  • msleep(1~20) may not do what the caller intends, and will often sleep longer.
    (~20 ms actual sleep for any value given in the 1~20ms range)
    This is not the desired behaviour for many cases like device resume time,
    device suspend time, device enable time, data reading time, etc.
    Thus, change msleep to usleep_range for precise wakeups.

    Signed-off-by: Aniroop Mathur
    Signed-off-by: Jonathan Cameron

    Aniroop Mathur
     
  • Compatible strings are not available on ACPI based systems. This patch adds
    support to use DSDT information read from platform BIOS instead for probing
    st pressure sensors.

    Signed-off-by: Shrirang Bagul
    Signed-off-by: Jonathan Cameron

    Shrirang Bagul
     

12 Nov, 2016

1 commit

  • We have #defines for all the individual sensor registers and
    value/mask pairs #defined at the top of the file and used at
    exactly one spot.

    This is usually good if the #defines give a meaning to the
    opaque magic numbers.

    However in this case, the semantic meaning is inherent in the
    name of the C99-addressable fields, and that means duplication
    of information, and only makes the code hard to maintain since
    you every time have to add a new #define AND update the site
    where it is to be used.

    Get rid of the #defines and just open code the values into the
    appropriate struct elements. Make sure to explicitly address
    the .hz and .value fields in the st_sensor_odr_avl struct
    so that the meaning of all values is clear.

    This patch is purely syntactic should have no semantic effect.

    Signed-off-by: Linus Walleij
    Signed-off-by: Jonathan Cameron

    Linus Walleij
     

24 Oct, 2016

2 commits

  • …/iio into staging-next

    Jonathan writes:

    First round of IIO new device support, features and cleanups for the 4.10 cycle.

    Fair number of outreachy related patches in here. Some of these may well
    have already been picked up by Greg but git will sort that out for us.

    Also some good staging cleanup work from other sources. Thanks Brian and Lars
    in particular for this.

    New device support
    * ACCES 104-quad-8
    - New driver for this 8 channel encoder input board. Lots of new ABI with
    this one.
    * AD7766
    - New driver supporting AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1 and
    AD7767-2 24 bit ADCs.
    * dmard 10
    - New driver for this 3 axis accelerometer.
    * Honeywell ABP pressure sensors.
    - New driver covering 56 parts in this series (too many to list here!)
    * HTS221
    - New driver to support this relative humidiy and temperature device.
    * LMP91000
    - New driver for this potentiostat (form of chemical sensor). Nice example
    of use of the buffered consumer interfaces and the use of a consumer
    provided trigger.
    * MiraMEMS DA311
    - New driver for this 3 axis accelerometer.
    * MiraMEMS DA280
    - New driver for this 3 axis accelerometer. Follow up caught up with
    vendor prefixes for these.

    Staging graduations
    * isl29018 light sensor
    - Fixes and cleanups listed below (thanks for your hard work on this Brian!)
    * sca3000
    - Fixes and cleanups listed below. This was one of the small set of drivers
    that went into staging when IIO was first added. Turns out it had a few
    bugs and needed to be brought into the modern era! Not clear if I am
    the only person who actually has one of these still wired to a board.

    New features (Core)
    - Add an iio_trigger_validate_own_device helper which relies on the device
    and trigger having the same parent. Convenient to have this for some
    of the more complex trigger / device interactions. Was hand rolled in
    a few drivers already so good to bring it into the core.
    - Add an iio_read_channel_offset in kernel access helper (similar to
    the existing one for scale).
    - IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros. These
    lead some rather contrived function naming, but there is no denying they
    do reduced boilerplate. I'm going to resist their introduction in
    drivers 'unless' they form part of a larger set of cleanups.
    - Counter channel type and index type.

    New features (Drivers)
    * hdc100x
    - Triggered buffer support.
    * mcp4725
    - Device tree bindings and support.
    - Voltage reference selection.
    * ti-adc0832
    - Triggered buffer support.
    * ti-adc161s626
    - Add regulator support allowing _scale and _offset values to be established
    and exported.

    New features (Tools)
    * iio_generic_buffer
    - -A option to force enable all channels rather than faulting if some are
    already enabled (like -a does). Followup patches tidied this support up.

    Cleanups (Core)
    - Use kmalloc_array in iio_scan_mask_set.
    - Take event_attrs field of iio_info structure constant
    - Staging todo list updates. Most of it was long done.
    - MAINTAINERS had a wrong directory listing.

    Cleanups (Drivers)
    * Missing i2c trivial devices entries.
    * ad5592r
    - Fix an endian type related sparse warnings.
    * ad7150
    - Constify the event attribute_group structures.
    * ad7152
    - Add some blank lines to improve readability.
    - Sampling frequency control via chan-info element rather than hand rolled
    attributes.
    - add a new lock to avoid use of mlock for non state change related locking.
    * ad7280
    - Constify atrribute_group structure (second patch covers the event ones)
    * ad7606 (Lars is driving most of the cleanup on this with some additions from
    Eva)
    - Fix improper setting of oversampling pins. This has been broken a very
    long time in this staging driver, so not going to push this back to stable.
    - Implement oversampling configuration via the chan_info mask element.
    - Remove an unused int_vref_mv field.
    - Remove a reundant name field from ad7606_chip_info.
    - Remove default device configuration from platform_data in favour of
    whatever the power on defaults are.
    - Remove out of band error reporting in the kernel log as not providing
    much information.
    - Fix oversampling ratio by having 1 be the value for no oversampling.
    - Avoid allocating buffer for each data capture.
    - Factor out common code between periodic and one-shot capture.
    - Move set_drvdat into common code.
    - Let the common probe function return int rather than jumping through
    an ERR_PTR.
    - Pass struct device * into common remove to simplify code.
    - Always run trigger handler only once per event (no one can remember why
    it was being possibly done twice).
    - Move over to the GPIO descriptor API to shorten and clarify code.
    - Move the buffer code into the main file as it's not optional and is
    now rather short in this driver.
    - Fix the naming of the supply regulator.
    - Rework regulator handling to handle errors including deferred probing.
    - Tidy up a ptr_err or 0 return.
    * ad7746
    - Sampling frequency control via info_mask element rather than hand rolled
    * ad7758
    - Sampling frequency control via info_mask element rather than hand rolled
    attributes.
    * ad7816
    - Constify the event attribute_group structure.
    * adt7316
    - Constify the event attribute group structures.
    * ak8974
    - Cleanup some sparse warnings about endian types.
    * ak8975
    - Cleanup some sparse warnings about endian types.
    * bmi160
    - Spare endian warning cleanups.
    * isl29018 (towards staging graduation)
    - Remove unusedvariables and defines.
    - Improve consistency of error handling.
    - Signed / unsigned comparison fixes.
    - Use the IIO_DEVICE_ATTR_{RO, RW} macros
    - Fix a race in in_illuminance_scale_available_show.
    - Cleanup exit points of _read_raw
    - Sanity check if in suspended state during a write_raw call as was already
    done for read_raw.
    - Document device tree bidnings.
    - Document infrared supression controls.
    - Add some newlines to improve readability and drop one that shouldn't be
    there.
    - Fix a poorly named functions name.
    - Fix multiline coment syntax.
    - Tidy up a pair or return statements by unifying them.
    - Rename description in Kconfig for consistency with similar drivers.
    * lidar
    - cleanup power management by dropping unnecessary call.
    * ltr501
    - Use the claim_direct_mode helpers. Fix a race condition along the way.
    * max1027
    - Fix a dubious x | !y sparse warning.
    - Use the new iio_trigger_validate_own_device helper.
    * max440000
    - Clean up some sparse warnings about endian types.
    * mcp4725
    - Use the regulator framework to establish the reference voltage rather than
    getting it from platform data.
    - Tidy up a comment typo.
    - Fix a wrong PTR_ERR query (wrong regulator).
    * mma7660
    - Take a mma7660_nscale static.
    * mma8452
    - Use the new iio_trigger_validate_own_device helper.
    - Use claim_direct_mode helpers - fix a race condition along the way.
    * mpl3115
    - Use claim_direct_mode helpers - fix a race condition along the way.
    * ms65611
    - Tidy up regulator error handling and clean out a static warning in the mix.
    * sca3000
    - Avoid a potential unitialized variable if a hardware read returns a value
    that isn't actually supported (mostly warning supression).
    - Fix a use before setting of the indio_dev->buffer pointer. Broken for
    a very long time so not going to rush this into stable.
    - Merge buffer file with core file. We used to always split these.
    Sometimes it's just not worth the hassle. In this case the device's main
    feature is it's hardware fifos so unlikely anyone would want to run it
    without.
    - Drop the sca3000_register_ring_funcs function as it's a pointless wrapper
    once we have only one file.
    - Fix cleaning of flag + setting of size of scan. Without this you can't
    start the buffer twice and expect sensible (or any) results. Again,
    broken for a long time so not heading for stable.
    - Drop the custom watershed setting ABI - for now we'll just support one
    value.
    - Move to a hybrid hard / soft buffer design (how we've been doing it
    for similar devices for a while now!)
    - Cleanup some unusued variables.
    - Use a fake channel to support core handling of freefall event registration.
    - Cleanup the register defines.
    - Fix an off by one error in axis due to IIO_NO_MOD taking up the 0 value.
    Been broken since first admission of IIO to the staging tree.
    - Add readback of the 3db low pass filter frequency and later writing
    allowing droppign of custom measurement mode attributes as they can
    be represented by the filter choices that is their main characteristic.
    - Drop non standard revision attr and replace with dev_info on probe.
    - Avoid a race in probe.
    - Various formatting fixes.
    - Kernel-docify docs that were very nearly in the write format.
    * tsl2583
    - Constify attribute_group structure.
    * zpa2326
    - Drop a redundant DEBUG ifdef.

    Cleanups (Tools)
    * iio_generic_buffer
    - Fix the ? arguement. Previously it sort of worked as you got the help
    message as a result of it not recognising the arguement.

    Greg Kroah-Hartman
     
  • Driver was checking for direct mode but not locking it. Use
    claim/release helper functions to guarantee the device stays
    in direct mode during raw reads.

    Signed-off-by: Alison Schofield
    Signed-off-by: Jonathan Cameron

    Alison Schofield