Commit Graph

1297 Commits

Author SHA1 Message Date
Lars-Peter Clausen f87f1a2375 staging:iio: Move ad7793 driver out of staging
The driver does not expose any custom API to userspace and none of the standard
static code checker tools report any issues, so move it out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:08 +00:00
Lars-Peter Clausen e786cc26dc staging:iio:ad7793: Implement stricter id checking
Instead of checking whether the id of the current device matches the id of any
device supported by the driver, check whether it matches the id of the device
which the driver was instantiated for. This makes sure that the driver is not
accidentally instantiated for the wrong device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:08 +00:00
Lars-Peter Clausen 891c8bcec1 staging:iio:ad7793: Move register definitions from header to source
The only user of the register definitions is the driver itself, so move them
from the header file to the driver source file. The header file now only
contains the platform data struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:08 +00:00
Lars-Peter Clausen dd2c101348 staging:iio:ad7793: Rework regulator handling
Rework the regulator handling of the driver to match more closely what we do in
other drivers. Make the regulator non-optional if a external reference is used.
Also dispose the option of specifying the reference voltage via platform data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:07 +00:00
Lars-Peter Clausen d21f30c99e staging:iio:ad7793: Rework platform data
Currently the platform data for the ad7793 consist just out of the raw default
register settings. This has some downsides, for one we actually don't want to
make all bits configurable and secondly not all register settings are actually
valid. This patch exposes all the options which should be configurable via
platform data as induvidual platform data struct fields. This also allows us to
document the different settings via proper kernel doc.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:07 +00:00
Lars-Peter Clausen fe2e0d5228 staging:iio:ad7793: Use kstrtol instead of strict_strtol
strict_strtol is deprecated in favor of kstrtol.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:07 +00:00
Lars-Peter Clausen 3e4334f2d6 staging:iio:ad7793: Use usleep_range instead of msleep
It is recommended to use usleep_range instead of msleep for durations smaller
than a 20ms.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:06 +00:00
Lars-Peter Clausen e4ac728363 staging:iio:ad7793: Fix temperature scale
The temperature scale was off by a factor of 1000.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:06 +00:00
Lars-Peter Clausen 24b27fa109 staging:iio:ad7793: Fix VDD monitor scale
The VDD monitor scale was off by a factor of 10.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-30 12:57:06 +00:00
Bill Pemberton e543acf07d 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>
2012-11-21 15:02:23 -08:00
Bill Pemberton 447d4f29ee 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>
2012-11-21 14:59:37 -08:00
Bill Pemberton 4ae1c61ff2 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>
2012-11-21 14:31:41 -08:00
Lars-Peter Clausen 709ab36e95 staging:iio: Move the ad7298 driver out of staging
The driver does not expose any custom API to userspace and none of the standard
static code checker tools report any issues, so move it out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:15 +00:00
Lars-Peter Clausen dc4871adf9 staging:iio:ad7298: Squash everything into one file
The recent cleanups have decimated the drivers code size by quite a bit. It is
only a few hundred lines in total now. Putting everything into one file also
allows to reduce the code size a bit more by removing a few lines of boilerplate
code. The only functional change made by this patch is that we now always
include buffer support, instead of making it optional. This is more consistent
with what we do for other drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:14 +00:00
Lars-Peter Clausen 01a10e04f8 staging:iio:ad7298: Fix temperature scale and offset
The temperature scale and offset depend on the reference voltage, the current
formula used in the driver assumes a 2.5V reference. This patch modifies the
code to report the unprocessed value for the temperature channel "raw" property
and to provide proper "scale" and "offset" properties which depend on the
selected reference voltage.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:14 +00:00
Lars-Peter Clausen 2e33460098 staging:iio:ad7298: Rework regulator handling
Rework the regulator handling of the driver to match more closely what we do in
other drivers. Make the regulator non-optional if a external reference is used.
Also dispose the option of specifying the reference voltage via platform data.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:13 +00:00
Lars-Peter Clausen ca654638f2 staging:iio:ad7298: Do not perform endianness conversion in buffered mode
For buffered mode we do not want to perform endianness conversion in the kernel,
but rather offload it to user space, since it is not always required to do a
conversion at all. It also greatly simplifies the kernel code since no
post-processing has to be done and may allow future optimizations like streaming
data directly to a storage device or over the network via DMA.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:13 +00:00
Lars-Peter Clausen ec04cb048d staging:iio: Move adis library out of staging
Now that the adis library no longer depends on the sw_ring buffer implementation
we can move it out of staging.

