1
0
Fork 0
Commit Graph

2602 Commits (8ef9ccf81044a1e31d116b5d4972d5b65ae10846)

Author SHA1 Message Date
Harinath Nampally 4ae2f37a2f staging: iio: meter: Fix the identations for proper alignments.
This patch fixes below checkpatch.pl kind of warnings:
CHECK: Alignment should match open parenthesis

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-14 16:25:55 +01:00
Enric Balletbo i Serra 8d04300483 tsl2x7x: remove paragraph about writing to the FSF's mailing address
Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF
has changed addresses in the past, and may do so again. Linux
already includes a copy of the GPL.

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07 13:50:46 +01:00
Brian Masney 38a67ffd44 staging: iio: tsl2x7x: rename driver for consistency with other IIO light drivers
This patch renames the tsl2x7x_core.c file to tsl2x7x.c so that the
naming convention is consistent with other IIO light drivers outside
of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07 13:10:17 +01:00
Quentin Swain b46c39a098 iio: ade7854: Convert symbolic permissions to octal
Convert symbolic S_IRUGO and S_IWUSR macros to octal to fix
warnings reported by checkpatch.pl

Signed-off-by: Quentin Swain <dudebrobro179@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-01 01:07:41 +01:00
Quentin Swain 78425b3290 iio: ade7758: Convert symbolic permissions to octal
Convert symbolic S_IRUGO and S_IWUSR macros to octal permissions to
fix warnings reported by checkpatch.pl

Signed-off-by: Quentin Swain <dudebrobro179@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-01 01:06:24 +01:00
Quentin Swain 37cbe596e2 iio: ade7754: Convert symbolic permissions to octal
Convert symbolic S_IRUGO and S_IWUSR macros to octal permissions
to resolve warnings reported by checkpatch.pl

Signed-off-by: Quentin Swain <dudebrobro179@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-01 01:05:17 +01:00
Quentin Swain 3e8eae9079 iio: ade7753 Convert: symbolic permissions to octal
Convert S_IRUGO and S_IWUSR macros to octal permissions to resolve
warnings reported by checkpatch.pl

Signed-off-by: Quentin Swain <dudebrobro179@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-01 01:01:44 +01:00
Quentin Swain 2451c5dda4 iio: ad9834 convert symbolic permissions to octal
Remove checkpatch warnings by converting symbolic S_IRUGO and S_IWUSR
permissions to octal

Signed-off-by: Quentin Swain <dudebrobro179@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-01 00:59:21 +01:00
Brian Masney 105c3de1eb staging: iio: isl29028: move out of staging
Move ISL29028 ALS / Proximity Sensor out of staging and into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-26 06:28:25 +01:00
Brian Masney e4ff6c1b41 staging: iio: isl29028: correct proximity sleep times
The sysfs attribute in_proximity_sampling_frequency_available currently
shows the values 1 3 5 10 13 20 83 100. These values are supposed to
correspond to the sleep values 800 400 200 100 75 50 12.5 0 (all in ms).
When passing in a sampling frequency of 3, it actually uses a sleep
time of 200ms instead of the expected 400ms value. This patch changes
the value shown by this sysfs attribute to use fixed-point numbers so
that the correct sampling frequency is shown to the user. This patch
also changes the code that updates the proximity sampling frequency to
only allow values that are shown in the _available sysfs attribute.

The original code showed the value 83 that corresponds to the sleep
time 12 ms. The data sheet actually lists 12.5 ms as the sleep time,
so the proximity frequency was updated to 80.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-26 06:26:09 +01:00
Paolo Cretaro d6d0014c6b staging: iio: tsl2x7x: Replace deprecated macros (S_IRUGO, S_IWUSR)
Use octal digits as suggested by checkpatch instead of deprecated macros.

Signed-off-by: Paolo Cretaro <melko@frugalware.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-26 06:04:47 +01:00
René Hickersberger?= ddf9ee4084 Staging: iio: accel: adis16203: fixed a brace coding style issue
Fixed a brace coding style issue.

Signed-off-by: René Hickersberger <renehickersberger@gmx.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14 16:13:34 +01:00
Chen Guanqiao b4bac145b9 iio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR)
This fixes the coding style issue of using (S_IWUSR | S_IRUGO) in place of
4-digit octal numbers.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14 15:09:07 +01:00
Narcisa Ana Maria Vasile 984fb24430 staging: iio: ad5933: Protect DIRECT mode using claim/release helpers
This device operates in DIRECT_MODE and BUFFER_HARDWARE mode.
Replace usages of iio_dev->mlock with iio_device_{claim|release}_direct_mode()
helper functions to guarantee DIRECT mode and consequently protect
BUFFER mode too.

Add and use a device private lock to protect against conflicting access of the
state data.
This helps with IIO subsystem redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

Protect changing of attributes inside ad5933_store(). Attributes
can no longer be changed while in buffered mode.

Remove lock from ad5933_work() because buffer mode should be enabled
when we reach this, and claiming DIRECT mode in all the other places
should protect it.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14 15:09:06 +01:00
Chen Guanqiao d97a913206 iio:meter:ade7759: Removing use of deprecated macros (S_IRUGO, S_IWUSR, S_IXUGO)
Removing use of deprecated macros(S_IRUGO, S_IWUSR, S_IXUGO), and replace
with 4 digit octal.

Signed-off-by: Chen Guanqiao <chen.chenchacha@foxmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14 15:09:05 +01:00
Guru Das Srinagesh 13e283d6fc staging: iio: ad9832: use 4-digit octal permissions
This fixes the coding style issue of using S_IWUSR in place of 4-digit
octal numbers.

Issue detected by checkpatch.

Signed-off-by: Guru Das Srinagesh <gurooodas@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 10:20:48 +01:00
simran singhal 5a70925b16 iio: gyro: adis16060: Change the name of function.
Change the name of function from adis16060_spi_write_than_read()
to adis16060_spi_write_then_read(). change "than" to "then" as
its time depended.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 09:10:32 +01:00
simran singhal d952b4e6ad staging: iio: light: tsl2x7x constify attribute_group structures
As the event_attrs field of iio_info structures is constant, so these
attribute_group structures can also be declared constant.

File size before:
   text	   data	    bss	    dec	    hex	filename
  15064	   1528	      0	  16592	   40d0
drivers/staging/iio/light/tsl2x7x_core.o

File size after:
   text	   data	    bss	    dec	    hex	filename
  15192	   1400	      0	  16592	   40d0
drivers/staging/iio/light/tsl2x7x_core.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-01 11:40:36 +01:00
Gargi Sharma b71244b62b staging: iio: update locking method during frequency writes
The driver needs to insure atomicity during frequency
changes of bus and device. The iiodev->mlock as used
was not doing that. Replace it with the drivers existing
buffer lock and introduce an auxiliary spi_write() that does
not hold the lock.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-30 19:20:38 +01:00
Olivier Leveque 40dffd9974 staging: iio: adc: ad7280a: fix permission coding style issue
Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using
octal permissions '0644'. Found running checkpatch.

Signed-off-by: Olivier Leveque <o_leveque@orange.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 17:07:24 +00:00
Mark Stenglein baecc573d8 staging: iio: accel: remove unneeded braces around single statements
Fixes three checkpatch warnings due to braces used when single
statements are sufficient.

Signed-off-by: Mark Stenglein <mark@stengle.in>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 17:02:26 +00:00
Eva Rachel Retuya cf6c77323a staging: iio: tsl2x7x_core: Fix standard deviation calculation
Standard deviation is calculated as the square root of the variance
where variance is the mean of sample_sum and length. Correct the
computation of statP->stddev in accordance to the proper calculation.

Fixes: 3c97c08b57 ("staging: iio: add TAOS tsl2x7x driver")
Reported-by: Abhiram Balasubramanian <abhiram@cs.utah.edu>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 16:47:13 +00:00
Arushi Singhal e29e7b3236 staging: iio: Remove extra Parenthesis.
Remove the extra parenthesis remove the checkpatch issue.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 16:04:38 +00:00
Gargi Sharma 66893ea375 staging: adis16203: Remove locking on raw reads of IIO_CHAN_INFO_CALIBBIAS
adis16203_read_raw does not need lock for IIO_CHAN_INFO_CALIBBIAS
since adis_read_reg_16 is already atomic and nothing else needs to be
protected.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:36 +00:00
Narcisa Ana Maria Vasile 745c6dad49 staging: iio: cdc: ad7746: Fix alignment with paranthesis
This was reported by checkpatch.pl:
CHECK: Alignment should match open parenthesis

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:35 +00:00
Narcisa Ana Maria Vasile 6602292e1d staging: iio: Add blank lines after function declarations
This was reported by checkpatch.pl:
CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:34 +00:00
Narcisa Ana Maria Vasile fb4d75a9db staging: iio: adt7136: Remove unnecessary blank lines
This was reported by checkpatch.pl

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:33 +00:00
Arushi Singhal 755d0da465 staging: ad7606: Replace mlock with driver private lock
The IIO subsystem is redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

In this driver, mlock was being used to protect hardware state
changes.  Replace it with a lock in the devices global data.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:32 +00:00
simran singhal 64822be434 staging: iio: ade7753: Remove trailing whitespaces
This patch removes trailing whitespaces in order to follow the Linux
coding style.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:31 +00:00
simran singhal d62bb1ad05 staging: ade7754: Clean up #includes
Alphabetize and separate kernel and subsystem headers.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:30 +00:00
Arushi Singhal 63bb38c000 staging: iio: Replace a bit shift by a use of BIT.
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:29 +00:00
simran singhal 9dde479e9f staging: iio: adis16060: Remove iio_dev mlock and refactor code
The IIO subsystem is redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

In this driver, mlock was being used to protect hardware state changes.

In the driver, buf_lock protects both the adis16060_spi_write() and
adis16060_spi_read() functions and both are always called in
pair. First write, then read. Refactor the code to have
one single function adis16060_spi_write_than_read() protected by
the buf_lock.  This removes the need for additional locking via
mlock, so this locking is removed.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-23 19:43:03 +00:00
Gargi Sharma dba968c4fe staging: iio: ad7280: Replace mlock with driver private lock
The IIO subsystem is redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

In this driver, mlock was being used to protect hardware state
changes.  Replace it with a lock in the devices global data.

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 11:11:37 +00:00
Miguel Robles 2b7cb7bed6 Staging: iio: resolver: ad2s1210: Fix warning, statements should start on a tabstop
Fix checkpatch warning:
Statements should start on a tabstop.

Signed-off-by: Miguel Robles <miguel.robles@farole.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 11:06:59 +00:00
Miguel Robles 1aca202610 Staging: iio: cdc: ad7746: use octal permissions instead of symbolic
Fix checkpatch warnings:
Symbolic permissions 'S_IWUSR' are not preferred.

Signed-off-by: Miguel Robles <miguel.robles@farole.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 11:05:15 +00:00
Narcisa Ana Maria Vasile ae81abcb6a staging: iio: adis16209: Remove mutex_lock() and mutex_unlock() calls
The function adis16209_read_raw() is safe to be run in parallel.
The call to adis_read_reg_16() is safe since adis_read_reg() uses the
txrx_lock from struct adis to protect simultaneous changes.

Remove mutex.h inclusion since it is no longer needed.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 11:01:19 +00:00
Aishwarya Pant 099c4cef24 staging: iio: accel: adis16201: remove iio_dev mlock
In the driver adis16201 read raw does not require an iio_dev->mlock for
reads. It can run concurrently as adis_read_reg_16() is protected by a
transaction lock.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 10:18:34 +00:00
Varsha Rao 2e2c8d227a staging: iio: adis16240: Remove mutex_lock() and mutex_unlock() function call.
Remove mutex_lock() and mutex_unlock() function calls, as the
adis16240_spi_read_signed() function can be run parallel and safely
multiple times. Also remove the mutex.h header file and comment, which
are no longer required.

As indio_dev is declared and initialized in adis16240_spi_read_signed(),
again declaration to same type and initialization to same value is not
required, remove it from adis16240_read_12bit_signed().

Simplify the return logic, by merging assignment and return into a single
line.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-18 14:19:43 +00:00
sayli karnik 01d2de39cd staging: iio: ad9834: Remove unnecessary goto statement
The patch removes unnecessary use of goto statement.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15 22:13:57 +00:00
sayli karnik c63313c605 staging: iio: ad9834: Use private driver lock instead of mlock
iio_dev->mlock should be used by the IIO core only for protecting
device operating mode changes. ie. Changes between INDIO_DIRECT_MODE,
INDIO_BUFFER_* modes.
Replace mlock with a lock in the device's global data to protect
hardware state changes.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15 22:12:21 +00:00
Miguel Robles 8fa06c902a Staging: iio: cdc: ad7152.c, use octal permissions instead of symbolic
Fix checkpatch warnings:
Symbolic permissions are not preferred. Consider using octal permissions.

Signed-off-by: Miguel Robles <miguel.robles@farole.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15 22:01:19 +00:00
Aishwarya Pant 9854a1b5c4 staging:iio:cdc:ade7746 replace mlock with driver private lock
The IIO subsystem is redefining iio_dev mlock to be used by IIO core
only for protecting device operating mode changes.

In driver ad7746 wherever mlock was used to protect hardware state
changes, it has been replaced with a driver private lock.

