openwrt/staging/blogic.git
9 years agoiio: imu: kmx61: Fixup parameters alignment
Daniel Baluta [Tue, 23 Dec 2014 13:22:27 +0000 (15:22 +0200)]
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>
9 years agoiio: imu: kmx61: Enhance error handling
Daniel Baluta [Tue, 23 Dec 2014 13:22:26 +0000 (15:22 +0200)]
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>
9 years agoiio: imu: kmx61: Don't ignore kmx61_set_power_state errors
Daniel Baluta [Tue, 23 Dec 2014 13:22:25 +0000 (15:22 +0200)]
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>
9 years agoiio: imu: kmx61: Save odr_bits for later use
Daniel Baluta [Tue, 23 Dec 2014 13:22:24 +0000 (15:22 +0200)]
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>
9 years agoiio: inkern: add out of range error message
Stefan Wahren [Thu, 1 Jan 2015 18:13:24 +0000 (18:13 +0000)]
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>
9 years agoiio: driver for Semtech SX9500 proximity solution
Vlad Dogaru [Mon, 29 Dec 2014 12:41:14 +0000 (14:41 +0200)]
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>
10 years agostaging: iio: dummy: fix compile error when not using buffering
Vlad Dogaru [Mon, 29 Dec 2014 09:50:16 +0000 (11:50 +0200)]
staging: iio: dummy: fix compile error when not using buffering

