1. 02 Dec, 2017 1 commit
  2. 24 Sep, 2017 1 commit
  3. 22 Aug, 2017 1 commit
  4. 11 Jun, 2017 2 commits
  5. 27 Apr, 2017 1 commit
  6. 02 Apr, 2017 1 commit
  7. 21 Mar, 2017 1 commit
  8. 10 Jan, 2017 1 commit
  9. 05 Jan, 2017 1 commit
  10. 13 Nov, 2016 1 commit
    • Jonathan Cameron's avatar
      iio:core: add a callback to allow drivers to provide _available attributes · 51239600
      Jonathan Cameron authored
      A large number of attributes can only take a limited range of values.
      Currently in IIO this is handled by directly registering additional
      *_available attributes thus providing this information to userspace.
      
      It is desirable to provide this information via the core for much the same
      reason this was done for the actual channel information attributes in the
      first place.  If it isn't there, then it can only really be accessed from
      userspace.  Other in kernel IIO consumers have no access to what valid
      parameters are.
      
      Two forms are currently supported:
      * list of values in one particular IIO_VAL_* format.
      	e.g. 1.300000 1.500000 1.730000
      * range specification with a step size:
      	e.g. [1.000000 0.500000 2.500000]
      	equivalent to 1.000000 1.5000000 2.000000 2.500000
      
      An addition set of masks are used to allow different sharing rules for the
      *_available attributes generated.
      
      This allows for example:
      
      in_accel_x_offset
      in_accel_y_offset
      in_accel_offset_available.
      
      We could have gone with having a specification for each and every
      info_mask element but that would have meant changing the existing userspace
      ABI.  This approach does not.
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      [forward ported, added some docs and fixed buffer overflows /peda]
      Acked-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
      Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      51239600
  11. 01 Oct, 2016 1 commit
  12. 05 Sep, 2016 1 commit
  13. 04 Sep, 2016 1 commit
  14. 30 Jun, 2016 1 commit
  15. 29 May, 2016 1 commit
  16. 23 Apr, 2016 1 commit
    • Gregor Boirie's avatar
      iio:core: mounting matrix support · dfc57732
      Gregor Boirie authored
      Expose a rotation matrix to indicate userspace the chip placement with
      respect to the overall hardware system. This is needed to adjust
      coordinates sampled from a sensor chip when its position deviates from the
      main hardware system.
      
      Final coordinates computation is delegated to userspace since:
      * computation may involve floating point arithmetics ;
      * it allows an application to combine adjustments with arbitrary
        transformations.
      
      This 3 dimentional space rotation matrix is expressed as 3x3 array of
      strings to support floating point numbers. It may be retrieved from a
      "[<dir>_][<type>_]mount_matrix" sysfs attribute file. It is declared into a
      device / driver specific DTS property or platform data.
      Signed-off-by: default avatarGregor Boirie <gregor.boirie@parrot.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      dfc57732
  17. 03 Apr, 2016 2 commits
  18. 12 Mar, 2016 1 commit
    • Alison Schofield's avatar
      iio: core: implement iio_device_{claim|release}_direct_mode() · 08a33805
      Alison Schofield authored
      It is often the case that the driver wants to be sure a device stays
      in direct mode while it is executing a task or series of tasks.  To
      accomplish this today, the driver performs this sequence: 1) take the
      device state lock, 2) verify it is not in a buffered mode, 3) execute
      some tasks, and 4) release that lock.
      
      This patch introduces a pair of helper functions that simplify these
      steps and make it more semantically expressive.
      
      iio_device_claim_direct_mode()
              If the device is not in any buffered mode it is guaranteed
              to stay that way until iio_release_direct_mode() is called.
      
      iio_device_release_direct_mode()
              Release the claim. Device is no longer guaranteed to stay
              in direct mode.
      Signed-off-by: default avatarAlison Schofield <amsfield22@gmail.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      08a33805
  19. 30 Jan, 2016 1 commit
  20. 16 Jan, 2016 1 commit
    • Michal Nazarewicz's avatar
      include/linux/kernel.h: change abs() macro so it uses consistent return type · 8f57e4d9
      Michal Nazarewicz authored
      Rewrite abs() so that its return type does not depend on the
      architecture and no unexpected type conversion happen inside of it.  The
      only conversion is from unsigned to signed type.  char is left as a
      return type but treated as a signed type regradless of it's actual
      signedness.
      
      With the old version, int arguments were promoted to long and depending
      on architecture a long argument might result in s64 or long return type
      (which may or may not be the same).
      
      This came after some back and forth with Nicolas.  The current macro has
      different return type (for the same input type) depending on
      architecture which might be midly iritating.
      
      An alternative version would promote to int like so:
      
      	#define abs(x)	__abs_choose_expr(x, long long,			\
      			__abs_choose_expr(x, long,			\
      			__builtin_choose_expr(				\
      				sizeof(x) <= sizeof(int),		\
      				({ int __x = (x); __x<0?-__x:__x; }),	\
      				((void)0))))
      
      I have no preference but imagine Linus might.  :] Nicolas argument against
      is that promoting to int causes iconsistent behaviour:
      
      	int main(void) {
      		unsigned short a = 0, b = 1, c = a - b;
      		unsigned short d = abs(a - b);
      		unsigned short e = abs(c);
      		printf("%u %u\n", d, e);  // prints: 1 65535
      	}
      
      Then again, no sane person expects consistent behaviour from C integer
      arithmetic.  ;)
      
      Note:
      
        __builtin_types_compatible_p(unsigned char, char) is always false, and
        __builtin_types_compatible_p(signed char, char) is also always false.
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Reviewed-by: default avatarNicolas Pitre <nico@linaro.org>
      Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Cc: Wey-Yi Guy <wey-yi.w.guy@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f57e4d9
  21. 22 Dec, 2015 1 commit
  22. 21 Nov, 2015 1 commit
  23. 15 Nov, 2015 1 commit
  24. 23 Sep, 2015 2 commits
  25. 27 Aug, 2015 1 commit
  26. 16 Aug, 2015 1 commit
  27. 02 Aug, 2015 1 commit
  28. 21 Jun, 2015 1 commit
  29. 23 May, 2015 1 commit
  30. 17 May, 2015 1 commit
  31. 10 May, 2015 1 commit
  32. 09 Apr, 2015 1 commit
  33. 14 Mar, 2015 1 commit
    • Martin Fuzzey's avatar
      iio: core: Fix double free. · c1b03ab5
      Martin Fuzzey authored
      When an error occurred during event registration memory was freed twice
      resulting in kernel memory corruption and a crash in unrelated code.
      
      The problem was caused by
      	iio_device_unregister_eventset()
      	iio_device_unregister_sysfs()
      
      being called twice, once on the error path and then
      again via iio_dev_release().
      
      Fix this by making these two functions idempotent so they
      may be called multiple times.
      
      The problem was observed before applying
      	78b33216 iio:core: Handle error when mask type is not separate
      Signed-off-by: default avatarMartin Fuzzey <mfuzzey@parkeon.com>
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      c1b03ab5
  34. 29 Jan, 2015 1 commit
  35. 27 Jan, 2015 3 commits