Signed-off-by: Aishwarya Pant <aishpant@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-15 21:56:50 +00:00
Narcisa Ana Maria Vasile 0bdd35bd95 staging: iio: adis16240: Group similar macros into enums
Group the scan indexes into an enum.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:39 +00:00
Narcisa Ana Maria Vasile a3b2ce9635 staging: iio: adis16209: Group similar macros into enums
Group the scan indexes into an enum.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:38 +00:00
simran singhal e7d87687cb staging: iio: gyro: Remove & on function name to conform to similar IIO drivers
Remove & from function pointers to conform to the style preferred in IIO.
(Note that this is fine in staging drivers, but would create too much churn
to do outside of staging, unless otherwise working on a driver).

Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:38 +00:00
simran singhal 67cba0264a staging: iio: resolver: Remove & on function name to align with other IIO drivers.
Remove & from function pointers to conform to the style found in the wider
subsystem.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:37 +00:00
simran singhal 3167d9259c staging: iio: adis16203: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:36 +00:00
simran singhal ebfb115c9c staging: iio: adis16209: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:35 +00:00
simran singhal f3e8556702 staging: iio: adis16201: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:34 +00:00
simran singhal 0701dccb21 staging: iio: adis16240: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:33 +00:00
simran singhal 4a7fa62786 staging: iio: cdc: ad7152: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:32 +00:00
simran singhal 95d73c616b staging: iio: cdc: ad7746: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:32 +00:00
simran singhal 2c4ef48a26 staging: iio: ad7780: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:31 +00:00
simran singhal 705d5ed2dc staging: iio: ad7192: Remove exceptional & on function name
Remove & from function pointers to conform to the style found elsewhere
in the file.  Done using the following semantic patch

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:30 +00:00
sayli karnik a2392d2688 staging: iio: ade7754: Move contents of header file to source file
The contents of ade7754.h are only used in ade7754.c. Move the header
contents to the source file and delete the header file.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:28 +00:00
Alison Schofield 4b88e516a6 staging: iio: ad9832: replace mlock with driver private lock
The IIO subsystem is redefining iio_dev->mlock to be used by
the IIO core only for protecting device operating mode changes.
ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes.

In this driver, mlock was being used to protect hardware state
changes.  Replace it with a lock in the devices global data.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-13 21:20:24 +00:00
Bo Yu 0a124e98f4 Staging: iio: return expression instead of return ret
The following Coccinelle script was used to detect this:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
       e;
-return ret;

Signed-off-by: Bo YU <tsu.yubo@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-11 18:24:38 +00:00
sayli karnik 3a1e329385 staging: iio: ade7759: Move contents of header file to source file
The contents of ade7759.h are only used in ade7759.c. Move the header
contents to the source file and delete the header file.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-11 17:17:25 +00:00
Narcisa Ana Maria Vasile 2df79e1bdd staging: iio: accel: Rename source files and update Makefile
Rename adis162xx_core.c files to adis162xx.c because
these are the only source files for these drivers.

Update Makefile to correspond to the new file names.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>

 rename drivers/staging/iio/accel/{adis16201_core.c => adis16201.c} (100%)
 rename drivers/staging/iio/accel/{adis16203_core.c => adis16203.c} (100%)
 rename drivers/staging/iio/accel/{adis16209_core.c => adis16209.c} (100%)
 rename drivers/staging/iio/accel/{adis16240_core.c => adis16240.c} (100%)
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-05 11:25:25 +00:00
Katie Dunne 0f0c106aa9 staging: iio: meter: ade7753: Clean up includes
Alphabetize header files.

Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-04 17:35:16 +00:00
Katie Dunne 63a98d2511 staging: iio: meter: ade7753: Move header content to implementation file
The contents of ade7753.h are only used in ade7753.c. Move the header
contents to the implementation file and delete the header file.

Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-04 17:34:27 +00:00
Narcisa Ana Maria Vasile aa04a7078b staging: iio: adis16240: Move contents of the header to the source file
The contents of the header file are used only by this single
source file. Move content into .c file and remove header.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-04 16:37:29 +00:00
Narcisa Ana Maria Vasile 21a123beaf staging: iio: adis16209: Move contents of the header to the source file
The contents of the header file are used only by this single
source file. Move content into .c file and remove header.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-04 16:24:49 +00:00
Narcisa Ana Maria Vasile dc35fa5628 staging: iio: ad9834: Moved contents of the header to the source file
Moved the contents of the header(ad9834.h) into the corresponding source
file with the exception of the platform data struct which is supposed to be
used from somewhere else other than the driver.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-02 19:44:06 +00:00
Narcisa Ana Maria Vasile d89aa24585 staging: iio: ad9832: Moved contents of the header to the source file
Moved the contents of the header(ad9832.h) into the corresponding source file
with the exception of the platform data struct which is supposed to be
used from somewhere else other than the driver.

Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-02 19:09:09 +00:00
Varsha Rao a8baa3c02a staging: iio: adis16203: Move header file content to source file.
The contents of the header file are used only by this single source
file. Moved content into adis16203_core.c file and removed adis16203.h
file. Arranged #include files in alphabetical order.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-02 18:58:15 +00:00
simran singhal 346834727a staging: iio: accel: adis16201: Move header file content to source file
The contents of the header file are used only by this single
source file. Move content into .c and remove .h.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-02 18:58:10 +00:00
sayli karnik 8f867691eb staging: iio: ad7152: Use BIT() macro for left shifting 1
Replace left shifting on 1 with the BIT(x) macro as suggested by
checkpatch.pl.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-25 16:46:21 +00:00
Derek Robson 31b9f91913 Staging: iio: impedance-analyzer: ad5933.c - style fix
Change permissions to octal style.
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-19 11:06:40 +00:00
Gargi Sharma fb364cea3d staging: iio: compress return logic
Simplify function returns by merging assignment and return.
Found with Coccinelle.

Semantic patch:
@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-18 18:58:08 +00:00
sayli karnik bf0adab4cd staging: iio: adis16240_core: Replace symbolic permission with octal permission
The patch resolves following checkpatch issue:
WARNING: Symbolic permissions 'S_IRUGO' are not preferred. Consider using
octal permissions '0444'.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-18 18:52:52 +00:00
Jonathan Cameron 0097e20e77 staging:iio:adc:lpc32xx Move out of staging.
There are a few more little cleanups that could be done on this driver, but
I don't think any are sufficient to justify not moving it out of staging.

It's a very simple driver (presumably for a simple part) so not much that can
go wrong.  I think it was only ever in staging because that's where IIO was
as a whole at the time and then we forgot about it!

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Roland Stigge <stigge@antcom.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 11:19:25 +00:00
Jonathan Cameron 7901b2a145 staging:iio:adc:lpc32xx rename local state structure to _state
Previously it was called _info with instances as info.  This caused some
confusion against the info structure that are used in the core of IIO.

Since this driver was written it's become a fairly strong convention to
use _state and st for instances so change to that.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 11:19:21 +00:00
Jonathan Cameron 5023574adc staging:iio:adc:lpc32xx Apply consistent prefix to local defines
There was a bit of a random mixture going on here so change all prefixes
to LPC32XXAD_

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 11:19:14 +00:00
Jonathan Cameron af8f651b39 staging:iio:adc:spear Move out of staging.
There are some unanswered questions due to disagreements between the code
and various datasheets (including between different datasheets for the same
part).

I don't think that is necessarily a reason to keep it in staging however.
I'm partly posting this patch inorder to reignite debate and with a bit
of luck find someone who has one of these to test!

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 11:17:33 +00:00
Brian Masney bcbbd0fa82 staging: iio: isl29028: add copyright
Add Brian Masney's copyright to the header for the several rounds of
staging cleanups that has been done to this driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 09:48:45 +00:00
Brian Masney 0b59c388f8 staging: iio: isl29028: use the runtime power management for system sleep
With the introduction of runtime power management in commit 2db5054ac2
("staging: iio: isl29028: add runtime power management support"), the
system could go to sleep and turn off the device without notifying the
runtime power management code. This patch changes the system suspend
and resume to go through the runtime power management.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 09:46:38 +00:00
Brian Masney 45e2852b8b staging: iio: isl29028: fix incorrect sleep time when taking initial proximity reading
When proximity is enabled in isl29028_enable_proximity(), the function
msleep() is called with the sampling frequency, which is not correct.
This patch changes the code to sleep the specified amount of time listed
in the datasheet instead.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 09:41:09 +00:00
Brian Masney 55bf851b4a staging: iio: isl29028: change mdelay() to msleep()
This driver in some cases can busy wait for upwards of 100 ms. Since the
kernel at this point is not running in atomic context, and is running in
process context, we can safely use msleep() instead. This patch changes
the two occurrences of mdelay() to msleep().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 09:38:21 +00:00
Derek Robson 92196732be Staging: iio: meter: meter.h - style fix
Changed file permissions to octal.
Found with checkpatch.

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-11 09:33:07 +00:00
Artur Lorincz 2eaf14277b iio: adc: ad7192: fixed symbolic permission references 'S_IRUGO | S_IWUSR'
Replaced the symbolic permission references S_IRUGO and S_IWUSR with their
octal counterparts.

Signed-off-by: Artur Lorincz <larturus@yahoo.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-05 09:19:06 +00:00
Michael S. Hansen 640fa30a70 iio: addac: adt7136: Fix style to use octal file permissions.
Signed-off-by: Michael S. Hansen <michael.schacht.hansen@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-05 09:14:38 +00:00
Derek Robson 6144f61af6 Staging: iio: resolver: ad2s1210.c - style fix
Changed symbolic permissions to octal permissions.
Found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-04 11:44:35 +00:00
Julián de Gortari 7f47d56c5b Staging: iio: adc: ad7816: fix symbolic permissions coding style issue
Octal permissions should be used instead of symbolic ones for easier
reading.

Signed-off-by: Julián de Gortari <kiototeko@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28 12:22:07 +00:00
Anthony Brandon 349ee0402c drivers:staging:iio:cdc: Style fix.
Align parameters to parentheses.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28 12:17:45 +00:00
Alison Schofield 10e840dfb0 iio: trigger: free trigger resource correctly
These stand-alone trigger drivers were using iio_trigger_put()
where they should have been using iio_trigger_free().  The
iio_trigger_put() adds a module_put which is bad since they
never did a module_get.

In the sysfs driver, module_get/put's are used as triggers are
added & removed. This extra module_put() occurs on an error path
in the probe routine (probably rare).

In the bfin-timer & interrupt trigger drivers, the module resources
are not explicitly managed, so it's doing a put on something that
was never get'd.  It occurs on the probe error path and on the
remove path (not so rare).

Tested with the sysfs trigger driver.
The bfin & interrupt drivers were build tested & inspected only.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 16:14:21 +00:00
Brian Masney 2db5054ac2 staging: iio: isl29028: add runtime power management support
This patch adds runtime power management support to the isl29028 driver.
It defaults to powering off the device after two seconds of inactivity.