Commit 4ae03019923f ("staging:iio:dummy: Register same channels for
device and buffer") has changed the number of parameters for
iio_simple_dummy_configure_buffer() only for the IIO_SIMPLE_DUMMY_BUFFER
case.  Fix this by also changing the placeholder function declared in
the header when buffering is not enabled.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: frequency: ad9523: Increase sleep time in ad9523_store_eeprom
Roberta Dobrescu [Tue, 30 Dec 2014 18:44:34 +0000 (20:44 +0200)]
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>
10 years agoiio: amplifiers: ad8366: Use right order for type specification
Roberta Dobrescu [Tue, 30 Dec 2014 18:45:44 +0000 (20:45 +0200)]
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>
10 years agoiio: amplifiers: ad8366: Remove space before ','
Roberta Dobrescu [Tue, 30 Dec 2014 18:45:43 +0000 (20:45 +0200)]
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>
10 years agoiio: light: lm3533-als: Remove space before ','
Roberta Dobrescu [Tue, 30 Dec 2014 18:48:50 +0000 (20:48 +0200)]
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>
10 years agoiio: light: Annotate Kconfig entry with module name information
Roberta Dobrescu [Tue, 30 Dec 2014 18:48:49 +0000 (20:48 +0200)]
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>
10 years agoiio: accel: Annotate Kconfig entries with module name information
Roberta Dobrescu [Tue, 30 Dec 2014 18:57:55 +0000 (20:57 +0200)]
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>
10 years agoiio: accel: mma8452: Remove trailing whitespace
Roberta Dobrescu [Tue, 30 Dec 2014 18:57:54 +0000 (20:57 +0200)]
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>
10 years agoiio: accel: kxcjk-1013: Add a blank line after declarations
Roberta Dobrescu [Tue, 30 Dec 2014 18:57:53 +0000 (20:57 +0200)]
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>
10 years agostaging: iio: accel: sca3000_core.c: Remove unused function
Rickard Strandqvist [Sat, 20 Dec 2014 14:53:07 +0000 (15:53 +0100)]
staging: iio: accel: sca3000_core.c: Remove unused function

Remove the function sca3000_check_status() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: imu: inv_mpu6050: ACPI enumeration
Srinivas Pandruvada [Mon, 15 Dec 2014 21:19:21 +0000 (13:19 -0800)]
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>
10 years agoiio: trigger: Add a blank line after declarations
Roberta Dobrescu [Tue, 16 Dec 2014 09:16:06 +0000 (11:16 +0200)]
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>
10 years agoiio: mma9551: fix sparse warning
Vlad Dogaru [Mon, 15 Dec 2014 15:16:51 +0000 (17:16 +0200)]
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>
10 years agoiio: core: Get rid of misleading comment
Karol Wrona [Fri, 19 Dec 2014 17:39:26 +0000 (18:39 +0100)]
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>
10 years agoiio: kfifo: Add resource management devm_iio_kfifo_allocate/free
Karol Wrona [Fri, 19 Dec 2014 17:39:25 +0000 (18:39 +0100)]
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>
10 years agoiio: kfifo: Remove unused argument in iio_kfifo_allocate
Karol Wrona [Fri, 19 Dec 2014 17:39:24 +0000 (18:39 +0100)]
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>
10 years agoiio: ABI: add clarification for proximity
Vlad Dogaru [Mon, 15 Dec 2014 15:14:49 +0000 (17:14 +0200)]
iio: ABI: add clarification for proximity

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>
10 years agoiio:pressure:bmp280: cleanup
Hartmut Knaack [Fri, 19 Dec 2014 22:59:25 +0000 (23:59 +0100)]
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>
10 years agoiio: frequency: Remove unnecessary braces around single statement block
Roberta Dobrescu [Tue, 16 Dec 2014 09:11:46 +0000 (11:11 +0200)]
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>
10 years agoiio: frequency: Remove 'out of memory' message
Roberta Dobrescu [Tue, 16 Dec 2014 09:11:45 +0000 (11:11 +0200)]
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>
10 years agoiio: imu: kmx61: kmx61_set_wake_up_odr() can be static
kbuild test robot [Fri, 12 Dec 2014 16:28:52 +0000 (00:28 +0800)]
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>
10 years agoiio: imu: kmx61: Add support for any motion trigger
Daniel Baluta [Wed, 3 Dec 2014 13:31:53 +0000 (15:31 +0200)]
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>
10 years agoiio: imu: kmx61: Add support for data ready triggers
Daniel Baluta [Wed, 3 Dec 2014 13:31:52 +0000 (15:31 +0200)]
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>
10 years agoiio: imu: kmx61: Add PM sleep support
Daniel Baluta [Wed, 3 Dec 2014 13:31:51 +0000 (15:31 +0200)]
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>
10 years agoiio: imu: kmx61: Add PM runtime support
Daniel Baluta [Wed, 3 Dec 2014 13:31:50 +0000 (15:31 +0200)]
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>
10 years agoiio: imu: kmx61: Add acpi support
Daniel Baluta [Wed, 3 Dec 2014 13:31:49 +0000 (15:31 +0200)]
iio: imu: kmx61: Add acpi support

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: imu: Add support for Kionix KMX61 sensor
Daniel Baluta [Wed, 3 Dec 2014 13:31:48 +0000 (15:31 +0200)]
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>
10 years agoRevert "iio: imu: Add support for Kionix KMX61 sensor"
Jonathan Cameron [Fri, 12 Dec 2014 13:30:04 +0000 (13:30 +0000)]
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 d7d787d29148cde12958c2e3765ad3a55dc55eaf.

10 years agoiio: add driver for Freescale MMA9551L
Vlad Dogaru [Mon, 24 Nov 2014 09:43:15 +0000 (11:43 +0200)]
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>
10 years agoiio: Add ABI documentation for input current readings
Adam Thomson [Tue, 25 Nov 2014 18:25:39 +0000 (18:25 +0000)]
iio: Add ABI documentation for input current readings

Add information on in_current related readings.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: consumer.h: Fix scale factor in function comment
Ivan T. Ivanov [Tue, 23 Sep 2014 12:51:42 +0000 (15:51 +0300)]
iio: consumer.h: Fix scale factor in function comment

1 milivolt is equal to 1000000 nanovolts.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: accel: kxcjk-1013: power off device if probe fails
Irina Tirdea [Wed, 10 Dec 2014 16:23:54 +0000 (18:23 +0200)]
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>
10 years agoiio: accel: kxcjk-1013: error handling when set mode fails
Irina Tirdea [Wed, 10 Dec 2014 16:23:53 +0000 (18:23 +0200)]
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>
10 years agoiio: buffer: Drop get_length callback
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:17 +0000 (18:55 +0100)]
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>
10 years agoiio: buffer: Make length attribute read only for buffers without set_length
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:16 +0000 (18:55 +0100)]
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>
10 years agoiio: buffer: Allocate standard attributes in the core
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:15 +0000 (18:55 +0100)]
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>
10 years agoiio: buffer: Move iio_buffer_alloc_sysfs and iio_buffer_free_sysfs
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:14 +0000 (18:55 +0100)]
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>
10 years agoiio: Remove get_bytes_per_datum() from iio_buffer_access_funcs
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:13 +0000 (18:55 +0100)]
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>
10 years agoiio: Move buffer registration to the core
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:12 +0000 (18:55 +0100)]
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>
10 years agostaging:iio:dummy: Register same channels for device and buffer
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:11 +0000 (18:55 +0100)]
staging:iio:dummy: Register same channels for device and buffer

