summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge tag 'iio-for-v3.7d' of ↵Greg Kroah-Hartman2012-09-178-11/+1136
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next IIO new drivers, features and rework for the 3.7 cycle, 4th set. Here we have 1) a set cleaning up and moving the ad7476 driver out of staging. Support for a number of additional parts is also added to that driver. 2) cleanups from various people for the in kernel interface code as that is getting more an more real use and hence people are picking up on minor issues that made it through review. Also a related useful set of utility functions to avoid duplicate code for converting IIO representations to other forms. 3) a new fractional type for our read_raw / write_raw functions. This allows avoiding loss of accuracy via the in kernel interfaces in some cases as well as being rather convenient for a lot of range -> scale conversions. 4) New AD5755 DAC driver. 5) Some Blackfin timer trigger improvements including hardware pulse control for device triggering. 6) Support for the ad7091r in the ad7476 driver.
| * iio: ad7476: Add support for the ad7091rLars-Peter Clausen2012-09-171-4/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the ad7091r 12 bit ADC to the ad7476 driver. Although the ad7091r is not really related to any of the other devices supported by this driver, luckily for us there are not so many ways (which are not totally insane) how sampling a single channel ADC via SPI can be implemented and support for the ad7091r can be added to the driver with just a few adjustments. The ad7091r requires an external "conversion start" pulse to start a sample conversion. After the conversion has finished the result can be read via SPI. We depend on a IIO trigger to generate this signal, as a result only sampling in buffered mode and not in manual mode is available. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio:inkern: Add function to read the processed valueLars-Peter Clausen2012-09-171-9/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a function to read a processed value from a channel. The function will first attempt to read the IIO_CHAN_INFO_PROCESSED attribute. If that fails it will read the IIO_CHAN_INFO_RAW attribute and convert the result from a raw value to a processed value. The patch also introduces a function to convert raw value to a processed value and exports it, in case a user needs or wants to do the conversion by itself. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio:dac: Add ad5755 driverLars-Peter Clausen2012-09-173-0/+662
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the AD5755, AD5755-1, AD5757, AD5735, AD5737 16 and 14 bit quad-channel DACs. The AD5757/AD5737 only have current outputs, but for the AD5755/AD5757 each of the outputs can be configured to either be a voltage or a current output. We only allow to configure this at device probe time since usually this needs to match the external circuitry and should not be changed on the fly. A few trivial formatting changes on merge. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: inkern: add error case in iio_channel_get()Kim, Milo2012-09-171-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The datasheet name is defined in the IIO driver. On the other hand, the adc_channel_label is configured in the platform side. If the datasheet name is not matched with any adc_channel_label, the iio_channel_get() should be returned as error for preventing invalid channel data access. This can be handled either way. (a) checking null data when using it : in the xxx_read_raw() or (b) error returns when the channel is requested : this patch The IIO consumer can't use the channel with invalid channel spec. Therefore case (b) is more reasonable. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: inkern: allocate zeroed memoryKim, Milo2012-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use kzalloc() rather than kmalloc() for initializing the iio_channel structure. This patch enables the iio_dev and iio_chan_spec are set to NULL. This may prevent the page fault problem because the pointer of iio_chan_spec is initialized as NULL. The iio_chan_spec is updated only in case that the IIO map has specific channel label. When the map has no ADC channel label, then the value of iio_chan_spec remains as invalid pointer. To prevent this problem, the pointer should be initialized as NULL. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Introduce a new fractional value typeLars-Peter Clausen2012-09-151-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently IIO uses a decimal fixed point representations for real type numbers. This patch introduces a new representation for rational type numbers. The number will be expressed by specifying a numerator and denominator. For converting a raw value to a processed value multiply it by the numerator and divide it by the denominator. The reasoning for introducing this new type is that for a lot of devices the scale can be represented easily by a fractional number, but it is not possible to represent it as fixed point number without rounding. E.g. for a simple DAC the scale is often the reference voltage divided by the number of possible values (Usually 2**n_bits - 1). Each driver currently implements the conversion of this fraction to a fixed point number on its own. Also when it comes to the in-kernel interface this allows to directly use the fractional factors to convert a raw value to a processed value. This should on one hand require less instructions and on the other hand increase the precision. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio:ad7476: Add support for ad7273/ad7274/ad7276/ad7277/ad7278Lars-Peter Clausen2012-09-152-3/+23
| | | | | | | | | | | | | | | | | | | | The ad7276/ad7277/ad7278 are similar to the ad7476/ad7477/ad7478 but have the same number of leading zeros as the ad7940. The ad7273/ad7274 have a extra pin for VREF where as for the ad7276/ad7277/ad7278 VREF is taken from VDD, but otherwise they are compatible to the ad7276/ad7277. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio:ad7476: Add ad7940 supportLars-Peter Clausen2012-09-152-6/+16
| | | | | | | | | | | | | | | | The AD7940 is a single channel 14 bit ADC similar to the ADCs already supported by the ad7476 driver, but it does have a different shift factor. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio:ad7476: Add ad7910/ad7920 device table entriesLars-Peter Clausen2012-09-152-5/+8
| | | | | | | | | | | | | | The ad7910/ad7920 are software compatible to the ad7467/ad7466. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Move ad7476 driver out of stagingLars-Peter Clausen2012-09-153-0/+293
| | | | | | | | | | | | | | | | | | The ad7476 driver is a driver for simple single channel ADCs. The driver does not export any experimental or custom ABI files nor do the static code check tools report any issues, so move the driver out of staging. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge 3.6-rc6 into staging-nextGreg Kroah-Hartman2012-09-171-1/+1
|\ \ | |/ |/| | | | | | | | | This pulls in the staging tree fixes in 3.6-rc6 into our branch to resolve the merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * drivers/iio/adc/at91_adc.c: adjust inconsistent IS_ERR and PTR_ERRJulia Lawall2012-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the call to PTR_ERR to access the value just tested by IS_ERR. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e,e1; @@ ( if (IS_ERR(e)) { ... PTR_ERR(e) ... } | if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } | *if (IS_ERR(e)) { ... * PTR_ERR(e1) ... } ) // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | staging:iio:adc: Add AD7791 driverLars-Peter Clausen2012-09-083-0/+473
| | | | | | | | | | | | | | | | This patch adds support for the Analog Devices AD7787, AD7788, AD7789, AD7790 and AD7791 Sigma Delta Analog-to-Digital converters. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:ad5446: Add device ids for ad5301/ad5311/ad5321Lars-Peter Clausen2012-09-082-4/+7
| | | | | | | | | | | | | | The ad5301/ad5311/ad5321 are software compatible to the ad5602/ad5612/ad5622. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:ad5446: Add support for the ad5300/ad5310/ad5320Lars-Peter Clausen2012-09-082-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | The ad5300/ad5310/ad5320 is a family of single channel DACs with a SPI interface similar to the ad5601/ad5611/ad5621 but use a different shift factor for the data word. While we are at it also reorder the device part numbers in the ad5446 driver Kconfig to be ordered alphabetically. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: Drop timestamp parameter from buffer store_to callbackLars-Peter Clausen2012-09-0810-17/+11Star
| | | | | | | | | | | | | | | | | | 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>
* | staging:iio: hid-sensors Use iio_push_to_bufferJonathan Cameron2012-09-074-4/+4
| | | | | | | | | | | | | | | | | | | | Consistently use iio_push_to_buffer instead of manually calling the buffers store_to callback. These crossed with Lars-Peter's patch set doing every other case. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
* | iio: hid-sensors: Added ALSsrinivas pandruvada2012-09-065-0/+399
| | | | | | | | | | | | | | | | | | | | Added usage id processing for ALS. This uses IIO interfaces for triggered buffer to present data to user mode.This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: hid-sensors: Added Compass/Magnetometer 3Dsrinivas pandruvada2012-09-065-0/+443
| | | | | | | | | | | | | | | | | | | | Added usage id processing for Compass 3D. This uses IIO interfaces for triggered buffer to present data to user mode.This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: hid-sensors: Added Gyroscope 3Dsrinivas pandruvada2012-09-065-0/+442
| | | | | | | | | | | | | | | | | | | | Added usage id processing for Gyroscope 3D. This uses IIO interfaces for triggered buffer to present data to user mode.This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: hid-sensors: Added accelerometer 3Dsrinivas pandruvada2012-09-065-0/+442
| | | | | | | | | | | | | | | | | | | | Added usage id processing for Accelerometer 3D.This uses IIO interfaces for triggered buffer to present data to user mode.This uses HID sensor framework for registering callback events from the sensor hub. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: hid-sensors: Common attribute and triggersrinivas pandruvada2012-09-0610-0/+483
| | | | | | | | | | | | | | | | | | | | | | This patch contains the common code, which is used by all HID sensors. There are some common set of attributes, which every hid sensor needs it. This patch contains all such attributes processing. Also the trigger interface is common among all HID sensors. This patch contains common trigger functions utilized by all HID sensors. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: core: Add hysteresis in channel specsrinivas pandruvada2012-09-061-0/+1
| | | | | | | | | | | | | | | | Added hysteresis to the list of channel info enumeration, shared /separate bit defines and to postfix channel info strings. Signed-off-by: srinivas pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | IIO: Update email address for Jonathan Cameron.Jonathan Cameron2012-09-031-1/+1
| | | | | | | | Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:ad5446: get rid of private header fileJean-Francois Dagenais2012-09-032-65/+34Star
| | | | | | | | | | | | | | | | | | Most of the defines in there were not even used, and the structs left are private to the .c file. Makes the driver more in line with most of the kernel drivers. Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:ad5446: Add support for I2C based DACsJean-Francois Dagenais2012-09-033-147/+293
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for I2C based single channel DACs to the ad5446 driver. Specifically AD5602, AD5612 and AD5622. V1: from Lars-Peter Clausen <lars@metafoo.de> V2: Split the device IDs into two enums and move them to the c file. Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: fix spelling of subsystemPeter Meerwald2012-09-031-1/+1
| | | | | | | | | | Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: whitespace cleanup and removal of semicolon after functionsPeter Meerwald2012-09-032-6/+6
| | | | | | | | | | Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: fix typosPeter Meerwald2012-09-031-1/+1
| | | | | | | | | | Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | drivers/iio/adc/at91_adc.c: use clk_prepare_enable and clk_disable_unprepareJulia Lawall2012-09-031-24/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and clk_enable, and clk_disable and clk_unprepare. They make the code more concise, and ensure that clk_unprepare is called when clk_enable fails. A simplified version of the semantic patch that introduces calls to these functions is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression e; @@ - clk_prepare(e); - clk_enable(e); + clk_prepare_enable(e); @@ expression e; @@ - clk_disable(e); - clk_unprepare(e); + clk_disable_unprepare(e); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: kfifo - add poll support.Jonathan Cameron2012-08-271-1/+14
| | | | | | | | | | | | | | | | This buffer implementation was missing poll support. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: srinivas pandruvada <srinivas.pandruvada@intel.com>
* | iio:kfifo_buf improve error handling in read_first_n.Jonathan Cameron2012-08-271-1/+3
| | | | | | | | | | | | | | | | | | | | These two elements were originally in the patch iio:kfifo_buf Take advantage of the fixed record size used in IIO but Lars-Peter Clausen pointed out they should not have been so here they are. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Lars-Peter Clausen <lars@metafoo.de>
* | iio:kfifo_buf Take advantage of the fixed record size used in IIOJonathan Cameron2012-08-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By bypassing the standard macros for setting up the kfifo we can take advantage of the fixed record size implementation without having to have a type to pass in (from which the size of an element is normally established). In IIO we have variable 'scans' as our records in which any element can be present or not. They do not however vary when we are actually filling or reading from the buffer. Thus we have a fixed record size whenever we are actually running. As setup and tear down are not in the fast path we can take the overhead of reinitializing the kfifo every time. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Lars-Peter Clausen <lars@metafoo.de>
* | iio: use IIO_CHAN_INFO_RAW rather than 0Kim, Milo2012-08-271-2/+4
| | | | | | | | | | | | | | | | | | (a) For better readability, replace 0 with IIO_CHAN_INFO_RAW. (b) Make same line-format as other apis() : iio_read_channel_scale() and iio_read_channel_offset() Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:adc: Add common code for ADI Sigma Delta devicesLars-Peter Clausen2012-08-273-0/+564
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most devices from the Analog Devices Sigma Delta family use a similar scheme for communication with the device. This includes register access, as well as trigger handling. But each device sub-family has different features and different register layouts (some even have no registers at all) and thus it is impractical to try to support all of the devices by the same driver. This patch adds a common base library for Sigma Delta converter devices. It will be used by individual drivers. This code is mostly based on the three existing Sigma Delta drivers the AD7192, AD7780 and AD7793, but has been improved for more robustness and flexibility. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge 3.6-rc3 into staging-nextGreg Kroah-Hartman2012-08-273-14/+21
|\| | | | | | | | | | | This picks up fixes we want in this branch to allow us to properly test. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: lm3533-als: Fix build warningsAxel Lin2012-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | Fix below build warnings: CC [M] drivers/iio/light/lm3533-als.o drivers/iio/light/lm3533-als.c:667:8: warning: initialization from incompatible pointer type [enabled by default] drivers/iio/light/lm3533-als.c:667:8: warning: (near initialization for 'dev_attr_in_illuminance0_thresh_either_en.show') [enabled by default] drivers/iio/light/lm3533-als.c:667:8: warning: initialization from incompatible pointer type [enabled by default] drivers/iio/light/lm3533-als.c:667:8: warning: (near initialization for 'dev_attr_in_illuminance0_thresh_either_en.store') [enabled by default] Signed-off-by: Axel Lin <axel.lin@gmail.com>
| * iio/adjd_s311: Fix potential memory leak in adjd_s311_update_scan_mode()Alexey Khoroshilov2012-08-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | Do not leak memory by updating pointer with potentially NULL realloc return value. There is no need to preserve data in the buffer, so replace krealloc() by kfree()-kmalloc() pair. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Acked-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: frequency: ADF4350: Fix potential reference div factor overflow.Michael Hennerich2012-08-161-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | With small channel spacing values and high reference frequencies it is possible to exceed the range of the 10-bit counter. Workaround by checking the range and widening some constrains. We don't use the REG1_PHASE value in this case the datasheet recommends to set it to 1 if not used. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | drivers/iio/adc/at91_adc.c: use devm_ functionsJulia Lawall2012-08-161-34/+8Star
|/ | | | | | | | | | | | | | | | | | The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. The call to platform_get_resource(pdev, IORESOURCE_MEM, 0) is moved coser to the call to devm_request_and_ioremap, which is th first use of the result of platform_get_resource. This does not use devm_request_irq to ensure that free_irq is executed before its idev argument is freed. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: fix pointer cast warningPeter Meerwald2012-07-151-1/+1
| | | | | | | | | | | | | | | | | | | | fix compile warning reported by Fengguang Wu: drivers/iio/light/adjd_s311.c: In function 'adjd_s311_trigger_handler': drivers/iio/light/adjd_s311.c:188:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] drivers/iio/light/adjd_s311.c:188:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 185 } 186 187 if (indio_dev->scan_timestamp) > 188 *(s64 *)((phys_addr_t)data->buffer + ALIGN(len, sizeof(s64))) 189 = time_ns; 190 iio_push_to_buffer(buffer, (u8 *)data->buffer, time_ns); 191 Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'togreg-3.6a' of ↵Greg Kroah-Hartman2012-07-125-7/+418
|\ | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next IIO: One new driver and a couple of nice cleanups.
| * iio: add adjd_s311 I2C digital color sensor driverPeter Meerwald2012-07-123-0/+377
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sensor has 4 channels (10-bit each, R/G/B and clear), sensitivity and gain is controlled in the driver by ext_info integration_time and CHAN_INFO_HARDWAREGAIN driver supports triggered buffer and IIO_CHAN_INFO_RAW to get the sensor data v5: address comments by Jonathan Cameron * use macro for channel declaration * get timestamp right before measurement * cleanups v4: address comments by Lars-Peter Clausen * make sure trigger handler is exited with iio_trigger_notify_done() and IRQ_HANDLED * kfree()/kalloc() -> krealloc() v3: * fix warnings v2: address comments by Lars-Peter Clausen * buffer allocation now in update_scan_mode instead of in trigger handler * simplify trigger code (assume active_scan_mask is not empty, use for_each_set_bit, use iio_push_to_buffer) * reorder entry in Makefile and Kconfig * fix remove Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * IIO channel type and modifiers for CCT and RGBC dataJon Brenner2012-07-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add iio channel type and modifiers for Correlated Color Temperature (CCT) and RGBC (red/green/blue/clear) data. Add CCT and RGBC descriptions to documentation. Changes: Revised/condensed RGBC descriptions. Merge and trivial fix done by Jonathan Cameron. Signed-off-by: Jon Brenner <jbrenner@taosinc.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Introduce iio_validate_scan_mask_onehotLars-Peter Clausen2012-07-091-0/+16
| | | | | | | | | | | | | | | | | | | | Add a helper function for validating a scan mask for devices where exactly one channel must be selected during sampling. This is a common case among devices which have scan mask restrictions so it makes sense to provide this function in the core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Add callback to check whether a scan mask is validLars-Peter Clausen2012-07-091-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is useful for cases where the number of valid scan masks grows exponentially, but it is rather easy to check whether a mask is valid or not programmatically. An example of such a case is a device with multiple ADCs where each ADC has a upstream MUX, which allows to select from a number of physical channels. +-------+ +-------+ | | | | --- Channel 1 | ADC 1 |---| MUX 1 | --- ... | | | | --- Channel M +-------+ +-------+ . . . . . . . . . +-------+ +-------+ | | | | --- Channel M * N + 1 | ADC N |---| MUX N | --- ... | | | | --- Channel M * N + M +-------+ +-------+ The number of necessary scan masks for this case is (M+1)**N - 1, on the other hand it is easy to check whether subsets for each ADC of the scanmask have only one bit set. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge tag 'fixes-togreg-3.6a' of ↵Greg Kroah-Hartman2012-07-122-21/+22
|\ \ | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-next Various minor IIO fixes for staging-next.
| * | iio: double unlock on error pathDan Carpenter2012-07-121-1/+2
| | | | | | | | | | | | | | | | | | | | | We should be holding the mutex when we goto error_free_chans. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: dac: ad5064: fix section mismatch in ad5064_init() in linux-nextGerard Snitselaar2012-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | ad5064_init() calls ad5064_spi_unregister_driver() which is annotated __exit. Signed-off-by: Gerard Snitselaar <dev@snitselaar.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>