Commit graph

1643 commits

Author SHA1 Message Date
Greg Kroah-Hartman 5982557ac6 Second set of IIO fixes for the 4.5 cycle. These ones are mostly
dependent on patches from the recent merge cycle.
 
 * adc, imu and iio staging drivers
   - !HAS_IOMEM dependency fixes
 * dht11
   - use boottime clock for time measurement to avoid incorrect measurements
    due to clock updates.
 * lidar
   - correct a return value for short i2c transfers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWr72hAAoJEFSFNJnE9BaILWsP/3hVDegr+6TRoVgqqfk8USz2
 Jb3omDrxvb1LDlMgR5sbwYMQw3JKg9Dn6ACPtsFJ4kdOHvZ/xQ5dzwKXuUTe9MfB
 ij3gl1/wO6czUvdW0FYEKwMHORh/z5ILKaVS/lOPjeJnRPhFD4GNRo3nM6qQ/le8
 nl/Q1RB1ONml0EKzWgQrcFAzdRessPU3ALsvXrmJQVn6Ah1fYcig46/jn/PZ8/iO
 1/9lgROCo78vwHMvu1vuBI/pjfm0Ry/AB1WTGrjquMY4Q/kEwM18qE2I4lRfoQSd
 3N9DvGkfhkmLpnqag3ujC5uVtMJK/SUlK5DPaAsLT7PtTuQ75UQfFZpy0syANfbD
 lLVnKqMBbTWpetin8butW1OBgKaCWukq9zvFvsp1ZbbxJIEeYaIF6vdkcVyn66j/
 O3u45zdbL0WrhvPZrQRbTa3jdXLVMe4psaBWF1fhBW/+8tYEpPzddHuE2miyVHP8
 2uxg7H+UR7WRJyZ20BzF18G1AFjtAouzuVtWtPEAw2z8BbtMfAf9g+02xHhwYmVd
 USdPfVHhAmYgFsgfRLRZRmbiSlg/SzBHK0RVS9ZwXsh3nnPvuYflfT/bCXxGvBzI
 j8pVAAkfrnTItKuFQ2rTgQ23JUHdOdmwkYtrMa6bHuFCCN6kIH8BTVxwGexEhE5U
 tBTWNHQxx/N1VhtY7BQG
 =iF19
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-4.5b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

Second set of IIO fixes for the 4.5 cycle.  These ones are mostly
dependent on patches from the recent merge cycle.

* adc, imu and iio staging drivers
  - !HAS_IOMEM dependency fixes
* dht11
  - use boottime clock for time measurement to avoid incorrect measurements
   due to clock updates.
* lidar
  - correct a return value for short i2c transfers.
