1. 13 8月, 2015 1 次提交
  2. 03 8月, 2015 1 次提交
  3. 21 6月, 2015 1 次提交
  4. 01 6月, 2015 4 次提交
  5. 23 5月, 2015 3 次提交
    • L
      iio: __iio_update_buffers: Leave device in sane state on error · 1250186a
      Lars-Peter Clausen 提交于
      Currently when something goes wrong at some step when disabling the buffers
      we immediately abort. This has the effect that the enable/disable calls are
      no longer balanced. So make sure that even if one step in the disable
      sequence fails the other steps are still executed.
      
      The other issue is that when either enable or disable fails buffers that
      were active at that time stay active while the device itself is disabled.
      This leaves things in a inconsistent state and can cause unbalanced
      enable/disable calls. Furthermore when enable fails we restore the old scan
      mask, but still keeps things disabled.
      
      Given that verification of the configuration was performed earlier and it
      is valid at the point where we try to enable/disable the most likely reason
      of failure is a communication failure with the device or maybe a
      out-of-memory situation. There is not really a good recovery strategy in
      such a case, so it makes sense to leave the device disabled, but we should
      still leave it in a consistent state.
      
      What the patch does if disable/enable fails is to deactivate all buffers
      and make sure that the device will be in the same state as if all buffers
      had been manually disabled.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      1250186a
    • L
      iio: __iio_update_buffers: Split enable and disable path into helper functions · 623d74e3
      Lars-Peter Clausen 提交于
      __iio_update_buffers is already a rather large function with many different
      error paths and it is going to get even larger. This patch factors out the
      device enable and device disable paths into separate helper functions.
      
      The patch also re-implements iio_disable_all_buffers() using the new
      iio_disable_buffers() function removing a fair bit of redundant code.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      623d74e3
    • L
      iio: __iio_update_buffers: Verify configuration before starting to apply it · 6e509c4d
      Lars-Peter Clausen 提交于
      Currently __iio_update_buffers() verifies whether the new configuration
      will work in the middle of the update sequence. This means if the new
      configuration is invalid we need to rollback the changes already made. This
      patch moves the validation of the new configuration at the beginning of
      __iio_update_buffers() and will not start to make any changes if the new
      configuration is invalid.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      6e509c4d
  6. 17 5月, 2015 3 次提交
  7. 29 3月, 2015 2 次提交
    • O
      iio: add support for hardware fifo · f4f4673b
      Octavian Purdila 提交于
      Some devices have hardware buffers that can store a number of samples
      for later consumption. Hardware usually provides interrupts to notify
      the processor when the FIFO is full or when it has reached a certain
      watermark level. This helps with reducing the number of interrupts to
      the host processor and thus it helps decreasing the power consumption.
      
      This patch enables usage of hardware FIFOs for IIO devices in
      conjunction with software device buffers. When the hardware FIFO is
      enabled the samples are stored in the hardware FIFO. The samples are
      later flushed to the device software buffer when the number of entries
      in the hardware FIFO reaches the hardware watermark or when a flush
      operation is triggered by the user when doing a non-blocking read
      on an empty software device buffer.
      
      In order to implement hardware FIFO support the device drivers must
      implement the following new operations: setting and getting the
      hardware FIFO watermark level, flushing the hardware FIFO to the
      software device buffer. The device must also expose information about
      the hardware FIFO such it's minimum and maximum watermark and if
      necessary a list of supported watermark values. Finally, the device
      driver must activate the hardware FIFO when the device buffer is
      enabled, if the current device settings allows it.
      
      The software device buffer watermark is passed by the IIO core to the
      device driver as a hint for the hardware FIFO watermark. The device
      driver can adjust this value to allow for hardware limitations (such
      as capping it to the maximum hardware watermark or adjust it to a
      value that is supported by the hardware). It can also disable the
      hardware watermark (and implicitly the hardware FIFO) it this value is
      below the minimum hardware watermark.
      
      Since a driver may support hardware FIFO only when not in triggered
      buffer mode (due to different semantics of hardware FIFO sampling and
      triggered sampling) this patch changes the IIO core code to allow
      falling back to non-triggered buffered mode if no trigger is enabled.
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Reviewed-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      f4f4673b
    • J
      iio: add watermark logic to iio read and poll · 37d34556
      Josselin Costanzi 提交于
      Currently the IIO buffer blocking read only wait until at least one
      data element is available.
      This patch makes the reader sleep until enough data is collected before
      returning to userspace. This should limit the read() calls count when
      trying to get data in batches.
      
      Co-author: Yannick Bedhomme <yannick.bedhomme@mobile-devices.fr>
      Signed-off-by: NJosselin Costanzi <josselin.costanzi@mobile-devices.fr>
      [rebased and remove buffer timeout]
      Signed-off-by: NOctavian Purdila <octavian.purdila@intel.com>
      Reviewed-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      37d34556
  8. 05 2月, 2015 1 次提交
  9. 26 1月, 2015 1 次提交
  10. 06 1月, 2015 1 次提交
  11. 12 12月, 2014 6 次提交
    • L
      iio: buffer: Drop get_length callback · 37495660
      Lars-Peter Clausen 提交于
      We already do have the length field in the struct iio_buffer which is
      expected to be in sync with the current size of the buffer. And currently
      all implementations of the get_length callback either return this field or a
      constant number.
      
      This patch removes the get_length callback and replaces all occurrences in
      the IIO core with directly accessing the length field of the buffer.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      37495660
    • L
      iio: buffer: Make length attribute read only for buffers without set_length · 8d92db28
      Lars-Peter Clausen 提交于
      If a buffer implementation does not implement the set_length() callback the
      length will be static and can not be changed by userspace. Mark the length
      attribute as a read only property in this case so userspace is aware of this
      rather than just silently accepting any length value.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      8d92db28
    • L
      iio: buffer: Allocate standard attributes in the core · 08e7e0ad
      Lars-Peter Clausen 提交于
      All buffers want at least the length and the enable attribute. Move the
      creation of those attributes to the core instead of having to do this in
      each individual buffer implementation. This allows us to get rid of some
      boiler-plate code.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      08e7e0ad
    • L
      iio: buffer: Move iio_buffer_alloc_sysfs and iio_buffer_free_sysfs · d967cb6b
      Lars-Peter Clausen 提交于
      The next patch will introduce new dependencies in iio_buffer_alloc_sysfs()
      to functions which are currently defined after iio_buffer_alloc_sysfs(). To
      avoid forward declarations move both iio_buffer_alloc_sysfs() and
      iio_buffer_free_sysfs() after those function.
      
      This is split into two patches one moving the functions and one adding the
      dependencies to make review of the actual changes easier.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      d967cb6b
    • L
      iio: Move buffer registration to the core · 3e1b6c95
      Lars-Peter Clausen 提交于
      Originally device and buffer registration were kept as separate operations
      in IIO to allow to register two distinct sets of channels for buffered and
      non-buffered operations. This has since already been further restricted and
      the channel set registered for the buffer needs to be a subset of the
      channel set registered for the device. Additionally the possibility to not
      have a raw (or processed) attribute for a channel which was registered for
      the device was added a while ago. This means it is possible to not register
      any device level attributes for a channel even if it is registered for the
      device. Also if a channel's scan_index is set to -1 and the channel is
      registered for the buffer it is ignored.
      
      So in summary it means it is possible to register the same channel array for
      both the device and the buffer yet still end up with distinctive sets of
      channels for both of them. This makes the argument for having to have to
      manually register the channels for both the device and the buffer invalid.
      Considering that the vast majority of all drivers want to register the same
      set of channels for both the buffer and the device it makes sense to move
      the buffer registration into the core to avoid some boiler-plate code in the
      device driver setup path.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      3e1b6c95
    • L
      iio: Unexport iio_scan_mask_set() · 217a5cf0
      Lars-Peter Clausen 提交于
      Individual drivers should not be messing with the scan mask that contains
      the list of enabled channels. This is something that is supposed to be
      managed by the core.
      
      Now that the last few drivers that used it to configure a default scan mask
      have been updated to not do this anymore we can unexport the function.
      
      Note, this patch also requires moving a few functions around so they are all
      declared before the first internal user.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Reviewed-by: NDaniel Baluta <daniel.baluta@intel.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      217a5cf0
  12. 08 8月, 2014 1 次提交
  13. 02 8月, 2014 1 次提交
  14. 28 7月, 2014 1 次提交
  15. 20 7月, 2014 1 次提交
    • L
      iio: buffer: Fix demux table creation · 61bd55ce
      Lars-Peter Clausen 提交于
      When creating the demux table we need to iterate over the selected scan mask for
      the buffer to get the samples which should be copied to destination buffer.
      Right now the code uses the mask which contains all active channels, which means
      the demux table contains entries which causes it to copy all the samples from
      source to destination buffer one by one without doing any demuxing.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      Cc: Stable@vger.kernel.org
      61bd55ce
  16. 29 6月, 2014 1 次提交
  17. 30 4月, 2014 1 次提交
  18. 22 3月, 2014 1 次提交
    • A
      iio: querying buffer scan_mask should return 0/1 · 2076a20f
      Alec Berg 提交于
      Ensure that querying the IIO buffer scan_mask returns a value of
      0 or 1. Currently querying the scan mask has the value returned
      by test_bit(), which returns either true or false. For some
      architectures test_bit() may return -1 for true, which will appear
      to return an error when returning from iio_scan_mask_query().
      
      Additionally, it's important for the sysfs interface to consistently
      return the same thing when querying the scan_mask.
      Signed-off-by: NAlec Berg <alecaberg@chromium.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      2076a20f
  19. 18 2月, 2014 1 次提交
  20. 04 12月, 2013 2 次提交
  21. 17 10月, 2013 2 次提交
    • L
      iio: Remove unused iio_sw_buffer_preenable() · bf741c08
      Lars-Peter Clausen 提交于
      The functionality implemented by iio_sw_buffer_preenable() is now done directly
      in the IIO core and previous users of iio_sw_buffer_preenable() have all been
      updated to not use it anymore. It is unused now and can be remove.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      bf741c08
    • L
      iio: Update buffer's bytes per datum after updating the scan mask · 8e050996
      Lars-Peter Clausen 提交于
      Currently a IIO device driver needs to make sure to update the buffer's bytes
      per datum after the scan mask has changed. This is usually done in the preenable
      callback by invoking iio_sw_buffer_preenable(). This is something that needs to
      be done and is done for virtually all devices which support buffers (we
      currently have only one exception). Also this a bit of a layering violation
      since we have to call the buffer setup ops from the device setup ops. This
      requires the device driver to know about the internal requirements of the buffer
      (e.g. whether we need to call the set_bytes_per_datum) callback. And especially
      with in-kernel buffer consumers, which allows to attach arbitrary buffers to a
      device, this is something that the driver can't know.
      
      Moving this to the core allows us to drop the individual calls to
      iio_sw_buffer_preenable() from drivers.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Cc: Denis Ciocca <denis.ciocca@st.com>
      Cc: Marek Vasut <marex@denx.de>
      Cc: Zubair Lutfullah <zubair.lutfullah@gmail.com>
      Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      8e050996
  22. 16 10月, 2013 1 次提交
  23. 12 10月, 2013 3 次提交