17 Dec, 2018

1 commit

  • [ Upstream commit 0145b50566e7de5637e80ecba96c7f0e6fff1aad ]

    Before this commit sensor_hub_input_attr_get_raw_value() failed to take
    the signedness of 16 and 8 bit values into account, returning e.g.
    65436 instead of -100 for the z-axis reading of an accelerometer.

    This commit adds a new is_signed parameter to the function and makes all
    callers pass the appropriate value for this.

    While at it, this commit also fixes up some neighboring lines where
    statements were needlessly split over 2 lines to improve readability.

    Signed-off-by: Hans de Goede
    Acked-by: Srinivas Pandruvada
    Acked-by: Benjamin Tissoires
    Cc:
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Sasha Levin

    Hans de Goede
     

10 Oct, 2018

1 commit

  • [ Upstream commit 65099ea85e885c3ea1272eca8774b771419d8ce8 ]

    This reverts commit 535fba29b3e1afef4ba201b3c69a6992583ec0bd.

    Seems the submitter (er me, hang head in shame) didn't look at the datasheet
    enough to see that the registers are quite different.

    This needs to be reverted because a) would never work b) to open it be added
    to a Maxim RTDs (Resistance Temperature Detectors) under development by author

    Signed-off-by: Matt Ranostay
    Signed-off-by: Jonathan Cameron
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Matt Ranostay
     

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
     

01 Jul, 2017

1 commit


07 May, 2017

1 commit

  • MAX31856 is register equivalent to the MAX31855 but suppports J, N, R,
    S, T, E and B type thermocouples in addition to K-type.

    Data conversion for the various types happens transparently to the driver
    via probe type detection, and a LUT on the sensor.

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

    Matt Ranostay
     

19 Mar, 2017

1 commit

  • 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
    Tested-by: Crt Mori
    Acked-by: Crt Mori
    Signed-off-by: Jonathan Cameron

    Javier Martinez Canillas
     

05 Mar, 2017

1 commit

  • Environmental temperature sensor is a hid defined sensor,
    it measures temperature.

    More information can be found in:
    http://www.usb.org/developers/hidpage/HUTRR39b.pdf

    According to IIO ABI definition, IIO_TEMP data output unit is
    milli degrees Celsius. Add the unit convert from degree to milli degree.

    Signed-off-by: Song Hongyan
    Acked-by: Srinivas Pandruvada
    Signed-off-by: Jonathan Cameron

    Song Hongyan
     

19 Feb, 2017

1 commit


05 Feb, 2017

1 commit


31 Jan, 2017

1 commit

  • The IIO ABI specifies the name field of the IIO device as:

    Description of the physical chip / device for device X.
    Typically a part number.

    The tmp007 driver currently uses the name of the parent device instead.
    Change this to the part name to be in accordance with the ABI.

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Jonathan Cameron

    Lars-Peter Clausen
     

14 Jan, 2017

1 commit

  • This patch adds support for TI TMP007 - 16 bit IR thermopile sensor with integrated Math engine.
    Sensor takes care of calculating the object temperature with the help of calibrated constants stored in non-volatile memory,
    thereby reducing the calculation overhead.

    Signed-off-by: Manivannan Sadhasivam
    Acked-by: Rob Herring
    Signed-off-by: Jonathan Cameron

    Manivannan Sadhasivam
     

07 Nov, 2016