2016-02-01 13:08:26 -08:00
Greg Kroah-Hartman 48436e82fd First set of IIO fixes for the 4.5 cycle.
This set comprises those not dependent on patches in the 4.5 merge cycle.
 A second set will follow shortly with ones that are.
 
 * core in kernel interfaces
   - fix a possible NULL dereference that is a theoretical possibility
     via odd usage of iio_channel_release. Pretty much a hardening of
     the interface, but observed in the wild with the twl4030_charger
     driver.
 * acpi-als
   - report the data as processed as it is in lux.  This fixes a wrong
     use of the IIO ABI.  However, old _raw version retained to avoid
     breaking any userspace in the wild that is relying on that (none
     known but it doesn't hurt us much to retain it)
 * ade7753
   - fix some error handling to avoid use of unitialized data.
 * ltr501
   - use a signed return type for ltr501_match_samp_freq so as to allow
     returning of an error code.
 * mcp4725
   - set name field of struct iio_dev to ensure the sysfs name attribute
     doesn't give NULL.
 * mpl115
   - temperature offset sign is wrong.
 * stk8ba50
   - IIO_TRIGGER dependency added
 * ti_am335x_adc
   - Label buffer as a software buffer. It's actually a hybrid of a
     true hardware buffer feeding a kfifo, but the meaning of these fields
     has changed a little recently and in this case it should be labeled
     a software buffer ensure it is allowed to use the kfifo.
 * vf610_adc
   - HAS_IOMEM dependency
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWr7r1AAoJEFSFNJnE9BaIEu4QAIb4FPipmsRLbNlPpngtYL9k
 uH13UiZLdGRdZsif2S9B0S5L0+PG25UTzXbtgleUq4IxdY4LnSyfa+/V+Ifn3SPE
 +F3Vr5Uqd9S/uRNNwJjgvSMf60s9J8Vm3PqFJ7aH8glJ7CRR4IbDAPJ7GXhUx4mt
 o5VXYLIm178JbwC6zKu8AanYGtRADG6orLqMbjCEWksK0SAuCz772CLgUCLMFxHC
 z1n/mdG8nadTZZDbuaHda5C5r9Baiqt/Wl7e/3gg7gHBl5LjcGUejlyD2VKRilpO
 4exHIARkHqlx/fXBxUxRN9kDbRK+6cuxca8MHn01Kn/XM7D8XoeZ1orQm+bItyOL
 9aHIoV2szS+VQMDE1oB+eKU8KZRGD0rLNKJRNumho+0lFtdbSZ0VqeBqn/wGYEBa
 QyGjpjdVCltdZJ2BX4kaUGcCQeWnpqqLc6jrXuUN0qSzvHyspt3XsllCKrTWbvNu
 oV1uDM+R8+YSsDQmgTpGuoTmpRHq2ED2lAJqRVan/Zi+Yk6gjxyDcIe1V4LbLdTt
 asXxzxp/eYFfM/K5nJyyASp3jl66f8QoQaVDly5XjXsf400xQKa3PlahQLWx66JM
 YfGJfHwhyzamO+mgiyuX1O4C7CO7uvHZgC/H+p7bB03GdtcUzjT1ZlBrR0JJlojg
 crBzUtRyX26wUNTGxHXG
 =27Pv
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-4.5a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First set of IIO fixes for the 4.5 cycle.

This set comprises those not dependent on patches in the 4.5 merge cycle.
A second set will follow shortly with ones that are.

* core in kernel interfaces
  - fix a possible NULL dereference that is a theoretical possibility
    via odd usage of iio_channel_release. Pretty much a hardening of
    the interface, but observed in the wild with the twl4030_charger
    driver.
* acpi-als
  - report the data as processed as it is in lux.  This fixes a wrong
    use of the IIO ABI.  However, old _raw version retained to avoid
    breaking any userspace in the wild that is relying on that (none
    known but it doesn't hurt us much to retain it)
* ade7753
  - fix some error handling to avoid use of unitialized data.
* ltr501
  - use a signed return type for ltr501_match_samp_freq so as to allow
    returning of an error code.
* mcp4725
  - set name field of struct iio_dev to ensure the sysfs name attribute
    doesn't give NULL.
* mpl115
  - temperature offset sign is wrong.
* stk8ba50
  - IIO_TRIGGER dependency added
* ti_am335x_adc
  - Label buffer as a software buffer. It's actually a hybrid of a
    true hardware buffer feeding a kfifo, but the meaning of these fields
    has changed a little recently and in this case it should be labeled
    a software buffer ensure it is allowed to use the kfifo.
* vf610_adc
  - HAS_IOMEM dependency
2016-02-01 13:07:38 -08:00
Abhilash Jindal 17a2f46c3d iio: dht11: Use boottime
Wall time obtained from ktime_get_real_ns is susceptible to sudden jumps due to
user setting the time or due to NTP.  Boot time is constantly increasing time
better suited for comparing two timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
Reviewed-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-01 20:16:13 +00:00
Linus Torvalds 8c4e378e42 Staging fixes for 4.5-rc2
Here are some small staging driver fixes for 4.5-rc2.  One of them
 predated 4.4-final, but I missed that merge window due to the holliday.
 The others fix reported issues that have come up recently.  The tty
 change is needed for the speakup driver fix and has the ack of the tty
 driver maintainer as well, i.e. myself :)
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlauWLoACgkQMUfUDdst+ynHbQCfWlGgQhtadfhtiaIKLwqy9NPG
 PksAn3/z4mXX037sfm2kZrcqtcNlv9zf
 =Vdai
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging fixes from Greg KH:
 "Here are some small staging driver fixes for 4.5-rc2.

  One of them predated 4.4-final, but I missed that merge window due to
  the holliday.  The others fix reported issues that have come up
  recently.  The tty change is needed for the speakup driver fix and has
  the ack of the tty driver maintainer as well, i.e.  myself :)

  All have been in linux-next with no reported issues"

* tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  Staging: speakup: fix read scrolled-back VT
  Staging: speakup: Fix getting port information
  Revert "Staging: panel: usleep_range is preferred over udelay"
  iio: adis_buffer: Fix out-of-bounds memory access
2016-01-31 17:00:27 -08:00
Akinobu Mita 431386e783 iio: pressure: mpl115: fix temperature offset sign
According to the datasheet, the resolusion of temperature sensor is
-5.35 counts/C. Temperature ADC is 472 counts at 25C.
(https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
NOTE: This is older revision, but this information is removed from the
latest datasheet from nxp somehow)

Temp [C] = (Tadc - 472) / -5.35 + 25
         = (Tadc - 605.750000) * -0.186915888

So the correct offset is -605.750000.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:07:32 +00:00
Richard Weinberger ddeb35cbd6 iio: imu: Fix dependencies for !HAS_IOMEM archs
Not every arch has io memory.
While the driver has correct dependencies the select statement
will bypass the HAS_IOMEM dependency.
So, unbreak the build by rendering it into a real dependency.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 15:48:19 +00:00
Richard Weinberger 0165c3005f iio: adc: Fix dependencies for !HAS_IOMEM archs
Not every arch has io memory.
So, unbreak the build by fixing the dependencies.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 15:43:49 +00:00
Dan Carpenter d81dac3c1c iio: inkern: fix a NULL dereference on error
In twl4030_bci_probe() there are some failure paths where we call
iio_channel_release() with a NULL pointer.  (Apparently, that driver can
opperate without a valid channel pointer).  Let's fix it by adding a
NULL check in iio_channel_release().

