1. 19 Apr, 2016 8 commits
    • Laxman Dewangan's avatar
      iio: core: Add devm_ APIs for iio_channel_{get,release}_all · efc2c013
      Laxman Dewangan authored
      Some of kernel driver uses the IIO framework to get the sensor
      value via ADC or IIO HW driver. The client driver get iio channel
      by iio_channel_get_all() and release it by calling
      iio_channel_release_all().
      
      Add resource managed version (devm_*) of these APIs so that if client
      calls the devm_iio_channel_get_all() then it need not to release it
      explicitly, it can be done by managed device framework when driver
      get un-binded.
      
      This reduces the code in error path and also need of .remove callback in
      some cases.
      Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      efc2c013
    • Laxman Dewangan's avatar
      iio: core: Add devm_ APIs for iio_channel_{get,release} · 8bf872d8
      Laxman Dewangan authored
      Some of kernel driver uses the IIO framework to get the sensor
      value via ADC or IIO HW driver. The client driver get iio channel
      by iio_channel_get() and release it by calling iio_channel_release().
      
      Add resource managed version (devm_*) of these APIs so that if client
      calls the devm_iio_channel_get() then it need not to release it explicitly,
      it can be done by managed device framework when driver get un-binded.
      
      This reduces the code in error path and also need of .remove callback in
      some cases.
      Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      8bf872d8
    • Linus Walleij's avatar
      iio: tools: generic_buffer: auto-enable channels · 5f991a92
      Linus Walleij authored
      If no channels are enabled when we run generic_buffer on a
      device, add a command-line option to just enable all of them,
      run the sampling and disable them all again afterwards.
      
      This is extremely useful when I'm low-level testing my
      sensors with interrupts and triggers, sample session:
      
      root@Ux500:/ lsiio
      Device 000: lsm303dlh_accel
      Device 001: lis331dl_accel
      Device 002: l3g4200d
      Device 003: lsm303dlh_magn
      Device 004: lps001wp
      Trigger 000: lsm303dlh_accel-trigger
      Trigger 001: lis331dl_accel-trigger
      Trigger 002: l3g4200d-trigger
      
      root@Ux500:/ generic_buffer -a -c 10 -n l3g4200d
      iio device number being used is 2
      iio trigger number being used is 2
      No channels are enabled, enabling all channels
      Enabling: in_anglvel_x_en
      Enabling: in_anglvel_y_en
      Enabling: in_anglvel_z_en
      Enabling: in_timestamp_en
      /sys/bus/iio/devices/iio:device2 l3g4200d-trigger
      -3.593664 -0.713133 4.870143 946684863662292480
      3.225546 0.867357 -4.945878 946684863671875000
      -0.676413 0.127296 0.106641 946684863681488037
      -0.661113 0.110160 0.128826 946684863690673828
      -0.664173 0.113067 0.123471 946684863700683593
      -0.664938 0.109395 0.124848 946684863710144042
      -0.664173 0.110619 0.130203 946684863719512939
      -0.666162 0.111231 0.132651 946684863729125976
      -0.668610 0.111690 0.130662 946684863738739013
      -0.660501 0.110466 0.131733 946684863748565673
      Disabling: in_anglvel_x_en
      Disabling: in_anglvel_y_en
      Disabling: in_anglvel_z_en
      Disabling: in_timestamp_en
      
      Pure awesomeness. If some channels have been enabled through
      scripts or manual interaction, nothing happens.
      
      Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
      Acked-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      5f991a92
    • Linus Walleij's avatar
      iio: st_sensors: support open drain mode · 0e6f6871
      Linus Walleij authored
      Some types of ST Sensors can be connected to the same IRQ line
      as other peripherals using open drain. Add a device tree binding
      and a sensor data property to flip the right bit in the interrupt
      control register to enable open drain mode on the INT line.
      
      If the line is set to be open drain, also tag on IRQF_SHARED
      to the IRQ flags when requesting the interrupt, as the whole
      point of using open drain interrupt lines is to share them with
      more than one peripheral (wire-or).
      
      Cc: devicetree@vger.kernel.org
      Cc: Giuseppe Barba <giuseppe.barba@st.com>
      Cc: Denis Ciocca <denis.ciocca@st.com>
      Acked-by: default avatarRob Herring <rob@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      0e6f6871
    • Linus Walleij's avatar
      iio: st_sensors: verify interrupt event to status · 97865fe4
      Linus Walleij authored
      This makes all ST sensor drivers check that they actually have
      new data available for the requested channel(s) before claiming
      an IRQ, by reading the status register (which is conveniently
      the same for all ST sensors) and check that the channel has new
      data before proceeding to read it and fill the buffer.
      
      This way sensors can share an interrupt line: it can be flaged
      as shared and then the sensor that did not fire will return
      NO_IRQ, and the sensor that fired will handle the IRQ and
      return IRQ_HANDLED.
      
      Cc: Giuseppe Barba <giuseppe.barba@st.com>
      Cc: Denis Ciocca <denis.ciocca@st.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      97865fe4
    • Linus Walleij's avatar
      iio: st_sensors: read each channel individually · 6436db37
      Linus Walleij authored
      The current buffer read code tries to optimize reads from the
      sensor data registers by issuing a single read operation across
      all the indata registers.
      
      This doesn't work: when the LIS331DL accelerometer sensor is
      configured to open drain, active low interrupt mode, this will
      just clear the XDA (X-axis data available) bit in the STATUS_REG
      register (0x27), while YDA, ZDA and even ZYXDA remain set to 1,
      and the internal logic of the sensor holds the DRDY (INT1) line
      asserted (the value of the status register is 0xee).
      
      If we instead issue one read operation per enabled channel
      (X, Y, Z) things start working and we can use open drain and
      active low interrupts.
      
      Note that a backported patch fixing this issue will be heading
      via the fixes branch but changes in this file already in staging-next
      will make that patch 'look' rather different.  The code in here
      is the correct one when that clash hits.
      
      Cc: Giuseppe Barba <giuseppe.barba@st.com>
      Cc: Denis Ciocca <denis.ciocca@st.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      6436db37
    • Stefan Wahren's avatar
      iio: mxs-lradc: move STMP reset out of ADC init · 850c25c8
      Stefan Wahren authored
      This patch moves the STMP reset out of ADC init function so as to remove
      the possiblity of an error return which will be necessary for PM ops support
      patches to follow.
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      850c25c8
    • Stefan Wahren's avatar
      iio: mxs-lradc: move TS config into suitable function · 9cf6fcc1
      Stefan Wahren authored
      This patch moves the touchscreen type configuration into
      a more suitable function. Btw this simplifies PM ops later.
      Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      Tested-by: default avatarMarek Vasut <marex@denx.de>
      Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      9cf6fcc1
  2. 18 Apr, 2016 2 commits
  3. 17 Apr, 2016 4 commits
  4. 16 Apr, 2016 18 commits
  5. 10 Apr, 2016 7 commits
  6. 04 Apr, 2016 1 commit