While we are at it also sort the entries in the iio Kconfig and Makefile to be
in alphabetical order.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:12 +00:00
Lars-Peter Clausen aacff892cb staging:iio:adis: Preallocate transfer message
Currently the driver reads out all sample registers of the device and throws
away those which it does not need. Furthermore the SPI message is constructed
each time the trigger handler is run, although it will be the same each time.
This patch preallocates and pre-constructs the SPI message in the
"update_scan_mode" callback. Only those register which are actually selected for
sampling are included in the message. The patch also gets rid of the conversion
of the sample data from big endian to the native endianness and instead marks
the channel as big endian in its scan type. This allows to directly push the
SPI transfer buffer to the IIO buffer without the need to post-process it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:11 +00:00
Lars-Peter Clausen a458c55c10 staging:iio:adis_lib: Use triggered buffer setup helper function
Use the triggered buffer helper functions to setup and tear down the buffer for
the adis library instead of doing this manually. This also means that we switch
away from the deprecated sw_ring buffer and use the kfifo buffer now instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:10 +00:00
Lars-Peter Clausen 9d5e9fdf0f staging:iio:adis16260: Use adis library
Use the new adis library for the adis16260 driver. This allows us to completely
scrap the adis16260 buffer and trigger code and about half of the core driver
code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:09 +00:00
Lars-Peter Clausen 5cb7cb1191 staging:iio:adis16240: Use adis library
Use the new adis library for the adis16240 driver. This allows us to completely
scrap the adis16240 buffer and trigger code and more than half of the core
driver code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:08 +00:00
Lars-Peter Clausen edcf600912 staging:iio:adis16220: Use adis library
Use the new adis library for the adis16220 driver. The adis16220 driver is a bit
special and so we can only make use of the generic register access and control
functions for now.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:07 +00:00
Lars-Peter Clausen 511fb29e35 staging:iio:adis16209: Use adis library
Use the new adis library for the adis16209 driver. This allows us to completely
scrap the adis16209 buffer and trigger code and more than half of the core
driver code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:06 +00:00
Lars-Peter Clausen 5bd22f516e staging:iio:adis16204: Use adis library
Use the new adis library for the adis16204 driver. This allows us to completely
scrap the adis16204 buffer and trigger code and more than half of the core
driver code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:06 +00:00
Lars-Peter Clausen 3bff7eb06d staging:iio:adis16203: Use adis library
Use the new adis library for the adis16203 driver. This allows us to completely
scrap the adis16203 buffer and trigger code and more than half of the core
driver code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:05 +00:00
Lars-Peter Clausen 6d78e862ac staging:iio:adis16201: Use adis library
Use the new adis library for the adis16201 driver. This allows us to completely
scrap the adis16201 buffer and trigger code and more than half of the core
driver code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:05 +00:00
Lars-Peter Clausen ccd2b52f4a staging:iio: Add common ADIS library
A lot of the devices from the ADIS family use the same methods for accessing
registers, sampling data and trigger handling. They also have similar register
layout for the control registers.

This patch adds a common library for these devices. The library implements
functions for reading and writing registers as buffer and trigger management. It
also provides a set functions for accessing the control registers and for
running the devices internal self-test. Having this common library code will
allow us to remove a lot of duplicated code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:04 +00:00
Wei Yongjun 6dc973d4fd iio: isl29018: fix to return error or 0 in isl29018_write_raw()
We had assigned the return value to 'ret' but ignored it when
return from isl29018_write_raw(), it's better to return 'ret'
instead of 0.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19 22:22:04 +00:00
Derek Basehore 95273f8952 tsl2563: fixed bug with disabling interrupts
In tsl_2563_write_interrupt_config and tsl2562_remove, interrupts are not
disabled where they should be. This seems to be from a mistake of using |=
instead of &= in 2 lines of code.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-17 10:17:24 +00:00
Lars-Peter Clausen e8f45e3341 staging:iio:adt7410: Fix adt7410_set_mode return value
The function is expected to return the number of bytes consumed and as long as
not all bytes have been consumed the function will be called again. Currently
the function returns 'ret', which will always be 0 in this case, so we end up in
a endless loop since the caller will assume that no bytes have been consumed. So
instead return len as it is supposed to.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-17 10:17:17 +00:00
Jonathan Cameron 168c9d95a9 iio:adc:max1363 move from staging.
Now this driver is using kfifo we can move it out of staging.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:31 +00:00
Jonathan Cameron b77b8f8c20 staging:iio:adc:max1363 cleanup regulator handling.
For historical reasons the regulator handling was a little clunky. This
patch brings it inline with a more standard ordering wrt to allocation
of the iio_device.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:30 +00:00
Jonathan Cameron 0d9fa2ce93 staging:iio:adc:max1363 white space cleanup
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:30 +00:00
Jonathan Cameron 2593b13a62 staging:iio:adc:max1363 make docs match the contents of max1363_chip_info
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:29 +00:00
Jonathan Cameron ec44372865 staging:iio:adc:max1363 drop references to 'ring' given now using a fifo
Seems worth clearing the old naming out to avoid any confusion in the future.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:29 +00:00
Jonathan Cameron b3bcbfcfec staging:iio:adc:max1363 consolidate files.
For a long while now the max1363 core has selected the
buffer anyway. For a while I meant to make the separation
work again, but given how long it has been it is probably
time to conclude it will never happen and settle for tidying
up what we have.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:28 +00:00
Jonathan Cameron 0d331e4fd2 staging:iio:adc:max1363 ring_sw->kfifo conversion
We are moving towards scrapping ring_sw so this move
is necessary.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10 10:17:28 +00:00
Jonathan Cameron 84b36ce5f7 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>
2012-11-10 10:17:21 +00:00
Lars-Peter Clausen 4eb3ccf157 staging:iio: Move the ad7887 driver out of staging
The driver does not expose any custom API to userspace and none of the standard
static code checker tools report any issues, so move it out of staging.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:54 +00:00
Lars-Peter Clausen 98efb70add staging:iio:ad7887: Use passed in chan spec in ad7887_read_raw
Use the passed in chan spec in ad7887_read_raw instead of alawys using the first
chan spec entry from the chip info data. Since all channels have the same shift
and realbits from a functional point of view it does not matter which chan spec
is used, but the patch makes the a bit more clear.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:53 +00:00
Lars-Peter Clausen fce7c3eac7 staging:iio:ad7887: Allow to use internal ref in two channel mode
While it is not recommended to use the internal reference in two channel mode in
order to obtain optimal performance it is still possible to use it.