Fixes: 2202e1fc5a ('drivers: power: twl4030_charger: fix link problems when building as module')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 15:37:40 +00:00
Linus Torvalds eae21770b4 Merge branch 'akpm' (patches from Andrew)
Merge third patch-bomb from Andrew Morton:
 "I'm pretty much done for -rc1 now:

   - the rest of MM, basically

   - lib/ updates

   - checkpatch, epoll, hfs, fatfs, ptrace, coredump, exit

   - cpu_mask simplifications

   - kexec, rapidio, MAINTAINERS etc, etc.

   - more dma-mapping cleanups/simplifications from hch"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (109 commits)
  MAINTAINERS: add/fix git URLs for various subsystems
  mm: memcontrol: add "sock" to cgroup2 memory.stat
  mm: memcontrol: basic memory statistics in cgroup2 memory controller
  mm: memcontrol: do not uncharge old page in page cache replacement
  Documentation: cgroup: add memory.swap.{current,max} description
  mm: free swap cache aggressively if memcg swap is full
  mm: vmscan: do not scan anon pages if memcg swap limit is hit
  swap.h: move memcg related stuff to the end of the file
  mm: memcontrol: replace mem_cgroup_lruvec_online with mem_cgroup_online
  mm: vmscan: pass memcg to get_scan_count()
  mm: memcontrol: charge swap to cgroup2
  mm: memcontrol: clean up alloc, online, offline, free functions
  mm: memcontrol: flatten struct cg_proto
  mm: memcontrol: rein in the CONFIG space madness
  net: drop tcp_memcontrol.c
  mm: memcontrol: introduce CONFIG_MEMCG_LEGACY_KMEM
  mm: memcontrol: allow to disable kmem accounting for cgroup2
  mm: memcontrol: account "kmem" consumers in cgroup2 memory controller
  mm: memcontrol: move kmem accounting code to CONFIG_MEMCG
  mm: memcontrol: separate kmem code from legacy tcp accounting code
  ...
2016-01-21 12:32:08 -08:00
Linus Torvalds 6b5a12dbca ARM: SoC multiplatform code changes for v4.5
This branch is the culmination of 5 years of effort to bring the ARMv6
 and ARMv7 platforms together such that they can all be enabled and
 boot the same kernel. It has been a tremendous amount of cleanup and
 refactoring by a huge number of people, and creation of several new
 (and major) subsystems to better abstract out all the platform details
 in an appropriate manner.
 
 The bulk of this branch is a large patchset from Arnd that brings several
 of the more minor and older platforms we have closer to multiplatform
 support.  Among these are MMP, S3C64xx, Orion5x, mv78xx0 and realview
 Much of this is moving around header files from old mach directories,
 but there are also some cleanup patches of debug_ll (lowlevel debug
 per-platform options) and other parts.
 
 Linus Walleij also has some patchs to clean up the older ARM Realview
 platforms by finally introducing DT support, and Rob Herring has some
 for ARM Versatile which is now DT-only. Both of these platforms are
 now multiplatform.
 
 Finally, a couple of patches from Russell for Dove PMU, and a fix from
 Valentin Rothberg for Exynos ADC, which were rebased on top of the
 series to avoid conflicts.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIUAwUAVqAGcmCrR//JCVInAQLDog/4x9F0PHGmZhexGfFOpi2Od63Jjx55izRU
 zRXqRjjFjambOrZuOx8lEGDy/qzqKbsDU8D1P4IUugkDr2bLSXv+NTLZL1kNBIdm
 YOlJhw/BmzLYqauOHmBzGhtv1FDUk3rqbgTsP5tTWj5LpSkwjmqui3HBZpi+f3Rr
 YOn+NeQSARiw+51D0b106a9RFshQXRGgn5m3xFjLWhJqshb2z2Ew5cogX/zdwrrM
 ss1BFomxsvgk6S+snN6v7cEX2iXe3r89qNR5jEW5BgNpQGFsAUeXPr9zzH07L/Qq
 O7XLw9jt5MX/X5372zVHPb57WoflLbF9cFaaDUZV3eTqt3lC67BTxOtYIdC2i90k
 E5GYlsy88CRwT2EO+ok/6UTryph+hVv7JqHfbKfnISrbraMCK36DtDTpBIpZ9uYF
 rRB7ncJZUWBcyoe+qvitSl+2KV54iB1ez2RXsketxM98dDZsfB2M2ImFou1F/Pgg
 ALvpifPubi/uDe7xNUsSuaT6/3jAomBuNsxnkYJ3NeiH/+duZbOYGkzK/LlcjZyc
 UrA0IpLfwIFsBNzwfpZPZ1lkEu8Y1YZZ+Hv9k65q1wMuBDgrFI5zUeYrPZi4pN9T
 Yo1xP9FstVLDouJrpGZo12VIIxR1UBeGqfRI/BZ58LEF3PRq/g2OVFsdQia5gZKr
 ddiJKSL1Vw==
 =z1AW
 -----END PGP SIGNATURE-----

