History log of /drivers/staging/iio/impedance-analyzer/ad5933.c
Revision Date Author Comments
97fb3033128958457f77456dc677a64bce8d33ae 25-Sep-2014 Lars-Peter Clausen <lars@metafoo.de> staging:iio:ad5933: Drop "raw" from channel names

"raw" is the name of a channel property, but should not be part of the
channel name itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
4a53d3afa00b0b74b0e49b147902a41e55b2e715 25-Sep-2014 Lars-Peter Clausen <lars@metafoo.de> staging:iio:ad5933: Fix NULL pointer deref when enabling buffer

In older versions of the IIO framework it was possible to pass a
completely different set of channels to iio_buffer_register() as the one
that is assigned to the IIO device. Commit 959d2952d124 ("staging:iio: make
iio_sw_buffer_preenable much more general.") introduced a restriction that
requires that the set of channels that is passed to iio_buffer_register() is
a subset of the channels assigned to the IIO device as the IIO core will use
the list of channels that is assigned to the device to lookup a channel by
scan index in iio_compute_scan_bytes(). If it can not find the channel the
function will crash. This patch fixes the issue by making sure that the same
set of channels is assigned to the IIO device and passed to
iio_buffer_register().

Fixes the follow NULL pointer derefernce kernel crash:
Unable to handle kernel NULL pointer dereference at virtual address 00000016
pgd = d53d0000
[00000016] *pgd=1534e831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 1626 Comm: bash Not tainted 3.15.0-19969-g2a180eb-dirty #9545
task: d6c124c0 ti: d539a000 task.ti: d539a000
PC is at iio_compute_scan_bytes+0x34/0xa8
LR is at iio_compute_scan_bytes+0x34/0xa8
pc : [<c03052e4>] lr : [<c03052e4>] psr: 60070013
sp : d539beb8 ip : 00000001 fp : 00000000
r10: 00000002 r9 : 00000000 r8 : 00000001
r7 : 00000000 r6 : d6dc8800 r5 : d7571000 r4 : 00000002
r3 : d7571000 r2 : 00000044 r1 : 00000001 r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 18c5387d Table: 153d004a DAC: 00000015
Process bash (pid: 1626, stack limit = 0xd539a240)
Stack: (0xd539beb8 to 0xd539c000)
bea0: c02fc0e4 d7571000
bec0: d76c1640 d6dc8800 d757117c 00000000 d757112c c0305b04 d76c1690 d76c1640
bee0: d7571188 00000002 00000000 d7571000 d539a000 00000000 000dd1c8 c0305d54
bf00: d7571010 0160b868 00000002 c69d3900 d7573278 d7573308 c69d3900 c01ece90
bf20: 00000002 c0103fac c0103f6c d539bf88 00000002 c69d3b00 c69d3b0c c0103468
bf40: 00000000 00000000 d7694a00 00000002 000af408 d539bf88 c000dd84 c00b2f94
bf60: d7694a00 000af408 00000002 d7694a00 d7694a00 00000002 000af408 c000dd84
bf80: 00000000 c00b32d0 00000000 00000000 00000002 b6f1aa78 00000002 000af408
bfa0: 00000004 c000dc00 b6f1aa78 00000002 00000001 000af408 00000002 00000000
bfc0: b6f1aa78 00000002 000af408 00000004 be806a4c 000a6094 00000000 000dd1c8
bfe0: 00000000 be8069cc b6e8ab77 b6ec125c 40070010 00000001 22940489 154a5007
[<c03052e4>] (iio_compute_scan_bytes) from [<c0305b04>] (__iio_update_buffers+0x248/0x438)
[<c0305b04>] (__iio_update_buffers) from [<c0305d54>] (iio_buffer_store_enable+0x60/0x7c)
[<c0305d54>] (iio_buffer_store_enable) from [<c01ece90>] (dev_attr_store+0x18/0x24)
[<c01ece90>] (dev_attr_store) from [<c0103fac>] (sysfs_kf_write+0x40/0x4c)
[<c0103fac>] (sysfs_kf_write) from [<c0103468>] (kernfs_fop_write+0x110/0x154)
[<c0103468>] (kernfs_fop_write) from [<c00b2f94>] (vfs_write+0xd0/0x160)
[<c00b2f94>] (vfs_write) from [<c00b32d0>] (SyS_write+0x40/0x78)
[<c00b32d0>] (SyS_write) from [<c000dc00>] (ret_fast_syscall+0x0/0x30)
Code: ea00000e e1a01008 e1a00005 ebfff6fc (e5d0a016)

Fixes: 959d2952d124 ("staging:iio: make iio_sw_buffer_preenable much more general.")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
6822ee34ad57b29a3b44df2c2829910f03c34fa4 25-Sep-2014 Lars-Peter Clausen <lars@metafoo.de> staging:iio:ad5933: Drop "raw" from channel names

"raw" is the name of a channel property, but should not be part of the
channel name itself.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
824269c5868d2a7a26417e5ef3841a27d42c6139 25-Sep-2014 Lars-Peter Clausen <lars@metafoo.de> staging:iio:ad5933: Fix NULL pointer deref when enabling buffer

In older versions of the IIO framework it was possible to pass a
completely different set of channels to iio_buffer_register() as the one
that is assigned to the IIO device. Commit 959d2952d124 ("staging:iio: make
iio_sw_buffer_preenable much more general.") introduced a restriction that
requires that the set of channels that is passed to iio_buffer_register() is
a subset of the channels assigned to the IIO device as the IIO core will use
the list of channels that is assigned to the device to lookup a channel by
scan index in iio_compute_scan_bytes(). If it can not find the channel the
function will crash. This patch fixes the issue by making sure that the same
set of channels is assigned to the IIO device and passed to
iio_buffer_register().

Fixes the follow NULL pointer derefernce kernel crash:
Unable to handle kernel NULL pointer dereference at virtual address 00000016
pgd = d53d0000
[00000016] *pgd=1534e831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 1626 Comm: bash Not tainted 3.15.0-19969-g2a180eb-dirty #9545
task: d6c124c0 ti: d539a000 task.ti: d539a000
PC is at iio_compute_scan_bytes+0x34/0xa8
LR is at iio_compute_scan_bytes+0x34/0xa8
pc : [<c03052e4>] lr : [<c03052e4>] psr: 60070013
sp : d539beb8 ip : 00000001 fp : 00000000
r10: 00000002 r9 : 00000000 r8 : 00000001
r7 : 00000000 r6 : d6dc8800 r5 : d7571000 r4 : 00000002
r3 : d7571000 r2 : 00000044 r1 : 00000001 r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 18c5387d Table: 153d004a DAC: 00000015
Process bash (pid: 1626, stack limit = 0xd539a240)
Stack: (0xd539beb8 to 0xd539c000)
bea0: c02fc0e4 d7571000
bec0: d76c1640 d6dc8800 d757117c 00000000 d757112c c0305b04 d76c1690 d76c1640
bee0: d7571188 00000002 00000000 d7571000 d539a000 00000000 000dd1c8 c0305d54
bf00: d7571010 0160b868 00000002 c69d3900 d7573278 d7573308 c69d3900 c01ece90
bf20: 00000002 c0103fac c0103f6c d539bf88 00000002 c69d3b00 c69d3b0c c0103468
bf40: 00000000 00000000 d7694a00 00000002 000af408 d539bf88 c000dd84 c00b2f94
bf60: d7694a00 000af408 00000002 d7694a00 d7694a00 00000002 000af408 c000dd84
bf80: 00000000 c00b32d0 00000000 00000000 00000002 b6f1aa78 00000002 000af408
bfa0: 00000004 c000dc00 b6f1aa78 00000002 00000001 000af408 00000002 00000000
bfc0: b6f1aa78 00000002 000af408 00000004 be806a4c 000a6094 00000000 000dd1c8
bfe0: 00000000 be8069cc b6e8ab77 b6ec125c 40070010 00000001 22940489 154a5007
[<c03052e4>] (iio_compute_scan_bytes) from [<c0305b04>] (__iio_update_buffers+0x248/0x438)
[<c0305b04>] (__iio_update_buffers) from [<c0305d54>] (iio_buffer_store_enable+0x60/0x7c)
[<c0305d54>] (iio_buffer_store_enable) from [<c01ece90>] (dev_attr_store+0x18/0x24)
[<c01ece90>] (dev_attr_store) from [<c0103fac>] (sysfs_kf_write+0x40/0x4c)
[<c0103fac>] (sysfs_kf_write) from [<c0103468>] (kernfs_fop_write+0x110/0x154)
[<c0103468>] (kernfs_fop_write) from [<c00b2f94>] (vfs_write+0xd0/0x160)
[<c00b2f94>] (vfs_write) from [<c00b32d0>] (SyS_write+0x40/0x78)
[<c00b32d0>] (SyS_write) from [<c000dc00>] (ret_fast_syscall+0x0/0x30)
Code: ea00000e e1a01008 e1a00005 ebfff6fc (e5d0a016)

Fixes: 959d2952d124 ("staging:iio: make iio_sw_buffer_preenable much more general.")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
69869c01ff148ef22d0ea1adec27b4543789792b 19-Sep-2014 Catalina Mocanu <catalina.mocanu@gmail.com> staging: iio: impedance-analyzer: add blank line after declaration

This fixes the following checkpatch.pl warning:
WARNING: Missing a blank line after declarations.

Signed-off-by: Catalina Mocanu <catalina.mocanu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7ddebf54292052898dd0cf3925d113e3527608a7 25-Jul-2014 Teodora Baluta <teodora.baluta@intel.com> staging: iio: ad5933: fix sparse warnings

Fix the following sparse warnings:

CHECK drivers/staging/iio/impedance-analyzer/ad5933.c
drivers/staging/iio/impedance-analyzer/ad5933.c:241:17: warning:
incorrect type in assignment (different base types)
drivers/staging/iio/impedance-analyzer/ad5933.c:241:17: expected
unsigned int [unsigned] [usertype] d32
drivers/staging/iio/impedance-analyzer/ad5933.c:241:17: got
restricted __be32 [usertype] <noident>
drivers/staging/iio/impedance-analyzer/ad5933.c:263:13: warning:
incorrect type in assignment (different base types)
drivers/staging/iio/impedance-analyzer/ad5933.c:263:13: expected
unsigned short [unsigned] dat
drivers/staging/iio/impedance-analyzer/ad5933.c:263:13: got
restricted __be16 [usertype] <noident>
drivers/staging/iio/impedance-analyzer/ad5933.c:271:13: warning:
incorrect type in assignment (different base types)
drivers/staging/iio/impedance-analyzer/ad5933.c:271:13: expected
unsigned short [unsigned] [addressable] dat
drivers/staging/iio/impedance-analyzer/ad5933.c:271:13: got
restricted __be16 [usertype] <noident>
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:310:19: warning: cast to
restricted __be32
drivers/staging/iio/impedance-analyzer/ad5933.c:446:21: warning:
incorrect type in assignment (different base types)
drivers/staging/iio/impedance-analyzer/ad5933.c:446:21: expected
unsigned short [unsigned] dat
drivers/staging/iio/impedance-analyzer/ad5933.c:446:21: got
restricted __be16 [usertype] <noident>
drivers/staging/iio/impedance-analyzer/ad5933.c:454:21: warning:
incorrect type in assignment (different base types)
drivers/staging/iio/impedance-analyzer/ad5933.c:454:21: expected
unsigned short [unsigned] [addressable] dat
drivers/staging/iio/impedance-analyzer/ad5933.c:454:21: got
restricted __be16 [usertype] <noident>
drivers/staging/iio/impedance-analyzer/ad5933.c:548:23: warning: cast to
restricted __be16
drivers/staging/iio/impedance-analyzer/ad5933.c:548:23: warning: cast to
restricted __be16
drivers/staging/iio/impedance-analyzer/ad5933.c:548:23: warning: cast to
restricted __be16
drivers/staging/iio/impedance-analyzer/ad5933.c:548:23: warning: cast to
restricted __be16

Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e9ed104de68c345c9a827225e93c74c6894613a9 01-Jan-2014 Julia Lawall <Julia.Lawall@lip6.fr> staging:iio:impedance:ad5933: correct error check

iio_kfifo_allocate returns NULL in case of error.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
identifier f;
statement S1,S2;
@@

*x = f(...);
if (x) { <+... when != if (...) S1 else S2
-ENOMEM ...+> }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
cc: stable@vger.kernel.org
75b19bbf22842edb9f6bb037a5befa31132c032a 14-Oct-2013 Lars-Peter Clausen <lars@metafoo.de> staging:iio:ad5933: Remove redundant call to iio_sw_buffer_preenable()

The equivalent of iio_sw_buffer_preenable() is now done in the IIO buffer core,
so there is no need to do this from the driver anymore.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
9e69c935fad9fd5f0550c51e3bd251cd30033136 04-Oct-2013 Lars-Peter Clausen <lars@metafoo.de> iio: Add reference counting for buffers

Since the buffer is accessed by userspace we can not just free the buffers
memory once we are done with it in kernel space. There might still be open file
descriptors and userspace still might be accessing the buffer. This patch adds
support for reference counting to the IIO buffers. When a buffer is created and
initialized its initial reference count is set to 1. Instead of freeing the
memory of the buffer the buffer's _free() function will drop that reference
again. But only after the last reference to the buffer has been dropped the
buffer the buffer's memory will be freed. The IIO device will take a reference
to its primary buffer. The patch adds a small helper function for this called
iio_device_attach_buffer() which will get a reference to the buffer and assign
the buffer to the IIO device. This function must be used instead of assigning
the buffer to the device by hand. The reference is only dropped once the IIO
device is freed and we can be sure that there are no more open file handles. A
reference to a buffer will also be taken whenever the buffer is active to avoid
the buffer being freed while data is still being send to it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2432e1aeec80872db806b76476733036fcce55ee 15-Sep-2013 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Remove unnecessary casts for iio_push_to_buffers()

Now that iio_push_to_buffers() takes a void pointer for the data parameter we
can remove those casts to u8*.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e5e26dd5bb740c34c975e2ae059126ba3486a1ce 20-Aug-2013 Jingoo Han <jg1.han@samsung.com> staging: iio: replace strict_strto*() with kstrto*()

The usage of strict_strto*() is not preferred, because
strict_strto*() is obsolete. Thus, kstrto*() should be
used.

Previously, there were only strict_strtol(), strict_strtoul(),
strict_strtoull(), and strict_strtoll(). Thus, when converting
to the variables, only long, unsigned long, unsigned long long,
and long long can be used.

However, kstrto*() provides various functions handling all types
of variables. Therefore, the types of variables can be changed
properly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
53703a493347ff2b43a6988bb5fcfa602e7ce67e 05-Sep-2013 Sachin Kamat <sachin.kamat@linaro.org> staging: iio: ad5933: Use devm_* APIs

devm_* APIs are device managed and make code simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
da200c2b812dddcad0041622f519de18e1a53551 27-Feb-2013 Jonathan Cameron <jic23@kernel.org> staging:iio:impedance:ad5933 move to info_mask_(shared_by_type/separate)

The original info_mask is going away in favour of the broken out versions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
032658a446145b9e6af7f90521179a9e0111b546 30-Nov-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:impedance-analyzer switch from sw_ring to kfifo.

sw_ring buffer implementation is going away so switch to the
kfifo based alternative.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
e543acf07db78cfc135e45c4ce0ed26ccf774c37 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
447d4f29ee3fa62f13c65688bb7b74d5a9a0d767 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4ae1c61ff2ba4fea4e4c1a045cb1f34520608789 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> staging: iio: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
84b36ce5f79c01f792c623f14e92ed86cdccb42f 30-Jun-2012 Jonathan Cameron <jic23@kernel.org> staging:iio: Add support for multiple buffers

Route all buffer writes through the demux.
Addition or removal of a buffer results in tear down and
setup of all the buffers for a given device.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Tested-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
ce56ade6ae74e604a4b5d6ea5b1d58960fa8e7aa 04-Sep-2012 Lars-Peter Clausen <lars@metafoo.de> iio: Drop timestamp parameter from buffer store_to callback

Drop timestamp parameter from buffer store_to callback and subsequently from
iio_push_to_buffer. The timestamp parameter is unused and it seems likely that
it will stay unused in the future, so it should be safe to remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
00176b360ce44bcc5dea2bcd0c8ff5ba9309685f 04-Sep-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Use iio_push_to_buffer

Consistently use iio_push_to_buffer instead of manually calling the buffers
store_to callback.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
f4e4b9558bc696cc89de460e754d3fecb50b13cb 09-Aug-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Constify static iio_chan_spec arrays

The per driver iio_chan_spec arrays are usually shared between multiple device
instances. So a single device instance may not modify the iio_chan_spec array
since this would also affect the other device instances. To make this restriction
explicit mark the per driver iio_chan_spec arrays as const.

Conversion was done automatically using the following coccinelle semantic patch:

// <smpl>
@disable optional_qualifier@
identifier channels;
@@
static
+const
struct iio_chan_spec channels[] = ...;
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ba86dc46b80e6907b05dd1c7bc1e88f3dacde2dc 12-May-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio:impedance-analyzer: Use dev_to_iio_dev()

Replace open-coded instances of getting a iio_dev struct from a device struct
with dev_to_iio_dev().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7cbb753701d11f3c71e8543e1ae0fc0772edac06 26-Apr-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Streamline API function naming

Currently we use two different naming schemes in the IIO API, iio_verb_object
and iio_object_verb. E.g iio_device_register and iio_allocate_device. This
patches renames instances of the later to the former. The patch also renames allocate to
alloc as this seems to be the preferred form throughout the kernel.

In particular the following renames are performed by the patch:
iio_put_device -> iio_device_put
iio_allocate_device -> iio_device_alloc
iio_free_device -> iio_device_free
iio_get_trigger -> iio_trigger_get
iio_put_trigger -> iio_trigger_put
iio_allocate_trigger -> iio_trigger_alloc
iio_free_trigger -> iio_trigger_free

The conversion was done with the following coccinelle patch with manual fixes to
comments and documentation.

<smpl>
@@
@@
-iio_put_device
+iio_device_put
@@
@@
-iio_allocate_device
+iio_device_alloc
@@
@@
-iio_free_device
+iio_device_free
@@
@@
-iio_get_trigger
+iio_trigger_get
@@
@@
-iio_put_trigger
+iio_trigger_put
@@
@@
-iio_allocate_trigger
+iio_trigger_alloc
@@
@@
-iio_free_trigger
+iio_trigger_free
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
06458e277eac2b8761b0a04d3c808d57be281a2e 25-Apr-2012 Jonathan Cameron <jic23@kernel.org> IIO: Move core headers to include/linux/iio

Step 1 in moving the IIO core out of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f5ee7b807fc90756d6852690a3777db7093efe0d 21-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:impedance-analyser make use of iio_sw_buffer_preenable

This avoids some code duplication by using the generic form
in a non performance critical place.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
251640a74b086cb5b602870cdbaf72e6d3f1e714 15-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio: drop procesed_val element of chan_spec.

There is no longer any need for this as we have separate
info_mask elements for raw and processed value reads.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
967d3fe0dc84ac26380e8c9d916d90e1977a75d8 15-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:impedance Add IIO_CHAN_INFO_RAW/PROCESSED entries to all drivers.

Precursor to making value read / write attribute optional.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cdacc05bfa479997424fa9a3b54c07573b0ce4ed 13-Apr-2012 Jonathan Cameron <jic23@kernel.org> staging:iio:impedance-analyzer:ad5933 unwind use of IIO_CHAN macro.

This macro is being removed to simplify ongoing maintenance
so we need to unwind and remaining users.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7e632344adfe749749aa525f6fbe0ffc05ae3190 03-Jan-2012 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Setup buffer access functions when allocating the buffer

Setup the buffer access functions in the buffer allocate function. There is no
need to let each driver handle this on its own.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f79a9098902635c7a2bcaf3d83fb5ce90c2c961f 05-Dec-2011 Jonathan Cameron <jic23@kernel.org> staging:iio:buffer struct iio_buffer doesn't need an indio_dev pointer.

In all existing cases, the calls are coming from a location where
the indio_dev is already available.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
550268ca1111a5b4737f15f7bf646cede9d1f0cd 05-Dec-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: scrap scan_count and ensure all drivers use active_scan_mask

Obviously drivers should only use this for pushing to buffers.
They need buffer->scan_mask for pulling from them post demux.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1612244f8a70dae6a7f266e78c5ba22a3db75780 05-Dec-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:buffer move setup ops from buffer instance to iio_dev

These callbacks should not be buffer instance specific.
Hence move them out of the buffer.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c8a9f8056f40f6201b84fdddb49a1c62630902c5 26-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:treewide only use shared to decide on interfaces

Internally the fact that say scale is shared across channels is
actually of remarkably little interest. Hence lets not store it.
Numerous devices have weird combinations of channels sharing
scale anyway so it is not as though this was really telling
us much. Note however that we do still use the shared sysfs
attrs thus massively reducing the number of attrs in complex
drivers.

Side effect is that certain drivers that were abusing this
(mostly my work) needed to do a few more checks on what the
channel they are being queried on actually is.

This is also helpful for in kernel interfaces where we
just want to query the scale and don't care whether it
is shared with other channels or not.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
af5046af1c812839f085030f358a01814666fc80 26-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: header reorganization

Issue brought up by Lars-Peter Clausen. This is a varient of what
he suggested.

io/iio.h for driver stuff (has to include types.h)
Sub files for the bits drivers may or may not use
iio/sysfs.h
iio/buffer.h (contents of current buffer_generic.h)
(obviously anything offering events will need events.h as well)
iio/types.h for the enums that matter to both
iio_chan_type, iio_modifier
iio/events.h for the event code stuff
IIO_EVENT_CODE and friends. + everything in chrdev.h So this
is the stuff that userspace cares about.
Also include iio_event_type, iio_event_direction

Thus iio drivers include iio.h + as required
events.h
sysfs.h
buffer.h

in kernel users (once that interface is merged) will need inkern.h
which will pull in types.h

Userspace will need just events.h (which pulls in types.h) to get
everything they need to know about. Buffer userspace access doesn't
currently need any core defines. All information about the data
format is passed through sysfs.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
e15fbc91a4304a977ed99c3eb21bab7015e86c11 25-Oct-2011 Michael Hennerich <michael.hennerich@analog.com> iio: introduce type casts to avoid __ucmpdi2 calls

This patch type casts the switch control variable to 32 bits in order to
prevent a call __ucmpdi2 generated by some versions of gcc.

This fixes an undefined reference to `__ucmpdi2' when compiled for arch/blackfin

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6e5af184f810f6150e07339bd23a09c498739c82 16-Nov-2011 Lars-Peter Clausen <lars@metafoo.de> staging:iio: Use module_i2c_driver to register I2C drivers

Use the newly introduced module_i2c_driver macro for registering I2C drivers.
This allows us to remove a few lines of boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
d2fffd6c2fd60fe9ab63ef30758d9d43a5057549 14-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: fix removal path to allow correct freeing.

Fix a dumb lack of consideration of the effect of combining
the iio_device_unregister and iio_free_device calls into
one. There is no valid place to free some of the sysfs
array elements.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
638e59fc8c867b44dfbe20c235df00384814cb5e 06-Oct-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:dac/dds/impedance dev_info to indio_dev for consistency

We had a random missmatch of these two. Lets pick the most common
and get rid of the other.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>

For adxxxx parts
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
748b636c4020286f84362f4a3cfa65a96d5387a5 01-Oct-2011 Paul Gortmaker <paul.gortmaker@windriver.com> staging: add module.h to various iio drivers

Since they are assuming it is there implicitly and will fail otherwise
with things like:

drivers/staging/iio/impedance-analyzer/ad5933.c:816: warning: type
defaults to ‘int’ in declaration of ‘MODULE_AUTHOR’

drivers/staging/iio/adc/ad7280a.c:990: warning: type defaults to ‘int’
in declaration of ‘MODULE_AUTHOR’

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
6835cb6b438b77ba82ad5a23944bbfb12128f5db 27-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: unwind the IIO_IN -> IIO_VOLTAGE define

This was originally there to avoid churn during a complex change.
Now everything is stable lets get rid of this as it is missleading
and confusing.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14555b14455f9acbdf0e500ae96140828a970796 21-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: replacing term ring with buffer in the IIO core.

They aren't always ring buffers, so just use buffer for all naming.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
3811cd6291bb5a11c8d830831149d6369e7d3b68 21-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: rename ring_generic.h -> buffer_generic.h

Nothing in this file is specific to RING buffers so rename it.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ec3afa40c648ed17eb2a83a4b7249deab3631f61 21-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: tree wide IIO_RING_TRIGGERED -> IIO_BUFFER_TRIGGERED

also, IIO_RING_HARDWARE_BUFFER -> IIO_BUFFER_HARDWARE

These aren't always rings so the naming should not imply that.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
322c95636739420631e51f3d3f24132dc220762a 14-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:tree wide. abi fixup for in_ out_ prefix introduction.

This patch set should bring all the attributes created outside
of chan_spec registration inline with the new abi.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26d25ae3f0d8ffe350aacc75b71198d6b35bd1f4 02-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: rework of attribute registration.

This set also includes quite a number of bug fixes of particularly
remove functions.

Necessary due to issue pointed out in Bart Van Assche's patch:
docs/driver-model: Document device.groups

V2: Rebase due to patch reordering.
V3: Pull various error fixes and cleanups out into their own patches.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
32b5eecab0f2d6f66f2e237e161d58d5916f8b13 02-Sep-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio: Switch the channel masks to bitmaps so as to allow for more channels.

This is as light as possible on changes to current drivers.
Some drivers make assumptions that their masks fit in a single
long. Given they were previously working this is clearly valid if
not tidy.

The max1363 is an example where there should be no such assumptions.

V2: Add the new ad5933

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
c009f7e42617bd52b61a35de621cd1deda08042b 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging:iio:buffering cleanup ring_buffer_register_ex naming.

Now the old method is long gone, lets get rid of the _ex and whilst
here remove the unused id parameter.

Trivial mechanical change, but will break any out of tree drivers
using this.

V2: rebase
V3: rebase

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1aa042783251c27a93e31929c24647729db326d4 30-Aug-2011 Jonathan Cameron <jic23@cam.ac.uk> staging: iio: push the main buffer chrdev down to the top level.

Sorry all, this one is very invasive, though the driver changes are
just trivial interface fixes. Not all done yet.

V2 - bring the sca3000 with us.
V3 - fix ade7758 bugs in conversion.
V4 - add ad5933

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
f94aa354d676532448e8e222e737fdd0755fc786 02-Aug-2011 Michael Hennerich <michael.hennerich@analog.com> iio: impedance-analyzer: New driver for AD5933/4 Impedance Converter, Network Analyzer

The AD5933 is a high precision impedance converter system solution
that combines an on-board frequency generator with a 12-bit, 1 MSPS,
analog-to-digital converter (ADC). The frequency generator allows an
external complex impedance to be excited with a known frequency.

The response signal from the impedance is sampled by the on-board ADC
and a discrete Fourier transform (DFT) is processed by an on-chip DSP engine.
The DFT algorithm returns a real (R) and imaginary (I) data-word at each
output frequency.

Changes since V1:

Apply list review feedback:
Consistently use poll_time_jiffies.
Use be|le cpu endian helpers where applicable.
Add various comments.

Changes since V2:

Fix KernelVersion tag in Documentation.
Declare ad5933_default_pdata static.
Fix typos.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>