summaryrefslogtreecommitdiff
path: root/include/linux/iio
AgeCommit message (Collapse)Author
2014-05-13staging: iio: light: update copyright to GPLv2Sri Krishna chowdary
Bug 1495051 Change-Id: I2bf7838dc79848017bf38affe6d61e4349fb3d49 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/400089 (cherry picked from commit 4a556c1bf36e12034f653dc129084954c98a896b) Reviewed-on: http://git-master/r/404970 (cherry picked from commit 050e92969edd6cd0e28542598a36eb1c50441edc) Reviewed-on: http://git-master/r/408090 Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2014-02-16iio: core: Implement devm_iio_device_{register,unregister}Sachin Kamat
Add device managed devm_iio_device_{register,unregister}() to automatically unregister IIO drivers thus leading to simplified IIO driver code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Lars-Peter Clausen <lars@metafoo.de> Tested-by: Lars-Peter Clausen <lars@metafoo.de> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org> (cherry picked from commit 8caa07c0e565a15f49f290ca4c6a3adf968ddd38) Conflicts: Documentation/driver-model/devres.txt Change-Id: I3ccfa11be374b150b3bb6a45defcf6fb5955a258 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/368084
2014-02-16iio: core: implement devm_iio_device_alloc/devm_iio_device_freeGrygorii Strashko
Add a resource managed devm_iio_device_alloc()/devm_iio_device_free() to automatically clean up any allocations made by IIO drivers, thus leading to simplified IIO drivers code. In addition, this will allow IIO drivers to use other devm_*() API (like devm_request_irq) and don't care about the race between iio_device_free() and the release of resources by Device core during driver removing. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com> Tested-by: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org> (cherry picked from commit 9dabaf5eddbafa21aded7c063cb38d2e8936c237) Change-Id: Ia761b80971ed58d735e39b93f32db4b510368363 Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-on: http://git-master/r/368083
2014-02-10staging: iio: light: provide sensor specs to userSri Krishna chowdary
Android HAL requires some specification details about a sensor. Since, this information is device as well as board specific, device tree is more appropriate to fill this information rather than the sensor's driver. The goal of this patch is two fold 1. add helpers to retrieve this data from device tree node 2. add helpers to share this information from device's platform data to the user space through sysfs. bug 1402172 Change-Id: I79b32a42d5e9234acf8f11788767162d9451bfd1 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/359781 (cherry picked from commit 478f7e628df61da1aeac43e72e6f30545916468f) Reviewed-on: http://git-master/r/350324 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2013-12-05staging: iio: light: jsa1127: Enable noisy optionJun Yan
Add noisy option for jsa1127, as some devices' ALS tint is too thick to prevent ALS working normally. Noisy option will make driver report values in random variations, in order to make ALS's applications working normally. Bug 1416007 Change-Id: Id5c794987caea9b3f94b856030bc827f09603ff4 Signed-off-by: Jun Yan <juyan@nvidia.com> Reviewed-on: http://git-master/r/338024 Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com> Tested-by: Anshul Jain (SW) <anshulj@nvidia.com> Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com> Tested-by: Sachin Nikam <snikam@nvidia.com>
2013-11-18iio: light: jsa1127: Add tint coefficientJun Yan
Due to the tint in front of the light sensor, the resolution has been changed. Enable tint support and use the value after calibration. Bug 1327929 Change-Id: I0609e778bfd8a2954c67a0ec9f6ab53a39f6855d Signed-off-by: Jun Yan <juyan@nvidia.com> Reviewed-on: http://git-master/r/332091 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sri Krishna Chowdary <schowdary@nvidia.com> Reviewed-by: Anshul Jain (SW) <anshulj@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2013-09-16iio: inkern: Add functions to read channel with dual modeJinyoung Park
Added functions to read channel with dual mode. The functions check a channel info attribute and the channel supports dual mode then read channel. If the channel doesn't support dual mode, return error value. Bug 1287901 Bug 1356128 Change-Id: Ia2ffdf8eb6d05f95f763939dc413be5b06b7c605 Signed-off-by: Jinyoung Park <jinyoungp@nvidia.com> Reviewed-on: http://git-master/r/273636 GVS: Gerrit_Virtual_Submit Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-09-14staging: iio: light: jsa1127: Add sensor driverSri Krishna chowdary
Bug 1327929 Change-Id: I7e5468aca05bbc929c3926695a817f94d54bd7b9 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Signed-off-by: Anshul Jain <anshulj@nvidia.com> Reviewed-on: http://git-master/r/261284 Reviewed-by: Raymond Poudrier <rapoudrier@nvidia.com> Tested-by: Raymond Poudrier <rapoudrier@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
2013-07-25iio: Fix iio_channel_has_infoAlexandre Belloni
commit 1c297a66654a3295ae87e2b7f3724d214eb2b5ec upstream. Since the info_mask split, iio_channel_has_info() is not working correctly. info_mask_separate and info_mask_shared_by_type, it is not possible to compare them directly with the iio_chan_info_enum enum. Correct that bit using the BIT() macro. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-30Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree updates from Jiri Kosina: "Usual stuff, mostly comment fixes, typo fixes, printk fixes and small code cleanups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (45 commits) mm: Convert print_symbol to %pSR gfs2: Convert print_symbol to %pSR m32r: Convert print_symbol to %pSR iostats.txt: add easy-to-find description for field 6 x86 cmpxchg.h: fix wrong comment treewide: Fix typo in printk and comments doc: devicetree: Fix various typos docbook: fix 8250 naming in device-drivers pata_pdc2027x: Fix compiler warning treewide: Fix typo in printks mei: Fix comments in drivers/misc/mei treewide: Fix typos in kernel messages pm44xx: Fix comment for "CONFIG_CPU_IDLE" doc: Fix typo "CONFIG_CGROUP_CGROUP_MEMCG_SWAP" mmzone: correct "pags" to "pages" in comment. kernel-parameters: remove outdated 'noresidual' parameter Remove spurious _H suffixes from ifdef comments sound: Remove stray pluses from Kconfig file radio-shark: Fix printk "CONFIG_LED_CLASS" doc: put proper reference to CONFIG_MODULE_SIG_ENFORCE ...
2013-03-25iio:trigger: Use dev_{set,get}_drvdata for private data managementLars-Peter Clausen
Use dev_{set,get}_drvdata for managing private data attached to a trigger instead of using a custom field in the iio_trigger struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-25iio:trigger: Introduce iio_tigger_{set,get}_drvdataLars-Peter Clausen
Introduce iio_tigger_{set,get}_drvdata which allows to attach driver specific data to a trigger. The functions wrap access to the triggers private_data field and all current users are updated to use iio_tigger_{set,get}_drvdata instead of directly accessing the private_data field. This is the first step towards removing the private_data field from the iio_trigger struct. The following coccinelle script has been used to update the drivers: <smpl> @@ struct iio_trigger *trigger; expression priv; @@ -trigger->private_data = priv +iio_trigger_set_drv_data(trigger, priv) @@ struct iio_trigger *trigger; @@ -trigger->private_data +iio_trigger_get_drv_data(trigger) </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-25Merge tag 'iio-for-3.10a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of IIO new drivers and cleanup for the 3.10 cycle. New stuff 1) Add OF support for specifying mappings between iio devices and their in kernel consumers. 2) Driver for AD7923 (extra functionality and support for ad7904, ad7914 and ad7924 added later in series) 3) Driver for Exynos adc (dt suppor for phy added later in series). 4) Make iio_push_event save IRQ context - necessary if it is to be used within an interrupt handler. Users of this functionality to follow. 5) For iio use the device tree node name to provide the hwmon name attribute if available. Removal and moves out of staging 1) Drop the adt7410 driver from IIO now that there is a hmwon driver with equivalent support. This device is very much targeted at hardware monitoring so hwmon is a more appropriate host for the driver. 2) Move iio_hwmon driver to drivers/hwmon. Cleanups 1) Minor cleanup in ST common library. 2) Large set of patches to break the info_mask element which previously used odd and even bits to specify if a channel attribute was either shared across similar channels or specific to only one. Now we have two bitmaps, one for those parameters that are specific to this channel and one for those shared by all channels with the same type as this one. This has no effect on the userspace abi. It simplifies the core code and provides more space for new channel parameters. It has been on the todo list for a long time! Conflicts: drivers/iio/dac/ad5064.c
2013-03-18itg3200: fix incorrect ifdef commentPaul Bolle
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-03-17iio:core drop info_mask from struct iio_infoJonathan Cameron
This has been replaced by the pair of masks info_mask_separate and info_mask_shared_by_type. Other variants may follow. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-17staging:iio:accel:adis move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-17iio:adc:ad_sigma_delta move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-17iio:st_sensors move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Denis Ciocca <denis.ciocca@st.com>
2013-03-17iio: Add broken out info_mask fields for shared_by_type and separateJonathan Cameron
This simplifies the code, removes an extensive layer of 'helper' macros and gives us twice as much room to play with in these masks before we have any need to be clever. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
2013-03-02iio: Fix build error seen if IIO_TRIGGER is defined but IIO_BUFFER is notGuenter Roeck
If CONFIG_IIO_TRIGGER is defined but CONFIG_IIO_BUFFER is not, the following build error is seen. drivers/iio/common/st_sensors/st_sensors_trigger.c:21:5: error: redefinition of ‘st_sensors_allocate_trigger’ In file included from drivers/iio/common/st_sensors/st_sensors_trigger.c:18:0: include/linux/iio/common/st_sensors.h:239:19: note: previous definition of ‘st_sensors_allocate_trigger’ was here drivers/iio/common/st_sensors/st_sensors_trigger.c:65:6: error: redefinition of ‘st_sensors_deallocate_trigger’ In file included from drivers/iio/common/st_sensors/st_sensors_trigger.c:18:0: include/linux/iio/common/st_sensors.h:244:20: note: previous definition of ‘st_sensors_deallocate_trigger’ was here This occurs because st_sensors_deallocate_trigger is built if CONFIG_IIO_TRIGGER is defined, but the dummy function is compiled if CONFIG_IIO_BUFFER is defined. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-09iio:triggers Protect functions in triggers.h from use when not compiledJonathan Cameron
Also include a couple of forward defs of struct iio_trigger and struct iio_trigger_ops to avoid doing this in each driver. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Denis Ciocca <denis.ciocca@st.com>
2013-02-09iio:common: added allocate and deallocate trigger functions when trigger is ↵Denis CIOCCA
disabled. This patch resolve a bugfix when driver is compiled without trigger. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Reported-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-06iio: Update iio_channel_get API to use consumer device pointer as argumentGuenter Roeck
For iio_channel_get to work with OF based configurations, it needs the consumer device pointer instead of the consumer device name as argument. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Anton Vorontsov <anton@enomsg.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio: Simplify iio_map_array_unregister APIiio-for-3.9cGuenter Roeck
Instead of requiring the map to unregister, simply unregister all map entries associated with the given iio device. This simplifies map removal and also works for maps generated through devicetree. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio: Update iio_channel_get_all and iio_channel_get_all_cb APIGuenter Roeck
Pass device pointer instead of device name as parameter to iio_channel_get_all and iio_channel_get_all_cb. This will enable us to use OF information to retrieve consumer channel information. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio:common: removed unused functions outside st_sensors libraryDenis CIOCCA
This patch remove st_sensors_get_sampling_frequency_avl and st_sensors_get_scale_avl functions used only in st_sensors_sysfs_sampling_frequency_avail and st_sensors_sysfs_scale_avail sysfs functions. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio: gyro: Add itg3200Manuel Stahl
This patch adds support for the InvenSense itg3200. The itg3200 is a three-axis gyro with 16-bit ADC and I2C interface. Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-31staging:iio: Remove noop call to __iio_update_bufferLars-Peter Clausen
__iio_update_buffer updates the buffer's bytes_per_datum and length fields. But the only user of this function just passes in these exact fields, so the call basically looks like this: buffer->bytes_per_datum = buffer->bytes_per_datum; buffer->length = buffer->length; Which means it is a noop and can be removed. Also remove the function itself, since it is now unused. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-31iio:common: Add STMicroelectronics common libraryDenis Ciocca
This patch add a generic library for STMicroelectronics 3-axis sensors. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio:imu: Add support for the ADIS16480 and similar IMUsLars-Peter Clausen
This patch adds support for the ADIS16375, ADIS16480, ADIS16485, ADIS16488 6 degree to 10 degree of freedom IMUs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio: Factor out fixed point number parsing into its own functionLars-Peter Clausen
Factor out the code for parsing fixed point numbers into its own function and make this function globally available. This allows us to reuse the code to parse fixed point numbers in individual IIO drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio: Add pressure channel typeLars-Peter Clausen
This patch adds support for a new IIO channel type for pressure measurements. This can for example be used for barometric pressure sensors. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio:imu:adis: Add paging supportLars-Peter Clausen
Some of the newer generation devices from the ADIS16XXX series have more registers than what can be supported with the current register addressing scheme. These devices implement register paging to support a larger register range. Each page is 128 registers large and the currently active page can be selected via register 0x00 in each page. This patch implements transparent paging inside the common adis library. The register read/write interface stays the same and when a register is accessed the library automatically switches to the correct page if it is not already selected. The page number is encoded in the upper bits of the register number, e.g. register 0x5 of page 1 is 0x85. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio:imu:adis: Add support for 32bit registersLars-Peter Clausen
Some of the newer generation devices from the ADIS16XXX family have 32bit wide register which spans two 16bit wide registers. This patch adds support for reading and writing a 32bit wide register. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-20iio:imu:adis: Add debugfs register access supportLars-Peter Clausen
Provide a IIO debugfs register access function for the ADIS library. This function can be used by individual drivers to allow raw register access via debugfs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-19staging:iio: Move adis library out of stagingLars-Peter Clausen
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-19iio: Fix iio_buffer_register stub signatureLars-Peter Clausen
Match the iio_buffer_register stub signature up to the real function and make the second parameter const. This fixes a the following warnings if CONFIG_IIO_BUFFER is disabled: drivers/staging/iio/accel/adis16201_core.c: In function ‘adis16201_probe’: drivers/staging/iio/accel/adis16201_core.c:536: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type drivers/staging/iio/accel/adis16203_core.c: In function ‘adis16203_probe’: drivers/staging/iio/accel/adis16203_core.c:468: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type drivers/staging/iio/accel/adis16204_core.c: In function ‘adis16204_probe’: drivers/staging/iio/accel/adis16204_core.c:527: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type drivers/staging/iio/accel/adis16209_core.c: In function ‘adis16209_probe’: drivers/staging/iio/accel/adis16209_core.c:542: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type drivers/staging/iio/accel/adis16240_core.c: In function ‘adis16240_probe’: drivers/staging/iio/accel/adis16240_core.c:588: warning: passing argument 2 of ‘iio_buffer_register’ discards qualifiers from pointer target type Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-13IIO: fix build error in lp8788-charger.cGreg Kroah-Hartman
Turns out that consumer.h needs to include types.h on some platforms to build properly (like powerpc). Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-10staging:iio: add a callback buffer for in kernel push interfaceJonathan Cameron
This callback buffer is meant to be opaque to users, but basically adds a very simple pass through buffer to which data may be pushed when it is inserted into the buffer list. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10staging:iio:in kernel users: Add a data field for channel specific info.Jonathan Cameron
Used to allow information about a given channel mapping to be passed through from board files to the consumer drivers. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10staging:iio: Add support for multiple buffersJonathan Cameron
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-10-29Merge 3.7-rc3 into staging-nextGreg Kroah-Hartman
This resolves the conflict with: drivers/staging/comedi/drivers/amplc_dio200.c and syncs up the changes that happened in the staging directory for 3.7-rc3. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-19iio: Add a logarithmic fractional value typeLars-Peter Clausen
For ADCs or DACs the denominator for fractional types often is a power of two. In this case we can use a shift operation instead of the rather expensive 64 bit division. This patch adds a new fractional type which expects the denominator to be specified as the log2 of the actual denominator. E.g. for ADCs and DACs this will usually be the number of significant bits. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-10-19iio: Add some helper macros for unit conversionLars-Peter Clausen
Some datasheets use a different unit to specify the channel scale than what IIO expects it to be. This patch adds two helper macros which allow to convert units commonly used in datasheets to IIO units: * acceleration: g -> meter / second**2 * angular velocity: degree (/ second) -> rad (/ second) This makes it much more convenient to specify and also easier to verify a channel's scale attribute. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-17iio:inkern: Add function to read the processed valueLars-Peter Clausen
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>
2012-09-17iio: consumer.h: Fix kernel doc incosistencyLars-Peter Clausen
For the iio_read_channel_raw and iio_read_channel_scale the kerneldoc comment refers to an argument called "channel", while the argument is called "chan" in the function signature. This leads to the following warnings from kerneldoc: Warning(include/linux/iio/consumer.h:71): No description found for parameter 'chan' Warning(include/linux/iio/consumer.h:71): Excess function parameter 'channel' description in 'iio_read_channel_raw' Warning(include/linux/iio/consumer.h:109): No description found for parameter 'chan' Warning(include/linux/iio/consumer.h:109): Excess function parameter 'channel' description in 'iio_read_channel_scale' This patch fixes the warnings by naming them consistently. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-15iio: Introduce a new fractional value typeLars-Peter Clausen
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>
2012-09-08iio: Drop timestamp parameter from buffer store_to callbackLars-Peter Clausen
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>
2012-09-06iio: core: Add hysteresis in channel specsrinivas pandruvada
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>
2012-09-03iio: whitespace cleanup and removal of semicolon after functionsPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>