In preparation for moving the buffer registration to the core make sure to
register the same channel array for the device and the buffer. Currently the
output voltage and the activity channels are not registered for the buffer,
setting its scan index to -1 will make sure that it is skipped for the
buffer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agostaging:iio:sca3000: Register same channels for device and buffer
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:10 +0000 (18:55 +0100)]
staging:iio:sca3000: Register same channels for device and buffer

In preparation for moving the buffer registration to the core make sure to
register the same channel array for the device and the buffer. Currently
the temperature channel is not registered for the buffer, setting its scan
index to -1 will make sure that it is skipped for the buffer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: Unexport iio_scan_mask_set()
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:09 +0000 (18:55 +0100)]
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>
10 years agostaging:iio:sca3000: Don't enable channels by default
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:08 +0000 (18:55 +0100)]
staging:iio:sca3000: Don't enable channels by default

The convention for IIO devices is that all channels are disabled by default.

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>
10 years agostaging:iio:ad5933: Don't enable channels by default
Lars-Peter Clausen [Wed, 26 Nov 2014 17:55:07 +0000 (18:55 +0100)]
staging:iio:ad5933: Don't enable channels by default

The convention for IIO devices is that all channels are disabled by default.

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>
10 years agoiio: inkern: add iio_write_channel_raw
Dmitry Eremin-Solenikov [Wed, 26 Nov 2014 22:42:45 +0000 (01:42 +0300)]
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>
10 years agoiio: accel: kxcjk-1013: only set power state if CONFIG_PM is defined
Irina Tirdea [Fri, 5 Dec 2014 22:18:08 +0000 (00:18 +0200)]
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>
10 years agoiio: accel: kxcjk-1013: always power on device in resume
Irina Tirdea [Fri, 5 Dec 2014 22:18:07 +0000 (00:18 +0200)]
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>
10 years agoiio: imu: inv_mpu6050: Add i2c mux for by pass
Srinivas Pandruvada [Fri, 5 Dec 2014 22:52:09 +0000 (14:52 -0800)]
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>
10 years agoiio: bmp280: refactor compensation code
Vlad Dogaru [Thu, 20 Nov 2014 12:00:48 +0000 (14:00 +0200)]
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>
10 years agoiio: common: remove unnecessary sizeof(u8)
Fabian Frederick [Sun, 16 Nov 2014 12:33:24 +0000 (13:33 +0100)]
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>
10 years agoiio: ak8975: add ak09911 and ak09912 support
Gwendal Grignou [Fri, 21 Nov 2014 18:45:49 +0000 (10:45 -0800)]
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>
10 years agoiio: ak8975: add definition structure per compass type
Gwendal Grignou [Fri, 21 Nov 2014 18:45:48 +0000 (10:45 -0800)]
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>
10 years agoiio: ak8975: minor fixes
Gwendal Grignou [Fri, 21 Nov 2014 18:45:47 +0000 (10:45 -0800)]
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>
10 years agodrivers:staging:iio: fix checkpatch complaint about space before comma
Zachary Warren [Sat, 22 Nov 2014 11:19:31 +0000 (22:19 +1100)]
drivers:staging:iio: fix checkpatch complaint about space before comma

Fixes:
drivers/staging/iio/adc/ad7192.c:615: ERROR: space prohibited before that ','
drivers/staging/iio/meter/ade7759.c:119: ERROR: space prohibited before that ','

Signed-off-by: Zachary Warren <conflatulence@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio: event_monitor: Add support for new channel types
Daniel Baluta [Mon, 10 Nov 2014 12:45:35 +0000 (14:45 +0200)]
iio: event_monitor: Add support for new channel types

We have the following testing scenario:

$ insmod iio_dummy_evgen.ko
$ insmod iio_dummy.ko