While we are at it also get rid of the duplicate tx_cmd_buf entries. There are
only two unique entries. One for channel 1 and one for channel 2.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:53 +00:00
Lars-Peter Clausen 5daa751f89 staging:iio:ad7887: Use proper kernel doc
Use proper kernel doc to document the platform data struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:52 +00:00
Lars-Peter Clausen 65dd3d3d7a staging:iio:ad7887: Squash everything into one file
The recent cleanups have decimated the drivers code size by quite a bit. It is
only a few hundred lines in total now and we also always build buffer support,
so there really is no need to spread the driver out over multiple files. Putting
everything into one file also allows to reduce the code size a bit more by
removing a few lines of boilerplate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:52 +00:00
Lars-Peter Clausen bf5d2613c9 staging:iio:ad7887: Rework regulator handling
Rework the regulator handling of the ad7887 driver to match more closely what we
do for other drivers. Only request the regulator if a external reference is
used, but treat it as an error if requesting the regulator fails. Also remove
the possibility to specify the reference voltage via platform data and always
use the regulator for this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:52 +00:00
Lars-Peter Clausen bd6880477a staging:iio:ad7887: Preallocate sample buffer
We know that the sample buffer will at most need to hold two 16 bit samples and
the 64 bit aligned 64 bit timestamp. Preallocate a buffer large enough to hold
this instead of allocating and freeing it each time a sample is read.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-05 20:39:51 +00:00
Lars-Peter Clausen 3c7f0c2b11 staging:iio:adis16400: Set the PROD_ID flag for the adis16334
The adis16334 has the PROD_ID register so set the PROD_ID flag in its chip info.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-04 15:55:44 +00:00
Lars-Peter Clausen a7462e640d staging:iio:adis16400: Remove now duplicated chip_table entry
The ADIS1360 and ADIS13605 are very similar and do have the same software
interface. The only difference is the contents of the PROD_ID register. Since we
now read the product id from the device name instead of the chip_info struct we
can use the same chip_table entry for both the ADIS1360 and ADIS13605.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-04 15:55:40 +00:00
Lars-Peter Clausen fc8850c0a1 staging:iio:adis16400: Fix product id check
The product id check currently ANDs the read id with 0xF000 and compares the
result to the product id from the chip info. Since none of the product ids in
the chip info table end in 0x000 the check will always fail. Furthermore it is
also wrong, the product id in the PROD_ID register will always match the part
number of the device.

Some of the ADIS16XXX devices are identical from a software point of
view with the product id register having a different content. If we keep the
current scheme of storing the product id in the chip info table this would
require us to have multiple almost identical chip info table entries. So instead
this patch changes the code to parse the product id from the device name.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-04 15:55:37 +00:00
Lars-Peter Clausen ea2ccb3e02 staging:iio:adis16400: Fix adis16334 sampling frequency control
Setting the sampling frequency for the adis16334 differs from the other devices.
This patch introduces two new callback functions to the adis16400 chip_info
struct which are used to specify how to read and write the current sample rate.
The patch also introduces the proper implementations for these callbacks for the
adis16334.

Related to this is that the adis16334 has no slow mode and so we do not limit
the SPI clock rate to 300kHz during initialization. The patch adds a new flag
for devices which do have a slow mode.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-04 15:55:32 +00:00