Consistently use indio_dev and access macro for devdata
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>
This patch adds support for the AD5601/AD5611/AD5621 single channel,
8-/10-/12-bit, buffered voltage output DACs.
Changes since v1:
Sort Kconfig description my number
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>
The previous implementation flawed, in case some channels are not enabled.
The sorted array would then include channel information of disabled channels,
And misses the enabled ones, when the count is reached.
More troublesome, the loop would not even terminate.
The fix is twofold:
First we skip channels that are not enabled.
Then we use a tested bubble sort algorithm to sort the array.
Since we already allocated exactly the number of bytes we need.
We can exercise bubble sort on the original memory.
In all cases I've seen, the array is already sorted, so this sort
terminates immediately.
Changes since V1:
Fix coding style issues.
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>
This driver did not conform with the IIO ABI for such devices.
Also the sysfs files that this driver adds were not complete and
partially un-documented.
Update and document ABI
Change License notice, stick to GPL-v2.
Fix indention style
Add option to specify external reference voltage via the regulator framework.
Add mandatory name attribute
Add mandatory out_scale attribute
Changes since V1:
Refine outY_powerdown_mode description
Remove bonus white line
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>
Moved to standard sysfs naming and got rid of direct register writing from
userspace.
The rx and tx buffers are never used together so just have one and avoid
the need to malloc it by using putting it in the state structure and
using the ____cacheline_aligned trick.
A number of obvious bugs also fixed and correction of register address
defines in header which has now been squashed into the driver.
I don't have one of these so can't test. This is done off datasheet.
Note that the driver had parts that definitely wouldn't work before
this patch. Now it 'might' assuming I haven't messed up too badly.
I've left fixing the fact that you can only have one of these on a given
machine for another day.
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>
These parts are very similar and the adis16260 driver supports
a lot of additional functionality.
Precursor to removal of adis16251 driver.
Note that some supported devices were missing from Kconfig help text
and are also added in this patch.
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>
Moved to standard sysfs naming and got rid of direct register writing
from userspace.
The rx and tx buffers are never used together so just have one and
avoid the need to malloc it by using putting it in the state structure
and using the ____cacheline_aligned trick.
Couple of obvious bug fixes whilst I was here.
I don't have one of these so can't test. This is done off datasheet.
Note that as with the adis16060 driver there are parts that definitely
wouldn't work before this patch. Now it 'might' assuming I haven't
messed up too badly.
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>
Variable sizeint is used uninitialized.
Remove sizeint completely and use bits_used instead.
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>
The first part of build_channel_array()identifies the number of enabled channels.
Further down this count is used to allocate the ci_array. The next section parses the
scan_elements directory again, and fills ci_array regardless if the channel is enabled or not.
So if less than available channels are enabled ci_array memory is overflowed.
This fix makes sure that we allocate enough memory. But the whole approach looks a bit
cumbersome to me. Why not allocate memory for MAX_CHANNLES, less say 64
(I never seen a part with more than that channels). And skip the first part entirely.
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>
No functional changes
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>
filename is used and freed later
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>
In case optarg n is not given return/exit
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>
This patch adds support for the
AD7298: 8-Channel, 1MSPS, 12-Bit SAR ADC with Temperature Sensor
via SPI bus.
This patch replaces the existing ad7298.c driver completely.
It was necessary since, the old driver did not comply with the
IIO ABI for such devices.
Changes since V1:
IIO: ADC: New driver for the AD7298 8-channel SPI ADC
Add documentation for new sysfs file tempX_input.
Simplify bit defines.
Remove outdated comments.
Fix indention style.
ad7298_show_temp():
Add locking.
Simplify temperature calculation.
Change temperature result from degrees into milli degrees Celsius.
Rename file according to new sysfs ABI documentation
Add timestamp attributes.
Revise timestamp handling accordingly.
Preset timestamp generation.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Reviewed-by: Shubhrajyoti <Shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This driver allows any Blackfin system timer to be used as IIO trigger.
It supports trigger rates from 0 to 100kHz in Hz resolution.
Changes since V1:
IIO: trigger: Apply review feedback
Add comment explaining Blackfin hardware timer configurations
Fix frequency_store, don't return -EINVAL for frequency set to 0
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>
Add support for the AD5543/AD5553 SPI 16-/14-Bit DACs
Fix typo in kconfig description
Changes since V1:
reorder Kconfig help text
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>
This patch adds support for the:
AD7606/AD7606-6/AD7606-4 8/6/4-Channel Data Acquisition
system (DAS) with 16-Bit, Bipolar, Simultaneous Sampling ADC.
Changes since V1:
IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4: Apply review feedback
Rename sysfs node oversampling to oversampling_ratio.
Kconfig: Add GPIOLIB dependency.
Use range in mV to better match HWMON.
Rename ad7606_check_oversampling.
Fix various comments and style.
Reorder is_visible cases.
Use new gpio_request_one/array and friends.
Drop check for SPI max_speed_hz.
Changes since V2:
IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4: Apply review feedback
Documentation: specify unit
Avoid raise condition in ad7606_scan_direct()
Check return value of bus ops read_block()
Changes since V3:
IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4: Add missing include file
Add linux/sched.h
Changes since V4:
IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4: Fix kconfig declaration
consistently use tristate to avoid configuration mismatches
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>
This reverts commit f2f1794835.
It should not be putting code into the include/input/ directory, and
lots of other people have complained about it.
Cc: Tony SIM <chinyeow.sim.xt@renesas.com>
Cc: Andrew Chew <achew@nvidia.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Get rid of unused stubs for trigger and buffer support.
Fix line length issues.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Removed stubs related to buffering and triggering. Put them back
when they are actually needed.
Fixed line length issues.
Made a number of functions static as no longer in header.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
General cleanup and use of standard functions to simplfy some spi reads
as well.
Also added a device id table to the spi version.
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>
General cleanup and use of standard functions to simplfy some spi reads
as well.
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>
General cleanup and use of standard functions to simplfy some spi reads
as well.
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>
General cleanup and use of standard functions to simplfy some spi reads
as well.
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>
Add ability to control delay for event free buffers
Add ability to control length of buffer
Add ability to control how many read cycles occur
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Tested-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
A very simple use of a kfifo as an alternative for the ring_sw
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Tested-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
The current interface is not as adaptable as it should be. Moving
this complexity into the implementations makes it easier to add
new implementations.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Tested-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
As some of the platform not support irq_to_gpio, we pass gpio port
by platform data.
Signed-off-by: Tony SIM <chinyeow.sim.xt@renesas.com>
Signed-off-by: Andrew Chew <achew@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This is a complete rewrite of the AD9832/35 driver.
Purpose was to move this driver to the recently
created API for such devices.
Changes since V1:
IIO: DDS: AD9832 / AD9835 driver: Apply review feedback
Save a few bytes, use union for data allocated for spi buffers.
Remove use of device IDs.
Fix comments.
Make master clock mclk always type unsigned long.
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>
This patch adds a new trigger that can be invoked by writing
the sysfs file: trigger_now. This approach can be valuable during
automated testing or in situations, where other trigger methods
are not applicable. For example no RTC or spare GPIOs.
Last but not least we can allow user space applications to produce triggers.
IIO: TRIGGER: Apply review feedback by Greg Kroah-Hartman
Changes since v1:
Add sysfs documentation.
Change license notice.
Add module alias.
Add more Kconfig help text
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>
This was done to resolve conflicts in the following files due
to patches in Linus's tree and in the staging-next tree:
drivers/staging/brcm80211/brcmsmac/wl_mac80211.c
drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
max517.c: Fix client obtainment by using iio_dev_get_devdata()
This patch uses dev_get_drvdata() and iio_dev_get_devdata() instead of
to_i2c_client() (broken!) to obtain i2c_client data.
Further, some minor typo fixes are included.
Signed-off-by: Roland Stigge <stigge@antcom.de>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
iio: Additional fixpoint formatted output bugfixes
Fix some ADC/DAC drivers' _scale interface to correct fixpoint formatted output
This patch adds the fixes to ad7887_core.c and ad5446.c
Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Changes since RFC/v1:
IIO: Apply list review feedback
Apply list review feedback:
Rename attributes to fit IIO convention used in other drivers.
Fix typos.
Provide ddsX_out_enable as opposed to ddsX_out_disable.
Use proper __devexit marking.
Use strict_strtoul() to avoid negatives.
Changes since v2:
IIO: ad9834.c: Apply more list review feedback
Update use of dds convenience macros.
Fix tabbing.
Remove superfluous brackets.
Keep output disabled after probe.
Remove unnecessary code.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Datta Shubhrajyoti <shubhrajyoti@ti.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Changes since RFC/v1:
IIO: Apply list review feedback
Apply list review feedback:
Rename attributes to fit IIO convention used in other drivers.
Provide ddsX_out_enable as opposed to ddsX_out_disable.
Fix typos.
Changes since v2:
IIO: dds.h: Apply more list review feedback
Fix mixture of X and [n] notation for indices.
Remove duplicated descriptions.
Add store methods to some dds convenience macros.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Reviewed-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>