1 commit

  • …/iio into staging-testing

    Jonathan writes:

    Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle

    This includes two branch merges for elements that may also go via MFD.

    New device support
    * cros_ec
    - new driver to support these Chrome OS contiguous sensors which are behind
    the Chrome OS embedded controller. Requires a few minor MFD and chrome
    platform changes. One follow up fix deals with some dependency issues in
    Kconfig.
    * mpu-3050
    - new driver and device tree bindings for this venerable device.
    * st_accel
    - support for the lng2dm an

    Driver features
    * ad7192
    - Add DVdd regulator handling
    * ad9832
    - Add DVDD regulator handling
    * at91
    - Suspend and resume support
    * si7020
    - Device tree bindings
    * ti-am335x
    - DMA support - uses dma to accelerate short bursts of read back rather
    than full blown DMA buffer support. Greatly improved performance.
    Includes an MFD addition to give access to the address needed for DMA.
    * tsl2583
    - Device tree bindings

    Cleanups and minor fixes
    * ad7192
    - Fix regulator naming to match datasheet
    - Handle regulator errors correctly (so as to not break deferred probing)
    - Rename reg variable to reflect which regulator it is
    * ad5933
    - Fix regulator naming to match datasheet
    - Handle regulator errors correctly (so as to not break deferred probing)
    * ad7746
    - Fix a missing return value (fallout from previous patch set)
    * ad7780
    - Fix regulator naming to match datasheet
    - Handle regulator errors correctly (so as to not break deferred probing)
    * ad9832
    - Fix regulator naming to match datasheet
    - Handle regulator errors correctly (so as to not break deferred probing)
    - Rename reg regulator to reflect which one it is
    * ad9834
    - Fix regulator naming to match datasheet
    - Handle regulator errors correctly (so as to not break deferred probing)
    * hts221
    - Remove a duplicated include
    * maxim thermocouple
    - Handle a wrong storage side in read function. Prevent any problems that
    might be introduced by additions to this driver in future.
    * tsl2583 - big set from Brian Masney to drive this towards a staging
    graduation.
    - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
    - Improved error handling in various functions
    - Drop redundant power_state custom sysfs attribute.
    - Use IIO_*_ATTR* macros for remaining attributes.
    - Return an error code to userspace on invalid parameters being writen to
    sysfs files.
    - Add locking to various attribute accesses to remove possible races.
    - Add defines for various magic numbers.
    - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
    - Query only relevant registers in probe.
    - Tidy up ordering of code comments.
    - Remove a pointless power off sequence in taos_chip_on.
    - Don't bother shutting down the chip when updating the lux table.
    The table is held entirely in the driver and doesn't effect the chip at all.
    - Drop a redundant i2c call in taos_als_calibrate where the same register
    is read twice in a row.

    Greg Kroah-Hartman
     

26 Oct, 2016

1 commit

  • As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
    than 2 or 4 will result in undefined behavior:

    drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
    drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    This probably cannot happen, but returning -EINVAL here is appropriate
    and makes gcc happy and the code more robust.

    Fixes: 231147ee77f3 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Jonathan Cameron

    Arnd Bergmann
     

01 Oct, 2016

