1
0
Fork 0
Commit Graph

2319 Commits (bf290f8f98b1a22fe131fa517ef66efb846cf849)

Author SHA1 Message Date
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
Peter Meerwald-Stadler b9b689c127 staging: iio: isl29028: Expose scale and sample frequency available without comma
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:50:28 +01:00
Peter Meerwald-Stadler bafaa6debe staging: iio: isl29028: Prefix stuff
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:49:56 +01:00
Peter Meerwald-Stadler 3a37f1c259 staging: iio: isl29028: Prefix #defines
and drop unused PROX_DRIVE

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:49:27 +01:00
Peter Meerwald-Stadler 9219376d04 staging: iio: isl29018: Prefix remaining functions
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:49:21 +01:00
Peter Meerwald-Stadler 96273f43a8 staging: iio: isl29018: Cleanup of comments
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:48:40 +01:00
Peter Meerwald-Stadler c833c6926a staging: iio: isl29018: Drop newlines
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:48:38 +01:00
Peter Meerwald-Stadler ab5b9492c0 staging: iio: isl29018: Remove excessive output messages
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:48:35 +01:00
Peter Meerwald-Stadler 13e6d634c1 staging: iio: isl29018: Prefix #defines
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-10 14:48:29 +01:00
Jonathan Cameron fc6bd7275b staging:iio:lis3l02dq drop separate driver
Retire this venerable driver as the basic support is now in the
generic st-sensors accelerometer driver.

There are a few missing features in the new driver:
* Threshold events.
* Access to the calibration adjustment registers (patch shortly)

In exchange it brings a cleaner and more maintainable code base that actually
gets tested more than once every few years.  I'll actually be suprised
if anyone other than me has a board with one of these on that is running
an up to date kernel.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04 18:07:45 +01:00
Greg Kroah-Hartman 7813029a50 Merge 4.7-rc6 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-04 08:15:03 -07:00
Gregor Boirie bc2b7dab62 iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30 19:41:38 +01:00
Luis de Bethencourt aea7b1dc2b staging: iio: accel: add error check
Go to error_ret if sca3000_read_ctrl_reg() failed.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-27 20:59:10 +01:00
Luis de Bethencourt ef3149eb3d staging: iio: accel: fix error check
sca3000_read_ctrl_reg() returns a negative number on failure, check for
this instead of zero.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-26 15:57:02 +01:00
Luis de Bethencourt f4070a1914 staging: iio: ad5933: fix order of cycle conditions
Correctly handle the settling time cycles value. The else branch is an
impossible condition, > 1022 in the else branch of > 511. Flipping the order.

Based on the Table 13 at the bottom of Page 25 of the Data Sheet:
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-11 18:37:13 +01:00
Arnd Bergmann 7e982555d8 staging: iio: fix ad7606_spi regression
As pointed out by Geert Uytterhoeven, the patch was incorrect
and breaks the driver, which was fortunately pointed out by
this gcc warning:

drivers/staging/iio/adc/ad7606_spi.c: In function ‘ad7606_spi_read_block’:
drivers/staging/iio/adc/ad7606_spi.c:34: warning: ‘data’ is used uninitialized in this function

The effect of the patch is that the data is copied into
a random memory location (from the uninitialized pointer)
instead of being byteswapped in place.

This adds the initialization for the 'data' variable back
to restore the original behavior.