isl29028_chip_init_and_power_on() currently only zeros the CONFIGURE
register on the chip, which will cause the chip to turn off. This patch
also renames that function to isl29028_clear_configure_reg() since it is
now used in several places.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:40 +00:00
Brian Masney 0fac96ed50 staging: iio: isl29028: only set ALS scale when ALS/IR sensing is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_als_scale() and
this is not needed until the user actually needs to take a reading from
the ALS/IR sensor. This patch moves the isl29028_set_als_scale() call
from isl29028_chip_init_and_power_on() to isl29028_set_als_ir_mode().
This sets the stage for faster resume times from runtime power
management if the user is only querying the proximity sensor.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:39 +00:00
Brian Masney 84a76694bc staging: iio: isl29028: only set proximity sampling rate when proximity is enabled
isl29028_chip_init_and_power_on() calls isl29028_set_proxim_sampling()
and this is not needed until the user actually needs to take a proximity
reading. This patch moves the isl29028_set_proxim_sampling() call from
isl29028_chip_init_and_power_on() to isl29028_enable_proximity().
This sets the stage for faster resume times from the runtime power
management if the user is only querying the ALS/IR sensor.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:38 +00:00
Brian Masney 6766342441 staging: iio: isl29028: remove enable flag from isl29028_enable_proximity()
isl29028_enable_proximity() has a boolean argument named enable. This
function is only called once and the enable flag is set to true in that
call. This patch removes the enable parameter from that function.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:38 +00:00
Brian Masney 71a0a64346 staging: iio: isl29028: remove unnecessary parenthesis
isl29028_write_raw() contains unnecessary parenthesis when checking to
see if the passed in lux scale is valid. This patch removes the
unnecessary parenthesis.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:37 +00:00
Brian Masney 8c93940268 staging: iio: isl29028: remove out of memory log message
If the call to devm_iio_device_alloc() fails, then isl29028_probe()
logs a message saying that memory cannot be allocated. The user's system
most likely has larger issues at this point. This patch removes that
error message since the error code is passed on and the message is not
necessary.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:37 +00:00
Brian Masney 65ac716b20 staging: iio: isl29028: remove unnecessary error logging in isl29028_chip_init_and_power_on()
If the call to isl29028_chip_init_and_power_on() in isl29028_probe()
fails, then isl29028_probe() will log an error message. All of the
error paths in that call path already have error logging in place. This
patch removes the unnecessary logging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:36 +00:00
Brian Masney 578e02a7ed staging: iio: isl29028: made error messages consistent
The wording and style of the different error messages was not
consistent. This patch makes the wording and style consistent
throughout the driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:35 +00:00
Brian Masney bcf5104e27 staging: iio: isl29028: move failure logging into isl29028_set_als_scale()
When isl29028_set_als_scale() fails, it was up to both callers to log
the failure message. This patch moves the logging into
isl29028_set_als_scale() to reduce the overall amount of code in the
driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:35 +00:00
Brian Masney ae1e5238f7 staging: iio: isl29028: move failure logging into isl29028_set_proxim_sampling()
When isl29028_set_proxim_sampling() fails, it was up to both callers to
log the failure message. This patch moves the logging into
isl29028_set_proxim_sampling() to reduce the overall amount of code in
the driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:34 +00:00
Brian Masney 19140ae904 staging: iio: isl29028: remove unused define ISL29028_DEV_ATTR
The #define ISL29028_DEV_ATTR was not used so this patch removes the
unnecessary code.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:33 +00:00
Brian Masney b1dda96935 staging: iio: isl29028: change newlines to improve readability
Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:33 +00:00
Brian Masney 6db2fa0ab5 staging: iio: isl29028: made alignment of variables in struct isl29028_chip consistent
The alignment of the variables in the struct isl29028_chip is not
consistent. This changes all of the variables to use consistent
alignment to improve the code readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:32 +00:00
Brian Masney b44b1f3193 staging: iio: isl29028: combine isl29028_proxim_get() and isl29028_read_proxim()
isl29028_proxim_get() checks to see if the promixity needs to be
enabled on the chip and then calls isl29028_read_proxim(). There
are no other callers of isl29028_read_proxim(). The naming between
these two functions can be confusing so this patch combines the
two to avoid the confusion.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:32 +00:00
Brian Masney c4f6092598 staging: iio: isl29028: fix alignment of function arguments
Two separate calls to regmap_update_bits() in isl29028_set_als_scale()
and isl29028_set_als_ir_mode() did not have their function arguments
on the next line aligned correctly to the open parenthesis. This patch
corrects the alignment.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:31 +00:00
Scott Matheina 06fc41daae staging:iio:addac:adt7316 Fixes Alignment should match open parenthesis
Fixes style issue where Alignment doesn't match open parenthesis

Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-10 19:54:57 +00:00
Jonathan Cameron 8abd5ba539 iio:kfifo_buf header include push down.
As a precursor to splitting buffer.h, lets make sure all drivers
include the relevant headers rather than relying on picking them
up from kfifo_buf.h.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-01-10 19:54:53 +00:00
Eva Rachel Retuya 17be2a2905 staging: iio: ad7606: replace range/range_available with corresponding scale
Eliminate the non-standard attributes in_voltage_range and
in_voltage_range_available. Implement in_voltage_scale_available in place
of these attributes and update the SCALE accordingly. The array
scale_avail is introduced to hold the available scale values.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-07 12:56:05 -05:00
rishabh hardas 04e917305d iio:trigger: Fix coding style in iio-trig-bfin-timer.c by aligning parameters with opening bracket.
Fixes a warning flagged by checkpatch.pl

Signed-off-by: rishabh hardas <rishabheudyptula@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-07 11:59:55 -05:00
Scott Matheina 9a18636ebb staging:iio:adt7316: Fix braces not present on all arms of if else statement
Adds braces to second arm of if else statement.

Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 18:49:16 +00:00
Nizam Haider f8611c00d9 Staging: iio: impedance-analyzer: ad5933: fix wrong comments
according to datasheet complete control register is of 2 bytes.
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf

Signed-off-by: Nizam Haider <nijam.h@hcl.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-10 17:50:38 +00:00
Brian Masney 29e90cd79f staging: iio: isl29028: made alignment of #defines consistent
The alignment of the #defines at the top of the file is not consistent.
This changes all of the defines to use consistent alignment to improve
the code readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04 11:38:31 +00:00
Brian Masney 58f643669e staging: iio: isl29028: remove chip test and defaults from isl29028_chip_init()
isl29028_chip_init() contains the device driver defaults and
two I2C calls that detect the presence of the chip. This patch
moves these into isl29028_probe() so that this function can
be used by the power management runtinme in a followup patch. This
patch also renames isl29028_chip_init() to
isl29028_chip_init_and_power_on().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04 11:23:00 +00:00
Brian Masney f40531d1e7 staging: iio: isl29028: remove nested if statements
There are two callers to the function isl29028_set_als_ir_mode() and
both instances use a nested if statement to only change the chip state
if it is not in the proper mode. This patch moves this check into the
isl29028_set_als_ir_mode() function to remove the nested if
statements.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04 11:01:10 +00:00
Pan Bian 91ca1a8c58 staging: iio: cdc: fix improper return value
At the end of function ad7150_write_event_config(), directly returns 0.
As a result, the errors will be ignored by the callers. It may be better
to return variable "ret".

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04 10:57:57 +00:00
Amit Kumar Kushwaha 67351df7f1 staging: iio: replace symbolic permission
This patch fixes the following checkpatch.pl warning in ad7150.c
WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred
Occured during build.

Signed-off-by: Amit Kushwaha <kushwaha.a@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 10:26:13 +00:00
Aniroop Mathur 071cf24943 IIO: Change msleep to usleep_range for small msecs
msleep(1~20) may not do what the caller intends, and will often sleep longer.
(~20 ms actual sleep for any value given in the 1~20ms range)
This is not the desired behaviour for many cases like device resume time,
device suspend time, device enable time, data reading time, etc.
Thus, change msleep to usleep_range for precise wakeups.

Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 08:58:40 +00:00
Reto Schneider 160d95870c iio: adis16203: Fix copyright year
The copyright year can not be in the future.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 08:56:29 +00:00
Reto Schneider 58401bd40b iio: adis1620x: Fix mixed up device descriptions
The module descriptions for the ADIS 16201, 16203 and 16209 drivers do not
match the actual function of the devices. Update them accordingly to fix
this.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 08:56:29 +00:00
Brian Masney f44d5c8ac3 staging: iio: tsl2583: move out of staging
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:33 +00:00
Brian Masney c45a226fca staging: iio: tsl2583: add copyright and MODULE_AUTHOR
Add Brian Masney's copyright to the header and to the MODULE_AUTHOR
for all of the staging cleanups that has been done to this driver.

The original MODULE_AUTHOR() did not have a space between his name and
email address. This patch also adds the missing space.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:33 +00:00
Brian Masney 0859fdd319 staging: iio: tsl2583: remove unnecessary variable initialization
The ret variable in tsl2583_suspend() and tsl2583_resume() was
initialized to 0. This is not necessary so this patch removes the
initialization.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:32 +00:00
Brian Masney b912c6564c staging: iio: tsl2583: remove unnecessary memset call
The entries in the lux table (als_device_lux) can be updated via sysfs
through the function in_illuminance_lux_table_store(). The last row in
the table must be terminated with values that are zero. The sysfs code
already ensures that the last row is all zeros. The call to memset to
clear out the table is not needed so this patch removes the unnecessary
call.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:31 +00:00
Brian Masney fafc5631d6 staging: iio: tsl2583: remove comment for tsl2583_probe()
The comment for tsl2583_probe() does not provide any useful value.
This patch removes the comment.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:31 +00:00
Brian Masney 2fb2848ff0 staging: iio: tsl2583: clarified comment about clearing interrupts
The comment that describes the code that clears the interrupt bit was
vague and didn't provide much value. This patch adds more detail about
why that bit needs to be cleared.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:30 +00:00
Brian Masney aadc4c904d staging: iio: tsl2583: add tsl2583 to list of supported devices in the header
The header only listed the tsl2580 and tsl2581 devices as supported by
this driver. This patch adds the tsl2583 since it is also supported by
this driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:29 +00:00
Brian Masney 0b6b361e16 staging: iio: tsl2583: move from a global to a per device lux table
The driver contains a global lux table that can be updated via sysfs.
Change this to a per device lux table so that multiple devices can be
hooked up to the same system with different lux tables.

There are 10 entries, plus 1 for the termination segment, set aside for
the entries in the lux table. When updating the lux table via sysfs,
only 9 entries, plus the terminator, could be added. This changes
the code to allow for the 10 entries, plus the terminator.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:29 +00:00
Brian Masney 8386dd50a7 staging: iio: tsl2583: don't assume an unsigned int is 32 bits
in_illuminance_lux_table_store assumes that an unsigned int is 32 bits.
Replace this with sizeof(value[1]).

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:28 +00:00
Brian Masney 1ad513604f staging: iio: tsl2583: remove unnecessary parentheses
in_illuminance_lux_table_store() contains some unnecessary parentheses.
This patch removes them since they provide no value.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:27 +00:00
Brian Masney a8898dced8 staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on success
tsl2583_als_calibrate() returns the newly computed gain_trim if the
calibration was successful. This function is only called by
in_illuminance_calibrate_store() and the return value inside that
sysfs attribute is only checked to see if an error was returned.
This patch changes tsl2583_als_calibrate() to return 0 on success.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:27 +00:00
Brian Masney ed9125566b staging: iio: tsl2583: moved code block inside else statement
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if
the ratio is not equal to zero. Move the code block inside the else
statement. This does away with the need to initialize the variables to
zero.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:26 +00:00
Brian Masney 043c1da794 staging: iio: tsl2583: updated code comment to match what the code does
If channel 0 does not have any data, then the code sets the lux to zero.
The corresponding comment says that the last value is returned. This
updates the comment to correctly reflect what the code does. It also
clarifies the comment about why 0 is returned.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:25 +00:00
Brian Masney 2a1e3f074c staging: iio: tsl2583: fix multiline comment syntax
The definition of the tsl2583_device_lux struct has a series of single
line comments. There are two other cases where the multiline comments
did not have an initial blank line. Change these comments to use the
proper multiline syntax.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:25 +00:00
Brian Masney a3549966ee staging: iio: tsl2583: combine sysfs documentation
There are two separate files describing the tsl2583 sysfs attributes.
Combine the two files into one. Updated the name of the sysfs attributes
to match the current ABI.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:24 +00:00
Brian Masney 184f916fa7 staging: iio: tsl2583: change newlines to improve readability
Add and remove newlines to improve code readability in preparation for
moving the driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:24 +00:00
Brian Masney 6d94de6aaf staging: iio: tsl2583: fix comparison between signed and unsigned integers
Fixed warning found by make W=2:

warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:23 +00:00
Brian Masney 8391c882ac staging: iio: tsl2583: fix alignment of #define values
Most of the values in the #defines have their values aligned on a single
column, but some do not. This changes the remaining defines to use
consistent alignment with the majority to improve code readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:22 +00:00
Brian Masney 686c592284 staging: iio: tsl2583: unify function and variable prefix to tsl2583_
Some functions and variables were prefixed with either taos, tsl258x,
taos2583, or tsl2583. Change everything to use the tsl2583 prefix since
that is the name of the .c file. The taos_settings member inside the
taos_settings struct was renamed to als_settings.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:22 +00:00
Brian Masney 24ad430ecd staging: iio: tsl2583: cleaned up logging
There are several places in the code where the function name is
hardcoded in the log message. Use the __func__ constant string to build
the log message. This also clarifies some of the error messages to match
the code and ensures that the correct priority is used since the message
is already being changed.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:21 +00:00
Brian Masney c9759e3fba staging: iio: tsl2583: remove the FSF's mailing address
Address warning from checkpatch:

CHECK: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:20 +00:00
Brian Masney cade8cde79 staging: iio: tsl2583: remove redundant write to the control register in taos_probe()
taos_probe() calls i2c_smbus_write_byte() to select the control
register, however there are no subsequent calls to
i2c_smbus_read_byte(). The write call is unnecessary and is removed by
this patch.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:20 +00:00
Brian Masney 85e9304c16 staging: iio: tsl2583: change current chip state from a tristate to a bool
The current chip state is represented as a tristate (working, suspended,
and unknown). The unknown state was not used. This patch changes the
chip state so that it is now represented as a single boolean value
(suspended).

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:19 +00:00
Brian Masney 2ff8a35bd7 staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resume
The device probing and the suspend/resume code checks a flag internal to
the driver that determines whether or not the chip is in a working
state. These checks are not needed. This patch removes the unnecessary
checks. It will do no harm to the hardware if the chip is
reinitialized if it is already powered on.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:18 +00:00
Brian Masney 6a77e3f651 staging: iio: tsl2583: remove unnecessary chip status check in taos_get_lux
taos_get_lux checks to see if the chip is in a working state. This
check is not necessary since it is only called from tsl2583_read_raw
and in_illuminance_calibrate_store (via taos_als_calibrate). The chip
state is already checked by these functions.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:18 +00:00
Brian Masney acf9ead8fa staging: iio: tsl2583: check if chip is in a working state in in_illuminance_calibrate_store
in_illuminance_calibrate_store() did not check to see if the chip is
in a working state. This patch adds the proper check. The return value
from taos_als_calibrate() was also not checked in this function, so the
proper check was also added while changes are being made here.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:17 +00:00
Brian Masney 2167769aed staging: iio: tsl2583: fix issue with changes to calibscale and int_time not being set on the chip
When updating the in_illuminance_calibscale and
in_illuminance_integration_time sysfs attributes, these values were not
actually written to the chip. The chip would continue to use the old
parameters. Extracted out tsl2583_set_als_gain() and
tsl2583_set_als_time() functions that are now called when these sysfs
attributes are updated. The chip initialization also calls these these
new functions.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 16:22:53 +00:00
Brian Masney c908fb76b2 staging: iio: tsl2583: split out functionality of taos_chip_on()
taos_chip_on() reads an eight member array called taos_config
that contains the desired state of the chip's registers. Only four
of the registers actually need to be written to. The four that do
not need to be written to are for the {low,high} byte of the lower
interrupt threshold and the {low,high} byte of the upper interrupt
threshold. Interrupts are currently not supported by this driver
so there is no need to write to these registers.