1 commit

  • Driver was reporting invalid raw read values for MAX6675 on big
    endian architectures. MAX6675 buffered mode is not affected, nor
    is the MAX31855.

    The driver was losing a 2 byte read value when it used a 32 bit
    integer buffer to store a 16 bit big endian value. Use big endian
    types to properly align buffers on big endian architectures.

    Fixes following sparse endianness warnings:
    warning: cast to restricted __be16
    warning: cast to restricted __be32
    Fixes checkpatch issue:
    CHECK: No space is necessary after a cast

    Signed-off-by: sayli karnik
    Fixes: 1f25ca11d84a ("iio: temperature: add support for Maxim
    thermocouple chips")
    Signed-off-by: Jonathan Cameron

    sayli karnik
     

30 Aug, 2016

1 commit

  • Fixes the following sparse warnings:

    drivers/iio/temperature/maxim_thermocouple.c:35:28: warning:
    symbol 'max6675_channels' was not declared. Should it be static?
    drivers/iio/temperature/maxim_thermocouple.c:52:28: warning:
    symbol 'max31855_channels' was not declared. Should it be static?
    drivers/iio/temperature/maxim_thermocouple.c:98:38: warning:
    symbol 'maxim_thermocouple_chips' was not declared. Should it be static?

    Signed-off-by: Wei Yongjun
    Reviewed-By: Matt Ranostay
    Signed-off-by: Jonathan Cameron

    Wei Yongjun
     

22 Aug, 2016

1 commit


10 Jul, 2016

1 commit


22 May, 2016

1 commit

  • The I2C drivers have an i2c_device_id array but that information isn't
    exported to the modules using the MODULE_DEVICE_TABLE() macro. So the
    modules autoloading won't work if the I2C device is registered using
    OF or legacy board files due missing alias information in the modules.

    The issue was found using Kieran Bingham's coccinelle semantic patch:
    https://lkml.org/lkml/2016/5/10/520

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

    Javier Martinez Canillas
     

28 Feb, 2016

1 commit


11 Oct, 2015

1 commit


04 Oct, 2015

1 commit


03 Oct, 2015

1 commit

  • Dan Carpenter reported a static checker report and after his mail I
    noticed that we actually return from function if positive value is
    obtained from i2c read. This was remainder from when code was not in
    separate function (which I changed during the review process).

    Static checker reported
    drivers/iio/temperature/mlx90614.c:167
    mlx90614_iir_search()
    warn: this cast is a no-op
    which meant that cast before negating is useless. Dan also proposed a
    solution on nicer bit operation form.

    Also changed magic number to macro in process as that was confusing.

    Reported-by: Dan Carpenter
    Signed-off-by: Crt Mori
    Signed-off-by: Jonathan Cameron

    Crt Mori
     

28 Aug, 2015

1 commit

  • Implemented Low pass 3db frequency filter which configures
    FIR and IIR values within the configuration register of EEPROM.
    For more standardized interface we have fixed the FIR value
    to 1024, while changes in IIR value are directly connected to
    filter responses. The new datasheet version will provide a
    simplified table (also in reStructured text format below) with
    this change, to provide quick overview of possible settings.

    Below sensor timings (bandwidth) are calculated for 3db frequency
    low pass filter.

    +--------------------+-----------------+
    | Filter setting (%) | Band width (Hz) |
    | (rounded to 1.0) | |
    +====================+=================+
    | 13 | 0.15 |
    +--------------------+-----------------+
    | 17 | 0.20 |
    +--------------------+-----------------+
    | 25 | 0.31 |
    +--------------------+-----------------+
    | 50 | 0.77 |
    +--------------------+-----------------+
    | 57 | 0.86 |
    +--------------------+-----------------+
    | 67 | 1.10 |
    +--------------------+-----------------+
    | 80 | 1.53 |
    +--------------------+-----------------+
    | 100 | 7.23 |
    +--------------------+-----------------+

    The diff is made towards togreg branch. Added myself to MAINTAINERS and
    authors as per discussion with Jonathan.

    Signed-off-by: Crt Mori
    Signed-off-by: Jonathan Cameron

    Crt Mori
     

13 Aug, 2015

1 commit

  • …3/iio into staging-next

    Jonathan writes:

    Second set of new device support, features and cleanup for the 4.3 cycle.
    Take 2 also includes a fix set that was too late for the 4.2 cycle.

    As we had a lot of tools and docs work in this set, I have broken those
    out into their own categories in this description.

    Fixes from the pull request '4th set of IIO fixes for the 4.2 cycle'.
    * Poll functions for both event chardev and the buffer one were returning
    negative error codes (via a positive value).
    * A recent change to lsiio adding some error handling that was wrong and
    stopped the tool working.
    * bmg160 was missing some dependencies in Kconfig
    * berlin2-adc had a misshandled register (wrote a value rather than a bitmap)

    New device support
    * TI opt3001 light sensor
    * TXC PA12 ALS and proximity sensor.
    * mcp3301 ADC support (in mcp320x driver)
    * ST lsm303agr accelerometer and magnetometer drivers (plus some st-sensors
    common support to allow different WHOAMI register addresses, devices with
    fixed scale and allow interrupt equiped magnetometers).
    * ADIS16305, ADIS16367, ADIS16445IMUs (in the adis16400 driver)
    * ADIS16266 gyro (in the adis16260 driver)
    * ADIS16137 gyro (in the adis16136 driver)

    New functionality
    * mmc35240 DT bindings.
    * Inverse unit conversion macros to aid handing of values written to sysfs
    attributes.

    Core cleanup
    * Forward declaration of struct iio_trigger to avoid a compile warning.

    Driver cleanup / fixes
    * mxs-lradc
    - Clarify which parts are supported.
    - Fix spelling erorrs.
    - Missing/extra includes
    - reorder includes
    - add datasheet name listings for all usable channels (to allow them
    to be bound by name from consumer drivers)
    * acpi-als - add some function prefixes as per general iio style.
    * bmc150_magn - replace a magic value with the existing define.
    * vf610 - determine possible sample frequencies taking into account the
    electrical characteristics (defining a minimum sample time)
    * dht11
    - whitespace
    - additional docs
    - avoid mulitple assignments in one line
    - Use the new funciton ktime_get_resolution_ns to cleanup a nasty trick
    previously used for timing.
    * Fix all drivers that consider 0 a valid IRQ for historical reasons.
    * Export I2C module alias info where previously missing (to allow autoprobing)
    * Export OF module alias info where previously missing.
    * mmc35240 - switch some variables into arrays to improve readability.
    * mlx90614 - define some magic numbers for readability.
    * bmc150_magn
    - expand area locked by a mutex to cover all the use of the
    data->buffer.
    - use descriptive naming for a mask instead of a magic value.
    * berin2-adc
    - pass up an error code rather that a generic error
    - constify the iio_chan_spec
    - some other little tidy ups.
    * stk8312
    - fix a dependency on triggered buffers in kconfig
    - add a check for invalid attribute values
    - improve error handling by returning error codes where possible and
    return immediately where relevant
    - rework macro defs to use GENMASK etc
    - change some variable types to reduce unnecessary casting
    - clean up code style
    - drop a local buffer copy for bulk reads and use the one in data->buffer
    instead.
    * adis16400 - the adis16448 gyroscope scale was wrong.
    * adis16480 - some more wrong scales for various parts.
    * adis16300 - has an undocumented product id and serial number registers so
    use them.
    * iio_simple_dummy - fix some wrong code indentation.
    * bmc150-accel - use the chip ID to detect the chip present rather than
    verifying the expected part was there. This was in response to a wrong
    ACPI entry on the WinBook TW100.
    * mma8452
    - fix _get_hp_filter_index
    - drop a double include
    - pass up an error code rather than rewriting it
    - range check input values to attribute writes
    - register defs tidy up using GENMASK and reordering them to be easier to
    follow.
    - various coding style cleanups
    - put the Kconfig entry in the write place (alphabetically).

    Tools related
    * Tools cleanup - drop an explicity NULL comparison, some unnecessary braces,
    use the ARRAY_SIZE macro, send error messages to stderr instead of dropping
    them in the middle of normal output.
    * Fix tools to allow that scale and offset attributes are optional.
    * More tools fixes including allowing true 32bit data (previously an overflow
    prevented more than 31bits)
    * Drop a stray header guard that ended up in a c file.
    * Make calc_digits static as it isn't exported or in the header.
    * Set ci_array pointer to NULL after free as a protection against non safe
    usage of the tools core code. Also convert a double pointer to a single
    one as the extra level of indirection was unnecessary.

    Docs
    * DocBook introduction by Daniel Baluta. Glad we are beginning to
    draw together some more introductory docs to suplement the various
    tools / examples.
    * Drop bytes_per_datum sysfs attribute docs as it no longer exists.
    * A whole load of missing / fixing of kernel-doc for the core of IIO.
    * Document the trigger name sysfs attribute in the ABI docs.
    * Minor typos in the ABI docs related to power down modes.

    Greg Kroah-Hartman
     

03 Aug, 2015

1 commit

  • Translates the magic constant numbers to named macros and add some
    additional comments about their meaning.

    The diff is made towards togreg branch as that branch seems to have the
    most recent updates of mlx90614 driver (many are yet to be merged).

    Signed-off-by: Crt Mori
    Acked-by: Peter Meerwald
    Signed-off-by: Jonathan Cameron

    Crt Mori
     

28 Jul, 2015

1 commit


21 Jul, 2015

1 commit


19 Jul, 2015

2 commits

  • Changed the offset to negative as usual equation is: (raw +
    offset)*scale and in this
    case offset should be negative (as we deduct 273.15 Kelvin to get temperature
    in Celsius).

    Signed-off-by: Crt Mori
    Acked-by: Peter Meerwald
    Signed-off-by: Jonathan Cameron

    Crt Mori
     
  • only SAMP_FREQ is writable

    Will lead to SAMP_FREQ being written by any attempt to write
    to the other exported attributes and hence a rather unexpected
    result!

    Signed-off-by: Peter Meerwald
    Cc:
    Signed-off-by: Jonathan Cameron

    Peter Meerwald
     

12 Jul, 2015

1 commit


05 Jul, 2015

2 commits


14 May, 2015

1 commit


19 Apr, 2015

2 commits


09 Apr, 2015

3 commits

  • The device uses the MSB of the returned temperature value as an error
    flag. Return a read error when this bit is set.

    Signed-off-by: Vianney le Clément de Saint-Marcq
    Cc: Arnout Vandecappelle (Essensium/Mind)
    Signed-off-by: Jonathan Cameron

    Vianney le Clément de Saint-Marcq
     
  • Add support for system sleep and runtime power management.

    To wake up the device, the SDA line should be held low for at least 33ms
    while SCL is high. As this is not possible using the i2c API (and not
    supported by all i2c adapters), a GPIO connected to the SDA line is
    needed. The GPIO is named "wakeup" and can be specified in a device
    tree with the "wakeup-gpios" binding.

    If the wake-up GPIO is not given, disable power management for the
    device. Entering sleep requires an SMBus byte access, hence power
    management is also disabled if byte access is not supported by the
    adapter.

    Signed-off-by: Vianney le Clément de Saint-Marcq
    Cc: Arnout Vandecappelle (Essensium/Mind)
    Signed-off-by: Jonathan Cameron

    Vianney le Clément de Saint-Marcq
     
  • The mapping from the 16-bit EEPROM value to the decimal 0-1 range is
    approximate. A special case ensures 0xFFFF shows as 1.0 instead of
    0.999998565.

    Writing to EEPROM requires an explicit erase by writing zero. In
    addition, it takes 20ms for the erase/write to complete. During this
    time no EEPROM register should be accessed. Therefore, two msleep()s
    are added to the write function and a mutex protects against concurrent
    access.

    Signed-off-by: Vianney le Clément de Saint-Marcq
    Cc: Arnout Vandecappelle (Essensium/Mind)
    Signed-off-by: Jonathan Cameron

    Vianney le Clément de Saint-Marcq
     

29 Mar, 2015

2 commits