Commit graph

1095 commits

Author SHA1 Message Date
Daniel Baluta 0475c68544 iio: imu: kmx61: Drop unused device parameter
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:53 +00:00
Daniel Baluta dfb12edea5 iio: imu: kmx61: Fixup parameters alignment
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:52 +00:00
Daniel Baluta 28ff344e1d iio: imu: kmx61: Enhance error handling
This fixes parts of kmx61 error handling to make code easier to read and to be
more consistent with IIO coding conventions:
	* prefer as single point for error handling instead of duplicating code
	for each function
	* directly return a value from a case branch instead of breaking
	* fix error message for writing REG_CTRL1

Also, add separate error paths for kmx61_trigger_setup/iio_triggered_buffer_setup
calls.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:52 +00:00
Daniel Baluta a3da4fa301 iio: imu: kmx61: Don't ignore kmx61_set_power_state errors
..except while in an error handler, where there is nothing
to be done anyway.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:51 +00:00
Daniel Baluta 4e8439779e iio: imu: kmx61: Save odr_bits for later use
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:50 +00:00
Stefan Wahren 1f202725b7 iio: inkern: add out of range error message
If the DT contains an invalid channel specifier then the probe of
iio_hwmon fails with the following message:

iio_hwmon: probe of iio_hwmon failed with error -22

So it's better to print out the relevant channel specifier in
error case to locate the problem.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:50 +00:00
Vlad Dogaru 4193c0f1d8 iio: driver for Semtech SX9500 proximity solution
Supports buffering, IIO events and changing sampling frequency.

Datasheet available at:
http://www.semtech.com/images/datasheet/sx9500_ag.pdf

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-05 18:59:42 +00:00
Fabien Proriol 65de7654d3 iio: iio: Fix iio_channel_read return if channel havn't info
When xilinx-xadc is used with hwmon driver to read voltage, offset used
for temperature is always applied whatever the channel.

iio_channel_read must return an error to avoid offset for channel
without IIO_CHAN_INFO_OFFSET property.

Signed-off-by: Fabien Proriol <fabien.proriol@jdsu.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:46:48 +00:00
Roberta Dobrescu e904ce7e26 iio: frequency: ad9523: Increase sleep time in ad9523_store_eeprom
This patch increases sleep time in ad9523_store_eeprom to 20ms since
it isn't timing critical. It fixes the following checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20ms

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:18:26 +00:00
Roberta Dobrescu ff6f46295d iio: amplifiers: ad8366: Use right order for type specification
This patch fixes the following checkpatch.pl warning:
WARNING: type 'char unsigned' should be specified in [[un]signed]
[short|int|long|long long] order

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:16:57 +00:00
Roberta Dobrescu c5878d9dbb iio: amplifiers: ad8366: Remove space before ','
This patch fixes the following checkpatch.pl error:
ERROR: space prohibited before that ',' (ctx:WxW)

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:16:07 +00:00
Roberta Dobrescu 586d48f926 iio: light: lm3533-als: Remove space before ','
This patch fixes the following checkpatch.pl error:
ERROR: space prohibited before that ',' (ctx:WxE)

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:14:36 +00:00
Roberta Dobrescu 4f51c9ada7 iio: light: Annotate Kconfig entry with module name information
This patch fixes the following checkpatch.pl warning:
WARNING: please write a paragraph that describes the config symbol fully

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:14:34 +00:00
Roberta Dobrescu 88f4c6c468 iio: accel: Annotate Kconfig entries with module name information
This patch fixes the following checkpatch.pl warning:
WARNING: please write a paragraph that describes the config symbol fully

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:13:10 +00:00
Roberta Dobrescu c876109e66 iio: accel: mma8452: Remove trailing whitespace
This patch fixes the following checkpatch.pl error:
ERROR: trailing whitespace

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:12:09 +00:00
Roberta Dobrescu b0868df433 iio: accel: kxcjk-1013: Add a blank line after declarations
This patch fixes the following checkpatch.pl warning:
WARNING: Missing a blank line after declarations

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-01 12:11:09 +00:00
Srinivas Pandruvada 6ed5ac50a3 iio: imu: inv_mpu6050: ACPI enumeration
Added changes so that the module can be enumerated via ACPI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 12:38:47 +00:00
Roberta Dobrescu 450a5ff768 iio: trigger: Add a blank line after declarations
This patch fixes the following checkpatch.pl warning:
WARNING: Missing a blank line after declarations

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 12:15:36 +00:00
Vlad Dogaru 60347e71c0 iio: mma9551: fix sparse warning
sparse warnings: (new ones prefixed by >>)

>> drivers/iio/accel/mma9551.c:554:57: sparse: mixing different enum types
   drivers/iio/accel/mma9551.c:554:57:     int enum mma9551_tilt_axis  versus
   drivers/iio/accel/mma9551.c:554:57:     int enum mma9551_gpio_pin
>> drivers/iio/accel/mma9551.c:576:57: sparse: mixing different enum types
   drivers/iio/accel/mma9551.c:576:57:     int enum mma9551_tilt_axis  versus
   drivers/iio/accel/mma9551.c:576:57:     int enum mma9551_gpio_pin

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reviewed-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 12:13:36 +00:00
Karol Wrona 20dd20f68f iio: core: Get rid of misleading comment
This comment did not fit here.  It explains why devm_kmalloc
uses dr_alloc.  Generally is not needed at all.