This patch removes the taos_config array and separates out the
i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG
registers. This is part of a larger refactor that was split up to
make the code review easier.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 16:17:07 +00:00
Arnd Bergmann c266cda29a staging: iio: tsl2583: fix unused function warning
Removing a call to the taos_chip_off() makes it unused when CONFIG_PM
is disabled:

drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function]

This removes all the #ifdef in this file, and marks the PM functions as
__maybe_unused instead, which is more reliable and gives us better
compile time coverage.

Fixes: 0561155f6f ("staging: iio: tsl2583: don't shutdown chip when updating the lux table")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:27:12 +00:00
Arnd Bergmann 6826fdbd2e staging: iio: ad9832: allocate data before using
The regulator changes assigned data to an uninitialized pointer:

drivers/staging/iio/frequency/ad9832.c: In function 'ad9832_probe':
drivers/staging/iio/frequency/ad9832.c:214:11: error: 'st' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This moves the allocation of the 'st' structure before its first
use, as it should have been.

Fixes: 43a07e48af ("staging: iio: ad9832: clean-up regulator 'reg'")
Fixes: a98461d79b ("staging: iio: ad9832: add DVDD regulator")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:22:32 +00:00
Greg Kroah-Hartman 7970b9e6a5 Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle
This includes two branch merges for elements that may also go via MFD.
 
 New device support
 * cros_ec
   - new driver to support these Chrome OS contiguous sensors which are behind
     the Chrome OS embedded controller.  Requires a few minor MFD and chrome
     platform changes.  One follow up fix deals with some dependency issues in
     Kconfig.
 * mpu-3050
   - new driver and device tree bindings for this venerable device.
 * st_accel
   - support for the lng2dm an
 
 Driver features
 * ad7192
   - Add DVdd regulator handling
 * ad9832
   - Add DVDD regulator handling
 * at91
   - Suspend and resume support
 * si7020
   - Device tree bindings
 * ti-am335x
   - DMA support - uses dma to accelerate short bursts of read back rather
   than full blown DMA buffer support.  Greatly improved performance.
   Includes an MFD addition to give access to the address needed for DMA.
 * tsl2583
   - Device tree bindings
 
 Cleanups and minor fixes
 * ad7192
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
   - Rename reg variable to reflect which regulator it is
 * ad5933
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * ad7746
   - Fix a missing return value (fallout from previous patch set)
 * ad7780
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * ad9832
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
   - Rename reg regulator to reflect which one it is
 * ad9834
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * hts221
   - Remove a duplicated include
 * maxim thermocouple
   - Handle a wrong storage side in read function.  Prevent any problems that
   might be introduced by additions to this driver in future.
 * tsl2583 - big set from Brian Masney to drive this towards a staging
   graduation.
   - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
   - Improved error handling in various functions
   - Drop redundant power_state custom sysfs attribute.
   - Use IIO_*_ATTR* macros for remaining attributes.
   - Return an error code to userspace on invalid parameters being writen to
     sysfs files.
   - Add locking to various attribute accesses to remove possible races.
   - Add defines for various magic numbers.
   - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
   - Query only relevant registers in probe.
   - Tidy up ordering of code comments.
   - Remove a pointless power off sequence in taos_chip_on.
   - Don't bother shutting down the chip when updating the lux table.
   The table is held entirely in the driver and doesn't effect the chip at all.
   - Drop a redundant i2c call in taos_als_calibrate where the same register
   is read twice in a row.
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJYH22HERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIUg4P
 /1GRFGpTbqyzDOX6KZKAdBRsRMn3XPL0XslvbKpupY4T9WFEJbZi01z4P/x+uRIk
 6TtRlhdWBLdzVQ6sLpVAZVXR2/FxGj+nsc2ONgHJXm02/fDBmjI89Ed9WVS1HR73
 D2yLAFhflvE6mDMExvAnUVBh9ClR2SXoGL0N1k+VQM08Rs+F6IzBAg2albiPkct/
 7UQB9apn4VCCaRY02gllvWrUiJV3w8jsSikwDACZsprQGIxKjLiH4evtRfSOI8bg
 Z7UoJYaYNMiQtn6+rFaNUjFQtzlnWcjB92RUy/MqnpXmkuAvw3+CbXYteYnailO1
 eTsIjKpwssKaQh5HHALrxIwP/a/9a+Wyrd8iheygUQvzSNx3gcxXrtNrUk8eI/9W
 N8pBRBbu+2pzSzVLQb+7SR5wJG1zQ5NEXI1gpZuyed94g30Be0vQpeiZRNCUL+J0
 ta28Xa25cREzHrXGXrhfyxNJuriav/8A5PTtnGJSZZ8RhuHZq24TcC8h6KVOWR+3
 BBiehupFcIErbrGcMKuhq01q8A9+Vj/1z6hQaZzfIpXFjEEUvkBo3OMiNtgpkQYM
 XYdaF2bH25t8wx020z4FrmN48nxg2HDTLtKissP/6bInh4kYyGneKhf6QQVnG2IX
 41XLE/fw4QoAnLuTBXD3boydC08uJmVkXeOH2sfaCYwG
 =ptGw
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle

This includes two branch merges for elements that may also go via MFD.

New device support
* cros_ec
  - new driver to support these Chrome OS contiguous sensors which are behind
    the Chrome OS embedded controller.  Requires a few minor MFD and chrome
    platform changes.  One follow up fix deals with some dependency issues in
    Kconfig.
* mpu-3050
  - new driver and device tree bindings for this venerable device.
* st_accel
  - support for the lng2dm an

Driver features
* ad7192
  - Add DVdd regulator handling
* ad9832
  - Add DVDD regulator handling
* at91
  - Suspend and resume support
* si7020
  - Device tree bindings
* ti-am335x
  - DMA support - uses dma to accelerate short bursts of read back rather
  than full blown DMA buffer support.  Greatly improved performance.
  Includes an MFD addition to give access to the address needed for DMA.
* tsl2583
  - Device tree bindings

Cleanups and minor fixes
* ad7192
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg variable to reflect which regulator it is
* ad5933
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad7746
  - Fix a missing return value (fallout from previous patch set)
* ad7780
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad9832
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg regulator to reflect which one it is
* ad9834
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* hts221
  - Remove a duplicated include
* maxim thermocouple
  - Handle a wrong storage side in read function.  Prevent any problems that
  might be introduced by additions to this driver in future.
* tsl2583 - big set from Brian Masney to drive this towards a staging
  graduation.
  - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
  - Improved error handling in various functions
  - Drop redundant power_state custom sysfs attribute.
  - Use IIO_*_ATTR* macros for remaining attributes.
  - Return an error code to userspace on invalid parameters being writen to
    sysfs files.
  - Add locking to various attribute accesses to remove possible races.
  - Add defines for various magic numbers.
  - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
  - Query only relevant registers in probe.
  - Tidy up ordering of code comments.
  - Remove a pointless power off sequence in taos_chip_on.
  - Don't bother shutting down the chip when updating the lux table.
  The table is held entirely in the driver and doesn't effect the chip at all.
  - Drop a redundant i2c call in taos_als_calibrate where the same register
  is read twice in a row.
2016-11-07 09:14:03 +01:00
Brian Masney c2b0d2cfb0 staging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate()
taos_als_calibrate() queries the control register to determine if the
unit is powered on and has the ADC enabled. It then queries the same
register a second time to determine if the ADC reading is valid. This
patch removes the redundant i2c_smbus_read_byte_data() call.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:54:32 +00:00
Brian Masney 0561155f6f staging: iio: tsl2583: don't shutdown chip when updating the lux table
in_illuminance_lux_table_store() shuts down the chip, updates the
contents of the lux table, and then turns the chip back on. The values
in lux table are not used by the chip and are only used internally by
the driver. It is not necessary to change the power state on the chip.
This patch removes the calls to taos_chip_off() and taos_chip_on()
in in_illuminance_lux_table_store().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:53:14 +00:00
Brian Masney babe444798 staging: iio: tsl2583: remove redundant power off sequence in taos_chip_on()
taos_chip_on() explicitly turns the sensor power on and then writes the
8 registers that are stored in taos_config. The first register in
taos_config is the CONTROL register and the configuration is set to
turn the power off. The existing state sequence in taos_chip_on() is:

- Turn device power on
- Turn device power off (via taos_config)
- Configure other 7 registers (via taos_config)
- Turn device power on, enable ADC

This patch changes the code so that the device is not powered off via
taos_config.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:51:17 +00:00
Brian Masney 4a0f36144c staging: iio: tsl2583: fixed ordering of comments
in taos_defaults()

The comments in taos_defaults() appear after the line of code
that they apply to. This patch moves the comments so that they appear
before the code. Some of the comments were updated to be more
informative.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:48:52 +00:00
Brian Masney 6bd0cb2b59 staging: iio: tsl2583: removed unused code from device probing
taos_probe() queries the all of the sensor's registers and loads all of
the values into a buffer stored on the stack. Only the chip ID register
was actually used. Change the probe function to just query the chip ID
register on the device.

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:46:11 +00:00
Brian Masney 6ba5dee90b staging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migration
There were several places where the driver would first call
i2c_smbus_write_byte() to select the register on the device, and then
call i2c_smbus_read_byte() to get the contents of that register. The
code would look roughly like:

/* Select register */
i2c_smbus_write_byte(client, REGISTER);

/* Read the the last register that was written to */
int data = i2c_smbus_read_byte(client);

Rewrite this to use i2c_smbus_read_byte_data() to combine the two
calls into one:

int data = i2c_smbus_read_byte_data(chip->client, REGISTER);

Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.

