1. 28 8月, 2015 1 次提交
  2. 08 8月, 2015 1 次提交
    • L
      iio: Add inverse unit conversion macros · c689a923
      Lars-Peter Clausen 提交于
      Add inverse unit conversion macro to convert from standard IIO units to
      units that might be used by some devices.
      
      Those are useful in combination with scale factors that are specified as
      IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will
      contain the maximum raw value the sensor will generate and the numerator
      the value it maps to in a specific unit. Sometimes datasheets specify those
      in different units than the standard IIO units (e.g. degree/s instead of
      rad/s) and so we need to do a unit conversion.
      
      From a mathematical point of view it does not make a difference whether we
      apply the unit conversion to the numerator or the inverse unit conversion
      to the denominator since (x / y) / z = x / (y * z). But as the denominator
      is typically a larger value and we are rounding both the numerator and
      denominator to integer values using the later method gives us a better
      precision (E.g. the relative error is smaller if we round 8000.3 to 8000
      rather than rounding 8.3 to 8).
      
      This is where in inverse unit conversion macros will be used.
      
      Marked for stable as used by some upcoming fixes.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      c689a923
  3. 17 5月, 2015 1 次提交
  4. 11 5月, 2015 1 次提交
  5. 09 4月, 2015 1 次提交
  6. 29 3月, 2015 1 次提交
    • 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
  7. 30 1月, 2015 1 次提交
  8. 28 1月, 2015 1 次提交
  9. 26 1月, 2015 1 次提交
  10. 22 11月, 2014 2 次提交
  11. 25 10月, 2014 1 次提交
  12. 24 7月, 2014 1 次提交
  13. 30 4月, 2014 2 次提交
  14. 15 2月, 2014 1 次提交
  15. 08 12月, 2013 1 次提交
  16. 25 11月, 2013 2 次提交
  17. 12 10月, 2013 1 次提交
    • L
      iio: Extend the event config interface · b4e3ac0a
      Lars-Peter Clausen 提交于
      The event configuration interface of the IIO framework has not been getting the
      same attention as other parts. As a result it has not seen the same improvements
      as e.g. the channel interface has seen with the introduction of the channel spec
      struct. Currently all the event config callbacks take a u64 (the so called event
      code) to pass all the different information about for which event the callback
      is invoked. The callback function then has to extract the information it is
      interested in using some macros with rather long names. Most information encoded
      in the event code comes straight from the iio_chan_spec struct the event was
      registered for. Since we always have a handle to the channel spec when we call
      the event callbacks the first step is to add the channel spec as a parameter to
      the event callbacks. The two remaining things encoded in the event code are the
      type and direction of the event. Instead of passing them in one parameter, add
      one parameter for each of them and remove the eventcode from the event
      callbacks. The patch also adds a new iio_event_info parameter to the
      {read,write}_event_value callbacks. This makes it possible, similar to the
      iio_chan_info_enum for channels, to specify additional properties other than
      just the value for an event. Furthermore the new interface will allow to
      register shared events. This is e.g. useful if a device allows configuring a
      threshold event, but the threshold setting is the same for all channels.
      
      To implement this the patch adds a new iio_event_spec struct which is similar to
      the iio_chan_spec struct. It as two field to specify the type and the direction
      of the event. Furthermore it has a mask field for each one of the different
      iio_shared_by types. These mask fields holds which kind of attributes should be
      registered for the event. Creation of the attributes follows the same rules as
      the for the channel attributes. E.g. for the separate_mask there will be a
      attribute for each channel with this event, for the shared_by_type there will
      only be one attribute per channel type. The iio_chan_spec struct gets two new
      fields, 'event_spec' and 'num_event_specs', which is used to specify which the
      events for this channel. These two fields are going to replace the channel's
      event_mask field.
      
      For now both the old and the new event config interface coexist, but over the
      few patches all drivers will be converted from the old to the new interface.
      Once that is done all code for supporting the old interface will be removed.
      Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      b4e3ac0a
  18. 16 9月, 2013 3 次提交
  19. 15 9月, 2013 1 次提交
    • P
      iio: Add INT_TIME (integration time) channel info attribute · 899d90bd
      Peter Meerwald 提交于
      Integration time is in seconds; it controls the measurement
      time and influences the gain of a sensor.
      
      There are two typical ways that scaling is implemented in a device:
      1) input amplifier,
      2) reference to the ADC is changed.
      These both result in the accuracy of the ADC varying (by applying its
      sampling over a more relevant range).
      
      Integration time is a way of dealing with noise inherent in the analog
      sensor itself.  In the case of a light sensor, a mixture of photon noise
      and device specific noise.  Photon noise is dealt with by either improving
      the efficiency of the sensor, (more photons actually captured) which is not
      easily varied dynamically, or by integrating the measurement over a longer
      time period.  Note that this can also be thought of as an averaging of a
      number of individual samples and is infact sometimes implemented this way.
      Altering integration time implies that the duration of a measurement changes,
      a fact the device's user may be interested in.
      
      Hence it makes sense to distinguish between integration time and simple
      scale. In some devices both types of control are present and whilst they
      will have similar effects on the amplitude of the reading, their effect
      on the noise of the measurements will differ considerably.
      
      Used by adjd_s311, tsl4531, tcs3472
      The following drivers have similar controls (and could be adapted):
      * tsl2563 (integration time is controlled via CALIBSCALE among other things)
      * tsl2583 (has integration_time device_attr, but driver doesn't use channels yet)
      * tsl2x7x (has integration_time attr)
      Signed-off-by: NPeter Meerwald <pmeerw@pmeerw.net>
      Cc: Jon Brenner <jon.brenner@ams.com>
      Signed-off-by: NJonathan Cameron <jic23@kernel.org>
      899d90bd
  20. 01 9月, 2013 1 次提交
  21. 18 8月, 2013 1 次提交
  22. 04 8月, 2013 2 次提交
  23. 03 7月, 2013 1 次提交
  24. 18 3月, 2013 2 次提交
  25. 21 11月, 2012 1 次提交
  26. 10 11月, 2012 1 次提交
  27. 19 10月, 2012 1 次提交
  28. 18 9月, 2012 1 次提交
  29. 07 9月, 2012 1 次提交
  30. 04 9月, 2012 3 次提交
  31. 28 8月, 2012 1 次提交