Signed-off-by: Karol Wrona <k.wrona@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 11:41:16 +00:00
Karol Wrona 780103fef5 iio: kfifo: Add resource management devm_iio_kfifo_allocate/free
iio kfifo allocate/free gained their devm_ wrappers.

Signed-off-by: Karol Wrona <k.wrona@samsung.com>
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 11:39:57 +00:00
Karol Wrona 7ab374a053 iio: kfifo: Remove unused argument in iio_kfifo_allocate
indio_dev was unused in function body plus some small style fix - add new
lines after "if(sth) return sth" and before the last return statement.

The argument was removed also in its client.

Signed-off-by: Karol Wrona <k.wrona@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 11:20:38 +00:00
Hartmut Knaack 44cf3798a3 iio:pressure:bmp280: cleanup
The calculations for temperature and pressure compensation were already slightly
optimized in comparison to the datasheet. So, it makes sense to optimize even a
bit more, making proper use of C operators:
  - variable t in bmp280_compensate_temp() can be eliminated by directly
    returning the result of the relevant equation.
  - make use of the += operator and eliminate an unnecessary parenthesis level in
    bmp280_compensate_press().
When the initialization of the ctrl_meas register fails, the error message will
now mention the right register name.
During probe, i2c_set_clientdata() is called, although it is not necessary. Drop
it.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 10:32:34 +00:00
Roberta Dobrescu 762c4da347 iio: frequency: Remove unnecessary braces around single statement block
This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 09:38:42 +00:00
Roberta Dobrescu d9d0ac9655 iio: frequency: Remove 'out of memory' message
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 09:36:17 +00:00
Linus Torvalds dab363f938 Staging patches for 3.19-rc1
Here's the big staging tree pull request for 3.19-rc1.
 
 We continued to delete more lines than were added, always a good thing,
 but not at a huge rate this release, only about 70k lines removed
 overall mostly from removing the horrid bcm driver.
 
 Lots of normal staging driver cleanups and fixes all over the place,
 well over a thousand of them, the shortlog shows all the horrid details.
 
 The "contentious" thing here is the movement of the Android binder code
 out of staging into the "real" part of the kernel.  This is code that
 has been stable for a few years now and is working as-is in the tens of
 millions of devices with no issues.  Yes, the code is horrid, and the
 userspace api leaves a lot to be desired, but it's not going to change
 due to legacy issues that we have no control over.  Because so many
 devices and companies rely on this, and the code is stable, might as
 well promote it out of staging.
 
 This was all discussed at the Linux Plumbers conference, and everyone
 participating agreed that this was the best way forward.
 
 There is work happening to replace the binder code with something new
 that is happening right now, but I don't expect to see the results of
 that work for another year at the earliest.  If that ever happens, and
 Android switches over to it, I'll gladly remove this version.
 
 As for maintainers, I'll be glad to maintain this code, I've been doing
 it for the past few years with no problems.  I'll send a MAINTAINERS
 entry for it before 3.19-final is out, still need to talk to the Google
 developers about if they are willing to help with it or not, last I
 checked they were, which was good.
 
 All of these patches have been in linux-next for a while with no
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSPICkACgkQMUfUDdst+yksdwCfSLE9VUy1o2sAPDRe+J3bQced
 EWEAoL3RtnejKbo5tHS2IT69pLrwiIDS
 =YXyM
 -----END PGP SIGNATURE-----

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

Pull staging driver updates from Greg KH:
 "Here's the big staging tree pull request for 3.19-rc1.

  We continued to delete more lines than were added, always a good
  thing, but not at a huge rate this release, only about 70k lines
  removed overall mostly from removing the horrid bcm driver.

  Lots of normal staging driver cleanups and fixes all over the place,
  well over a thousand of them, the shortlog shows all the horrid
  details.

  The "contentious" thing here is the movement of the Android binder
  code out of staging into the "real" part of the kernel.  This is code
  that has been stable for a few years now and is working as-is in the
  tens of millions of devices with no issues.  Yes, the code is horrid,
  and the userspace api leaves a lot to be desired, but it's not going
  to change due to legacy issues that we have no control over.  Because
  so many devices and companies rely on this, and the code is stable,
  might as well promote it out of staging.

  This was all discussed at the Linux Plumbers conference, and everyone
  participating agreed that this was the best way forward.

  There is work happening to replace the binder code with something new
  that is happening right now, but I don't expect to see the results of
  that work for another year at the earliest.  If that ever happens, and
  Android switches over to it, I'll gladly remove this version.

  As for maintainers, I'll be glad to maintain this code, I've been
  doing it for the past few years with no problems.  I'll send a
  MAINTAINERS entry for it before 3.19-final is out, still need to talk
  to the Google developers about if they are willing to help with it or
  not, last I checked they were, which was good.

  All of these patches have been in linux-next for a while with no
  reported issues"