This fixes the following warnings that were found by the
kbuild test robot that were introduced by commit 8ba355cce3c6 ("staging:
iio: tsl2583: check for error code from i2c_smbus_read_byte()").

drivers/staging/iio/light/tsl2583.c:365:5-12: WARNING: Unsigned
expression compared with zero: reg_val < 0

drivers/staging/iio/light/tsl2583.c:388:5-12: WARNING: Unsigned
expression compared with zero: reg_val < 0

This also removes the need for the taos_i2c_read() function since all
callers were only calling the function with a length of 1.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06 11:33:11 +00:00
Eva Rachel Retuya 43a07e48af staging: iio: ad9832: clean-up regulator 'reg'
Rename regulator 'reg' to 'avdd' so as to be clear what regulator it
stands for specifically. Additionally, get rid of local variable 'reg'
and use direct assignment instead. Update also the goto label pertaining
to the avdd regulator during disable.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:23:01 +00:00
Eva Rachel Retuya a98461d79b staging: iio: ad9832: add DVDD regulator
The AD9832/AD9835 is supplied with two power sources: AVDD as analog
supply voltage and DVDD as digital supply voltage.

Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error
occurs.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:22:09 +00:00
Eva Rachel Retuya 9d1548143f staging: iio: ad7192: rename regulator 'reg' to 'avdd'
Rename regulator 'reg' to 'avdd' so as to be clear what regulator it
stands for specifically. Also, update the goto label accordingly.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:21:34 +00:00
Eva Rachel Retuya cb8bb16caf staging: iio: ad7192: add DVdd regulator
The AD7190/AD7192/AD7193/AD7195 is supplied with two power sources:
AVdd as analog supply voltage and DVdd as digital supply voltage.

Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error
occurs.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:20:59 +00:00
Eva Rachel Retuya 3925ff0fcb staging: iio: rework regulator handling
Currently, the affected drivers ignore all errors from regulator_get().
The way it is now, it also breaks probe deferral (EPROBE_DEFER). The
correct behavior is to propagate the error to the upper layers so they
can handle it accordingly.

Rework the regulator handling so that it matches the standard behavior.
If the specific design uses a static always-on regulator and does not
explicitly specify it, regulator_get() will return the dummy regulator.

The following semantic patch was used to apply the change:
@r1@
expression reg, dev, en, volt;
@@

reg = \(devm_regulator_get\|regulator_get\)(dev, ...);
if (
- !
   IS_ERR(reg))
+	return PTR_ERR(reg);
(
- {	en = regulator_enable(reg);
-	if (en) return en; }
+
+	en = regulator_enable(reg);
+	if (en) {
+		dev_err(dev, "Failed to enable specified supply\n");
+		return en; }
|
+
- {	en = regulator_enable(reg);
-	if (en)	return en;
-	volt = regulator_get_voltage(reg); }
+	en = regulator_enable(reg);
+	if (en) {
+		dev_err(dev, "Failed to enable specified supply\n");
+		return en;
+	}
+	volt = regulator_get_voltage(reg);
)

@r2@
expression arg;
@@

-	if (!IS_ERR(arg)) regulator_disable(arg);
+	regulator_disable(arg);

Hand-edit the debugging prints with the supply name to become more
specific.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:17:14 +00:00
Eva Rachel Retuya c834e1718a staging: iio: set proper supply name to devm_regulator_get()
The name passed to devm_regulator_get() should match the name of the
supply as specified in the device datasheet. This makes it clear what
power supply is being referred to in case of presence of other
regulators.

Currently, the supply name specified on the affected devices is 'vcc'.
Use lowercase version of the datasheet name to specify the supply
voltage.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:07:13 +00:00
Eva Rachel Retuya 579d542534 staging: iio: cdc: ad7746: add additional config defines
Introduce defines for shifting and mask under the config register for
better readability. Also, introduce helper variables for index
calculation.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:09 +00:00
Brian Masney 1b7e9e2cbd staging: iio: tsl2583: add locking to sysfs attributes
in_illuminance_input_target_show(), in_illuminance_input_target_store(),
in_illuminance_calibrate_store(), and in_illuminance_lux_table_store()
accesses data from the tsl2583_chip struct. Some of these fields can be
modified by other parts of the driver concurrently. This patch adds the
mutex locking to these sysfs attributes.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:09 +00:00
Brian Masney f375a49f71 staging: iio: tsl2583: add error code to sysfs store functions
in_illuminance_input_target_store() and in_illuminance_calibrate_store()
validated the data from userspace, however it would not return an
error code to userspace if an invalid value was passed in. This patch
changes these functions so that they return -EINVAL if invalid data is
passed in.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:08 +00:00
Brian Masney b2fa81be96 staging: iio: tsl2583: use IIO_*_ATTR* macros to create sysfs entries
Use the IIO_CONST_ATTR, IIO_DEVICE_ATTR_RW, and IIO_DEVICE_ATTR_WO
macros for creating the in_illuminance_calibscale_available,
in_illuminance_integration_time_available, in_illuminance_input_target,
in_illuminance_calibrate, and in_illuminance_lux_table sysfs entries.
Previously these sysfs entries were prefixed with illuminance0_, however
they are now prefixed with in_illuminance_ to make these sysfs entries
consistent with how the IIO core is creating the other sysfs entries.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:07 +00:00
Brian Masney 143c30f4a5 staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use iio_chan_spec
The illuminance0_calibscale sysfs attribute is not currently created by
the IIO core. This patch adds the appropriate mask to iio_chan_spec,
along with the appropriate data handling in the read_raw() and
write_raw() functions, so that the sysfs attribute is created by the IIO
core. With this change, this sysfs entry will have its prefix changed
from illuminance0_ to in_illuminance_.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:07 +00:00
Brian Masney b3d941550d staging: iio: tsl2583: convert to use iio_chan_spec and {read,write}_raw
The tsl2583 driver directly creates sysfs attributes that should instead
be created by the IIO core on behalf of the driver. This patch adds the
iio_chan_spec array, the relevant info_mask elements and the read_raw()
and write_raw() functions to take advantage of features provided by the
IIO core. These sysfs attributes were migrated with this patch:
illuminance0_input, illuminance0_calibbias,
illuminance0_integration_time. This also exposes the raw values read
from the two channels on the sensor.

With this change, these four sysfs entries have their prefix changed
from illuminance0_ to in_illuminance_. This is deemed to be acceptable
since none of the IIO light drivers in mainline use the illuminance0_
prefix, however 8 of the IIO light drivers in mainline use the
in_illuminance_ prefix.

Also fix the units of integration_time to meet with the ABI.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:06 +00:00
Brian Masney 84bc1704cb staging: iio: tsl2583: check return values from taos_chip_{on,off}
The return value from taos_chip_on() and taos_chip_off() was not
checked in taos_luxtable_store() and taos_probe(). This patch adds
proper error checking to these function calls.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:06 +00:00
Brian Masney 27f4fabd4f staging: iio: tsl2583: remove redundant power_state sysfs attribute
IIO devices have a /sys/bus/iio/devices/iio:deviceX/power/ directory
that allows viewing and controling various power parameters. The tsl2583
driver also has an additional custom sysfs attribute named power_state
that is not needed. This patch removes the redundant power_state sysfs
attribute.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:05 +00:00
Brian Masney 20d823afff staging: iio: tsl2583: return proper error code instead of -1
taos_als_calibrate() has a code path where -1 is returned. This patch
changes the code so that a proper error code is returned.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:04 +00:00
Brian Masney 9d5f36d241 staging: iio: tsl2583: check for error code from i2c_smbus_read_byte()
taos_i2c_read() and taos_als_calibrate() does not check to see if the
value returned by i2c_smbus_read_byte() was an error code. This patch
adds the appropriate error handling.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:04 +00:00
Brian Masney a3b6b4b63b staging: iio: tsl2583: add of_match table for device tree support
Add device tree support for the tsl2583 IIO driver with no custom
properties.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:03 +00:00
Arnd Bergmann 3089ec2c10 staging: iio: cdc/ad7746: fix missing return value
As found by "gcc -Wmaybe-uninitialized", the latest change to the
driver lacked an initalization for the return code in one of the
added cases:

drivers/staging/iio/cdc/ad7746.c: In function ‘ad7746_read_raw’:
drivers/staging/iio/cdc/ad7746.c:655:2: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets it to IIO_VAL_INT, which I think is what we want here.

Fixes: 2296c0623e ("staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25 17:25:34 +01:00
Arnd Bergmann b8fd722075 staging: iio: ad5933: avoid uninitialized variable in error case
The ad5933_i2c_read function returns an error code to indicate
whether it could read data or not. However ad5933_work() ignores
this return code and just accesses the data unconditionally,
which gets detected by gcc as a possible bug:

drivers/staging/iio/impedance-analyzer/ad5933.c: In function 'ad5933_work':
drivers/staging/iio/impedance-analyzer/ad5933.c:649:16: warning: 'status' may be used uninitialized in this function [-Wmaybe-uninitialized]

This adds minimal error handling so we only evaluate the
data if it was correctly read.

Link: https://patchwork.kernel.org/patch/8110281/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-25 11:04:17 +02:00
kbuild test robot dbdef9ba69 staging:iio:ad7606: fix ptr_ret.cocci warnings
drivers/staging/iio/adc/ad7606.c:357:1-3: WARNING: PTR_ERR_OR_ZERO can be used

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

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

CC: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:27 +01:00
Eva Rachel Retuya f0879217a8 staging: iio: ad7606: rework regulator handling
Currently, this driver ignores all errors from regulator_get(). The way
it is now, it also breaks probe deferral (EPROBE_DEFER). The correct
behavior is to propagate the error to the upper layers so they can
handle it accordingly.

Rework the regulator handling so that it matches the standard behavior.
If the specific design uses a static always-on regulator and does not
explicitly specify it, regulator_get() will return the dummy regulator.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:19 +01:00
Eva Rachel Retuya 12edb97471 staging: iio: ad7606: set proper supply name to devm_regulator_get()
The name passed to devm_regulator_get() should match the name of the
supply as specified in the device datasheet. The supply on this device
is called 'AVcc' while currently, the driver uses just 'vcc'.

Use 'avcc' to specify the supply voltage since it is custom to use the
lower-caps version of the datasheet name.

Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:19 +01:00
Lars-Peter Clausen fa23105f85 staging:iio:ad7606: Move buffer code to main source file
Currently the ad7606 buffer handling code resides in its own source file.
But this file contains only 4 small functions of which half are just
wrappers around other functions. Buffer support is also always enabled for
this driver, so move them over to the main source file. This reduces the
amount of boilerplate code.

Also rename the main function from ad7606_core.c to ad7606.c since there is
only a single file now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:18 +01:00
Lars-Peter Clausen 722407a4e8 staging:iio:ad7606: Use GPIO descriptor API
Convert the ad7606 driver away from the deprecated legacy GPIO API and use
the new GPIO descriptor API.

This also means that the platform data struct is now empty and can be
removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:17 +01:00
Lars-Peter Clausen f52666772d staging:iio:ad7606: Run trigger handler only once per trigger event
Currently the ad7606 driver installs the same function for the hard-irq and
threaded trigger handlers. This was introduced in commit 1caf7cb461
("staging:iio:adc:ad7606 Convert to new channel registration method Update
Add missing call to iio_trigger_notify_done() Set pollfunc top and bottom
half handler"). Unfortunately the commit message does not mention why this
was done and Michael does not remember either.

Since the trigger handler function is idempotent (set a GPIO to 1) running
it twice does not do any harm, but is simply not necessary either. So set
the threaded trigger handler for the driver to NULL.

While we are at it also remove the function description comment that does
no say anything that can't be derived from the function name itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:17 +01:00
Lars-Peter Clausen a866058f8e staging:iio:ad7606: Let common remove function take a struct device *
Currently the common remove function takes a struct iio_dev *. This
parameter is retrieved by the individual driver remove functions by calling
get_drvdata() on their device. To simplify the code let the common remove
function directly take a struct dev * and do the IIO device in retrieval
the common remove function.

This also aligns the interface with the common probe function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:16 +01:00
Lars-Peter Clausen 71faca73af staging:iio:ad7606: Let the common probe function return int
The common probe function for the ad7606 currently returns a struct iio_dev
pointer. The returned value is not used by the individual driver probe
functions other than for error checking.

Let the common probe function return a int instead to report the error
value directly (or 0 on success). This allows to simplify the code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:16 +01:00
Lars-Peter Clausen 382a4777ec staging:iio:ad7606: Move set_drvdata() into common code
Both the platform_device and SPI driver call set_drvdata() at the end of
their probe function. Move this into the common probe() function to reduce
duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:15 +01:00
Lars-Peter Clausen 91b7334bae staging:iio:ad7606: Factor out common code between periodic and one-shot capture
Both the periodic buffer based and one-shot sysfs based capture methods
share a large portion of their code. Factor this out into a common helper
function.

Also provide a comment that better explains in more detail what is going on
in the capture function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:15 +01:00
Lars-Peter Clausen f915f7aafb staging:iio:ad7606: Avoid allocating buffer for each data capture
Currently the ad7606 driver dynamically allocates and frees a transfer
buffer each time a sample capture is performed in buffered mode, which
introduces unnecessary overhead. The driver state struct already contains a
buffer that is used for transfers in one-shot mode. This buffer is large
enough to hold all samples, but not the timestamp that might be present in
buffered mode. Extend the buffer size to be able to contain the timestamp
and update the buffered capture function to use this buffer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:14 +01:00
Lars-Peter Clausen e79e8027c1 staging:iio:ad7606: Use oversampling ratio of 1 for no oversampling
Currently the ad7606 driver uses a value of 0 for the oversampling ratio to
express that no oversampling is done. Strictly speaking this means though
that no data capture is done at all. Instead change the driver to use a
value of 1, this is in accordance with what other drivers do and what the
IIO spec suggests.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:13 +01:00
Lars-Peter Clausen aa96026668 staging:iio:ad7606: Remove out-of-band error reporting
Currently the ad7606 driver prints a error message to the kernel log when
an application writes an invalid value to a sysfs attribute. While for
initial driver development and testing this might be useful it is quite
disadvantageous in a production environment. The write() call to the sysfs
attribute will already return an error if the value was invalid so the
application is aware that the operation failed. And generally speaking it
is impossible for an application to reliably match a log message in the
kernel log to a specific operation it performed, so the message becomes
just noise and might distract from more critical messages.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:13 +01:00
Lars-Peter Clausen 9f72520fa4 staging:iio:ad7606: Remove default device configuration from platform data
While for some very selected setups it might be useful to be able to
provide default configuration data via the platform data, generally this
becomes very impractical as the number of configuration options increases.
So the general policy is to use the power-on default values of the device
and let the application using the device configure it according to its
needs.

Implement this scheme for the ad7606 driver by removing support for
specifying a default configuration via the platform data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:12 +01:00
Lars-Peter Clausen 063a51c5bd staging:iio:ad7606: Remove redundant name field from ad7606_chip_info
The name field in the ad7606_chip_info struct is set to the same value as
the as the name field in the corresponding {platform,spi}_device_id table
entry. Remove it from the ad7606_chip_info struct and pass the name from
the ID to the probe function. This slightly reduces the size of the
chip_info table and adding new entries requires less boilerplate.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:12 +01:00
Lars-Peter Clausen 36534b4067 staging:iio:ad7606: Remove unused int_vref_mv field
Remove the int_vref_mv field from the ad7606_chip_info struct since the
field is never used by the driver. The value is also the same for all
derivatives of this chip, so if it will ever be used in the driver a
constant value will work just fine.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:11 +01:00
Jonathan Cameron d62e5fee88 staging:iio:accel:sca3000 Move out of staging.
Now the driver is in a reasonable state, lets get it (finally) out
of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:07 +01:00
Jonathan Cameron 2ccf61442f staging:iio:accel:sca3000 kernel docify comments that were nearly kernel doc.
Basic tidy up of comments to bring them into a standard style.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:06 +01:00
Jonathan Cameron 389c583fd8 staging:iio:accel:sca3000 small checkpatch fixes (alignment etc)
Tidied up where checkpatch warning suppressions doesn't effect the
readability of the code.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:06 +01:00
Jonathan Cameron 9a4936dc89 staging:iio:accel:sca3000 Tidy up probe order to avoid a race.
Previously the device was exposed to userspace and in kernel consumers
before the interrupts had been configured. As nothing stopped them being
enabled in the interval this could cause unhandled interrupts.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:05 +01:00
Jonathan Cameron 7ab9fa0052 staging:iio:accel:sca3000 replace non standard revision attr with dev_info on probe
There seems little point in being able to query the part revision number
via sysfs.  Hence just put it in the kernel logs during probe incase
anyone ever wants to know.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:04 +01:00
Jonathan Cameron 6831c17236 staging:iio:accel:sca3000 Drop custom measurement mode attributes
This is now represented by the standard 3db filter frequency controls.
Things get complex wrt to the sampling frequency as these modes change
but that is fine under the IIO ABI where any value is allowed to effect
any other.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:04 +01:00
Jonathan Cameron 626f971b5b staging:iio:accel:sca3000 Add write support to the low pass filter control
Also includes an available attribute.  The ordering of values appears
a bit random, but as the ABI doesn't specify this and we already have
both rising and falling lists I think this is fine.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:03 +01:00
Jonathan Cameron 74bdc94075 staging:iio:accel:sca3000: Fix off by one error in axis due to IIO_NO_MOD
Given the introduction of IIO_NO_MOD was prior to the first submission
prior to IIO entering staging this has been broken for a while.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:03 +01:00
Jonathan Cameron 085fe1b2e3 staging:iio:accel:sca3000 add readback of the 3db low pass filter frequency
Driving towards getting rid of the non standard mode control interface.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:02 +01:00
Jonathan Cameron 9bc11d32b3 staging:iio:accel:sca3000 Clean up register defines.
Introduce some more masks and generally drive towards consistent naming.
Note the small indents used to indicate parts of registers + parts of
multiplexed registers.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:01 +01:00
Jonathan Cameron 45ae5561ac staging:iio:accel:sca3000 use a 'fake' channel to handle freefall event registration.
This is an approach used in some newer drivers as it exposes the
compound channel events to the core rather than hiding their control
in sysfs attributes entirely via the driver.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:01 +01:00
Jonathan Cameron 2600e12b8b staging:iio:accel:sca3000 drop some unused variables.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:00 +01:00
Jonathan Cameron 152a6a884a staging:iio:accel:sca3000 move to hybrid hard / soft buffer design.
In a similar fashion to other newer drivers (e.g. ti_am335x), instead
of using the hardware buffer support in IIO to directly access the hardware
fifo, insert a software fifo and feed that from the hardware one when
interrupts occur.  This gives a simpler structure to the data flows and
allows more flexibility over how often data is shipped to userspace etc.

This was also the only direct user of the simplistic generalization found
in ring_hw.h so that header is removed.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:34:00 +01:00
Jonathan Cameron c19a02582b staging:iio:accel:sca3000 Drop custom ABI for watersheds.
For now we support only the 50% watershed interrupt and start and stop it
as part of the buffer bring up.  The 75% case may come back in future.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:33:59 +01:00
Jonathan Cameron 271a25f648 staging:iio:accel:sca3000 Fix clearing of flag + setting of size of scan.
Not clearing the stuff_to_read flag can lead to a false flag being set
on restarting the buffer if the data was not all read the previous time.

The size of the scan is needed to ensure the function
iio_buffer_read_first_n_outer actually tries to read the data.

This stuff has been broken for some time so not stable material.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:33:58 +01:00
Jonathan Cameron d1bf1a865f staging:iio:accel:sca3000 drop sca3000_register_ring_funcs
This was needed when the buffer support was optional. Pointless wrapper
now so drop it.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:33:58 +01:00
Jonathan Cameron ced5c03d36 staging:iio:accel:sca3000 merge files into one.
In the early days of IIO we were much more inclined to keep the impact
of the core IIO elements to the minimum.  As time has moved on it has
become clear that hardly any builds are done without buffer support
and that it adds considerable complexity to the drivers.

Hence merge down the buffer and non buffer elements of the sca3000 driver
also allowing us to drop the header file used for the interfaces between
the two.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:33:57 +01:00
Jonathan Cameron e3ef7532a3 staging:iio:accel:sca3000 Fix a use before setting of the indio_dev->buffer pointer.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23 19:33:57 +01:00
Brian Masney a57504144c staging: iio: isl29018: move out of staging
Move ISL29018/ISL29023/ISL29035 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:56 +01:00
Brian Masney bac80fd0cf staging: iio: isl29018: rename description in Kconfig for consistency
Rename description from "ISL 29018" to "Intersil 29018" in Kconfig for
consistency with other drivers in mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:43 +01:00
Brian Masney b2f85b08c9 staging: iio: isl29018: remove blank line for consistency
Remove blank line between MODULE_DEVICE_TABLE() and its corresponding
structure for consistency with the other device table entries.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:43 +01:00
Brian Masney aba1a8d77f staging: iio: isl29018: combine two return statements into one
Use the return value from isl29018_set_integration_time() as the return
value for isl29018_chip_init() since this is the last piece of work
inside that function.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:42 +01:00
Brian Masney 19a00a9d4c staging: iio: isl29018: fix multiline comment syntax
Change multiline comments from:

/* line1
 * line2
 * ...
 */

to

/*
 * line1
 * line2
 * ...
 */

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:41 +01:00
Brian Masney 8281101c2d staging: iio: isl29018: fix poorly named function
isl29035_detect() did not just do chip detection. Move functionality directly
into isl29018_chip_init() to avoid naming confusion.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:41 +01:00
Brian Masney 744ef62c2e staging: iio: isl29018: add newlines to improve readability
Add newlines to improve code readability in preparation for moving the
driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:40 +01:00
Jonathan Cameron 92da01a08d staging:iio:TODO drop outdated entries in this todo.
There is still stuff to be done in the remaining drivers but pretty much
nothing was left from this original TODO.

Sorry Greg, should have been keeping this up to date.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-23 19:33:40 +01:00
sayli karnik f08a150847 staging: iio: cdc: ad7152: Replace mlock with a local mutex lock
mlock is intended to protect only switches between modes.
Given this driver doesn't support more than one mode (sysfs polled reads
only), replace mlock with a local mutex lock.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:37 +01:00
Eva Rachel Retuya 2296c0623e staging: iio: cdc: ad7746: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.

Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the
sampling_frequency attribute instead of using IIO_DEVICE_ATTR() macro.

Move code from the functions associated with IIO_DEVICE_ATTR() into
respective read and write hooks with the mask set to
IIO_CHAN_INFO_SAMP_FREQ.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:28:04 +01:00
sayli karnik 6572389bcc staging: iio: cdc: ad7152: Implement IIO_CHAN_INFO_SAMP_FREQ attribute
Attributes that were once privately defined become standard with time
and hence a special global define is used. Hence update driver ad7152 to use
IIO_CHAN_INFO_SAMP_FREQ which is a global define instead of
IIO_DEV_ATTR_SAMP_FREQ.
Move functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute.
Modify ad7152_read_raw() and ad7152_write_raw() to allow reading and
writing the element as well. Also add a lock in the driver's private
data.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:28:01 +01:00
Brian Masney e748e2801a staging: iio: isl29018: add documentation about the infrared suppression
Add documentation from the ISL29018 Data Sheet (FN6619.4, Oct 8, 2012)
about the infrared suppression that can be controlled
with the proximity_on_chip_ambient_infrared_suppression sysfs attribute.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11 19:40:26 +01:00
Sandhya Bankar 73d2ad96fd Staging: iio: meter: ade7758_core: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ attribute
wherein usage has some advantages like it can be accessed by in-kernel
consumers as well as reduces the code size.

Hence moving functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ handlers. Also Adding ade7758_read_raw() and
ade7758_write_raw() to allow reading/writing the element as well.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11 19:40:25 +01:00
Eva Rachel Retuya a13e831fca staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQ
This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.

Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the
sampling_frequency attribute instead of using IIO_DEV_ATTR_SAMP_FREQ()
macro.

Move code from the functions associated with IIO_DEV_ATTR_SAMP_FREQ()
into respective read and write hooks with the mask set to
IIO_CHAN_INFO_SAMP_FREQ.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11 19:39:38 +01:00
Eva Rachel Retuya 4a5936dac5 staging: iio: ad7606: implement IIO_CHAN_INFO_OVERSAMPLING_RATIO
This driver predates the availability of IIO_CHAN_INFO_OVERSAMPLING_RATIO
attribute wherein usage has some advantages like it can be accessed by
in-kernel consumers as well as reduces the code size.

Therefore, use IIO_CHAN_INFO_OVERSAMPLING_RATIO to implement the
oversampling_ratio attribute instead of using IIO_DEVICE_ATTR() macro.

Move code from the functions associated with IIO_DEVICE_ATTR() into
the read_raw hook as well as add the write_raw hook with both masks set
to IIO_CHAN_INFO_OVERSAMPLING_RATIO.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-08 17:44:32 +01:00
Eva Rachel Retuya b321a38d24 staging: iio: ad7606: fix improper setting of oversampling pins
The oversampling ratio is controlled using the oversampling pins,
OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control
bit.

The gpio connected to the OS2 pin is not being set correctly, only OS0
and OS1 pins are being set. Fix the typo to allow proper control of the
oversampling pins.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Fixes: b9618c0 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4")
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-08 17:42:34 +01:00
Bhumika Goyal 23123cd8d3 Staging: iio: ad7150: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   3561	   1152	      8	   4721	   1271	drivers/staging/iio/cdc/ad7150.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   3625	   1088	      8	   4721	   1271	drivers/staging/iio/cdc/ad7150.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03 21:08:09 +01:00
Bhumika Goyal f0c816161c Staging: iio: addac: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
  11013	   6096	      0	  17109	   42d5
drivers/staging/iio/addac/adt7316.o

File size after:
   text	   data	    bss	    dec	    hex	filename
  11141	   5968	      0	  17109	   42d5
drivers/staging/iio/addac/adt7316.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03 21:07:24 +01:00
Bhumika Goyal 0fa90023f2 Staging: iio: ad7816: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   3295	    768	      0	   4063	    fdf	drivers/staging/iio/adc/ad7816.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   3359	    736	      0	   4095	    fff	drivers/staging/iio/adc/ad7816.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03 21:06:04 +01:00
Bhumika Goyal e0e1bec855 Staging: iio: ad7280a: constify attribute_group structures
Check for attribute_group structures that are only stored in the
event_attrs filed of iio_info structure. As the event_attrs field
of iio_info structures is constant, so these attribute_group
structures can also be declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.event_attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   6271	    672	    776	   7719	   1e27
drivers/staging/iio/adc/ad7280a.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   6335	    608	    776	   7719	   1e27
drivers/staging/iio/adc/ad7280a.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03 21:03:43 +01:00
Anchal Jain 6d01a4d3fb staging: iio: cdc: ad7152: Add blank line after declarations to increase readability
Add a blank line after the function to increase the readability of the code.

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-03 20:31:44 +01:00
Brian Masney 0005356638 staging: iio: isl29018: check if the chip is in a suspended state
Add a check to isl29018_write_raw() to ensure that the chip is not in a
suspended state. This makes the code consistent with what is present
in isl29018_read_raw().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01 14:57:04 +01:00
Brian Masney 5611cd6fc6 staging: iio: isl29018: change isl29018_read_raw() to only have one exit point
When the chip is in a suspended state, isl29018_read_raw() will return
-EBUSY. Change the function so that it only has a single exit point.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01 14:55:34 +01:00
Brian Masney 5faf98cb31 staging: iio: isl29018: fixed race condition in in_illuminance_scale_available_show()
in_illuminance_scale_available_show() references the
isl29018_chip->int_time variable in three places inside a for loop.
The value of the int_time variable can be updated by the
isl29018_set_integration_time() function, which is called by the
isl29018_write_raw() function. isl29018_write_raw() locks a
mutex specific to this driver when the integration time variable is
updated.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01 14:53:51 +01:00
Brian Masney 028199660d staging: iio: isl29018: use IIO_DEVICE_ATTR_{RO, RW} macros
Use the IIO_DEVICE_ATTR_RO and IIO_DEVICE_ATTR_RW macros to
create the device attributes.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01 14:48:25 +01:00
Bhumika Goyal 1cb3576958 Staging:iio:light:tsl2583: constify attribute_group structures
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before: drivers/staging/iio/light/tsl2583.o
   text	   data	    bss	    dec	    hex	filename
   6529	   1052	      0	   7581	   1d9d
drivers/staging/iio/light/tsl2583.o

File size after: drivers/staging/iio/light/tsl2583.o
   text	   data	    bss	    dec	    hex	filename
   6593	    988	      0	   7581	   1d9d
drivers/staging/iio/light/tsl2583.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 21:08:49 +01:00
Bhumika Goyal d306ddbad1 Staging:iio:adc:ad7280a: constify attribute_group structures
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before: drivers/staging/iio/adc/ad7280a.o
   text	   data	    bss	    dec	    hex	filename
   6487	    584	    776	   7847	   1ea7
drivers/staging/iio/adc/ad7280a.o

File size after: drivers/staging/iio/adc/ad7280a.o
   text	   data	    bss	    dec	    hex	filename
   6551	    544	    776	   7871	   1ebf
drivers/staging/iio/adc/ad7280a.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 21:08:48 +01:00
Brian Masney ea908ab69e staging: iio: isl29018: fix comparison between signed and unsigned integers
Fixes warning found by make W=2:
warning: comparison between signed and unsigned integer expressions

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 21:08:47 +01:00
Brian Masney 528021fcd2 staging: iio: isl29018: made error handling consistent
Changed the processing of IIO_CHAN_INFO_INT_TIME in isl29018_write_raw()
to unlock the mutex and return at the end of the function if invalid
input is passed in. This makes the error handling code consistent with
the processing of IIO_CHAN_INFO_CALIBSCALE and IIO_CHAN_INFO_SCALE
within the same function.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 21:08:47 +01:00
Brian Masney 7fd1accc9f staging: iio: isl29018: remove unused variable and defines
Removes unused variable and associated #defines that was found using
make W=1.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 21:08:46 +01:00
Arnd Bergmann a1427af599 iio: accel: sca3000_core: avoid potentially uninitialized variable
The newly added __sca3000_get_base_freq function handles all valid
modes of the SCA3000_REG_ADDR_MODE register, but gcc notices
that any other value (i.e. 0x00) causes the base_freq variable to
not get initialized:

drivers/staging/iio/accel/sca3000_core.c: In function 'sca3000_write_raw':
drivers/staging/iio/accel/sca3000_core.c:527:23: error: 'base_freq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This adds explicit error handling for unexpected register values,
to ensure this cannot happen.

Fixes: e0f3fc9b47 ("iio: accel: sca3000_core: implemented IIO_CHAN_INFO_SAMP_FREQ")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-22 18:36:57 +01:00
Brian Masney d2a9334e7a staging: iio: isl29018: remove the FSF's mailing address
Address warning from checkpatch:

CHECK: Do not include the paragraph about writing to the Free Software
Foundation's mailing address from the sample GPL notice. The FSF has
changed addresses in the past, and may do so again. Linux already
includes a copy of the GPL.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:43:32 +02:00
Georgiana Rodica Chelu 748df3b1a4 staging: iio: meter: ade7754: Match alignment with open parenthesis
Reorganize the parameters to improve the readability of the code in
two manners:
- parameters of distinctive variable types on different lines
- parameters of similar variable types on the same line

Also, take advantage of the horizontal space available and place
all the parameters on a single line.

Issues found by checkpatch.pl script.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:43:32 +02:00
Georgiana Rodica Chelu 89237e06e2 staging: iio: meter: ade7758_ring: Match alignment with open parenthesis
Organize the parameters on a single line to improve the readability of
the code. Also, indent the line to match alignment with the open
parenthesis. Ensure that the modifications do not break the rule
of 80 characters per line.

Issues found by checkpatch.pl script.

Signed-off-by: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-20 13:43:32 +02:00
Katie Dunne a8886770dc staging: iio: ad5933: align arguments on new line with open parenthesis
Issue found by checkpatch: "Alignment should match open parenthesis."
Multiple lines are also reduced to a single line where possible.

Signed-off-by: Katie Dunne <kdunne@mail.ccsf.edu>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18 12:11:32 +01:00
Ico Doornekamp e0f3fc9b47 iio: accel: sca3000_core: implemented IIO_CHAN_INFO_SAMP_FREQ
Moved functionality from IIO_DEV_ATTR_SAMP_FREQ attribute into
IIO_CHAN_INFO_SAMP_FREQ handlers. Added sca3000_write_raw() to allow
writing the element as well.

Signed-off-by: Ico Doornekamp <ico@pruts.nl>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18 11:46:20 +01:00
Greg Kroah-Hartman 552edf8d79 Second set of iio new device support, features and cleanups for the 4.9 cycle.
New device support
 * ad8801 dac
   - new driver supporting ad8801 and ad8803 DACs.
 * adc12138
   - new driver supporting TI adc12130/adc12132 and adc12138 ADCs.
 * ltc2485 adc
   - new driver
 * mxc6255
   - add support for the mxc6225 part name and fixup the ID check so it works.
 * vz89x VOC sensor
   - add support for the vz89te part which drops the voc_short channel and adds
     CRCs compared to other supported parts.
 
 New features
 * core
   - immutable triggers.  These effectively grant exclusive control over a
     trigger. The typical usecase is a device representing an analog part
     (perhaps a MUX) that needs to control the sampling of a downstream
     ADC.
   - resource managed trigger registration and triggered_buffer_init.
   - iio_push_event now protected against case of the event interface
     registration not having yet occured.  Only matters if an interrupt
     can occur during this window - might happen on shared interrupt lines.
   - helper to let a driver query if the trigger it is using is provided by
     itself (using the convention of both device and trigger having the same
     parent).
 * tools
   - iio-utils. Used channel modifier scaling in preference to generic scaling
     when both exist.
 * at91-adc
   - Add support for touchscreen switches closure time needed by some newer
     parts.
 * stx104
   - support the ADC channels on this ADC/DAC board. As these are the primary
     feature of the board also move the driver to the iio/adc directory.
 * sx9500
   - device tree bindings.
 
 Cleanups / Fixes
 * ad5755
   - fix an off-by-one on devnr limit check (introduced earlier this cycle)
 * ad7266
   - drop NULL check on devm_regulator_get_optional as it can't return NULL.
 * ak8974
   - avoid an unused functional warning due to rework in PM core code.
   - remove .owner field setting as done by i2c_core.
 * ina2xx
   - clear out a left over debug field from chip global data.
 * hid-sensors
   - avoid an unused functional warning due to rework in PM core code.
 * maxim-thermocouple
   - fix non static symbol warnings.
 * ms5611
   - fetch and enable regulators unconditionally when they aren't optional.
 * sca3000
   - whitespace cleanup.
 * st_sensors
   - fetch and enable regulators unconditionally rather than having them
     supported as optional regulators (missunderstanding on my part amongst
     others a while back)
   - followup to previous patch fixes error checking on the regulators.
   - mark symbols static where possible.
   - use the 'is it my trigger' help function.  This prevents the odd case
     of another device triggering from the st-sensors trigger whilst the
     st-sensors trigger is itself not using it but rather using say an hrtimer.
 * ti-ads1015
   - add missing of_node_put.
 * vz89x
   - rework to all support of new devices.
   - prevent reading of a corrupted buffer.
   - fixup a return value of 0/1 in a bool returning function.
 
 Address updates
 - Vlad Dogaru email address change.
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJX1wW9ERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaII9UP
 /jXkXtaL62pvipMuEujmpR7j/A+GhmSWHhnbJ9XXeGZStGMUummTyaM+6WZoCKUH
 bMtZh/ETsn+FI7mD7P/FtwHauoxSmndcaAfB6cDKQMVakbXbz4VHrim256cY3gvq
 dzF5nYX+wDue6D7k55VPrtV1isBfipeCXKBtzBlAXaVE2FK2qKP+PIlAln8Ql5/l
 b5B3pvqu0YVED4t2MzyVWcVidPOEh9GgwHu7Ba+kjVi6zuB4w+r5ZreIObb5IR54
 FDcEwL6vV9AlmX15Pc18NO+50bZ8TvgT4y7ISqaOwszaIEoDAc0hXT7TdUOscmtt
 LIbhzHVMVkPSjxvtpz2ui8GfqzhxLi3ZzfNHRegOqH4b2Cpoh4zdwn7nCyJEHZV5
 simAL00FGjzp6B4Zp+Ly6ygKzpF3iXZce0Qjlr/ge+ioNIrfuK10sdLw8NZA5GUB
 JcFYijcFLUb0Cu/KjZ7njlfdAN9Tt94xzpnllM8+j4M50Nhbw05YNhIxB7RxmeSH
 Y44/oBLG51SgtlIg5Z4rULRAcOC5dty73Inb0n4lbN/pjgIcnh+EYtPeI2fA8vyB
 XYqr4xx+A3ZX1yKpYLYO+JYtVsVq9RGYdb501uBhEE3/GWEpxZvbyqHnPwwfM+Pf
 ZNuBceBxM3yyi4Z/lKkZnQbaF/1fFoG7FO1n6iRpb8Ci
 =V1xL
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of iio new device support, features and cleanups for the 4.9 cycle.

New device support
* ad8801 dac
  - new driver supporting ad8801 and ad8803 DACs.
* adc12138
  - new driver supporting TI adc12130/adc12132 and adc12138 ADCs.
* ltc2485 adc
  - new driver
* mxc6255
  - add support for the mxc6225 part name and fixup the ID check so it works.
* vz89x VOC sensor
  - add support for the vz89te part which drops the voc_short channel and adds
    CRCs compared to other supported parts.

New features
* core
  - immutable triggers.  These effectively grant exclusive control over a
    trigger. The typical usecase is a device representing an analog part
    (perhaps a MUX) that needs to control the sampling of a downstream
    ADC.
  - resource managed trigger registration and triggered_buffer_init.
  - iio_push_event now protected against case of the event interface
    registration not having yet occured.  Only matters if an interrupt
    can occur during this window - might happen on shared interrupt lines.
  - helper to let a driver query if the trigger it is using is provided by
    itself (using the convention of both device and trigger having the same
    parent).
* tools
  - iio-utils. Used channel modifier scaling in preference to generic scaling
    when both exist.
* at91-adc
  - Add support for touchscreen switches closure time needed by some newer
    parts.
* stx104
  - support the ADC channels on this ADC/DAC board. As these are the primary
    feature of the board also move the driver to the iio/adc directory.
* sx9500
  - device tree bindings.

Cleanups / Fixes
* ad5755
  - fix an off-by-one on devnr limit check (introduced earlier this cycle)
* ad7266
  - drop NULL check on devm_regulator_get_optional as it can't return NULL.
* ak8974
  - avoid an unused functional warning due to rework in PM core code.
  - remove .owner field setting as done by i2c_core.
* ina2xx
  - clear out a left over debug field from chip global data.
* hid-sensors
  - avoid an unused functional warning due to rework in PM core code.
* maxim-thermocouple
  - fix non static symbol warnings.
* ms5611
  - fetch and enable regulators unconditionally when they aren't optional.
* sca3000
  - whitespace cleanup.
* st_sensors
  - fetch and enable regulators unconditionally rather than having them
    supported as optional regulators (missunderstanding on my part amongst
    others a while back)
  - followup to previous patch fixes error checking on the regulators.
  - mark symbols static where possible.
  - use the 'is it my trigger' help function.  This prevents the odd case
    of another device triggering from the st-sensors trigger whilst the
    st-sensors trigger is itself not using it but rather using say an hrtimer.
* ti-ads1015
  - add missing of_node_put.
* vz89x
  - rework to all support of new devices.
  - prevent reading of a corrupted buffer.
  - fixup a return value of 0/1 in a bool returning function.

Address updates
- Vlad Dogaru email address change.
2016-09-14 20:42:03 +02:00
Greg Kroah-Hartman 9c2edd8b5b Merge 4.8-rc5 into staging-next
We want the staging fixes in here as well to handle merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-05 08:13:24 +02:00
Clifton Barnes a5211b0d06 staging: iio: accel: sca3000: remove extra space
fix checkpatch.pl warning about 'Statements should start on a
tabstop'

Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-29 16:29:08 +01:00
Greg Kroah-Hartman d5bd1eba19 First round of new features, device support and cleanups for IIO in the 4.9 cycle.
Device support
 
 * ak8974
   - New driver and bindings for this 2009 vintage magnetometer (it was very
     popular back then!)
 * atlas-ph-sensor
   -  ORP sensor support(I had to look up what one of these was)
 * cio-dac
   - New driver for Measurement Computing DAC boards
 * dmard06
   - New driver for Domintech DMARDO6 accelerometer. Also vendor prefix.
 * dmard09
   - New driver for Domintech DMARD09 accelerometer.
 * maxim-thermocouple
   - max6675 and max31855 new driver
 * mt6577 auxdac
   - new driver for this Mediatek chip mt2701, mt6577 and mt8173 have this
     hardware.
 * ti-adc161s626
   - new driver for this TI single channel differential ADC.
 * vcnl4000
   - support vcnl4010 and vcnl4020 which are compatible for all features
     currently supported by this driver.
 
 New features
 
 * Core
   - Allow retrieving of underlying iio_dev from a callback buffer handle.
     This is needed to allow client drivers to perform operations such as
     configuring the trigger used.
 * hid-sensors
   - asynchronous resume support to avoid really long resume times.
 * kxcjk-1013
   - add the mysterious KIOX000A ACPI id seen in the wild.
 * Tools
   - lsiio now enumerates processed as well as raw channels.
 
 Cleanup
 
 * ad7298
   - use iio_device_claim_direct_mode and friends to simplify locking around
     mode switching and drop some boilerplate.
 * ad7793
   - use iio_device_claim_direct_mode and friends to simplify locking around
     mode switching and drop some boilerplate.
 * ade7854
   - checkpatch fixups (alignment of parameters)
 * atlas-ph-sensor
   - use iio_device_claim_direct_mode and friends to simplify locking around
     mode switching and drop some boilerplate.
   - Switch to REGCACHE_NONE as there are no useful register to cache.
 * bma180
   - use iio_device_claim_direct_mode and friends to simplify locking around
     mode switching and drop some boilerplate.
 * hdc100x
   - Add mention of the HDC1000 and HDC1008 to the Kconfig help text.
 * isl29018
   - Add driver specific prefixes to defines and function names.
   - Remove excessive logging.
   - Drop newlines which add nothing to readability.
   - General tidying up of comments.
   - Drop I2C_CLASS_HWMON as irrelevant to driver.
 * isl29028
   - Add driver specific prefixes to defines, enums and function names.
   - Drop comma's from available attribute output as not ABI compliant.
   - Drop I2C_CLASS_HWMON as irrelevant to driver.
 * kxsd9
   - devicetree bindings.
 * mag3110
   - This one wasn't locking to protect against mode switches during
     raw_reads.  Use the iio_claim_direct_mode function to fix this buglet.
 * maxim-theromcouple
   - Fix missing selects for triggered buffer support in Kconfig.
 * nau7802
   - Use complete instead of complete_all as only one completion at a time.
 * sx9500
   - Use complete instead of complete_all as only one completion at a time.
 * us5182d
   - Add a missing error code asignment instead of checking the result of
     an already checked statement.
 * vcnl4000
   - Use BIT macro where appropriate.
   - Refactor return codes in read_raw callback.
   - Add some missing locking for concurrent accesses to the device.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIuBAABCAAYBQJXvMBjERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaInZAP
 /0yQg+tm9eBpjaVAdfV2ecuf0hVNdCjFg/7n5MLuSN1aDTPRn3O3nuwp8R8ARoe+
 7ctBFTIOJVqQpLYpunde1iJcOtEk2DIJEnxZQJjExOgn7AwIS4fgqSZQP7u5vDoT
 xrZe8nf5fcvMa1KIvWAadDNflYnn+Ug464Vt8tTdxL6XBIj0xcf8i62aS44XgGwS
 6boHXW0pVg1/QtvJmuajVCdxSouZyikDXWEpJx0UUlLmv2enF+KaJnKVwfbQ7rf/
 UG5ZhdOarbD4miXm8YC+x46v9FeWysatVpMu7Ch5LHrVVvBQCjIubcsZX/qH9cbS
 5VfV00NENHkNEnUL8luVAbLbwxLSq9pFy3LjJOzWmGlBQxT8X6uinA3XbZoqdouf
 5qu+TFUg1RDkL/6GSOsZ4EAGJfY7D9bCbQ0LQUaqPfcdAFZToE8ldLHapU1GtYjt
 Tj0xUxlzQ3fsRH6hTyhy2goAw0s88ruxcUpld8chCd2JWWD2OZJf7TzHGJ2GuuAj
 2yIYXjlVSKlM9yNCrFOyBrKxeg9n5eQI2f9KBiZZpNzxO2dFwaJkAiMF09sleTVv
 7O58g86ywrohp0eT/1sX6qYENJhZROPJGFMbYVHXhWwD1tqGs69zFVGa6ndL1i7w
 MXJ7c+1XjnaAuHEIPRyGZ6/Np27z6Jz0CpxGB4CyHseS
 =d6Kh
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-testing

Jonathan writes:

First round of new features, device support and cleanups for IIO in the 4.9 cycle.

Device support

* ak8974
  - New driver and bindings for this 2009 vintage magnetometer (it was very
    popular back then!)
* atlas-ph-sensor
  -  ORP sensor support(I had to look up what one of these was)
* cio-dac
  - New driver for Measurement Computing DAC boards
* dmard06
  - New driver for Domintech DMARDO6 accelerometer. Also vendor prefix.
* dmard09
  - New driver for Domintech DMARD09 accelerometer.
* maxim-thermocouple
  - max6675 and max31855 new driver
* mt6577 auxdac
  - new driver for this Mediatek chip mt2701, mt6577 and mt8173 have this
    hardware.
* ti-adc161s626
  - new driver for this TI single channel differential ADC.
* vcnl4000
  - support vcnl4010 and vcnl4020 which are compatible for all features
    currently supported by this driver.

New features

* Core
  - Allow retrieving of underlying iio_dev from a callback buffer handle.
    This is needed to allow client drivers to perform operations such as
    configuring the trigger used.
* hid-sensors
  - asynchronous resume support to avoid really long resume times.
* kxcjk-1013
  - add the mysterious KIOX000A ACPI id seen in the wild.
* Tools
  - lsiio now enumerates processed as well as raw channels.

Cleanup

* ad7298
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
* ad7793
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
* ade7854
  - checkpatch fixups (alignment of parameters)
* atlas-ph-sensor
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
  - Switch to REGCACHE_NONE as there are no useful register to cache.
* bma180
  - use iio_device_claim_direct_mode and friends to simplify locking around
    mode switching and drop some boilerplate.
* hdc100x
  - Add mention of the HDC1000 and HDC1008 to the Kconfig help text.
* isl29018
  - Add driver specific prefixes to defines and function names.
  - Remove excessive logging.
  - Drop newlines which add nothing to readability.
  - General tidying up of comments.
  - Drop I2C_CLASS_HWMON as irrelevant to driver.
* isl29028
  - Add driver specific prefixes to defines, enums and function names.
  - Drop comma's from available attribute output as not ABI compliant.
  - Drop I2C_CLASS_HWMON as irrelevant to driver.
* kxsd9
  - devicetree bindings.
* mag3110
  - This one wasn't locking to protect against mode switches during
    raw_reads.  Use the iio_claim_direct_mode function to fix this buglet.
* maxim-theromcouple
  - Fix missing selects for triggered buffer support in Kconfig.
* nau7802
  - Use complete instead of complete_all as only one completion at a time.
* sx9500
  - Use complete instead of complete_all as only one completion at a time.
* us5182d
  - Add a missing error code asignment instead of checking the result of
    an already checked statement.
* vcnl4000
  - Use BIT macro where appropriate.
  - Refactor return codes in read_raw callback.
  - Add some missing locking for concurrent accesses to the device.
2016-08-23 17:50:16 -04:00
Johanna Abrahamsson d1682a9a7a staging: iio: ade7854: checkpatch fixes (alignment of parameters)
CHECK: Alignment should match open parenthesis

Signed-off-by: Johanna Abrahamsson <johanna@mjao.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-21 12:23:29 +01:00
Phil Turnbull 776b645315 staging: iio: ad5933: Return correct value for AD5933_OUT_RANGE.
The 'break' statement after calling ad5933_cmd only breaks out of the
'for' loop, which then unconditionally sets the return value to -EINVAL.
Move the initialisation of 'ret' so we return the correct value.

Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 15:39:04 +01:00
Alison Schofield b75b23bc59 staging: iio: light: isl29018/28: remove I2C_CLASS_HWMON .class setting
I2C_CLASS_HWMON is for a hardware monitoring chip wanting
auto-detection.  IIO drivers don't typically use .class.
Remove it.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-24 19:58:40 +01:00
Greg Kroah-Hartman 6c71ee3b61 Third set of IIO new device support, features and cleanups for the 4.8 cycle.
New core features
 - Selection of the clock source for IIO timestamps.  This is done per device
   as it makes little sense to have events in one timebase and data timestamped
   on another.  Biggest reason for this is that we currently use a clock
   source which is non monotonic which can result in 'interesting' data sets.
   (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
    in an earlier version.)
 - MAINTAINERS add the git tree to the list for IIO.
 
 New device support + a kind of indirect staging graduation.
 * Broadcom iproc-static-adc
   - new driver
 * mcp4531
   - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
 * mpu6050
   - support the IC20608 6 axis motion tracking device
 * st-sensors
   - support the lis3l02dq + drop the lis3l02dq driver from staging.
   The general purpose driver is missing event support, but good to get
   rid of this driver which was rather long in the tooth.
 
 New driver features
 * ak8975
   - Add vid regulator support and refactor handling in general.
   - Allow a delay after enabling regulators.
   - Runtime and system PM.
 * bmg160
   - filter frequency control support.
 * bmp280
   - SPI device support.
   - EOC interrupt support for the BMP085
   - power management support.
   - supply regulator support.
   - reset gpio support
   - dt bindings for reset gpio and regulators.
   - of table to support device tree registration
 * max1363
   - Device tree bindings.
 * mcp4531
   - Device tree bindings.
 * st-pressure
   - temperature channels as part of triggered buffer (previously not due
   probably to alignment issues - see below).
   - lps22hb open drain interrupt support.
   - lps22hb temperature channel support
 
 Cleanups and reworkings.
 * numerous ADC drivers
   - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
   as to allow client bindings to find the device.
 * ak8975
   - Fix incorrect handling of missing regulator
   - make sure power is down and remove.
 * bmp280
   - read the calibration data only once as it doesn't change.
 * isl29125
   - Use a few macros to make code a touch more readable.
 * mma8452
   - fix a memory leak on error.
   - drop an unecessary bit of return value handling.
 * potentiometer kconfig
   - typo fix.
 * st-pressure
   - drop some uninformative default assignments of elements of the channel
   array structure (aids readability).
 * st-sensors
   - Harden interrupt handling considerably.  These are actually all using
   level interrupts, but at least two known boards have them wired to
   edge only interrupt chips.  Hence a slightly interesting bit of handling
   is needed in which we first allow for the easy option (level triggered) and
   secondly check the status registers before reenabling edge interrupts and
   fall back to a tight loop in the thread until we successfully clear the
   interrupt.  No harm is done if we never succeed in doing so.  It's an odd
   patch that has been through a lot of revisions to reach a consensus on how
   to handle what is basically broken hardware (which the previous defaults
   allowed to kind of work).
   - Fix alignment to defined storagebytes boundaries.
   - Ensure alignment of power of 2 byte boundaries.  This has always in theory
   been part of the ABI of IIO, but we missed a few that snuck in that need
   fixing.  The effect was minor as they were only followed by timestamp
   channels which were correctly aligned,
   - Add some docs to explain the gain calculations.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIuBAABCAAYBQJXfBqnERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIqjwP
 /0OJbr8kIa1i6+iCqCRCPCixdymd6k9wvjDaKSQoDeamen+8iKOLZNhXJJjOX8hd
 eCRMrCJbvY96Bl2Ll51TCEBb8R1xppCwwYIYylKhF9CL6N2ndapzWY0G4XZb6pc0
 e1JIa6uxynAAEsfplBskk4Ytf5PPHDOWER5WsTmxlZcTTAL9gLxIlii2Du0AmeN/
 tANVzwuvK07i5HHuZfYV2h2+OWDSlm4Y5rvE7t8keWpp6wnZ0XtiIw1WjkpR1OY7
 KiKGKRJMomFlp51hP9IKqc20Dweiaf3lHS7BDggvkB11VxyajQTcjvogxQ0BSPUv
 7PTHHlk8txgEUMqrDWP8x0TL97iNt3hiOZ0/rI3IZdFLC8pnibewnB+uHEGCH3tv
 bqToPtpJHjsIiGlCGVxvt8BRgqT5Qq7JT65hYS6774uFcQiPEvPDI44BDqUxaDUf
 /1WFM23VB4KJpx8JnL+nC8iu6DBnVPDWDKAsjGgc+ljnz3VRcSxWz5P0yMFZRMA2
 mbLiG2yiD4oD/LcI8FeZh9X50Irg09ElAWu07VRymrYMRfCYLXO07o5nZJ0bOqOB
 R+1MToYaHz2g6jJ+KGVC0Ul5EuULzymqH0CMbdjWnaD9AaoPuOKkNfUVBkzRK0t/
 TO/wLHm/qNbk+zGZHQFU15mH1Nn9leEJ/uCdnGqkRo7i
 =FxNN
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Third set of IIO new device support, features and cleanups for the 4.8 cycle.

New core features
- Selection of the clock source for IIO timestamps.  This is done per device
  as it makes little sense to have events in one timebase and data timestamped
  on another.  Biggest reason for this is that we currently use a clock
  source which is non monotonic which can result in 'interesting' data sets.
  (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
   in an earlier version.)
- MAINTAINERS add the git tree to the list for IIO.

New device support + a kind of indirect staging graduation.
* Broadcom iproc-static-adc
  - new driver
* mcp4531
  - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
* mpu6050
  - support the IC20608 6 axis motion tracking device
* st-sensors
  - support the lis3l02dq + drop the lis3l02dq driver from staging.
  The general purpose driver is missing event support, but good to get
  rid of this driver which was rather long in the tooth.

New driver features
* ak8975
  - Add vid regulator support and refactor handling in general.
  - Allow a delay after enabling regulators.
  - Runtime and system PM.
* bmg160
  - filter frequency control support.
* bmp280
  - SPI device support.
  - EOC interrupt support for the BMP085
  - power management support.
  - supply regulator support.
  - reset gpio support
  - dt bindings for reset gpio and regulators.
  - of table to support device tree registration
* max1363
  - Device tree bindings.
* mcp4531
  - Device tree bindings.
* st-pressure
  - temperature channels as part of triggered buffer (previously not due
  probably to alignment issues - see below).
  - lps22hb open drain interrupt support.
  - lps22hb temperature channel support

Cleanups and reworkings.
* numerous ADC drivers
  - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
  as to allow client bindings to find the device.
* ak8975
  - Fix incorrect handling of missing regulator
  - make sure power is down and remove.
* bmp280
  - read the calibration data only once as it doesn't change.
* isl29125
  - Use a few macros to make code a touch more readable.
* mma8452
  - fix a memory leak on error.
  - drop an unecessary bit of return value handling.
* potentiometer kconfig
  - typo fix.
* st-pressure
  - drop some uninformative default assignments of elements of the channel
  array structure (aids readability).
* st-sensors
  - Harden interrupt handling considerably.  These are actually all using
  level interrupts, but at least two known boards have them wired to
  edge only interrupt chips.  Hence a slightly interesting bit of handling
  is needed in which we first allow for the easy option (level triggered) and
  secondly check the status registers before reenabling edge interrupts and
  fall back to a tight loop in the thread until we successfully clear the
  interrupt.  No harm is done if we never succeed in doing so.  It's an odd
  patch that has been through a lot of revisions to reach a consensus on how
  to handle what is basically broken hardware (which the previous defaults
  allowed to kind of work).
  - Fix alignment to defined storagebytes boundaries.
  - Ensure alignment of power of 2 byte boundaries.  This has always in theory
  been part of the ABI of IIO, but we missed a few that snuck in that need
  fixing.  The effect was minor as they were only followed by timestamp
  channels which were correctly aligned,
  - Add some docs to explain the gain calculations.
2016-07-14 12:05:29 +09:00
Peter Meerwald-Stadler f612770432 staging: iio: isl29028: Prefix functions
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:51:12 +01:00