./iio_event_monitor /dev/iio:device0
Event: time: 1412786467971335337, type: activity(running), channel: 0,
evtype: thresh, direction: rising
Event: time: 1412786530792974091, type: activity(walking), channel: 0,
evtype: thresh, direction: falling
Event: time: 1412764319184761765, type: steps, channel: 0, evtype: instance

$ echo 1 > /sys/bus/iio/devices/iio_evgen/poke_ev0
$ echo 2 > /sys/bus/iio/devices/iio_evgen/poke_ev0
$ echo 3 > /sys/bus/iio/devices/iio_evgen/poke_ev0

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>
10 years agoiio: dummy: Demonstrate the usage of new channel types
Daniel Baluta [Mon, 10 Nov 2014 12:45:34 +0000 (14:45 +0200)]
iio: dummy: Demonstrate the usage of new channel types

Adds support for the new channel types in the dummy driver:
  * a new channel IIO_ACTIVITY
  * two state transition events (running and walking)
  * a new channel IIO_STEPS and support for reading and writing
    pedometer step counter
  * step detect event
  * a new IIO_CHAN_INFO_CALIBHEIGHT mask bit for reading and writing
    user's height.

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>
10 years agoiio: core: Introduce IIO_CHAN_INFO_CALIBHEIGHT
Irina Tirdea [Mon, 10 Nov 2014 12:45:33 +0000 (14:45 +0200)]
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>
10 years agoiio: core: Introduce STEPS channel, ENABLE mask and INSTANCE event
Irina Tirdea [Mon, 10 Nov 2014 12:45:32 +0000 (14:45 +0200)]
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>
10 years agoiio: core: Introduce IIO_EV_DIR_NONE
Irina Tirdea [Mon, 10 Nov 2014 12:45:31 +0000 (14:45 +0200)]
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>
10 years agoiio: core: Introduce IIO_ACTIVITY channel
Daniel Baluta [Mon, 10 Nov 2014 12:45:30 +0000 (14:45 +0200)]
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>
10 years agoiio: dummy: Add virtual registers for dummy device
Daniel Baluta [Mon, 10 Nov 2014 12:45:29 +0000 (14:45 +0200)]
iio: dummy: Add virtual registers for dummy device

We need a way to store events generated by iio_dummy_evgen module,
in order to correctly process IRQs in iio_simple_dummy_events.

For the moment, we add two registers:

* id_reg  - ID register, stores the source of the event
* id_data - DATA register, stores the type of the event

e.g echo 4 > /sys/bus/iio/devices/iio_evgen/poke2

id_reg 0x02, id_data 0x04

This means, event of type 4 was generated by fake device 2.

We currently use a hardcoded mapping of virtual events to IIO events.

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>
10 years agoiio: imu: Add support for Kionix KMX61 sensor
Daniel Baluta [Tue, 18 Nov 2014 16:47:55 +0000 (18:47 +0200)]
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>
10 years agoMAINTAINERS: Add IIO include files
Daniel Baluta [Tue, 11 Nov 2014 14:36:00 +0000 (14:36 +0000)]
MAINTAINERS: Add IIO include files

Files under include/linux/iio were not reported as part
of the IIO subsystem.

Reported-by: Cristina Ciocan <cristina.ciocan@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
10 years agoiio:kxcjk-1013: Add support for SMO8500 device
Bastien Nocera [Sun, 11 May 2014 21:09:00 +0000 (22:09 +0100)]
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>
10 years agoiio: jsa1212: Add JSA1212 proximity/ALS sensor
Kuppuswamy Sathyanarayanan [Tue, 16 Sep 2014 03:54:00 +0000 (04:54 +0100)]
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>
10 years agostaging: comedi: das800: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:09 +0000 (10:21 -0700)]
staging: comedi: das800: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:08 +0000 (10:21 -0700)]
staging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_AiActualScan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

The function v_APCI3120_InterruptDmaMoveBlock16bit() is then just a wrapper
for comedi_buf_write_samples(). Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:07 +0000 (10:21 -0700)]
staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA

Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the analog input end-of-acquisition.

Move the EOA check so it happens after adding the samples from the current
urb to the async buffer. This prevents the unnecessary resubmit of the urb
when the EOA occurs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:06 +0000 (10:21 -0700)]
staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA

Remove the private data member 'ao_sample_count' and use the comedi_async
'scans_done' member to detect the analog output end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: use comedi_async 'scans_done' to detect AI EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:05 +0000 (10:21 -0700)]
staging: comedi: usbdux: use comedi_async 'scans_done' to detect AI EOA

Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the analog input end-of-acquisition.

Move the EOA check so it happens after adding the samples from the current
urb to the async buffer. This prevents the unnecessary resubmit of the urb
when the EOA occurs.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:04 +0000 (10:21 -0700)]
staging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA

Remove the private data member 'ao_sample_count' and use the comedi_async
'scans_done' member to detect the analog output end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: s626: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:03 +0000 (10:21 -0700)]
staging: comedi: s626: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_sample_count' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Also, remove the unnecessary COMEDI_CB_EOS event. The core automatically
detects and adds that event.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:02 +0000 (10:21 -0700)]
staging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'stop_count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcmmio: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:01 +0000 (10:21 -0700)]
staging: comedi: pcmmio: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: adv_pci1710: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:21:00 +0000 (10:21 -0700)]
staging: comedi: adv_pci1710: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:59 +0000 (10:20 -0700)]
staging: comedi: pcl818: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl818: remove private data member 'ai_act_chan'
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:58 +0000 (10:20 -0700)]
staging: comedi: pcl818: remove private data member 'ai_act_chan'

This member of the private data is set to '0' but never used. Remove it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl816: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:57 +0000 (10:20 -0700)]
staging: comedi: pcl816: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl812: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:56 +0000 (10:20 -0700)]
staging: comedi: pcl812: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ai_act_scan' and use the comedi_async
'scans_done' member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:55 +0000 (10:20 -0700)]
staging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'ntrig' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: amplc_dio200_common: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:54 +0000 (10:20 -0700)]
staging: comedi: amplc_dio200_common: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'stopcount' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: addi_apci_2032: use comedi_async 'scans_done' to detect EOA
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:53 +0000 (10:20 -0700)]
staging: comedi: addi_apci_2032: use comedi_async 'scans_done' to detect EOA

Remove the private data member 'stop_count' and use the comedi_async 'scans_done'
member to detect the end-of-acquisition.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: comedidev.h: add 'scans_done' member to comedi_async
H Hartley Sweeten [Wed, 5 Nov 2014 17:20:52 +0000 (10:20 -0700)]
staging: comedi: comedidev.h: add 'scans_done' member to comedi_async

Introduce a new member to comedi_async to count the number of scans completed.
This member is cleared by comedi_buf_reset() along with the other comedi_async
members. It is incremented in comedi_inc_scan_progress() when the end of scan
is detected.

This member will be used to clean up the scan counting in the comedi drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: panel: Fix single-open policy race condition
Mariusz Gorski [Tue, 4 Nov 2014 21:47:19 +0000 (22:47 +0100)]
staging: panel: Fix single-open policy race condition

Fix the implementation of a single-open policy for both
devices (lcd and keypad) by using atomic_t instead of plain ints.

Signed-off-by: Mariusz Gorski <marius.gorski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: change tx wake queue
Malcolm Priestley [Tue, 4 Nov 2014 14:49:46 +0000 (14:49 +0000)]
staging: vt6655: change tx wake queue

Wake queue in the dwIsr loop of device_intr instead of device_tx_srv.

This fixes an issue when ISR_TXDMA0 or ISR_AC0DMA does not occur
device_tx_srv is not called and the queue gets stuck in stopped
condition.

On test if the queue is stuck another MACvTransmitAC0 or MACvTransmit0
in vnt_tx_packet will clear it.

Check on vif that both buffers are available and the queue is stopped.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: imx-drm: remove old FSF address from license text
Philipp Zabel [Tue, 4 Nov 2014 10:52:48 +0000 (11:52 +0100)]
staging: imx-drm: remove old FSF address from license text

Linux already includes a copy of the GPL, checkpatch compains about the address.
Remove it from the license text.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: add ioctls to set per-file read and write subdevice
Ian Abbott [Tue, 4 Nov 2014 18:09:01 +0000 (18:09 +0000)]
staging: comedi: add ioctls to set per-file read and write subdevice