Cc: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Fixes: 87787e5ef7 ("Staging: iio: Fix sparse endian warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-11 17:56:53 +01:00
Lars-Peter Clausen 87a048ef95 staging:iio:adis16240: Set self_test_no_autoclear flag
The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:43:47 +01:00
Lars-Peter Clausen 5d116edd71 staging:iio:adis16209: Set self_test_no_autoclear flag
The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:43:45 +01:00
Lars-Peter Clausen 26d96e8ea9 staging:iio:adis16203: Set self_test_no_autoclear flag
The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:43:43 +01:00
Lars-Peter Clausen 2441049286 staging:iio:adis16201: Set self_test_no_autoclear flag
The ADIS16201 does not automatically clear the self test flag bit the self
test has been, so clear it manually. Otherwise we'll see a offset caused by
the self-test bias on the output values during normal operation.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:43:42 +01:00
Alison Schofield ff5c37e3ea staging: iio: ad7606: use iio_device_{claim|release}_direct_mode()
Replace the code that guarantees the device stays in direct mode with
iio_device_{claim|release}_direct_mode() which does same.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-10 14:58:52 +01:00
Greg Kroah-Hartman eb7bfed901 First round of IIO new device support, features and cleanups for the 4.7 cycle.
New core support
 * UV light modifier (for intensity)
 * UV light index channel type.
 
 New device support
 * hp206c barometer and altimeter
   - new driver.
 * mcp4131 potentiometer
   - new driver supporting lots of parts from Microchip.
 * mma8452
   - FXLS8471Q support
 - NXP LPC18XX SOC ADC
   - new driver.
 - NXP LPC18XX SOC DAC
   - new driver.
 - rockchip_saradc
   - support rk3399
 * st accel
   - h3lis331dl support
 
 Staging driver removals
 * adis16204
   - obsolete part making it hard to get parts to test the driver in order
     to clean it up.
 * adis16220
   - obsolete part making it hard to get the parts test the driver in order
     to clean it up.
 
 Features
 * core
   - convenience functions to claim / release direct access to the device.
     Makes more consistent handling of this corner easier. Used in ad7192 driver.
 * ak8975
   - power regulator support.
 * at91-sama5d2
   - differential channel support.
 * mma8452
   - runtime pm support
   - drop device specific autosleep and use the runtime pm one instead.
 * ms5611
   - DT bindings
   - oversampling ratio support
 
 Cleanups and minor fixes
 * MAINTAINERS
   - Peter got married - hence name change!
 
 * Documentation
   - Fix a typo in in_proximity_raw description.
   - Add some missing docs for iio_buffer_access_funcs.
 
 * Tools
   - update iio_event_monitor names to match new stuff.
   - make generic_buffer look for triggers ending in -trigger as we let these in
   for a number of drivers a long time back and now it is a fairly common
   option.
 
 Drivers
 * staging wide
   - convert bare unsigned usage to unsigned int to comply with coding style.
 * non staging wide:
   - since boiler plate gpio handling of interrupts has been moved into the
    ACPI core we don't need to include gpio/consumer.h in a load of drivers so
    drop it.
 * ad7606
   - fix an endian casting sparse warning.
 * ak8975
   - fix a possible unitialized warning from gcc.
   - drop and unused field left over from earlier cleanups
   - fix a missing regulator_disable on exit.
 * at91-sama5d2
   - typo and indentation
   - missing IOMEM dependency.
   - cleanup mode register usage by avoidling erasing whole thing when changing
   the sampling frequency.
 * bmc150
   - use the core demux and available_scan_masks to simplify buffer handling
   - optimize the transfers in the trigger handler now we have a magic function
   to emulate bulk reads (under circumstances met here).  This matters with some
   rather dumb i2c adapters in particular.
   - use a single regmap_conf for all bus types as they were all the same.
 * bmg160
   - use the core demux and available_scan_masks to simplify the buffer handling
   - optimize the transfers in the trigger handler now we have a magic funciton
   to emulate bulk rads (under circumstances met here).
   - drop gpio interrupt probing from the driver (ACPI) as now handled by the
   ACPI core.
 * ina2xx-adc
   - update the CALIB register when RShunt changes.
   - fix scale for VShunt - in reality this error canceled out when used.
 * isl29028
   - use regmap to retrieve the struct device instead of carrying a second
   copy of it around.
 * kxcjk-1013
   - use core demux
   - optimize i2c transfers in the trigger handler.
 * mcp4531
   - refactor to use a pointer to access model parameters instead of indexing
     into the array each time.
 * mma8452
   - style fixes
   - avoid swtiching to active whenever the config changes
   - add missin i2c_device_id for mma8451
 * mpu6050
   - fix possible NULL dereference.
   - fix the name / chip_id used when ACPI used (otherwise reports as NULL).
 * ms5611
   - fix a missing regulator_disable that left the regulator on during removal.
 * mxc4005
   - drop gpio interrupt handling for ACPI case from driver as the core now
   handles this case.
 * st-sensors
   - note that there are only ever a maximum of 3 axis on current st-sensors
   so just allocate a fixed sized buffer big enough for that.
 * tpl0102
   - change the i2c_check_functionality condition to bring it inline with other
     IIO users as EOPNOTSUPP.
 * tsl2563
   - replace deprecated flush_scheduled_work
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXAYogAAoJEFSFNJnE9BaIhtsQAK9hsojCFC4EmcE0LdlC7A6r
 h/Any+ehurHSQIZmAZ1mn8QDBedf6Afpj+jl/qt/DADQk3e3u+TO1TbVHHUDB8Na
 ynvt1eibnUPAKxjbetUnPfOTaksp2GN8oScjPqk/3xmP1ip/uP3l2DM+jBOspW2K
 44UDpKE/aeulyCeG8wBHLY0ySuipQ8ZJyebETM3E94UrNdMHiuMyRA+SEbhcG+0T
 GyHYrlmPScFlk3xlhuYk7kS6gJQG0xg6u/qyuaBlQMKY1KXMGknU8sxSmqxRmCNn
 pJ3MeHZY6hFe3PNTgd30z+xbXN4JAifyUBHT2foRF86+f0BJSNIZJo/ynfCPli4z
 Rl+4M9NziYxw4V6osjKtPBquvk8UV6G/1tcgrr5pNFJor4dk6xRg/xCotYsqZuMX
 ypWOMuvkPQq+mqf68uJYlE++/A3xHP7aHdOlsXMgM8605KH1aSecbUP2dhRbHdRs
 u8XTt8Xj6uumQnxUnKjDZGIsDaxyw5JwarjhiNdJaCRgAgFw2qmNiFWYNkBaxxOt
 BheQBceoHLHDk/qTDsi0b5KDLqvArrbY8L6WBR+gW21isFpho5VDMgBSfNfdObGB
 nYaYTBcdx6sXm1SC1bMwVcgMnd3Bs4eWJRw79VFz/pFtTOc5Xpj4uVvnNCzuomqb
 MygKzQb48Gx23saBy4Za
 =SgQo
 -----END PGP SIGNATURE-----

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

Jonathan writes:

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

New core support
* UV light modifier (for intensity)
* UV light index channel type.

New device support
* hp206c barometer and altimeter
  - new driver.
* mcp4131 potentiometer
  - new driver supporting lots of parts from Microchip.
* mma8452
  - FXLS8471Q support
- NXP LPC18XX SOC ADC
  - new driver.
- NXP LPC18XX SOC DAC
  - new driver.
- rockchip_saradc
  - support rk3399
* st accel
  - h3lis331dl support

Staging driver removals
* adis16204
  - obsolete part making it hard to get parts to test the driver in order
    to clean it up.
* adis16220
  - obsolete part making it hard to get the parts test the driver in order
    to clean it up.

Features
* core
  - convenience functions to claim / release direct access to the device.
    Makes more consistent handling of this corner easier. Used in ad7192 driver.
* ak8975
  - power regulator support.
* at91-sama5d2
  - differential channel support.
* mma8452
  - runtime pm support
  - drop device specific autosleep and use the runtime pm one instead.
* ms5611
  - DT bindings
  - oversampling ratio support

Cleanups and minor fixes
* MAINTAINERS
  - Peter got married - hence name change!

* Documentation
  - Fix a typo in in_proximity_raw description.
  - Add some missing docs for iio_buffer_access_funcs.

* Tools
  - update iio_event_monitor names to match new stuff.
  - make generic_buffer look for triggers ending in -trigger as we let these in
  for a number of drivers a long time back and now it is a fairly common
  option.

Drivers
* staging wide
  - convert bare unsigned usage to unsigned int to comply with coding style.
* non staging wide:
  - since boiler plate gpio handling of interrupts has been moved into the
   ACPI core we don't need to include gpio/consumer.h in a load of drivers so
   drop it.
* ad7606
  - fix an endian casting sparse warning.
* ak8975
  - fix a possible unitialized warning from gcc.
  - drop and unused field left over from earlier cleanups
  - fix a missing regulator_disable on exit.
* at91-sama5d2
  - typo and indentation
  - missing IOMEM dependency.
  - cleanup mode register usage by avoidling erasing whole thing when changing
  the sampling frequency.
* bmc150
  - use the core demux and available_scan_masks to simplify buffer handling
  - optimize the transfers in the trigger handler now we have a magic function
  to emulate bulk reads (under circumstances met here).  This matters with some
  rather dumb i2c adapters in particular.
  - use a single regmap_conf for all bus types as they were all the same.
* bmg160
  - use the core demux and available_scan_masks to simplify the buffer handling
  - optimize the transfers in the trigger handler now we have a magic funciton
  to emulate bulk rads (under circumstances met here).
  - drop gpio interrupt probing from the driver (ACPI) as now handled by the
  ACPI core.
* ina2xx-adc
  - update the CALIB register when RShunt changes.
  - fix scale for VShunt - in reality this error canceled out when used.
* isl29028
  - use regmap to retrieve the struct device instead of carrying a second
  copy of it around.
* kxcjk-1013
  - use core demux
  - optimize i2c transfers in the trigger handler.
* mcp4531
  - refactor to use a pointer to access model parameters instead of indexing
    into the array each time.
* mma8452
  - style fixes
  - avoid swtiching to active whenever the config changes
  - add missin i2c_device_id for mma8451
* mpu6050
  - fix possible NULL dereference.
  - fix the name / chip_id used when ACPI used (otherwise reports as NULL).
* ms5611
  - fix a missing regulator_disable that left the regulator on during removal.
* mxc4005
  - drop gpio interrupt handling for ACPI case from driver as the core now
  handles this case.
* st-sensors
  - note that there are only ever a maximum of 3 axis on current st-sensors
  so just allocate a fixed sized buffer big enough for that.
* tpl0102
  - change the i2c_check_functionality condition to bring it inline with other
    IIO users as EOPNOTSUPP.
* tsl2563
  - replace deprecated flush_scheduled_work
2016-04-04 12:31:05 -07:00
Ksenija Stanojevic 6154a108fa Staging: iio: ad7606: Fix sparse endian warning
Fix following sparse warning:
warning: cast to restricted __be16

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:50 +01:00
Ksenija Stanojevic 87787e5ef7 Staging: iio: Fix sparse endian warning
Fix following sparse warning:
warning: cast to restricted __be16

Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik b075286912 staging: iio: accel: adis16240: Improve readability
Lines with #define interlaced with comment lines making a mess.

Separate groups of #define-comment with blank lines.
Separate section title comments with blank lines.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik 7da6ec4870 staging: iio: accel: adis16220: Improve readability
Lines with #define interlaced with comment lines making a mess.

Separate groups of #define-comment with blank lines.
Separate section title comments with blank lines.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik 328bdff8ec staging: iio: accel: adis16209: Improve readability
Lines with #define interlaced with comment lines making a mess.

Separate groups of #define-comment with blank lines.
Separate section title comments with blank lines.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik 0f5c42116e staging: iio: accel: adis16201: Fix 'line over 80 characters' warning
Many of the comments in the same lines with #define
caused checkpatch warning 'line over 80 characters'.

Move all such comments to line before #define.
This style is already used in some other .h files in accel:

Add blank lines after #define to improve readability.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik a48b2362dd staging: iio: accel: adis16203: Fix 'line over 80 characters' warning
Many of the comments in the same lines with #define
caused checkpatch warning 'line over 80 characters'.

Move all such comments to line before #define.
This style is already used in some other .h files in accel:

Add blank lines after #define to improve readability.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik 81da8a8913 staging: iio: accel: adis16204: Fix 'line over 80 characters' warning
Many of the comments in the same lines with #define
caused checkpatch warning 'line over 80 characters'.

Move all such comments to line before #define.
This style is already used in some other .h files in accel:

Add blank lines after #define to improve readability.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik 3261c31c7c staging: iio: accel: adis16240: Replace 'unsigned' with 'unsigned int'
Replace 'unsigned' with 'unsigned int' to avoid checkpatch warning.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Svetlana Orlik a5948d917c Staging: iio: ad9832: Replace 'unsigned' with 'unsigned int'
Replace 'unsigned' with 'unsigned int' to avoid checkpatch.pl warning.

Signed-off-by: Svetlana Orlik <sveta.orlik.code@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield a6634f8340 staging: iio: use kernel preferred block commenting style
Use * on subsequent lines and trailing */ on a separate
line in block comments.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 7df7ee9be9 Staging: iio: ad5933: Remove unnecessary space after cast.
Remove unnecessary space after cast.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 04e1f7b9b0 Staging: iio: ade7758: Fix open parentheses alignment issues.
Fix open parentheses alignment issues.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 93636775b9 Staging: iio: ade7758: Use a blank line after function/struct declarations.
Use a blank line after function/struct declarations.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 929d2691f2 Staging: iio: ade7758_core: Remove unnecessary blank line.
Remove unnecessary blank line.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Sandhya Bankar 0eea4ce3f4 Staging: iio: ade7758_core: Fix open parentheses alignment issues.
Fix open parentheses alignment issues.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield 5359ada246 staging: iio: ad5933: remove unused #includes
Remove #includes no longer used in this module.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield f5d82ad9bc staging: iio: ad5933: move contents of header file 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: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield e279ee89d3 staging: iio: io-trig-bfin-timer: use dev_get_platdata()
Use dev_get_platdata() for retrieving the platform data instead of
accessing dev->platform_data directly. Move the assignment out of
the declaration (avoid lines over 80 char and put it close to
usage).

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield 7b58e2402f staging: iio: ad5933: use dev_get_platdata()
Use dev_get_platdata() for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield 5e3d1d520f staging: iio: meter: remove fixme comment on device remove
This comment was in place in the original drafts of these drivers
when the remove function did a whole lot of work: flushed queues,
unregistered interrupts, uninitialized rings, unconfigured rings,
and a few kfree's.

The remove functions have since been reduced to unregistering and
stopping the device.  This is the inverse of what was done during
probe and is correct. Time to remove the comment.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Eva Rachel Retuya b026338289 staging: iio: tsl2x7x_core: add blank line after struct declaration
Add the missing blank line after struct declaration. Checkpatch found
this issue.

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Eva Rachel Retuya 95066a028b staging: iio: tsl2x7x_core: add spaces around operators
Address the checkpatch check by adding the necessary whitespace around
operators:

CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Eva Rachel Retuya 54a0cd3e57 staging: iio: tsl2x7x_core: remove space after a cast
Delete unneeded space after a cast as suggested by checkpatch.

CHECK: No space is necessary after a cast.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Eva Rachel Retuya 2cbc8b34ef staging: iio: tsl2x7x_core: use preferred comment style
Adjust block comments by adding the necessary trailing */ on a separate
line. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Eva Rachel Retuya 437ba274b5 staging: iio: tsl2x7x_core: adjust alignment to match open parenthesis
Align the parameters to match open parenthesis. Issue detected using
checkpatch.

CHECK: Alignment should match open parenthesis

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-28 07:30:36 -07:00
Alison Schofield 51fadb9857 staging: iio: convert bare unsigned usage to unsigned int
Use kernel preferred unsigned int declaration style.

Patch created using:
git ls-files drivers/staging/iio | \
xargs ./scripts/checkpatch.pl -f --fix-inplace --types=unspecified_int

Hand edits restored columns in structure definitions.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28 09:37:41 +01:00
Alison Schofield 722fc31663 staging: iio: isl29028: use regmap to retrieve struct device
Driver includes struct regmap and struct device in its global data.
Remove the struct device and use regmap API to retrieve device info.

Simplified version of Coccinelle semantic patch used:

@ a @
identifier drvdata, r;
position p;
@@
  struct drvdata@p {
  ...
  struct regmap *r;
  ...
  };

@ b @
identifier a.drvdata, d;
position a.p;
@@
  struct drvdata@p {
  ...
- struct device *d;
  ...
  };

@ passed depends on b @
identifier a.drvdata, a.r, b.d, i, f;
@@
  f (..., struct drvdata *i ,...) {
+ struct device *dev = regmap_get_device(i->r);
   <+...
-	   i->d
+	   dev
   ...+>
  }

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20 10:27:25 +00:00
Alison Schofield 1c118b7230 staging: iio: ad7192: use iio_device_{claim|release}_direct_mode()
Replace the code that guarantees the device stays in direct mode with
iio_device_{claim|release}_direct_mode() which does same.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-12 18:09:54 +00:00
Bhaktipriya Shridhar 09971adc33 staging: iio: addac: Remove unnecessary else after return
This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s1
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Georgiana Chelu 0d9363c5f7 Staging: iio: Fixed block comments warning
Fixed the following warning:
WARNING: Block comments use a trailing */ on a separate line

Signed-off-by: Georgiana Chelu <georgiana.chelu93@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 63ac41f5d8 Staging: iio: ade7854: Remove unnecessary goto.
Remove unnecessary goto.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 3949d9292a Staging: iio: ade7758_core: Remove unnecessary goto.
Remove unnecessary goto.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Sandhya Bankar 78731a01f4 Staging: iio: ade7754: Remove unnecessary goto.
Remove unnecessary goto.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Amitoj Kaur Chawla 09b9da3399 staging: iio: adc: Replace of_iomap() with devm_ioremap_resource()
The adc driver uses of_iomap() which doesn't request the resource and
isn't device managed so error handling is needed. of_iomap() is mainly
used in cases where there is no driver or struct device so a switch to
devm_ functions is required.

This patch switches to use devm_ioremap_resource() instead which
automatically requests the resource and is freed when the driver
detaches.

Removed the error handling to unmap I/O registers i.e.
iounmap() in probe and remove functions of this driver and
consequently removed an unnecessary label.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Alison Schofield a04b4e5005 staging: iio: ade7854: use devm_iio_device_register
Replace iio_device_register with the device managed version.
This change is safe because it does not change the order of
any device removal actions. Unregistering the device was the
only removal action. The newly emptied .remove functions are
deleted.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Alison Schofield 8f27f7323f staging: iio: adt7316: remove useless initialization
Remove the initialization of a variable that is immediately
reassigned.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Alison Schofield e3f9555202 staging: iio: light: tsl2x7x: remove useless initialization
Remove the initialization of a variable that is immediately
reassigned.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Lars-Peter Clausen 2bcdb3f2e0 staging:iio:adis16220: Remove adis16220 driver
The ADIS16220 part has been obsoleted, which makes it hard to get the
hardware to even test the driver. Considering this there is no expectation
that the driver will be cleaned up and be able to move out of staging, so
remove the driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-09 21:08:50 +00:00
Lars-Peter Clausen 88ae3aedb8 staging:iio:adis16204: Remove adis16204 driver
The ADIS16204 part has been obsoleted, which makes it hard to get the
hardware to even test the driver. Considering this there is no expectation
that the driver will be cleaned up and be able to move out of staging, so
remove the driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-09 21:06:02 +00:00
Greg Kroah-Hartman ec3c13e4ac Third set of IIO new device support, features and cleanups for the 4.6 cycle.
Good to see several new contributors in this set - and more generally a
 number of new 'faces' over this whole cycle.
 
 Staging movements
 * hmc5843
   - out of staging.
 * periodic RTC trigger
   - driver dropped.  This is an ancient driver (brings back some memories ;)
   that was always somewhat of a bodge. Originally there was a driver that
   never went into mainline that supported large numbers of periodict timers
   on the PXA270 via this route. Discussions to have a generic periodic
   timer subsystem never went anywhere.  At the time RTC periodic
   interrupts were real - now they are emulated using high resolution
   timers so with the HRT driver this has become pointless.
 
 New device support
 * mpu6050 driver
   - Add support for the mpu6500.
 * TI tpl0102 potentiometer
   - new driver.
 * Vybrid SoC DAC
   - new driver.  The ADC on this SoC has been supported for a while, this
     adds a separate driver for the DAC.
 
 New Features
 * hmc5844
   - Attributes to configure the bias current (typically part of a self test)
     This could be done before via a somewhat obscure custom interface.
     This at least makes it easy to tell what is going on.
   - Document all custom attributes.
 * mpu6050
   - Add support for calibration offset control and readback.
 * ms5611
   - power regulator support.  This is always one that gets added the
     first time someone has a board that needs it.  Here it was needed,
     hence it was added.
 
 Cleanups / minor fixes
 * tree wide
   - clean up all the myriad different return values in response to a
     failure of i2c_check_functionality.  After discussions everyone seemed
     happy wiht -EOPNOTSUPP which seems to describe the situation well.
     I encouraged a tree wide cleanup to set a good example in future for
     this.
 * core
   - Typos in the iio_event_spec documentation in iio.h
 * afe4403
   - select REGMAP_SPI to avoid dependency issues
   - mark suspend/resume as __maybe_unused to avoid warnings
 * afe4404
   - mark suspend/resume as __maybe_unused to avoid warnings
 * atlas-ph-sensor
   - switch the regmap cache type from linear to rbtree to gain reading of
     registers on initial startup.  It's not immediately obvious, but
     regmap flat is meant for high performances cases so doesn't read these
     registers.
   - use regmap_bulk_read in one case where it was using
     i2c_smbus_read_i2c_block_data directly (unlike everything else that was
     through regmap).
 * ina2xx
   - stype cleanups (lots of them!)
 * isl29018
   - Get the struct device back from regmap rather than storing another
     copy of it in the private data.  This cleanup makes sense in a number
     of other drivers so patches may well follow.
 * mpu6050
   - style cleanups (lots of them!)
   - improved return value handling
   - use usleep_range to avoid the usual issues with very short msleeps.
   - add some missing documentation.
 * ms5611
   - use the probed device name for the device rather than the driver name.
   - select IIO_BUFFER to avoid dependency issues
 * palmas
   - drop IRQF_EARLY_RESUME as no longer needed after genirq changes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJW0ygBAAoJEFSFNJnE9BaIJDQP/RpVwCxgxgUi0QyuLFAfQ0Ab
 FJFZznvmK6aGtGBAt/uKwBD5K/JcX9zGgm82j10+rVCtnLxFmusNXB180jUjvknu
 ZAEzJ58IWX+FqEsbVUZsx8qpef+yCCLP/HHvyctqXhtVTrlVlyoGSfn6+xzP3766
 PxkXpdWSd3IEdITYZrZo7BsZ6h6Tjz9c4i40f3RdnEce48nNnzM5IKMNbvU2puRs
 NxGDXflKKkA5N4uIW2n6pLxIyyW/LdwChmHkR+U7dxxj3/wUK9BC46qvhyqtgC3I
 U6uYCI+p2up22bfQsZ+p/CKRRhhrOtBs9//wSMapK96CVbI3HGcJLZP1yJENwfW8
 5sWEypaZNlpZVnjtREQpk5oz2hOsunxI+7FHSqUjLe+wwON79WXVFZz2qx3NcIle
 YPZFIQiYZTVauE/PsPy22I2vBoHxpgsD+A8M1d4+nQAH8SkRqvnnu5WVgd3ftm/u
 kXUjj+s+M1Pn84EIWYlEaIypAnhaNgIDW8M269rRdC0hH6yAxjJ9PXm45TGcRxr/
 qmkUKfD5wfPgE3FwYoyH8da22dc7dRSgLdizxtSS7rInmFH1HJ3xb566VszXsPVH
 tJjM2KtIC16czGUh5V+MmCpdSfOT1wR0wFPdUhGoJGm7sGkTsuoQRkQzgHwJM/aF
 ITuCZWLR/2YXw0bx4MKM
 =rDIQ
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.6c' 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.6 cycle.

Good to see several new contributors in this set - and more generally a
number of new 'faces' over this whole cycle.

Staging movements
* hmc5843
  - out of staging.
* periodic RTC trigger
  - driver dropped.  This is an ancient driver (brings back some memories ;)
  that was always somewhat of a bodge. Originally there was a driver that
  never went into mainline that supported large numbers of periodict timers
  on the PXA270 via this route. Discussions to have a generic periodic
  timer subsystem never went anywhere.  At the time RTC periodic
  interrupts were real - now they are emulated using high resolution
  timers so with the HRT driver this has become pointless.

New device support
* mpu6050 driver
  - Add support for the mpu6500.
* TI tpl0102 potentiometer
  - new driver.
* Vybrid SoC DAC
  - new driver.  The ADC on this SoC has been supported for a while, this
    adds a separate driver for the DAC.

New Features
* hmc5844
  - Attributes to configure the bias current (typically part of a self test)
    This could be done before via a somewhat obscure custom interface.
    This at least makes it easy to tell what is going on.
  - Document all custom attributes.
* mpu6050
  - Add support for calibration offset control and readback.
* ms5611
  - power regulator support.  This is always one that gets added the
    first time someone has a board that needs it.  Here it was needed,
    hence it was added.

Cleanups / minor fixes
* tree wide
  - clean up all the myriad different return values in response to a
    failure of i2c_check_functionality.  After discussions everyone seemed
    happy wiht -EOPNOTSUPP which seems to describe the situation well.
    I encouraged a tree wide cleanup to set a good example in future for
    this.
* core
  - Typos in the iio_event_spec documentation in iio.h
* afe4403
  - select REGMAP_SPI to avoid dependency issues
  - mark suspend/resume as __maybe_unused to avoid warnings
* afe4404
  - mark suspend/resume as __maybe_unused to avoid warnings
* atlas-ph-sensor
  - switch the regmap cache type from linear to rbtree to gain reading of
    registers on initial startup.  It's not immediately obvious, but
    regmap flat is meant for high performances cases so doesn't read these
    registers.
  - use regmap_bulk_read in one case where it was using
    i2c_smbus_read_i2c_block_data directly (unlike everything else that was
    through regmap).
* ina2xx
  - stype cleanups (lots of them!)
* isl29018
  - Get the struct device back from regmap rather than storing another
    copy of it in the private data.  This cleanup makes sense in a number
    of other drivers so patches may well follow.
* mpu6050
  - style cleanups (lots of them!)
  - improved return value handling
  - use usleep_range to avoid the usual issues with very short msleeps.
  - add some missing documentation.
* ms5611
  - use the probed device name for the device rather than the driver name.
  - select IIO_BUFFER to avoid dependency issues
* palmas
  - drop IRQF_EARLY_RESUME as no longer needed after genirq changes.
2016-03-01 16:31:55 -08:00
Lars-Peter Clausen c720842e36 staging:iio: Remove periodic RTC trigger driver
With the recently introduced hrtimer based trigger we have a fully
functional replacement for the RTC timer trigger that is more flexible and
has a better interface to instantiate and manage the trigger instances. The
RTC trigger timer could only be instantiated using platform devices which
makes it unsuitable for modern devicetree based platforms, while the
hrtimer trigger has a configfs based interface that allows creating and
deletion of triggers at runtime.

In addition since a few years the periodic RTC timer is internally always
emulated using a hrtimer using the hrtimer interface directly will yield
the same timing precision. So using the RTC timer won't have any advantages
on this front either.

There is also no evidence that the periodic RTC trigger is currently
actually being used on any system. So considering all this remove the
driver. Also remove the related item from the TODO list.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27 17:18:38 +00:00
Alison Schofield 646708693e staging: iio: isl29018: use regmap to retrieve struct device
Remove struct device from drivers global data and use regmap
API to retrieve device info instead.

This replacement can be done for drivers that include regmap
in their global data.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 21:15:24 +00:00
Cristina Moraru 7247645f68 iio: hmc5843: Move hmc5843 out of staging
This patch moves hmc5843 driver from staging/iio/magnetometer
to iio/magnetometer, updates the corresponding Makefiles and
moves the hmc5843* entries to the 'Industrial I/O support ->
Magnetometer sensors' menu.

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:39 +00:00
Cristina Moraru 1c7be4c260 iio: hmc5843: Add attributes for measurement config of bias current
Change static attribute meas_conf for bias current configuration
to channel attribute in_magn_meas_conf and also add
in_magn_meas_conf_available attribute to view available configurations.

This patch solves functionality bug: driver was using same function
hmc5843_set_measurement_configuration for setting bias current config
for all device types but the function was returning -EINVAL for any
setting >= 0x03 although, for sensor HMC5983, value 3 is valid.

API for setting bias measurement configuration:

normal - 	Normal measurement configuration (default):
		In normal measurement configuration the device
		follows normal measurement flow. Pins BP and BN
		are left floating and high impedance.

positivebias - 	Positive bias configuration: In positive bias
		configuration, a positive current is forced across
		the resistive load on pins BP and BN.

negativebias - 	Negative bias configuration. In negative bias
		configuration, a negative current is forced across
		the resistive load on pins BP and BN.

disabled     - 	Only available on HMC5983. Magnetic sensor is disabled.
		Temperature sensor is enabled.

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-21 20:22:21 +00:00
Eva Rachel Retuya b5b6e7beb0 staging: iio: resolver: fix comparison to NULL
Remove comparison of spi->dev.platform_data to NULL by replacing it with
'!spi->dev.platform_data' as checkpatch suggested:

CHECK: Comparison to NULL could be written "!spi->dev.platform_data"

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya c7e426d1c5 staging: iio: resolver: remove unnecessary blank line
Delete the excess newline. Issue found by checkpatch.

CHECK: Please don't use multiple blank lines

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya c3f63dd6fe staging: iio: resolver: delete space after a cast
Delete unwanted whitespace after casting. Issue pointed out by
checkpatch.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya 84681c7c85 staging: iio: resolver: add missing braces on if-else statements
Add braces around the else clause to adhere to kernel coding style. This
clears the following checkpatch issue:

CHECK: braces {} should be used on all arms of this statement

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya 8d80ccbb1e staging: iio: resolver: use blank line after array declaration
Add a blank line after array declaration. This clears the checkpatch
check:

CHECK: Please use a blank line after function/struct/union/enum
declarations

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya cdd6dee0f1 staging: iio: resolver: add spaces around operators
Add spaces around operators to improve readability and to address the
checkpatch issue:

CHECK: spaces preferred around that '/' (ctx:VxV)

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya ae6394aaf1 staging: iio: resolver: align to match open parenthesis
Use a combination of tabs and spaces to align parameters to its
corresponding open parenthesis. Checkpatch found this issue.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:46:35 -08:00
Eva Rachel Retuya ddab4a02c4 staging: iio: light: fix multiple assignments in a single line
Rewrite the multiple assignments to clear checkpatch check:

CHECK: multiple assignments should be avoided

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:56 -08:00
Eva Rachel Retuya e537daa198 staging: iio: light: add space around '*"
Address checkpatch check pointing out the lack of space around the
operator '*'.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:56 -08:00
Eva Rachel Retuya 7f3829a354 staging: iio: light: fix block comments according to kernel coding style
Add the trailing */ accordingly to suit the preferred way of placing
block comments.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:56 -08:00
Eva Rachel Retuya 79783b31d5 staging: iio: light: omit space after a cast
Remove the unneeded space as pointed out by checkpatch:
CHECK: No space is necessary after a cast

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:56 -08:00
Eva Rachel Retuya ca52c88cac staging: iio: light: indent to match open parenthesis
Indent the parameters to match open parenthesis as suggested by checkpatch.

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:56 -08:00
Janani Ravichandran 911568be45 staging: iio: accel: Remove unnecessary else after goto in if block
This patch removes the unnecessary else following an if block with a
goto statement.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:45:05 -08:00
Amitoj Kaur Chawla 0fd736f9f4 staging: iio: adc: Remove unnecessary test from if conditions
Remove unnecessary test condition on ret variable which has been
previously tested and returns its value if the value is non zero.

This fixes the following smatch warnings:
drivers/staging/iio/adc/ad7816.c:299 ad7816_set_oti() warn: we tested
'ret' before and it was 'false'
drivers/staging/iio/adc/ad7816.c:306 ad7816_set_oti() warn: we tested
'ret' before and it was 'false'

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20 14:43:48 -08:00
Bhumika Goyal 343af6379e Staging: iio: magnetometer: remove exceptional & on function name
In this file,function names are otherwise used as pointers without &.
Found using coccinelle.
// <smpl>
@r@
identifier f;
@@

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

- &f
+ f
// </smpl>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:44:06 -08:00
Bhumika Goyal df27103469 Staging: iio: light: remove exceptional & on function name
In this file,function names are otherwise used as pointers without &.
Found using coccinelle.
// <smpl>
@r@
identifier f;
@@

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

- &f
+ f
// </smpl>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:44:06 -08:00
Bhumika Goyal 6d9b10c866 Staging: iio: light: remove exceptional & on function name
In this file,function names are otherwise used as pointers without &.
Found using coccinelle.
// <smpl>
@r@
identifier f;
@@

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

- &f
+ f
// </smpl>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-14 16:44:06 -08:00