Merge tag 'armsoc-multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC multiplatform code updates from Arnd Bergmann:
 "This branch is the culmination of 5 years of effort to bring the ARMv6
  and ARMv7 platforms together such that they can all be enabled and
  boot the same kernel.  It has been a tremendous amount of cleanup and
  refactoring by a huge number of people, and creation of several new
  (and major) subsystems to better abstract out all the platform details
  in an appropriate manner.

  The bulk of this branch is a large patchset from Arnd that brings
  several of the more minor and older platforms we have closer to
  multiplatform support.  Among these are MMP, S3C64xx, Orion5x, mv78xx0
  and realview Much of this is moving around header files from old mach
  directories, but there are also some cleanup patches of debug_ll
  (lowlevel debug per-platform options) and other parts.

  Linus Walleij also has some patchs to clean up the older ARM Realview
  platforms by finally introducing DT support, and Rob Herring has some
  for ARM Versatile which is now DT-only.  Both of these platforms are
  now multiplatform.

  Finally, a couple of patches from Russell for Dove PMU, and a fix from
  Valentin Rothberg for Exynos ADC, which were rebased on top of the
  series to avoid conflicts"

* tag 'armsoc-multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (75 commits)
  ARM: realview: don't select SMP_ON_UP for UP builds
  ARM: s3c: simplify s3c_irqwake_{e,}intallow definition
  ARM: s3c64xx: fix pm-debug compilation
  iio: exynos-adc: fix irqf_oneshot.cocci warnings
  ARM: realview: build realview-dt SMP support only when used
  ARM: realview: select apropriate targets
  ARM: realview: clean up header files
  ARM: realview: make all header files local
  ARM: no longer make CPU targets visible separately
  ARM: integrator: use explicit core module options
  ARM: realview: enable multiplatform
  ARM: make default platform work for NOMMU
  ARM: debug-ll: move DEBUG_LL_UART_EFM32 to correct Kconfig location
  ARM: defconfig: use correct debug_ll settings
  ARM: versatile: convert to multi-platform
  ARM: versatile: merge mach code into a single file
  ARM: versatile: switch to DT only booting and remove legacy code
  ARM: versatile: add DT based PCI detection
  ARM: pxa: mark ezx structures as __maybe_unused
  ARM: pxa: mark raumfeld init functions as __maybe_unused
  ...
2016-01-20 18:03:56 -08:00
Fengguang Wu f9ed89e17e iio: core: fix ptr_ret.cocci warnings
drivers/iio/industrialio-sw-trigger.c:169:1-3: WARNING: PTR_ERR_OR_ZERO can be used

 Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Octavian Purdila <octavian.purdila@intel.com>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: Adriana Reus <adriana.reus@intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Cc: Cristina Opriceana <cristina.opriceana@gmail.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-20 17:09:18 -08:00
Michal Nazarewicz 8f57e4d930 include/linux/kernel.h: change abs() macro so it uses consistent return type
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: Michal Nazarewicz <mina86@mina86.com>
Reviewed-by: Nicolas 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-16 11:17:22 -08:00
Jonathan Cameron 9d0be85d4e iio:adc:ti_am335x_adc Fix buffered mode by identifying as software buffer.
Whilst this part has a hardware buffer, the identifcation that IIO cares
about is the userspace facing end.  It this case we push individual elements
from the hardware fifo into the software interface (specifically a kfifo)
rather than providing direct reads through to a hardware buffer
(as we still do in the sca3000 for example).

Technically the original specification as a hardware buffer could be
considered wrong, but it didn't matter until the patch listed below.

Result is that any attempt to enable the buffer will return -EINVAL

Fixes: 225d59adf1 ("iio: Specify supported modes for buffers")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-16 13:06:33 +00:00
Gabriele Mazzotta fa34e6dd44 iio: light: acpi-als: Report data as processed
As per the ACPI specification (Revision 5.0) [1], the data coming
from the sensor represent the ambient light illuminance reading
expressed in lux. So use IIO_CHAN_INFO_PROCESSED to signify that
the data are pre-processed.

However, to keep backward ABI compatibility, the IIO_CHAN_INFO_RAW
bit is not removed.