* tag 'staging-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1382 commits)
  Staging: slicoss: Fix long line issues in slicoss.c
  staging: rtl8712: remove unnecessary else after return
  staging: comedi: change some printk calls to pr_err
  staging: rtl8723au: hal: Removed the extra semicolon
  lustre: Deletion of unnecessary checks before three function calls
  staging: lustre: fix sparse warnings: static function declaration
  staging: lustre: fixed sparse warnings related to static declarations
  staging: unisys: remove duplicate header
  staging: unisys: remove unneeded structure
  staging: ft1000 : replace __attribute ((__packed__) with __packed
  drivers: staging: rtl8192e: Include "asm/unaligned.h" instead of "access_ok.h" in "rtl819x_BAProc.c"
  Drivers:staging:rtl8192e: Fixed checkpatch warning
  Drivers:staging:clocking-wizard: Added a newline
  staging: clocking-wizard: check for a valid clk_name pointer
  staging: rtl8723au: Hal_InitPGData() avoid unnecessary typecasts
  staging: rtl8723au: _DisableAnalog(): Avoid zero-init variables unnecessarily
  staging: rtl8723au: Remove unnecessary wrapper _ResetDigitalProcedure1()
  staging: rtl8723au: _ResetDigitalProcedure1_92C() reduce code obfuscation
  staging: rtl8723au: Remove unnecessary wrapper _DisableRFAFEAndResetBB()
  staging: rtl8723au: _DisableRFAFEAndResetBB8192C(): Reduce code obfuscation
  ...
2014-12-15 18:06:13 -08:00
Linus Torvalds e6b5be2be4 Driver core patches for 3.19-rc1
Here's the set of driver core patches for 3.19-rc1.
 
 They are dominated by the removal of the .owner field in platform
 drivers.  They touch a lot of files, but they are "simple" changes, just
 removing a line in a structure.
 
 Other than that, a few minor driver core and debugfs changes.  There are
 some ath9k patches coming in through this tree that have been acked by
 the wireless maintainers as they relied on the debugfs changes.
 
 Everything has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSOD20ACgkQMUfUDdst+ylLPACg2QrW1oHhdTMT9WI8jihlHVRM
 53kAoLeteByQ3iVwWurwwseRPiWa8+MI
 =OVRS
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the set of driver core patches for 3.19-rc1.

  They are dominated by the removal of the .owner field in platform
  drivers.  They touch a lot of files, but they are "simple" changes,
  just removing a line in a structure.

  Other than that, a few minor driver core and debugfs changes.  There
  are some ath9k patches coming in through this tree that have been
  acked by the wireless maintainers as they relied on the debugfs
  changes.

  Everything has been in linux-next for a while"

* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
  Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
  fs: debugfs: add forward declaration for struct device type
  firmware class: Deletion of an unnecessary check before the function call "vunmap"
  firmware loader: fix hung task warning dump
  devcoredump: provide a one-way disable function
  device: Add dev_<level>_once variants
  ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
  ath: use seq_file api for ath9k debugfs files
  debugfs: add helper function to create device related seq_file
  drivers/base: cacheinfo: remove noisy error boot message
  Revert "core: platform: add warning if driver has no owner"
  drivers: base: support cpu cache information interface to userspace via sysfs
  drivers: base: add cpu_device_create to support per-cpu devices
  topology: replace custom attribute macros with standard DEVICE_ATTR*
  cpumask: factor out show_cpumap into separate helper function
  driver core: Fix unbalanced device reference in drivers_probe
  driver core: fix race with userland in device_add()
  sysfs/kernfs: make read requests on pre-alloc files use the buffer.
  sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
  fs: sysfs: return EGBIG on write if offset is larger than file size
  ...
2014-12-14 16:10:09 -08:00
kbuild test robot ebd1636606 iio: imu: kmx61: kmx61_set_wake_up_odr() can be static
drivers/iio/imu/kmx61.c:422:5: sparse: symbol 'kmx61_set_wake_up_odr' was not declared. Should it be static?

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 18:14:59 +00:00
Daniel Baluta fd3ae7a9f2 iio: imu: kmx61: Add support for any motion trigger
We use WUFE (Wake Up from Sleep Engine) and BTSE (Back to Sleep Engine)
to detect general motion input.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:54:33 +00:00
Daniel Baluta c3a23ecc09 iio: imu: kmx61: Add support for data ready triggers
This creates a data ready trigger per IIO device.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:49:30 +00:00
Daniel Baluta 3b9c40e604 iio: imu: kmx61: Add PM sleep support
Per sensor state (ACTIVE/STANDBY) is saved in driver's
private data (acc_stby/mag_stby) and restored when
resume is called.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:45:14 +00:00
Daniel Baluta aff8609add iio: imu: kmx61: Add PM runtime support
By default both sensors are ACTIVE, in this way the driver
will work even if CONFIG_PM_RUNTIME is not selected.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:44:30 +00:00
Daniel Baluta b25862c577 iio: imu: kmx61: Add acpi support
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:43:57 +00:00
Daniel Baluta 20ffac278e iio: imu: Add support for Kionix KMX61 sensor
Minimal implementation for KMX61 6-axis accelerometer/magnetometer. It exports
raw accel/magn readings together with scale and sampling frequency.

This driver uses two IIO devices one for accelerometer and one for magnetometer.

Datasheet will be available at:
http://www.kionix.com/6-axis-accelerometer-magnetometer/kmx61

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 13:43:54 +00:00
Jonathan Cameron 3909a0713e Revert "iio: imu: Add support for Kionix KMX61 sensor"
The two halves of this part can run largely independently.  Hence
a version 4 of this patch followed that reorganized things completely.

This reverts commit d7d787d291.
2014-12-12 13:30:04 +00:00
Lars-Peter Clausen 2eacc608b3 iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
The ad7991/ad7995/ad7999 does not have a configuration register like the
other devices that can be written and read. The configuration is written as
part of the conversion sequence.

Fixes: 0f7ddcc1bf ("iio:adc:ad799x: Write default config on probe and reset alert status on probe")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:34:00 +00:00
Vlad Dogaru c78b917163 iio: add driver for Freescale MMA9551L
Add support for Freescale MMA9551L Intelligent Motion-Sensing Platform.
The driver supports raw reads for acceleration and inclination, as well
as configuring inclination rate-of-change events.  The events can be
used similarly to an Android sensor Tilt event.

The specifications can be downloaded from:
http://www.freescale.com/files/sensors/doc/ref_manual/MMA955xLSWRM.pdf

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:37 +00:00
Irina Tirdea 9d02daf738 iio: accel: kxcjk-1013: power off device if probe fails
When the device is initialized in probe, it is also powered on.
If there is an error after the initialization, the device will
remain powered on.

Power off the device in case probe fails after device initialization.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:35 +00:00
Irina Tirdea fbd123e913 iio: accel: kxcjk-1013: error handling when set mode fails
If there is an error in set mode at runtime resume, reset the state of
the runtime usage count.

If there is an error in set mode at runtime suspend, make sure the framework
retries to suspend the device.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:35 +00:00
Lars-Peter Clausen 374956600e iio: buffer: Drop get_length callback
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:34 +00:00
Lars-Peter Clausen 8d92db2827 iio: buffer: Make length attribute read only for buffers without set_length
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:33 +00:00
Lars-Peter Clausen 08e7e0adaa iio: buffer: Allocate standard attributes in the core
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:33 +00:00
Lars-Peter Clausen d967cb6bd4 iio: buffer: Move iio_buffer_alloc_sysfs and iio_buffer_free_sysfs
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:32 +00:00
Lars-Peter Clausen 616dde2a1e iio: Remove get_bytes_per_datum() from iio_buffer_access_funcs
There haven't been any users of the get_bytes_per_datum() callback for a
while. The core assumes that the number of bytes per datum can be calculated
based on the enabled channels and the storage size of the channel and
iio_compute_scan_bytes() is used to compute this number. So remove the
callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:32 +00:00
Lars-Peter Clausen 3e1b6c95b9 iio: Move buffer registration to the core
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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:31 +00:00
Lars-Peter Clausen 217a5cf0a1 iio: Unexport iio_scan_mask_set()
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: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:29 +00:00
Dmitry Eremin-Solenikov f9380e7123 iio: inkern: add iio_write_channel_raw
Introduce API for easy in-kernel setting of DAC values.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:27 +00:00
Irina Tirdea c75b8dc84f iio: accel: kxcjk-1013: only set power state if CONFIG_PM is defined
When CONFIG_PM is not defined and the driver tries to power off the device,
kxcjk1013_set_power_state will call pm_runtime_put_autosuspend, which is
not implemented (wil return -ENOSYS).

Only call pm_runtime calls to change power state  when CONFIG_PM is defined.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:27 +00:00
Irina Tirdea d3653d0989 iio: accel: kxcjk-1013: always power on device in resume
When the system resumes, it will first call system resume and
then runtime suspend (if CONFIG_RUNTIME_PM is enabled).
There is no need to conditionally power on the device in
system resume, so always power it on and leave runtime
suspend to power it off if needed.

Suggested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:26 +00:00
Srinivas Pandruvada 3a2ecc3d2d iio: imu: inv_mpu6050: Add i2c mux for by pass
This chip allows some limited number of sensors connected to it as
slaves, which can be directly accessed by register interface of this
driver.But the current upstream driver doesn't support such mode.
To attach such slaves to main processor i2c bus, chip has to be set
up in bypass mode. This change adds i2c mux, which will enable/disable
this mode for transaction to/from such slave devices.
This was discussed for a while in mailing list, this was the outcome:
Reference:
http://www.spinics.net/lists/linux-iio/msg12126.html
http://comments.gmane.org/gmane.linux.kernel.iio/11470

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:26 +00:00
Vlad Dogaru 0f8994b18a iio: bmp280: refactor compensation code
This version of the code avoids extra memory copy operations and is
somewhat smaller in code size.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:25 +00:00
Fabian Frederick 8f6eb02596 iio: common: remove unnecessary sizeof(u8)
sizeof(u8) is always 1.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:25 +00:00
Gwendal Grignou 57e73a423b iio: ak8975: add ak09911 and ak09912 support
Add 2 new definition entries to support ak0991x compass.
Add a more advanced function to check we are dealing with the
expected device.
Remove standalone driver for ak09911.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:20 +00:00
Gwendal Grignou 286f74c253 iio: ak8975: add definition structure per compass type
For each type of compass supported (AK8975 and AK8963),
add a definition structure for register masks, important registers,
raw data interpretation.
This change will make integrating new type of devices easier.

Remove i2c register cache. It is only used for one single register.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:25:14 +00:00
Rafael J. Wysocki e3d857e1ae Merge branch 'pm-runtime'
* pm-runtime: (25 commits)
  i2c-omap / PM: Drop CONFIG_PM_RUNTIME from i2c-omap.c
  dmaengine / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  drivers: sh / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  e1000e / igb / PM: Eliminate CONFIG_PM_RUNTIME
  MMC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  MFD / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  misc / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  media / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  input / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  iio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  hsi / OMAP / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  i2c-hid / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  drm / exynos / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  gpio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  hwrandom / exynos / PM: Use CONFIG_PM in #ifdef
  block / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
  USB / PM: Drop CONFIG_PM_RUNTIME from the USB core
  PM: Merge the SET*_RUNTIME_PM_OPS() macros
  PM / Kconfig: Do not select PM directly from Kconfig files
  PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core
  ...
2014-12-08 20:00:44 +01:00
Rafael J. Wysocki 5996d93054 Merge branches 'acpi-video' and 'acpi-pmic'
* acpi-video:
  ACPI / video: Run _BCL before deciding registering backlight

* acpi-pmic:
  ACPI / PMIC: AXP288: support virtual GPIO in ACPI table
  ACPI / PMIC: support PMIC operation region for XPower AXP288
  ACPI / PMIC: support PMIC operation region for CrystalCove
  iio/axp288_adc: remove THIS_MODULE owner
  mfd/axp20x: avoid irq numbering collision
  iio: adc: Add module device table for autoloading
  iio: adc: Add support for axp288 adc
  mfd: axp20x: Extend axp20x to support axp288 pmic
2014-12-08 19:54:45 +01:00
Rafael J. Wysocki 6f0a13f25e iio / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM
After commit b2b49ccbdd (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks
depending on CONFIG_PM_RUNTIME may now be changed to depend on
CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under
drivers/iio/.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
2014-12-04 01:08:13 +01:00
Greg Kroah-Hartman deef2a118a Merge 3.18-rc7 into staging-work.
We want those staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-02 16:20:59 -08:00
Rafael J. Wysocki a26033a1f5 Merge branch 'ib-mfd-iio-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into acpi-pmic
Pull MFD changes that the ACPI PMIC changes depend on from Lee Jones.
2014-11-25 02:18:58 +01:00
Gwendal Grignou 71222bf541 iio: ak8975: minor fixes
Fixes code duplication, return of function.
Check client->irq properly when setting up optional irq handler.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 11:28:04 +00:00
Irina Tirdea bcdf28fb1b iio: core: Introduce IIO_CHAN_INFO_CALIBHEIGHT
Some devices need the height of the user to compute various
parameters. One of this devices is Freescale's MMA9553L
(http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf)
that needs the height of the user to compute the stride length which
is used further to determine distance, speed and activity type.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 11:05:56 +00:00
Irina Tirdea a88bfe7858 iio: core: Introduce STEPS channel, ENABLE mask and INSTANCE event
These changes are needed to support the functionality of a pedometer.
A pedometer has two basic functionalities: step counter and step detector.

The step counter needs to be enabled and then it will count the steps
in its hardware register. Whenever the application needs to check
the step count, it will read the step counter register. To support the
step counter a new channel type STEPS is added. Since the pedometer needs
to be enabled first so that the hardware can count and store the steps,
we need a specific ENABLE channel info mask.

The step detector will generate an interrupt each time a step is detected.
To support this functionality we add a new event type INSTANCE.

For more information on the Android requirements for step counter and step
detector see:
http://source.android.com/devices/sensors/composite_sensors.html#counter
and http://source.android.com/devices/sensors/composite_sensors.html#detector.

A device that has the pedometer functionality this interface needs to
support is Freescale's MMA9553L:
http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 11:05:51 +00:00
Irina Tirdea 1843c2f3de iio: core: Introduce IIO_EV_DIR_NONE
For some events (e.g.: step detector) a direction does not make sense.

Add IIO_EV_DIR_NONE to be used with such events and generate sysfs event
attributes that do not contain direction.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 11:05:49 +00:00
Daniel Baluta 55aebeb926 iio: core: Introduce IIO_ACTIVITY channel
This channel will be used for exposing information about
activity composite sensors. Activities supported so far:
	* running
	* jogging
	* walking
	* still

THRESHOLD event is used to signal a change in the activity
state.

We associate a confidence interval for each activity expressed
as a percentage from 0 to 100.
  * 0, means the sensor IS NOT reporting that activity.
  * 100, means the sensor IS reporting that activity.

Users of this interface have two possible means to gather
information about the ongoing activities.

1. Event based, via event file descriptor
  * sensor may report an event when ENTERING an activity or LEAVING
    an activity based on a threshold value.
  * drivers will wake up applications waiting data on the event fd

2. Polling, by reading the sysfs associated attribute files:
  * /sys/bus/iio/devices/iio:device0/in_activity_running_input
expressed as percentage confidence value from 0 to 100.

This will offer an interface for Android significant motion
composite sensor defined here:
http://source.android.com/devices/sensors/composite_sensors.html

Activities listed above are supported by Freescale's MMA9553 sensor:
http://freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 11:05:47 +00:00
Daniel Baluta d7d787d291 iio: imu: Add support for Kionix KMX61 sensor
Minimal implementation for KMX61 6-axis accelerometer/magnetometer. It exports
raw accel/magn readings together with scale and sampling frequency.

Datasheet will be available at:
http://www.kionix.com/6-axis-accelerometer-magnetometer/kmx61

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-22 10:47:20 +00:00
Jacob Pan 8019f69627 iio/axp288_adc: remove THIS_MODULE owner
This is no longer needed in that platform driver_register will do it.

Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-11-18 15:34:22 +00:00
Aaron Lu 29ec0a25c8 iio: adc: Add module device table for autoloading
Add the module device id table so that the driver can be automatically
loaded once the platform device is created.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-11-18 15:33:52 +00:00
Srinivas Pandruvada 9e8e228f2b iio: accel: bmc150: set low default thresholds
Set the threshold to low by default. With this thresholds any movement
on the device with this sensor will generate event.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:25:00 +00:00
Srinivas Pandruvada 1174124c45 iio: accel: bmc150: Fix iio_event_spec direction
Change event spec direction from
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING
to
IIO_EV_DIR_EITHER

Suggested-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:23:48 +00:00
Srinivas Pandruvada 8d5a978192 iio: accel: bmc150: Send x, y and z motion separately
This chip is capable to identify motion across x, y and z axes. So
send different events.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:22:39 +00:00
Srinivas Pandruvada aaeecd8044 iio: accel: bmc150: Error handling when mode set fails
When mode set fails due to some transient failures, it will atleast
reset the state of runtime usage count and also let the runtime
suspend retry from the driver framework.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:22:34 +00:00
Srinivas Pandruvada 6896ab3a8c iio: gyro: bmg160: Fix iio_event_spec direction
Change event spec direction from
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING
to
IIO_EV_DIR_EITHER

Suggested-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:19:25 +00:00
Srinivas Pandruvada cb80f6a36b iio: gyro: bmg160: Send x, y and z motion separately
This chip is capable to identify motion across x, y and z axes. So
send different events.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:19:22 +00:00
Srinivas Pandruvada 5af6b30788 iio: gyro: bmg160: Don't let interrupt mode to be open drain
Change the mode to push/pull type instead of open drain as some
platforms fails to drive the GPIO pin with open drain.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:19:20 +00:00
Srinivas Pandruvada 10bef28973 iio: gyro: bmg160: Error handling when mode set fails
When mode set fails due to some transient failures, it will atleast
reset the state of runtime usage count and also let the runtime
suspend retry from the driver framework.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-16 20:19:18 +00:00
Axel Lin fbbba1f89e iio: adc: men_z188_adc: Add terminating entry for men_z188_ids
The mcb_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-15 16:12:04 +00:00
Daniel Baluta e90dea6aaf iio: accel: kxcjk-1013: Fix kxcjk10013_set_range
Currently, we get the new GSEL bits by OR-ing the old values
with the new ones. This only works first time when the old
values are 0.

Startup:
	* GSEL0 = 0, GSEL1 = 0

Set range to 4G: (GSEL0 = 1, GSEL1 = 0)
	* GSEL0 = 0 | 1 = 1
	* GSEL1 = 0 | 0 = 0
	* correct

Change range to 2G: (GSEL0 = 0, GSEL1 = 0)
	* GSEL0 = 1 | 0 = 1
	* GSEL1 = 0 | 0 = 0
	* wrong, GSEL0 should be 0

This has the nice effect that we can use the full scale range,
exported in in_accel_scale_available.

Fixes: a735e3d7f0 (iio: accel: kxcjk-1013: Set adjustable range)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-15 16:11:28 +00:00
Greg Kroah-Hartman cc03f9bc26 Merge 3.18-rc4 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-10 12:24:26 +09:00
Bastien Nocera 3bfa74f860 iio:kxcjk-1013: Add support for SMO8500 device
The Onda v975w tablet contains an accelerometer that's advertised over
ACPI as SMO8500. This device is however a KXCJ9 accelerometer as
can be seen in the Windows driver's INF file, and from the etching on
the chipset ("KXCJ9 41566 0414").

This patch also removes the attempt to get the IRQ for the "data ready"
signal, as it does not seem to be supported by this device on this
platform.

Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-08 12:40:53 +00:00
Kuppuswamy Sathyanarayanan 995863cc8e iio: jsa1212: Add JSA1212 proximity/ALS sensor
This patch adds a new driver for solteam opto JSA1212 proximity and
ambient light sensor.

Basic details of the chip can be found here.

http://www.solteamopto.com.tw/detail.php?ms=3&po_unit=2&pt_unit=29&p_unit=120

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-08 12:24:50 +00:00
Greg Kroah-Hartman be61a0d784 First round of new drivers, features and cleanups for IIO in the 3.19 cycle.
New drivers / supported parts
 * rockchip - rk3066-tsadc variant
 * si7020 humidity and temperature sensor
 * mcp320x - add mcp3001, mcp3002, mcp3004, mcp3008, mcp3201, mcp3202
 * bmp280 pressure and temperature sensor
 * Qualcomm SPMI PMIC current ADC driver
 * Exynos_adc - support exynos7
 
 New features
 * vf610-adc - add temperature sensor support
 * Documentation of current attributes, scaled pressure, offset and
   scaled humidity, RGBC intensity gain factor and scale applied to
   differential voltage channels.
 * Bring iio_event_monitor up to date with newer modifiers.
 * Add of_xlate function to allow for complex channel mappings from the
   device tree.
 * Add -g parameter to generic_buffer example to allow for devices with
   directly fed (no trigger) buffers.
 * Move exynos driver over to syscon for PMU register access.
 
 Cleanups, fixes for new drivers
 * lis3l02dq drop an unneeded else.
 * st sensors - renam st_sensors to st_sensor_settings (for clarity)
 * st sensors - drop an unused parameter from all the probe utility
   functions.
 * vf610 better error handling and tidy up.
 * si7020 - cleanups following merge
 * as3935 - drop some unnecessary semicolons.
 * bmp280 - fix the pressure calculation.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUWnZBAAoJEFSFNJnE9BaIZAAQAJpkot0ZAYPwtIkmtV1JqrLQ
 EZRkBN+cIf3q5zp/TnQTqfyhKbpHbJ9/Pnb0zHvn7Yh3WpZod2tyoC3xb8JAlX2h
 3tJRrA7plkdMjtwO/ryOxrVJYrm6rCeqKpciwMpDf4E/4fhU5CU++TpmWbhn04qB
 7PEZJN5dkmdnQYSIyNle11MYN+NpCAB4zqDvRJoJHpqZV6zAqygJy03H1PqXFS/S
 iNBL3jS8/PTbeUURUFOQTiqnJw5KuDke7OoXxUfvCpUwQfNLD8mOTrVrEoId1cM0
 Y2fmasfHteh83KP34/MOTwNA3EezM8iQOMzJnXtOpxpySPDrDSP68FDAJs15TUJm
 je8E1xxxdjOWuzgSd9djNm9qhlBkoYgbRwzc8wSAHMK7mCV7pP485WZk5E8rRX2z
 gMFgUmu4LkiZ2V9glGTAcHqnjhLNDTRCp1Nl/sMVgssFBBNjgR5+nZjUFqDR2QpD
 eo4ReIzev7Rzxe2lACRjnRrCnO+KKcjiDkyCdM3X2zdTddQRVrP5Uz+jgnvGAeMO
 hCYDHSOiMzV/r5emVfmNG9w8P9a6rZqu4KqcM/KjSzAfHFQTqmfr4Tkfn/hbeUjY
 h/zzB18EM4kUSxm3E6+CbFRWcfC7b/PLcUOwSitdujb9cYaX72gdesO2/P3jNFAK
 2bjoLRr5l4M4n/DeHae4
 =BDOo
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of new drivers, features and cleanups for IIO in the 3.19 cycle.

New drivers / supported parts
* rockchip - rk3066-tsadc variant
* si7020 humidity and temperature sensor
* mcp320x - add mcp3001, mcp3002, mcp3004, mcp3008, mcp3201, mcp3202
* bmp280 pressure and temperature sensor
* Qualcomm SPMI PMIC current ADC driver
* Exynos_adc - support exynos7

New features
* vf610-adc - add temperature sensor support
* Documentation of current attributes, scaled pressure, offset and
  scaled humidity, RGBC intensity gain factor and scale applied to
  differential voltage channels.
* Bring iio_event_monitor up to date with newer modifiers.
* Add of_xlate function to allow for complex channel mappings from the
  device tree.
* Add -g parameter to generic_buffer example to allow for devices with
  directly fed (no trigger) buffers.
* Move exynos driver over to syscon for PMU register access.

Cleanups, fixes for new drivers
* lis3l02dq drop an unneeded else.
* st sensors - renam st_sensors to st_sensor_settings (for clarity)
* st sensors - drop an unused parameter from all the probe utility
  functions.
* vf610 better error handling and tidy up.
* si7020 - cleanups following merge
* as3935 - drop some unnecessary semicolons.
* bmp280 - fix the pressure calculation.
2014-11-05 11:42:48 -08:00
George McCollister f73cde600d iio: as3935: allocate correct iio_device size
Signed-off-by: George McCollister <george.mccollister@gmail.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 18:33:46 +00:00
Daniel Baluta 25afffe16d io: accel: kxcjk-1013: Fix iio_event_spec direction
Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING is not equal
with IIO_EV_DIR_EITHER.

This could lead to potential misformatted sysfs attributes
like:
	* in_accel_x_thresh_(null)_en
	* in_accel_x_thresh_(null)_period
	* in_accel_x_thresh_(null)_value

or even memory corruption.

Fixes: b4b491c083 (iio: accel: kxcjk-1013: Support threshold)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 18:33:46 +00:00
Dan Murphy 03045bcf31 iio: tsl4531: Fix compiler error when CONFIG_PM_OPS is not defined
Fix the compiler error when the CONFIG_PM_OPS flag is not set.

drivers/iio/light/tsl4531.c:235:8: error: ‘tsl4531_suspend’ undeclared here (not in a function)
drivers/iio/light/tsl4531.c:235:8: error: ‘tsl4531_resume’ undeclared here (not in a function)

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 18:33:45 +00:00
Robin van der Gracht c6b4cac2d9 iio: st_sensors: Fix buffer copy
Use byte_for_channel as iterator to properly initialize the buffer.

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: <Stable@vger.kernel.org>
2014-11-05 18:33:43 +00:00
Hartmut Knaack 81ebe850a0 iio:pressure:bmp280: fix pressure calculation
According to the datasheet and as defined in struct bmp280_comp_press, dig_p1 is
of type u16, while dig_p2 to dig_p9 are of type s16. In
bmp280_read_compensation_press(), values read from the device were treated as
the wrong type.
In bmp280_read_press() the fractional part of the measured pressure is
calculated wrong. A better way is to use *val for the raw pressure and *val2 for
the quotient and let the core do the proper conversion using IIO_VAL_FRACTIONAL.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 15:58:35 +00:00
Abhilash Kesavan c1b501564c iio: adc: exynos_adc: Add support for exynos7
The ADC on exynos7 is quite similar to ADCv2. The differences are as
follows:
	- exynos7-adc has 8 input channels (as against 10 in ADCv2).
	- exynos7 does not include an ADC PHY control register.
	- Some ADC_CON2 register bits being used in ADCv2 are listed as
	  reserved in exynos7-adc. This results in a different init_hw
	  function for exynos7.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 15:38:25 +00:00
Naveen Krishna Chatradhi fafb37cfae iio: exyno-adc: use syscon for PMU register access
This patch updates the IIO based ADC driver to use syscon and regmap
APIs to access and use PMU registers instead of remapping the PMU
registers in the driver.

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
To: linux-iio@vger.kernel.org
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 15:30:09 +00:00
George McCollister 455f0049e0 iio: as3935: Remove unnecessary semicolons
Signed-off-by: George McCollister <george.mccollister@gmail.com>
Acked-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05 13:47:42 +00:00
Greg Kroah-Hartman a8a93c6f99 Merge branch 'platform/remove_owner' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next
Remove all .owner fields from platform drivers
2014-11-03 19:53:56 -08:00
Ivan T. Ivanov ce0694841e iio: iadc: Qualcomm SPMI PMIC current ADC driver
The current ADC is peripheral of Qualcomm SPMI PMIC chips. It has
16 bits resolution and register space inside PMIC accessible across
SPMI bus.

The driver registers itself through IIO interface.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25 21:03:22 +01:00
Hartmut Knaack e0922e5e3c iio:humidity:si7020: fix pointer to i2c client
In si7020_read_raw() the pointer to the i2c client was obtained as second level
pointer, although a simple pointer is appropriate.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25 20:55:56 +01:00
Hartmut Knaack 345b48307d iio:humidity:si7020: cleanup read_raw and probe
When reading temperature or humidity values, a shift of two bits to the right
needs to be applied, and only for the humidity channel a mask of the lower
12 bits needs to be applied. This reduces code repetition.
During probe, i2c_set_clientdata() was used, although its counterpart was not,
so drop it.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25 20:55:56 +01:00
Ivan T. Ivanov acd8256723 iio: inkern: Add of_xlate function to struct iio_info
When #iio-cells is greater than '0', the driver could provide
a custom of_xlate function that reads the *args* and returns
the appropriate index in registered IIO channels array.

Add simple translation function, suitable for the most 1:1
mapped channels in IIO chips, and use it when driver did not
provide custom implementation.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25 11:03:40 +01:00
Vlad Dogaru 46ee98a206 bmp280: use correct routine for division
The proper way to divide two signed 64-bit values is to use div64_s64.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25 10:44:54 +01:00
Greg Kroah-Hartman 7e74783a9d First round of IIO fixes for the 3.18 cycle.
* ad5933 - fix a null pointer dereference due to an old change that prevents
   different channels being registered for the buffer and used for sysfs
   interfaces.
 * ad5933 - Drop a bonus _raw from attribute names.
 * st-sensors - Makes sure the correct number of elements are copied when
   filling a local buffer copy.
 * mxs-lradc - Disable clocks in a failure path during probe so they aren't
   left running.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUPWESAAoJEFSFNJnE9BaI/TAP/2EZp7NR+k3CRZVRLuXxeSrD
 voMS3zNtYMC2E56W0l89gOZdR4rCXzJlhUdRHcGkl7qw1r6stjEBMKIJmd3NVEc4
 dOZ4tCsb/kTmF+66QitL73ioZqoLMrpaGubf8l10t8V3wSsOqnf3wYUftGcdl4NK
 uXAIDmUYgAm4zUUZCKE95o2Npkotm5ftRQqgdChuK7vGVJikN8blzRDokGcZTAh6
 CR04tktxhkg/E+Nq67h9zXPnMOTbw4onNGKD3cztGKZ2bBN+4W/ywEnUrTOu35Eg
 zKMkwYnlBKMTOkTwzml4izHlZw/yFXTXHSPwm1a2fxcVuLuGUBuxX5Pa+kCpLOJo
 2aewUhnwlXhvCrDcFq/rTeqUsOV8mfZxuxqVOQ/utbyUgX5LtHCgQ8aPf0GBbty7
 l8SzxTkCXyogUc4PbNh8DqqksKGkMn/AtC3MfWeEvAYdCZpMXROb4RTAAMVvqytl
 34DMKVaRUy8eiUfcJ+8cH9LvH3Gri7OIbXeLD7iatZ7anaXlQB/EzjTc8yw7+t+C
 EBa7s90XhbRCkE5cadZm76deSscyGgX1cCQS6eStzn1AF0LY/Cj1KMkkJjtFFN31
 Cc7SOAa7rY0BwotwVRV5id4tihyxU9b/Dxi1StoioP4Rjp0B3Y9WsN+EuvPGjFYo
 4JrfV0JYhHktQF+rEmM0
 =TYUO
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of IIO fixes for the 3.18 cycle.

* ad5933 - fix a null pointer dereference due to an old change that prevents
  different channels being registered for the buffer and used for sysfs
  interfaces.
* ad5933 - Drop a bonus _raw from attribute names.
* st-sensors - Makes sure the correct number of elements are copied when
  filling a local buffer copy.
* mxs-lradc - Disable clocks in a failure path during probe so they aren't
  left running.
2014-10-25 10:09:39 +08:00
Vlad Dogaru d5c94568cc iio: add bmp280 pressure and temperature driver
Minimal implementation, can read temperature and data using direct mode.

Datasheet available at
<http://ae-bst.resource.bosch.com/media/products/dokumente/bmp280/BST-BMP280-DS001-09.pdf>

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-22 20:28:27 +01:00
Fabio Estevam 8552befa30 iio: adc: vf610: Propagate the real error when platform_get_irq() fails
There is no need to pass a 'fake' return value when platform_get_irq() fails.

Propagate the real error instead.

While at it, only consider negative numbers returned by platform_get_irq()
as error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-22 20:28:11 +01:00
Wolfram Sang 770ca15c03 iio: adc: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:20:39 +02:00
Søren Andersen b12206e917 iio: adc: mcp320x. Add support for more ADCs
Signed-off-by: Soeren Andersen <san at rosetechnology.dk>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-09 20:14:03 +01:00