1. 25 Oct, 2016 3 commits
    • Arnd Bergmann's avatar
      staging: iio: cdc/ad7746: fix missing return value · 3089ec2c
      Arnd Bergmann authored
      As found by "gcc -Wmaybe-uninitialized", the latest change to the
      driver lacked an initalization for the return code in one of the
      added cases:
      
      drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’:
      drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      This sets it to IIO_VAL_INT, which I think is what we want here.
      
      Fixes: 2296c062 ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      3089ec2c
    • Linus Walleij's avatar
      iio: gyro: Add driver for the MPU-3050 gyroscope · 3904b28e
      Linus Walleij authored
      This adds a new driver for the Invensense MPU-3050 gyroscope.
      This driver is based on information from the rough input driver
      in drivers/input/misc/mpu3050.c and the scratch misc driver
      posted by Nathan Royer in 2011. Some years have passed but this
      is finally a fully-fledged driver for this gyroscope. It was
      developed and tested on the Qualcomm APQ8060 Dragonboard.
      
      The driver supports both raw and buffered input. It also
      supports the internal trigger mechanism by registering a trigger
      that can fire in response to the internal sample engine of the
      component. In addition to reading out the gyroscope sensor
      values, the driver also supports reading the temperature from
      the sensor.
      
      The driver currently only supports I2C but the MPU-3050 can
      also be used from SPI, so the I2C portions are split in their
      own file and we just use regmap to access all registers, so
      it will be trivial to plug in SPI support if/when someone has
      a system requiring this.
      
      To conserve power, the driver utilizes the runtime PM
      framework and will put the sensor in off mode and disable the
      regulators when unused, after a timeout of 10 seconds.
      
      The fullscale can be set for the sensor to 250, 500, 1000 or
      2000 deg/s. This corresponds to scale values of rougly 0.000122,
      0.000275, 0.000512 or 0.001068. By writing such values (or close
      to these) into "in_anglevel_scale", the corresponding fullscale
      can be chosen. It will default to 2000 deg/s (~35 rad/s).
      
      The gyro component can have DC offsets on all axes. These can be
      compensated using the standard sysfs ABI property
      "in_anglevel_[xyz]_calibbias". This is in positive/negative
      values of the raw values, so a suitable calibration bias can be
      determined by userspace by reading the "in_anglevel_[xyz]_raw"
      for a few iterations while holding the sensor still, create an
      average integer, and writing the negative inverse of that into
      "in_anglevel_[xyz]_calibbias". After this the hardware will
      automatically subtract the bias, also when using buffered
      readings.
      
      Since the MPU-3050 has an outgoing I2C port it needs to act as
      an I2C mux. This means that the device is switching I2C traffic
      to devices beyond it. On my system this is the only way to reach
      the accelerometer. The "sensor fusion" ability of the MPU-3050
      to directly talk to the device on the outgoing I2C port is
      currently not used by the driver, but it has code to allow I2C
      traffic to pass through so that the Linux kernel can reach the
      device on the other side with a kernel driver.
      
      Example usage with the native trigger:
      
      $ generic_buffer -a -c10 -n mpu3050
      iio device number being used is 0
      iio trigger number being used is 0
      No channels are enabled, enabling all channels
      Enabling: in_anglvel_z_en
      Enabling: in_timestamp_en
      Enabling: in_anglvel_y_en
      Enabling: in_temp_en
      Enabling: in_anglvel_x_en
      /sys/bus/iio/devices/iio:device0 mpu3050-dev0
      29607.142578 -0.117493 0.074768 0.012817 180788797150
      29639.285156 -0.117493 0.076904 0.013885 180888982335
      29696.427734 -0.116425 0.076904 0.012817 180989178039
      29742.857422 -0.117493 0.076904 0.012817 181089377742
      29764.285156 -0.116425 0.077972 0.012817 181189574187
      29860.714844 -0.115356 0.076904 0.012817 181289772705
      29864.285156 -0.117493 0.076904 0.012817 181389971520
      29910.714844 -0.115356 0.076904 0.013885 181490170483
      29917.857422 -0.116425 0.076904 0.011749 181590369742
      29975.000000 -0.116425 0.076904 0.012817 181690567075
      Disabling: in_anglvel_z_en
      Disabling: in_timestamp_en
      Disabling: in_anglvel_y_en
      Disabling: in_temp_en
      Disabling: in_anglvel_x_en
      
      The first column is the temperature in millidegrees, then the x,y,z
      axes in succession followed by the timestamp. Also tested successfully
      using the HRTimer trigger.
      
      Cc: Nick Vaccaro <nvaccaro@google.com>
      Cc: Ge Gao <ggao@invensense.com>
      Cc: Anna Si <asi@invensense.com>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: Crestez Dan Leonard <leonard.crestez@intel.com>
      Cc: Daniel Baluta <daniel.baluta@intel.com>
      Cc: Gregor Boirie <gregor.boirie@parrot.com>
      Cc: Peter Rosin <peda@axentia.se>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      3904b28e
    • Linus Walleij's avatar
      iio: gyro: Add MPU-3050 device tree bindings · e0549df6
      Linus Walleij authored
      This adds device tree bindings for the MPU-3050 gyroscope. Since it
      is the first set of bindings for a gyroscope, the folder for it
      is also created.
      
      Cc: devicetree@vger.kernel.org
      Cc: Peter Rosin <peda@axentia.se>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      e0549df6
  2. 24 Oct, 2016 14 commits
    • Pankaj Bharadiya's avatar
      staging: greybus: audio: remove redundant slot field · 49b9137a
      Pankaj Bharadiya authored
      gb_audio_manager_module_descriptor's intf_id field maintains the
      information about the interface on which module is connected hence
      having an extra slot field is redundant.
      
      Thus remove the slot field and its associated code.
      Signed-off-by: default avatarPankaj Bharadiya <pankaj.bharadiya@gmail.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: default avatarVaibhav Agarwal <vaibhav.sr@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      49b9137a
    • Rahul Krishnan's avatar
      Staging: Greybus: Fix trailing */ in block comments · 73270bb4
      Rahul Krishnan authored
      This patch fixes the following checkpath.pl warning
      WARNING: Block comments use a trailing */ on a separate line
      Signed-off-by: default avatarRahul Krishnan  <mrahul.krishnan@gmail.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      73270bb4
    • Rui Miguel Silva's avatar
      staging: greybus: es2: fix arpc request size · 7fec2bc9
      Rui Miguel Silva authored
      Fix size field of arpc message request by using the header size and not
      the pointer size.
      Signed-off-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
      Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7fec2bc9
    • Elise Lennion's avatar
      staging: greybus: audio_manager_sysfs: Replace sscanf with kstrto* to single variable conversion. · f9a21a3f
      Elise Lennion authored
      Fix checkpatch warning:
      
      WARNING: Prefer kstrto<type> to single variable sscanf
      
      kstrto* is designed to convert string to numerical value and makes
      it easier to understand what the code does.
      Signed-off-by: default avatarElise Lennion <elise.lennion@gmail.com>
      Reviewed-by: default avatarMark Greer <mgreer@animalcreek.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9a21a3f
    • Elise Lennion's avatar
      staging: xgifb: Remove unnecessary parentheses. · 5bc45c9d
      Elise Lennion authored
      The removed parentheses are unnecessary and don't add readability.
      
      Found using Coccinelle semantic patch:
      @@ expression e, e1, e2; @@
      e &=
      (
              (e1 == e2)
      |
      -       (e1)
      +       e1
      )
      
      @@ expression e, e1, e2; @@
      e |=
      (
              (e1 == e2)
      |
      -       (e1)
      +       e1
      )
      Signed-off-by: default avatarElise Lennion <elise.lennion@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5bc45c9d
    • Elise Lennion's avatar
      staging: vt6656: Remove unnecessary parentheses. · 596f1449
      Elise Lennion authored
      The removed parentheses are unnecessary and don't add readability.
      
      Found using Coccinelle semantic patch:
      @@ expression e, e1, e2; @@
      e +=
      (
              (e1 == e2)
      |
      -       (e1)
      +       e1
      )
      
      @@ expression e, e1, e2; @@
      e =
      (
              (e1 == e2)
      |
      -       (e1)
      +       e1
      )
      Signed-off-by: default avatarElise Lennion <elise.lennion@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      596f1449
    • Mihaela Muraru's avatar
      Staging: android: ion: Make a read-only structure · a0f204a4
      Mihaela Muraru authored
      This patch add const qualifier at the declaration of the structure.
      The structure become a read-only data, this increase the security.
      
      Found with Coccinelle:
      @r disable optional_qualifier@
      identifier s,i;
      @@
      * static struct s i ={...};
      Signed-off-by: default avatarMihaela Muraru <mihaela.muraru21@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a0f204a4
    • Elise Lennion's avatar
      staging: android: Remove unnecessary parentheses. · 9fdd532c
      Elise Lennion authored
      The removed parentheses are unnecessary and don't add readability.
      
      Found using Coccinelle semantic patch:
      @@ expression e, e1, e2; @@
      e =
      (
              (e1 == e2)
      |
      -       (e1)
      +       e1
      )
      Signed-off-by: default avatarElise Lennion <elise.lennion@gmail.com>
      Acked-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9fdd532c
    • Michael Zoran's avatar
      staging: vc04_services: Add casts to remove warnings in vchiq_core.c · f9bee6dd
      Michael Zoran authored
      When compiling vchiq_core.c for 64 bit, the compiler
      emits a few warnings that are not actual issues. This
      change adds a few casts to remove the extra unnecessary
      warnings.
      Signed-off-by: default avatarMichael Zoran <mzoran@crowfest.net>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f9bee6dd
    • Michael Zoran's avatar
      staging: vc04_services: Handle conversion from VCHIQ_SERVICE_HANDLE_T to VCHI_SERVICE_HANDLE_T · 8e8e2e36
      Michael Zoran authored
      A VCHIQ_SERVICE_HANDLE_T which is an int is stuffed into a
      VCHI_SERVICE_HANDLE_T which is a pointer, passed around, then
      converted back to a VCHIQ_SERVICE_HANDLE_T. Since the data is
      always actually a VCHIQ_SERVICE_HANDLE_T(int), never actually a
      pointer, it is safe to simply cast the two back in forth.
      
      Note that pointers are never stuffed into an int.
      Signed-off-by: default avatarMichael Zoran <mzoran@crowfest.net>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8e8e2e36
    • Michael Zoran's avatar
      staging: vc04_services: Convert pointers in shared state to offsets · 24a4262a
      Michael Zoran authored
      The arm processor core and the GPU have a shared data structure.
      This structure contains pointers to base linux kernel objects such as
      events.  The size of the pointer changes between 32 bit and 64 bit,
      so it is necessary to convert these pointers to offsets from the
      beginning of the state structure.
      
      Luckly, the GPU does not interpret these pointers/offsets,
      but this change is necessary to keep the structure the same since
      the GPU code is outside the scope of the linux kernel
      and can't be easily changed.
      Signed-off-by: default avatarMichael Zoran <mzoran@crowfest.net>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24a4262a
    • Michael Zoran's avatar
      staging: vc04_services: Change fields of page list structure to fixed length · e64568b8
      Michael Zoran authored
      The arm processor core and the GPU have shared data structures.
      One of these structures is a list of pages of data for messages.
      This structure can not change since it is dependent on the GPU
      firmware which is external to the kernel.  Convert the fields
      of this structure to fixed length fields.
      Signed-off-by: default avatarMichael Zoran <mzoran@crowfest.net>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e64568b8
    • Michael Zoran's avatar
      staging: vc04_services: Convert dsb() to dsb(sy) · 35b7ebda
      Michael Zoran authored
      The dsb() macro for 32 arm compiles to dsb(sy) in the binary file.
      This macro is no longer supported on arm64, so instead use dsb(sy)
      which is completely binary compatible.
      Signed-off-by: default avatarMichael Zoran <mzoran@crowfest.net>
      Reviewed-by: default avatarEric Anholt <eric@anholt.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      35b7ebda
    • Greg Kroah-Hartman's avatar
      Merge tag 'iio-for-4.10a' of... · c7c88e99
      Greg Kroah-Hartman authored
      Merge tag 'iio-for-4.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/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.
      c7c88e99
  3. 23 Oct, 2016 23 commits