[1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

This issue has also been responsible for at least one userspace bug
report hence marking what is a small semantic fix really for stable.
[2] https://github.com/hadess/iio-sensor-proxy/issues/46

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-16 12:58:18 +00:00
Yong Li 97a249e98a iio: dac: mcp4725: set iio name property in sysfs
Without this change, the name entity for mcp4725 is missing in
/sys/bus/iio/devices/iio\:device*/name

With this change, name is reported correctly

Signed-off-by: Yong Li <sdliyong@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-09 16:33:41 +00:00
Vegard Nossum 005ce07130 iio: add HAS_IOMEM dependency to VF610_ADC
Ran into this on UML:

drivers/built-in.o: In function `vf610_adc_probe':
drivers/iio/adc/vf610_adc.c:744: undefined reference to `devm_ioremap_resource'

devm_ioremap_resource() is defined only when HAS_IOMEM is selected.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-04 11:37:16 +00:00
Vegard Nossum 01cc523560 iio: add IIO_TRIGGER dependency to STK8BA50
Ran into this on UML:

drivers/iio/accel/stk8ba50.c: In function ‘stk8ba50_data_rdy_trigger_set_state’:
drivers/iio/accel/stk8ba50.c:163:9: error: implicit declaration of function ‘iio_trigger_get_drvdata’ [-Werror=implicit-function-declaration]

iio_trigger_get_drvdata() is defined only when IIO_TRIGGER is selected.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-04 11:36:19 +00:00
Matt Ranostay 9979e320b5 iio: proximity: lidar: correct return value
lidar_i2c_xfer() function was never a non-positive value on error,
and this correct that with a -EIO return code.

Fixes: 366e65633c ("iio: proximity: lidar: optimize i2c transactions")
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-03 17:54:08 +00:00
Greg Kroah-Hartman 02c34ccc1d Third set of new stuff for IIO in the 4.5 cycle.
New driver features
 - us5182
   * Add interrupt support and rising / falling threshold events.
 
 Cleanups / fixes to new stuff / minor additions
 * Expose the IIO value formatting function for drivers to
   make use of internally.
 - ina2xx
    * Fix wrong channel order
    * Fix incorrect reporting of endianness
    * Adding documentation of ABI unique to this device
 - mma8452
   * Drop an unused register description
   * Use an enum for the channel index to aid readability
 - sca3000
   * Use standard NULL comparison style
 - us5182
   * fix an inconsistency in status of enable (a bug with no real effect until
     above patches are applied)
   * refactor the read_raw function to improve maintainability / readability.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWeZ3IAAoJEFSFNJnE9BaIT2UP/3+VlQzBFrg1pBqLCR4xqMHB
 9gUBInzgBwmzpmAqD9pkvyG5f9fTz7hSqX2IGkAA1V6I91H2cunEROSGyhFd4VBW
 vhUhpz9WpRyx+8yLE3fQKUU/UmZJWTI7Xyladwrk3k87OOdcfn3wjtUdTuAhD5SW
 OWzW9txC5dAgSEC5yhqD8VdXN6tRL/eEOEFawHlf9f7bBr9DuyhECp6aIP79gKAS
 pynUPe3R5Uk/GuXdKX6zEWim4XZxhQR0oRmtrdCPIbauK6/ENDOWcaAvgS3mcN8i
 KJ/L27hQGc5zjR8VzysZzZw+7Edc4EqY2UvhA19+0RN93064s0qvR8hoEMp0bHP/
 MKGtwHv8MiqKfdCqIdimf6aT2GILTVWWx8WjyrM0O0+h444ba3ETRPGQ4mYNohuN
 Gt7FFv345aiFh2lQw8Rb54H2d19KV2hwUar3CTpRcl9OhOEnD3ulfDvQghzNlbXl
 nUh5dSOK+yDmXPPMEeZU4pYKG8rNaNZ1FxvVFy/yvUgytD1uqQDnWZ3b1gR0DiV9
 56ucUcrSg74LSqC8R/D6BXb+73LPBTmpu60iGvOQsUYcnmJSdnmEobWCnSXGjFXR
 I2e/H/ZOL4+dyHVpoyfQIiDpe6rGgYQHxyQ/kojWn2NxCJpgUufuR6jPTJ9GMF7k
 eckCq5cDb0nmmg45EQq0
 =aiE2
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.5c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third set of new stuff for IIO in the 4.5 cycle.

New driver features
- us5182
  * Add interrupt support and rising / falling threshold events.

Cleanups / fixes to new stuff / minor additions
* Expose the IIO value formatting function for drivers to
  make use of internally.
- ina2xx
   * Fix wrong channel order
   * Fix incorrect reporting of endianness
   * Adding documentation of ABI unique to this device
- mma8452
  * Drop an unused register description
  * Use an enum for the channel index to aid readability
- sca3000
  * Use standard NULL comparison style
- us5182
  * fix an inconsistency in status of enable (a bug with no real effect until
    above patches are applied)
  * refactor the read_raw function to improve maintainability / readability.
2015-12-26 17:05:25 -08:00
Greg Kroah-Hartman 35ea984dac Second set of IIO new drivers, functionality and cleanups for the 4.5 cycle.
The big one here is the configfs support which has been a long time in the
 works but should allow for cleaner ways to do instantiation of those elements
 of IIO that aren't directly connected to specific hardware. Lots of cool new
 stuff we can use this for in the works!
 
 New core stuff (basically all configfs support related)
 * Configfs support
   - Core support (was waiting for a configfs patch that went in around 4.4rc2)
   - A little fixlet to add a configfs.h to contain a reference to the
     configfs_subsystem structure.
 * Some infrastructure to simplify handling of software based triggers
   (i.e. ones with no actual hardware associated with them)
 * A high resolution timer based trigger.  This has been around for years
     but until the configfs support was ready we didn't have a sensible way
     of instantiating instances of it (the method used for the sysfs_trigger
     has never been really satisfactory)
 
 New Device Support
 * AMS iAQ Volatile Organic Compounds sensor support.
 * Freescale imx7d ADC driver
 * Maxim MAX30100 oximeter driver (note that for these devices most of the
   smart stuff will be in userspace - effectively they are just light sensors
   with some interesting led synchronization as far as the kernel is concerned).
 * Microchip mcp3421 support added to the mcp3422 driver.
 * TI adc124s021 support added to the adc128s052 driver.
 * TI ina219, inda226 power monitors. Note that there is an existing hwmon driver
   for these parts, the usecase is somewhat different so it is unclear at this
   point if the hwmon driver will eventually be replaced by a bridge from
   this driver.  In the meantime the Kconfig dependencies should prevent both
   from being built.
 
 New driver functionality
 * us8152d power management support.
 
 Cleanups, fixups
 * Use list_for_each_entry_safe instead of list_for_each_safe with the entry
   bit coded longhand.
 * Select IRQ_WORK for IIO_DUMMY_EVGEN.  This is a fix that somehow got lost
   when the driver was moved so lets do it again.
 * st-accel - drop an unused define.
 * vz89x, lidar - optimize i2c transactions by using a single i2c tranfers
   instead of multiple calls where supported (fall back to smbus calls as
   before if not).
 * Use dev_get_platdata() in staging drivers: tsl2x7x, adcs and frequency
   drivers instead of direct access to the structure element.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWbX6IAAoJEFSFNJnE9BaI6E4QAIvGXHn4ew8ZH+IF3UP+n47C
 WWtgeh7dEvhqpmXN3eWVo9bxA1JdwbE4/purWttszoJjzqowT0qAt6PuIUME+Md4
 3jOQ41Sc99YjttIwkLpWTqq3H5c3Tn3q9guZ3Imiz9rmpgHRePQ8aatMGUpOp53m
 AEY5JQHqCoWHLMEbEy/5w8RJdNf3cy3Re4kjtwrtp7CMynC4ob7dKE7kcZRvywEw
 6m4hVOQusLvygg1j235czwBDnf79qYOo96z93Pk/auQlqKX3ce/7yQW3GXvWl97a
 8FOmse3FNzX3jwWHELOdAZWIQSLBSqP9N4716qa4orVSihzqAZQ5CSEBPB0r2LS2
 cgK4BL6+xjDkwXn9ui4FiyLdUeUjz/zRhvwFZdjwP63hGf5n9ggZO3RuVslc6/8z
 DOHY5mLdg8CFlMlZUCnCc+1BjU8lgf90+a46Vx4ACJJiqIJrvNRxRKGQZyY/C9sO
 O8h0Ep5mWovcK1+SWdQSsfxdcWcdb0nJFG/VQeJVxMeJR+5mD5lCYmIj5xFkOxJU
 WP9xm+7rsCqSPW+vp8hlY3EWunIQB4gWROvLzWCTS2bKW7B12t1UapLZBrI1f6vK
 JuqHrjKkK7RBRAEldKz6cWCToEaHE+I/k+uIRhlp0of2IPEvGpnm3NoPN1XH3RID
 9boPy/eHuShq8EVg0WUt
 =54PR
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.5b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new drivers, functionality and cleanups for the 4.5 cycle.

The big one here is the configfs support which has been a long time in the
works but should allow for cleaner ways to do instantiation of those elements
of IIO that aren't directly connected to specific hardware. Lots of cool new
stuff we can use this for in the works!

New core stuff (basically all configfs support related)
* Configfs support
  - Core support (was waiting for a configfs patch that went in around 4.4rc2)
  - A little fixlet to add a configfs.h to contain a reference to the
    configfs_subsystem structure.
* Some infrastructure to simplify handling of software based triggers
  (i.e. ones with no actual hardware associated with them)
* A high resolution timer based trigger.  This has been around for years
    but until the configfs support was ready we didn't have a sensible way
    of instantiating instances of it (the method used for the sysfs_trigger
    has never been really satisfactory)

New Device Support
* AMS iAQ Volatile Organic Compounds sensor support.
* Freescale imx7d ADC driver
* Maxim MAX30100 oximeter driver (note that for these devices most of the
  smart stuff will be in userspace - effectively they are just light sensors
  with some interesting led synchronization as far as the kernel is concerned).
* Microchip mcp3421 support added to the mcp3422 driver.
* TI adc124s021 support added to the adc128s052 driver.
* TI ina219, inda226 power monitors. Note that there is an existing hwmon driver
  for these parts, the usecase is somewhat different so it is unclear at this
  point if the hwmon driver will eventually be replaced by a bridge from
  this driver.  In the meantime the Kconfig dependencies should prevent both
  from being built.

New driver functionality
* us8152d power management support.

Cleanups, fixups
* Use list_for_each_entry_safe instead of list_for_each_safe with the entry
  bit coded longhand.
* Select IRQ_WORK for IIO_DUMMY_EVGEN.  This is a fix that somehow got lost
  when the driver was moved so lets do it again.
* st-accel - drop an unused define.
* vz89x, lidar - optimize i2c transactions by using a single i2c tranfers
  instead of multiple calls where supported (fall back to smbus calls as
  before if not).
* Use dev_get_platdata() in staging drivers: tsl2x7x, adcs and frequency
  drivers instead of direct access to the structure element.
2015-12-26 17:03:33 -08:00
Jonathan Cameron e8aab48b34 iio: adc: ina2xx: Fix incorrect report of data endianness to userspace.
This was extracted from a reposting of the driver after it had been applied
to the IIO tree.  I have fast tracked it as the driver will be in 4.5 and
it would be nice to fix this trivial issue before it is.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-22 18:51:27 +00:00
Adriana Reus 9b1de75b5d iio: light: us5182d: Refactor read_raw function
A bit of refactoring for better readability.
Moved and slightly reorganized all the activity necessary for reading als
and proximity into a different function. This way the switch in read raw
becomes clearer and more compact.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-22 18:07:08 +00:00
Adriana Reus b6695254f8 iio: light: us5182d: Add interrupt support and events
Add interrupt support for proximity.
Add two threshold events to signal rising and falling directions.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-22 18:07:05 +00:00
Adriana Reus 58e9042f5f iio: light: us5182d: Fix enable status inconcistency
When setting als only or proximity only modes make sure that we mark the
other component as disabled. This fix is in preparation of adding event
support because that will make it possible to switch between one-shot and
continuous modes and not tracking these correctly may cause faulty
behaviour (e.g wrongfully considering px enabled and not setting an
appropriate mode in the chip).

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-22 18:00:51 +00:00
Andrew F. Davis 7d2c2acac5 iio: Make IIO value formating function globally available.
Make IIO value formating function globally available to allow IIO drivers
to output values as the core does.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-22 17:04:56 +00:00
Valentin Rothberg 86af47413a iio: exynos-adc: fix irqf_oneshot.cocci warnings
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.

So pass the IRQF_ONESHOT flag in this case.

Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
2015-12-21 21:08:55 -08:00
Markus Elfring c08ae18560 iio-light: Use a signed return type for ltr501_match_samp_freq()
The return type "unsigned int" was used by the ltr501_match_samp_freq()
function despite of the aspect that it will eventually return a negative
error code.
Improve this implementation detail by deletion of the type modifier then.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 17:00:29 +00:00
Martin Kepplinger e60378c17c iio: mma8452: use enum for channel index
This gets rid of some magic numbers by adding an enum.

Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 16:45:42 +00:00
Martin Kepplinger 8e34f2c8d2 iio: mma8452: remove unused register description
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 16:44:56 +00:00
Marc Titinger 75e1a3a789 iio: ina2xx: fix channel order in software buffer
POWER and CURRENT were swapped out in the buffer:
was current2 and power3, correct order is power2 and current3.

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19 15:06:28 +00:00
Greg Kroah-Hartman 93c222c0e1 Merge 4.4-rc5 into staging-next
We want those fixes in here for testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-13 19:23:01 -08:00
Anshul Garg c34c18195d iio/inkern.c Use list_for_each_entry_safe
Use list_for_each_entry_safe instead of list_for_each_safe
and list_entry call.

Signed-off-by: Anshul Garg <aksgarg1989@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 17:23:37 +00:00
Haibo Chen 16846ebeff iio: adc: add IMX7D ADC driver support
Freescale i.MX7D soc contains a new ADC IP. This patch add this ADC
driver support, and the driver only support ADC software trigger.

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 16:25:41 +00:00
Marc Titinger 46294cd948 iio: ina2xx: give the capture kthread a more useful name string.
PID  PPID USER     STAT   VSZ %VSZ %CPU COMMAND
  144     2 root     DW       0   0%  33% [ina226:1-8800us]
  141     2 root     DW       0   0%  25% [ina226:0-8800us]
   40     2 root     SW       0   0%  15% [irq/156-4802a00]
  147     2 root     DW       0   0%   7% [ina226:2-8800us]
  145     1 root     S     1236   0%   6% dd if /dev/iio:device1 of /dev/null
  148     1 root     S     1236   0%   4% dd if /dev/iio:device2 of /dev/null
  149   137 root     R     1244   0%   3% top -d 1
  142     1 root     S     1236   0%   2% dd if /dev/iio:device0 of /dev/null

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 16:08:37 +00:00
Marc Titinger b17dc40155 iio: ina2xx: re-instate a sysfs show/store for the shunt resistor value
Different probe modules use different resistor values. The front-end
application may read a probe ID (from eeprom) and set the shunt value
accordingly.

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 16:08:13 +00:00
Marc Titinger f9993c0771 iio: ina2xx: provide a sysfs parameter to allow async readout of the ADCs
This can lead to repeated or skipped samples depending on the clock beat
between the capture thread and the chip sampling clock, but will also spare
reading/waiting for the Capture Ready Flag and improve the available i2c
bandwidth for reading measurements.

Output of iio_info:
...snip...
4 device-specific attributes found:
  attr 0: in_oversampling_ratio value: 4
  attr 1: in_allow_async_readout value: 0
  attr 2: integration_time_available value: 140 204 332 588 1100 2116...
  attr 3: in_sampling_frequency value: 114

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 16:07:41 +00:00
Marc Titinger c43a102e67 iio: ina2xx: add support for TI INA2xx Power Monitors
in SOFTWARE buffer mode, a kthread will capture the active scan_elements
into a kfifo, then compute the remaining time until the next capture tick
and do an active wait (udelay).

This will produce a stream of up to fours channels plus a 64bits
timestamps (ns).

Tested with ina226, on BeagleBoneBlack.

Datasheet: http://www.ti.com/lit/gpn/ina226

Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 16:07:36 +00:00
Matt Ranostay 466df4d0c1 iio: chemical: add AMS iAQ-core support
Add support for AMS iAQ-core continuous and pulsed VOC sensors.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 15:07:38 +00:00
Matt Ranostay 4d33615df5 iio: light: add MAX30100 oximeter driver support
MAX30100 is an heart rate and pulse oximeter sensor that works using
two LEDS of different wavelengths, and detecting the light reflected
back.

This patchset adds support for both IR and RED LED channels which can
be processed in userspace to determine heart rate and blood oxygen
levels.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 12:14:37 +00:00
Oliver Stäbler b41fa86b67 iio:adc128s052: add support for adc124s021
Signed-off-by: Oliver Stäbler <oliver.staebler@bytesatwork.ch>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-12 12:08:17 +00:00
Arnd Bergmann 9ab655a32e staging: iio: select IRQ_WORK for IIO_DUMMY_EVGEN
The iio dummy code was recently changed to use irq_work_queue, but
that code is compiled into the kernel only if IRQ_WORK is set, so
we can get a link error here:

drivers/built-in.o: In function `iio_evgen_poke':
(.text+0x208a04): undefined reference to `irq_work_queue'

This changes the Kconfig file to match what other drivers do.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: fd2bb310ca ("Staging: iio: Move evgen interrupt generation to irq_work")
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-05 17:33:39 +00:00
Lars-Peter Clausen d590faf9e8 iio: adis_buffer: Fix out-of-bounds memory access
The SPI tx and rx buffers are both supposed to be scan_bytes amount of
bytes large and a common allocation is used to allocate both buffers. This
puts the beginning of the tx buffer scan_bytes bytes after the rx buffer.
The initialization of the tx buffer pointer is done adding scan_bytes to
the beginning of the rx buffer, but since the rx buffer is of type __be16
this will actually add two times as much and the tx buffer ends up pointing
after the allocated buffer.

Fix this by using scan_count, which is scan_bytes / 2, instead of
scan_bytes when initializing the tx buffer pointer.

Fixes: aacff892cb ("staging:iio:adis: Preallocate transfer message")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-05 17:32:04 +00:00
Robert Kmiec ec0096f853 iio: st_accel_core: Remove unneeded define
Definition of ST_SENSORS_WAI_ADDRESS was introduced within a very
first commit of this driver, but it was never used.
This address is already defined as ST_SENSORS_DEFAULT_WAI_ADDRESS
in include/linux/iio/common/st_sensors.h

To avoid duplication of the same constant in two different places
called almost exactly the same, the one which was never used
should be removed.

Signed-off-by: Robert Kmiec <robert.r.kmiec@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-05 17:28:31 +00:00
Matt Ranostay 366e65633c iio: proximity: lidar: optimize i2c transactions
Optimize device tranactions using i2c transfers versus multiple
possibly racey i2c_smbus_* function calls, and only one transaction
for distance measurement. Falls back to smbus method if i2c
functionality isn't available.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-05 16:40:48 +00:00
Jonathan Cameron 8d6c16dd72 iio:configfs: Introduce iio/configfs.h to provide a location for the configfs_subsystem
This exported element needs to be accesible to all drivers using configfs
within IIO.  Previously it was in the sw_trig.h file which only convered one
such usecase.  This also fixes a sparse warning as it is now in a header
that makes sense to include from industrialio-configfs.c

Signed-off-by: Jonathan Cameron < jic23@kernel.org>
2015-12-05 16:25:30 +00:00
Matt Ranostay 93e87d73cc iio: chemical: vz89x: rework i2c transfer reading
Add an optimized i2c transfer reading function, and fallback
to racey smbus transfers if client->adapter doesn't support this.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-03 18:31:12 +00:00
Daniel Baluta ac5006a2a5 iio: trigger: Introduce IIO hrtimer based trigger
This patch registers a new IIO software trigger interrupt source
based on high resolution timers.

Notice that if configfs is enabled we create sampling_frequency
attribute allowing users to change hrtimer period (1/sampling_frequency).

The IIO hrtimer trigger has a long history, this patch is based on
an older version from Marten and Lars-Peter.

Signed-off-by: Marten Svanfeldt <marten@intuitiveaerial.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-03 18:19:27 +00:00
Daniel Baluta b662f809d4 iio: core: Introduce IIO software triggers
A software trigger associates an IIO device trigger with a software
interrupt source (e.g: timer, sysfs). This patch adds the generic
infrastructure for handling software triggers.

Software interrupts sources are kept in a iio_trigger_types_list and
registered separately when the associated kernel module is loaded.

Software triggers can be created directly from drivers or from user
space via configfs interface.

To sum up, this dynamically creates "triggers" group to be found under
/config/iio/triggers and offers the possibility of dynamically
creating trigger types groups. The first supported trigger type is
"hrtimer" found under /config/iio/triggers/hrtimer.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-03 18:19:27 +00:00
Daniel Baluta 8261d961d1 iio: core: Introduce IIO configfs support
This patch creates the IIO configfs root group. The group
will appear under <mount-point>/iio/, usually /config/iio.

We introduce configfs support in IIO in order to be able to easily
create IIO objects from userspace. The first supported IIO objects
are triggers introduced with next patches.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Tested-by: Matt Ranostay <matt.ranostay@intel>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-03 18:19:24 +00:00
Adriana Reus f0e5f57d3a iio: light: us8152d: Add power management support
Add power management for sleep as well as runtime pm.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-02 18:42:05 +00:00