1. 14 Apr, 2017 5 commits
    • Narcisa Ana Maria Vasile's avatar
      staging: iio: ad5933: Protect DIRECT mode using claim/release helpers · 984fb244
      Narcisa Ana Maria Vasile authored
      This device operates in DIRECT_MODE and BUFFER_HARDWARE mode.
      Replace usages of iio_dev->mlock with iio_device_{claim|release}_direct_mode()
      helper functions to guarantee DIRECT mode and consequently protect
      BUFFER mode too.
      
      Add and use a device private lock to protect against conflicting access of the
      state data.
      This helps with IIO subsystem redefining iio_dev->mlock to be used by
      the IIO core only for protecting device operating mode changes.
      ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.
      
      Protect changing of attributes inside ad5933_store(). Attributes
      can no longer be changed while in buffered mode.
      
      Remove lock from ad5933_work() because buffer mode should be enabled
      when we reach this, and claiming DIRECT mode in all the other places
      should protect it.
      Signed-off-by: default avatarNarcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      984fb244
    • Akinobu Mita's avatar
      iio: adc: add max1117/max1118/max1119 ADC driver · a9e9c715
      Akinobu Mita authored
      This adds max1117/max1118/max1119 8-bit, dual-channel ADC driver.
      
      This new driver uses the zero length spi_transfers with the cs_change
      flag set and/or the non-zero delay_usecs.
      
      1. The zero length transfer with the spi_transfer.cs_change set is
      required in order to select CH1.  The chip select line must be brought
      high and low again without transfer.
      
      2. The zero length transfer with the spi_transfer.delay_usecs > 0 is
      required for waiting the conversion to be complete.  The conversion
      begins with the falling edge of the chip select.  During the conversion
      process, SCLK is ignored.
      
      These two usages are unusual.  But the spi controller drivers that use
      a default implementation of transfer_one_message() are likely to work.
      (I've tested this adc driver with spi-omap2-mcspi and spi-xilinx)
      
      On the other hand, some spi controller drivers that have their own
      transfer_one_message() may not work.  But at least for the zero length
      transfer with delay_usecs > 0, I'm proposing a new testcase for the
      spi-loopback-test that can test whether the delay_usecs setting has
      taken effect.
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Lars-Peter Clausen <lars@metafoo.de>
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mark Brown <broonie@kernel.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      a9e9c715
    • Chen Guanqiao's avatar
      iio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR, S_IXUGO) · d97a9132
      Chen Guanqiao authored
      Removing use of deprecated macros(S_IRUGO, S_IWUSR, S_IXUGO), and replace
      with 4 digit octal.
      Signed-off-by: default avatarChen Guanqiao <chen.chenchacha@foxmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      d97a9132
    • Benjamin Gaignard's avatar
      iio: stm32 trigger: Add counter enable modes · 2a830a45
      Benjamin Gaignard authored
      Device counting could be controlled by the level or the edges of
      a trigger.
      in_count0_enable_mode attibute allow to set the control mode.
      Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@st.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      2a830a45
    • Benjamin Gaignard's avatar
      iio: stm32 trigger: Add quadrature encoder device · 4adec7da
      Benjamin Gaignard authored
      One of the features of STM32 trigger hardware block is a quadrature
      encoder that can counts up/down depending of the levels and edges
      of the selected external pins.
      
      This patch allow to read/write the counter, get it direction,
      set/get quadrature modes and get scale factor.
      
      When counting up preset value is the limit of the counter.
      When counting down the counter start from preset value down to 0.
      This preset value could be set/get by using
      /sys/bus/iio/devices/iio:deviceX/in_count0_preset attribute.
      Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@st.com>
      Reviewed-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      4adec7da
  2. 08 Apr, 2017 10 commits
  3. 03 Apr, 2017 4 commits
    • Fabrice Gasnier's avatar
      iio: adc: stm32: add dt option to set resolution · 25a85bed
      Fabrice Gasnier authored
      stm32 adc supports several resolution. Add 'assigned-resolution-bits'
      dt optional property to set it. Default to maximum resolution in case
      it isn't set.
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      25a85bed
    • Fabrice Gasnier's avatar
      dt-bindings: iio: stm32-adc: add option to set resolution · 02108730
      Fabrice Gasnier authored
      Add documentation for 'assigned-resolution-bits' dt optional property.
      Signed-off-by: default avatarFabrice Gasnier <fabrice.gasnier@st.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      02108730
    • Peter Rosin's avatar
      iio: gyro: mpu3050: stop double error reporting · 6a95d825
      Peter Rosin authored
      i2c_mux_add_adapter already logs a message on failure.
      Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      6a95d825
    • Greg Kroah-Hartman's avatar
      Merge tag 'iio-for-4.12c' of... · edf5e794
      Greg Kroah-Hartman authored
      Merge tag 'iio-for-4.12c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
      
      Third set of new device support, cleanups and features for IIO in the 4.12 cycle
      
      Somewhat dominated in patch numbers of last of the outreachy application
      window related patches (they are still coming, despite window being closed
      which is good to see!)
      
      Good set of new drivers as well.
      
      New device support
      * ASPEED ADC
        - new driver
      * cpcap PMIC ADC
        - new driver
      * hid-humidity
        - driver for HID compatible humidity sensors.
      * ltc2497 ADC
        - new driver
      * mpu6050
        - bring bindings up to date and add trivial support for 9250
      * rockchip-saradc
        - update bindings to cover rk3328
      * vl6180 light, proximity and time of flight sensor.
        - new driver
      
      Features
      * meson-saradc
        - add calibration
      
      Cleanup and minor fixes
      * ad5504
        - constify attribute_group structure
        - drop casting of void *
      * ad7150
        - replace some shifts of 1 by BIT macro usage
      * ad7152
        - blank lines between function definitions
      * ad7280a
        - octal permissions.
      * ad7606
        - replace use of core mlock mutex with a local lock
      * ad7746
        - replace some shifts of 1 by BIT macro usage
        - function parameter alignment
        - drop some excessive brackets (introduced in last pull request)
      * ad7753
        - white space cleanup
      * ad7754
        - includes in alphabetical order and groupped appropriately.
        - change from missuse of internal mlock mutex to using the buffer lock to
        also protect values during frequency update.
      * ad779x
        - constify attribute_group structures
      * ad9832
        - octal permissions
      * adis16060
        - remove use of core mlock mutex in favour of adding a local
        _spi_write_then_read which can use the local buffer protection lock.
        - fix naming of above function.
      * adis16203
        - remove locking during reads of calibbias that doesn't protect anything
        not protected elsewhere.
      * adis16209
        - remove unnecessary braces in single statement if
      * adis16240
        - remove unnecessary braces in single statement if
      * adt7136
        - drop excess blank lines and put some in between functions.
      * ams-iaq
        - replace comma with semi colon. Not actual bug, just unusual syntax.
      * apds9960
        - constify attribute group structure
      * as3935
        - constify attribute group structure
      * bm1750
        - constify attribute group structure
      * cros_ec
        - devm version of triggered buffer setup to simplify code.
      * exynos
        - drop casting of void *
      * hdc100x
        - constify attribute_group structure
      * hid-accel
        - fix wrong scale for newly introduced gravity sensor.
      * hts221
        - drop casting of void *
      * hx711
        - constify attribute_group structure
      * imx7d_adc
        - drop casting of void *
      * lm35333
        - constify attribute_group structure
      * lsm6dsx
        - drop casting of void *
        - hold ODR configuration until enabling to avoid a race condition.
      * max1027
        - drop casting of void *
      * max11100
        - fix a comma where semicolon was intended (no actual bug, just odd)
      * max1363
        - constify attribute_group structure
      * ms sensors
        - drop casting of void *
      * rockchip_saradc
        - drop casting of void *
      * sun4i-gpadc
        - fix missing dependency on THERMAL or presence of stubs (issue only
        introduced in pervious set)
        - drop casting of void *
      * tsl2x7x
        - fix wrong standard deviation calc.  Note these aren't actually used for
        anything at the moment so bug didn't really matter.
        - constify attribute group structure.
      * vf610adc
        - drop casting of void *
      * vz89x
        - replace comma with semicolon. Not actual bug, just odd syntax.
      * zpa2326
        - drop casting of void *
      edf5e794
  4. 02 Apr, 2017 15 commits
  5. 01 Apr, 2017 6 commits
    • Rick Altherr's avatar
      iio: Aspeed ADC · 57380323
      Rick Altherr authored
      Aspeed BMC SoCs include a 16 channel, 10-bit ADC. Low and high threshold
      interrupts are supported by the hardware but are not currently implemented.
      Signed-off-by: default avatarRick Altherr <raltherr@google.com>
      Tested-by: default avatarXo Wang <xow@google.com>
      Reviewed-by: default avatarJoel Stanley <joel@jms.id.au>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      57380323
    • Rick Altherr's avatar
    • simran singhal's avatar
      staging: iio: light: tsl2x7x constify attribute_group structures · d952b4e6
      simran singhal authored
      As the event_attrs field of iio_info structures is constant, so these
      attribute_group structures can also be declared constant.
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
        15064	   1528	      0	  16592	   40d0
      drivers/staging/iio/light/tsl2x7x_core.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
        15192	   1400	      0	  16592	   40d0
      drivers/staging/iio/light/tsl2x7x_core.o
      Signed-off-by: default avatarsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      d952b4e6
    • simran singhal's avatar
      iio: adc: hx711: constify attribute_group structures · 4214dc18
      simran singhal authored
      Check for attribute_group structures that are only stored in the
      attrs filed of iio_info structure. As the attrs field of iio_info
      structures is constant, so these attribute_group structures can also be
      declared constant.
      Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         3042	    480	      0	   3522	    dc2	drivers/iio/adc/hx711.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
         3098	    416	      0	   3514	    dba	drivers/iio/adc/hx711.o
      Signed-off-by: default avatarsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      4214dc18
    • simran singhal's avatar
      iio: humidity: hdc100x: constify attribute_group structures · 757cff86
      simran singhal authored
      Check for attribute_group structures that are only stored in the
      attrs filed of iio_info structure. As the attrs field of iio_info
      structures is constant, so these attribute_group structures can also be
      declared constant.
      Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         3459	    488	      0	   3947	    f6b	drivers/iio/humidity/hdc100x.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
         3507	    424	      0	   3931	    f5b	drivers/iio/humidity/hdc100x.o
      Signed-off-by: default avatarsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      757cff86
    • simran singhal's avatar
      iio: light: apds9960: constify attribute_group structures · 3ca437c0
      simran singhal authored
      Check for attribute_group structures that are only stored in the
      attrs filed of iio_info structure. As the attrs field of iio_info
      structures is constant, so these attribute_group structures can also be
      declared constant.
      Done using coccinelle:
      
      @r1 disable optional_qualifier @
      identifier i;
      position p;
      @@
      static struct attribute_group i@p = {...};
      
      @ok1@
      identifier r1.i;
      position p;
      struct iio_info x;
      @@
      x.attrs=&i@p;
      
      @bad@
      position p!={r1.p,ok1.p};
      identifier r1.i;
      @@
      i@p
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      static
      +const
      struct attribute_group i={...};
      
      @depends on !bad disable optional_qualifier@
      identifier r1.i;
      @@
      +const
      struct attribute_group i;
      
      File size before:
         text	   data	    bss	    dec	    hex	filename
         8503	    488	      0	   8991	   231f	drivers/iio/light/apds9960.o
      
      File size after:
         text	   data	    bss	    dec	    hex	filename
         8567	    424	      0	   8991	   231f	drivers/iio/light/apds9960.o
      Signed-off-by: default avatarsimran singhal <singhalsimran0@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      3ca437c0