Now that Comedi has the structures in place to support setting the
current "read" and/or "write" subdevice on a per-file object basis, add
new ioctls to set them.  The newly chosen "read" ("write") subdevice
needs to support "read" ("write") commands, and the file cannot be busy
handling a "read" ("write") command on the previous subdevice (if any).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: comedi: prepare support for per-file read and write subdevices
Ian Abbott [Tue, 4 Nov 2014 18:09:00 +0000 (18:09 +0000)]
staging: comedi: prepare support for per-file read and write subdevices

Comedi devices may have several subdevices that support "read" and/or
"write" asynchronous commands that use the "read" or "write" file
operations for data transfer.  The low-level Comedi drivers may nominate
a default "read" subdevice and/or a default "write" subdevice, but it
may have other subdevices that support asynchronous commands.

The Comedi core provides a somewhat clunky mechanism to provide access
to the asynchronous command support of the non-default subdevices.  When
a low-level device is "attached" to a core Comedi device, it dynamically
allocates a minor device number for each of the subdevices that support
asynchrounous commands and associates them with files created in SysFS
named "comediX_subdY", where "X" is the minor device number of the main
comedi device, and "Y" is the subdevice number.  An application can open
these subdevice-specific files and they behave like the regular
"comediX" files except that the "read" and/or "write" subdevice may be
different to the default chosen by the low-level driver.

This patch adds a layer of indirection between the file object and the
comedi device object to allow the current "read" and/or "write"
subdevice to be altered after opening the Comedi device, on a per-file
object basis.  The advantage is that an application only needs to open
the main Comedi device file and can then choose which subdevice it wants
to "read" or "write".  The main Comedi device file can be opened more
than once, and each file object can choose the "read" and "write"
subdevices independently.

The new `struct comedi_file` is created on "open" and freed on
"release".  It includes pointers to the main Comedi device structure,
and to the current "read" and "write" subdevice structures (which may be
NULL).  It also has information to keep track of when a low-level device
has been attached or detached since the previous time the file object
was used.  In that case, the current "read" and "write" subdevices in
the `struct comedi_file` will be changed to the new defaults (or set to
NULL).  (The change to new defaults is done by `comedi_file_reset()`.
The checking for attach/detach is done by `comedi_file_check()` which
will call `comedi_file_reset()` if there have been any attach/detach
operations since the previous call.)

A subsequent patch will add the ioctls to change the current "read" and
"write" subdevices.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: media: lirc: modify print calls
Aya Mahfouz [Tue, 4 Nov 2014 21:43:07 +0000 (23:43 +0200)]
staging: media: lirc: modify print calls

This patches replaces one pr_debug call by dev_dbg and
changes the device used by one of the dev_err calls.

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: dgap: remove unnecessary function
Daeseok Youn [Wed, 5 Nov 2014 08:58:11 +0000 (17:58 +0900)]
staging: dgap: remove unnecessary function

The dgap_init_global() initialize the dgap_board
that is a global variable as static and dgap_poll_timer.
But init_timer() is called twice in dgap_start() and dgap_board
doesn't need to be initialized to NULL.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655 baseband.c camel case replace pDevice -> priv
Malcolm Priestley [Wed, 5 Nov 2014 21:08:59 +0000 (21:08 +0000)]
staging: vt6655 baseband.c camel case replace pDevice -> priv

for struct vnt_private

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: device.h remove dead member wstats
Malcolm Priestley [Wed, 5 Nov 2014 21:08:58 +0000 (21:08 +0000)]
staging: vt6655: device.h remove dead member wstats

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: device_set_options remove dead variables
Malcolm Priestley [Wed, 5 Nov 2014 21:08:57 +0000 (21:08 +0000)]
staging: vt6655: device_set_options remove dead variables

uConnectionRate
wRTSThreshold
byOpMode
b11hEnable
uChannel

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10 years agostaging: vt6655: baseband.c/h remove dead functions
Malcolm Priestley [Wed, 5 Nov 2014 21:08:56 +0000 (21:08 +0000)]
staging: vt6655: baseband.c/h remove dead functions

These functions are not used so remove them
BBbIsRegBitsOn
BBbIsRegBitsOff
BBvReadAllRegs
BBvLoopbackOn
BBvLoopbackOff

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>