aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-06-10Merge tag 'iio-for-v4.2c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman1-1/+3
Jonathan writes: Third round of new IIO drivers, cleanups and functionality for the 4.2 cycle. Given Linus announced a 4.8rc coming up, hopefully time for one more lot of IIO patches this cycle. Some of these are actually improvements / fixes for patches earlier in the cycle. New device support * st_accel driver - support devices with 8 bit channels. Cleanup * A general cleanup of the iio tools under /tools/ from Hartmut. I'm more than a little embarassed by how bad some of these were! Are well, much more refined and less bug prone now. These cover lots of stuff like unhandled error returns, memory leaks as well as general refactoring to tidy the code up. * iio_simple_dummy - fix memory leaks in the init functions, drop some pointless error returns from functions that never generate errors and make the module parameter explicitly unsigned. * More buffer handling reworks from Lars-Peter, this time targetting hardware buffers (a little used corner that looks likely to get more use in the near future). Specifically: - Always compute the masklength as inkernel buffer users may need it. - Add a means of labeling which buffer modes a given buffer implementation supports. - In the case of hardware buffers, require strict scan matching rather than matching to a superset. Currently the demux is bypassed by these drivers (this may well not change for efficiency reasons) so allowing a superset of channels to be selected would otherwise lead to more data than requested confusing userspace. Driver funcationality improvments * mmc35240 - adds a compensation to the raw values as borrowed form Memsic's own input driver. * mma8452 - event support - event debouncing - high pass filter configuration - triggers * vf610 - allow conversion mode to be adjusted Fixlets * mmc35240 - Off by one error that by coincidence had no real effect. - i2c_device_name should be lowercase. - Lack of null terminator at end of attributes array. - Avoid computing the fractional part of the magnetic field by moving the scaling into userspace where floating point is available to simplify the maths. - Use a smaller sleep before assuming the measurement is done. This is safe and improves the possible polling rate. - Fix sensitivity on z-axis - datasheet disagrees with Memsic's releasedd code and the value used in the code seems to be correct. * stk3310 - make a local variable signed to ensure error handling works. * twl4030 - fix calculation of the temperature sense current - bug unlikely to have ever been noticed as the difference is small. - Fix errors in descriptions.
2015-06-07iio: st_accel: support 8bit channel dataLinus Walleij1-1/+3
Some sensors like the LIS331DL only support 8bit data by a single register per axis. These utilize the MSB byte. Make it possible to register these apropriately. A oneliner change is needed in the ST sensors core to handle 8bit reads as this is the first supported 8bit sensor. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-18Merge 4.1-rc4 into staging-nextGreg Kroah-Hartman1-2/+0
We want the fixes in here for testing and merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-13Merge tag 'iio-fixes-for-4.1a-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman1-2/+0
Jonathan writes: The usual mixed bag of fixes for IIO in the 4.1 cycle. Second version of this pull request as a small fix to a fix turned up before Greg pulled it for a cc10001 patch near the top of the tree. One core fix * Set updated for a iio kfifo was incorrectly set to false during a failed update, resulting in atttempts to repeat the failed operation appearing to succeed. This time I've decided to list the driver fixes in alphabetical order rather than 'randomly'. * axp288_adc - a recent change added a check for valid info masks when reading channels from consumer drivers. * bmp280 - temperature compensation was failing to read the tfine value, hence causing a temperature of 0 to always be returned and incorrect presure measurements. * cc10001 - Fix channel number mapping when some channels are reserved for remote CPUs. Fix an issue with the use of the power-up/power-down register (basically wrong polarity). Fix an issue due to the missinterpretting the return value from regulator_get_voltage. Add a delay before the start bit as recommended for the hardware to avoid data corruption. * hid pressure - fix channel spec of modfiied, but no modifier (which makes no sense!) * hid proximity - fix channel spec of modified, but no modifier (which makes no sense!). Fix a memory leak in the probe function. * mcp320x - occasional incorrect readings on dma using spi busses due to cacheline corruption. Fixed by forcing ___cacheline_aligned for the buffers. * mma9551 - buffer overrun fix (miss specified maximum length of buffers) * mma9553 - endian fix on status message. Add an enable element for activity channel. Input checking for activity period to avoid rather unpredictable results. * spmi-vadc - fix an overflow in the output value normalization seen on some boards. * st-snesors - oops due to use of a mutex that is not yet initialized during probe. * xilinx adc - Some wrong register addresses, a wrong address for vccaux channel, incorrect scale on VREFP and incorrect sign on VREFN.
2015-05-09Merge tag 'iio-for-v4.2a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman2-6/+21
Jonathan writes: First round of new drivers, functionality and cleanups for the 4.2 cycle New drivers / device support * st sensors driver, lsm303dlh magnetometer support. * ltr501 - support ltr301 and ltr559 chips. New functionality * IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors. * kxcjk1013 - make driver operational with external trigger. * Add iio targets to the tools Makefile. Cleanups * st sensors - more helpful error message if device id wrong or irq request fails, explicitly make the Block Data Update optional rather than relying on writes to address 0 not doing anything, make interrupt support optional (Not always wired, and not all devices actually have an interrupt line.) * kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI id as seen in the wild. * sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power management, optimize power usage by powering down when possible, rename the gpio interrupt pin to be more useful, trivial return path simplification, trivial formatting fixes. * isl29018 - move towards ABI compliance with a view to moving this driver out of staging, add some brackets to ensure code works as expected. Note there is no actual bug as the condition being tested is always true (with current devices). * ltr501 - add regmap support to get caching etc for later patches, fix a parameter sanity check that always fails (bug introduced earlier in this series), ACPI enumeration support, interrupt rate control support, interrupt support in general and integration time control support, code alignment cleanups. * mma9553 - a number of little cleanups following a review from Hartmut after I'd already applied the original driver patch. * tmp006 - prefix some defines with TMP006 for consistency. * tsl4531 - cleanup some wrong prefixes, presumably from copy and paste. * mlx90614 - check for errors in read values, add power management, add emissivity setting, add device tree binding documentation, fix a duplicate const warning. * ti_am335x_adc - refactor the DT parsing into a separate function.
2015-05-07iio: st_sensors: make detection more helpfulLinus Walleij1-1/+2
The ST sensors are detected by reading a WhoAmI register and matching the number found to a sensor name string. To make it easier to figure out what happens when things go wrong, print the WhoAmI value and the device name we're trying to match. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07iio: st_sensors: make BDU optionalLinus Walleij1-3/+5
Not all sensors support BDU (block data update) and in fact a bunch of the in-kernel sensor settings do not specify the BDU address field. Make this optional. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07iio: st_sensors: make interrupt optionalLinus Walleij1-1/+11
Some sensors such as magnetometers and pressure sensors doesn't have interrupts at all, and thus no DRDY setting applies. Make the assignment of an interrupt optional, and do not call st_sensors_set_drdy_int_pin() if there is no drdy (data ready) pin specified. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07iio: st_sensors: print error when failing to get IRQLinus Walleij1-1/+3
Print a proper error message if we're missing the trigger IRQ. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio:st_sensors: Fix oops when probing SPI devicesAlban Bedel1-2/+0
In SPI mode the transfer buffer is locked with a mutex. However this mutex is only initilized after the probe, but some transfer needs to be done in the probe. To fix this bug we move the mutex initialization at the beginning of the device probe. Signed-off-by: Alban Bedel <alban.bedel@avionic-design.de> Acked-by: Denis Ciocca <denis.ciocca@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-14Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hidLinus Torvalds2-18/+19
Pull HID updates from Jiri Kosina: - quite a few firmware fixes for RMI driver by Andrew Duggan - huion and uclogic drivers have been substantially overlaping in functionality laterly. This redundancy is fixed by hid-huion driver being merged into hid-uclogic; work done by Benjamin Tissoires and Nikolai Kondrashov - i2c-hid now supports ACPI GPIO interrupts; patch from Mika Westerberg - Some of the quirks, that got separated into individual drivers, have historically had EXPERT dependency. As HID subsystem matured (as well as the individual drivers), this made less and less sense. This dependency is now being removed by patch from Jean Delvare - Logitech lg4ff driver received a couple of improvements for mode switching, by Michal Malý - multitouch driver now supports clickpads, patches by Benjamin Tissoires and Seth Forshee - hid-sensor framework received a substantial update; namely support for Custom and Generic pages is being added; work done by Srinivas Pandruvada - wacom driver received substantial update; it now supports i2c-conntected devices (Mika Westerberg), Bamboo PADs are now properly supported (Benjamin Tissoires), much improved battery reporting (Jason Gerecke) and pen proximity cleanups (Ping Cheng) - small assorted fixes and device ID additions * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (68 commits) HID: sensor: Update document for custom sensor HID: sensor: Custom and Generic sensor support HID: debug: fix error handling in hid_debug_events_read() Input - mt: Fix input_mt_get_slot_by_key HID: logitech-hidpp: fix error return code HID: wacom: Add support for Cintiq 13HD Touch HID: logitech-hidpp: add a module parameter to keep firmware gestures HID: usbhid: yet another mouse with ALWAYS_POLL HID: usbhid: more mice with ALWAYS_POLL HID: wacom: set stylus_in_proximity before checking touch_down HID: wacom: use wacom_wac_finger_count_touches to set touch_down HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT HID: pidff: effect can't be NULL HID: add quirk for PIXART OEM mouse used by HP HID: add HP OEM mouse to quirk ALWAYS_POLL HID: wacom: ask for a in-prox report when it was missed HID: hid-sensor-hub: Fix sparse warning HID: hid-sensor-hub: fix attribute read for logical usage id HID: plantronics: fix Kconfig default HID: pidff: support more than one concurrent effect ...
2015-04-13Merge branch 'for-4.1/sensor-hub' into for-linusJiri Kosina2-18/+19
Conflicts: drivers/iio/common/hid-sensors/hid-sensor-trigger.c include/linux/hid-sensor-hub.h
2015-03-28iio: constify of_device_id arrayFabian Frederick1-1/+1
of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-23HID: hid-sensor-hub: Enhance feature report set APISrinivas Pandruvada2-10/+10
Current API only allows setting one offset in the field. This API is extended to set multiple offsets in the field report. Also update parameters in the users of this API. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-02-23HID: hid-sensor-hub: Enhance get feature report APISrinivas Pandruvada2-8/+9
Some hid sensor feature report can contain more than one reports. This API can now support receiving multiple values from the feature report. Also update the parameters in the users of this API. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-02-22iio: common: ssp_sensors: Protect PM-only functions to kill warningGeert Uytterhoeven1-0/+2
If CONFIG_PM_SLEEP=n: drivers/iio/common/ssp_sensors/ssp_dev.c:644: warning: ‘ssp_suspend’ defined but not used drivers/iio/common/ssp_sensors/ssp_dev.c:669: warning: ‘ssp_resume’ defined but not used Protect the unused functions by #ifdef CONFIG_PM_SLEEP to fix this. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Karol Wrona <k.wrona@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-31iio:common:ssp_sensors fix warnings due to 32 bit instead of 64 bit passed to do_divJonathan Cameron1-4/+5
Also change to div64_u64 in one place to avoid loss of precision (was dividing a 32 bit number by a 64 bit number, but casting this to 64 bit divided by 32 bit) Those divide functions certainly have esoteric naming! Fixes warnings with asm-generic/div64.h do_div such as: In file included from drivers/iio/common/ssp_sensors/ssp_iio.c:20:0: drivers/iio/common/ssp_sensors/ssp_iio_sensor.h: In function 'ssp_convert_to_freq': >> drivers/iio/common/ssp_sensors/ssp_iio_sensor.h:56:16: warning: comparison of distinct pointer types lacks a cast [enabled by default] drivers/iio/common/ssp_sensors/ssp_iio_sensor.h:56:2: warning: right shift count >= width of type [enabled by default] >> drivers/iio/common/ssp_sensors/ssp_iio_sensor.h:56:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default] include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'int *' drivers/iio/common/ssp_sensors/ssp_iio.c: In function 'ssp_common_process_data': include/linux/iio/buffer.h:142:32: warning: 'calculated_time' may be used uninitialized in this function [-Wuninitialized] drivers/iio/common/ssp_sensors/ssp_iio.c:83:10: note: 'calculated_time' was declared here Fixed by using straight coded version as per the description in the div64.h header, thus ensuring no issue with 32 bit integers. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-29iio: common: ssp_sensors: Add sensorhub iio commonsKarol Wrona4-0/+189
This patch adds common library for sensorhub iio drivers. Signed-off-by: Karol Wrona <k.wrona@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-29iio: common: ssp_sensors: Add sensorhub driverKarol Wrona7-0/+1601
Sensorhub is MCU dedicated to collect data and manage several sensors. Sensorhub is a spi device which provides a layer for IIO devices. It provides some data parsing and common mechanism for sensorhub sensors. Adds common sensorhub library for sensorhub driver and iio drivers which uses sensorhub MCU to communicate with sensors. Signed-off-by: Karol Wrona <k.wrona@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-25iio: hid_sensor_hub: Common PM functionsSrinivas Pandruvada2-2/+78
To improvement power and performance, both regular and run time callbacks are introduced. Because of auto suspend delay, two consecutive read don't have to go through full power on/off procedure. The auto suspend time can be adjusted using regular power attributes of PM sysfs. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12iio: common: remove unnecessary sizeof(u8)Fabian Frederick1-1/+1
sizeof(u8) is always 1. Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05Merge tag 'iio-for-3.19a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman3-58/+70
Jonathan writes: First round of new drivers, features and cleanups for IIO in the 3.19 cycle. New drivers / supported parts * rockchip - rk3066-tsadc variant * si7020 humidity and temperature sensor * mcp320x - add mcp3001, mcp3002, mcp3004, mcp3008, mcp3201, mcp3202 * bmp280 pressure and temperature sensor * Qualcomm SPMI PMIC current ADC driver * Exynos_adc - support exynos7 New features * vf610-adc - add temperature sensor support * Documentation of current attributes, scaled pressure, offset and scaled humidity, RGBC intensity gain factor and scale applied to differential voltage channels. * Bring iio_event_monitor up to date with newer modifiers. * Add of_xlate function to allow for complex channel mappings from the device tree. * Add -g parameter to generic_buffer example to allow for devices with directly fed (no trigger) buffers. * Move exynos driver over to syscon for PMU register access. Cleanups, fixes for new drivers * lis3l02dq drop an unneeded else. * st sensors - renam st_sensors to st_sensor_settings (for clarity) * st sensors - drop an unused parameter from all the probe utility functions. * vf610 better error handling and tidy up. * si7020 - cleanups following merge * as3935 - drop some unnecessary semicolons. * bmp280 - fix the pressure calculation.
2014-10-25Merge tag 'iio-fixes-for-3.18a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman1-1/+1
Jonathan writes: First round of IIO fixes for the 3.18 cycle. * ad5933 - fix a null pointer dereference due to an old change that prevents different channels being registered for the buffer and used for sysfs interfaces. * ad5933 - Drop a bonus _raw from attribute names. * st-sensors - Makes sure the correct number of elements are copied when filling a local buffer copy. * mxs-lradc - Disable clocks in a failure path during probe so they aren't left running.
2014-10-04iio: st_sensors: Fix buffer copyRobin van der Gracht1-1/+1
Use byte_for_channel as iterator to properly initialize the buffer. Signed-off-by: Robin van der Gracht <robin@protonic.nl> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: <Stable@vger.kernel.org>
2014-10-04iio:common: Set the device pointer into ST common sensors libraryDenis CIOCCA2-0/+2
Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:imu: changed structure name from st_sensors to st_sensor_settingsDenis CIOCCA1-58/+68
This patch change structure name and related variables names. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-09-22Merge 3.17-rc6 into staging-next.Greg Kroah-Hartman2-2/+3
We want the fixes in there, and it resolves a merge issue with drivers/iio/accel/bma180.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-30iio: sensors-core: st: Check st_sensors_set_drdy_int_pin()'s return valueLee Jones1-1/+4
Value from st_sensors_set_drdy_int_pin() is assigned to err here, but that stored value is not used before it is overwritten. To fix this we're enforcing a check on st_sensors_set_drdy_int_pin()'s return value and if it's an error, we're returning right away. Cc: jic23@kernel.org Cc: linux-iio@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-08-25iio: st_sensors: Fix indio_dev->trig assignmentSrinivas Pandruvada1-1/+1
This can result in wrong reference count for trigger device, call iio_trigger_get to increment reference. Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion with Jonathan. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Stable@vger.kernel.org
2014-08-25iio: hid_sensor_hub: Fix indio_dev->trig assignmentSrinivas Pandruvada1-1/+2
This can result in wrong reference count for trigger device, call iio_trigger_get to increment reference. Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion with Jonathan. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Stable@vger.kernel.org
2014-07-11iio: st_sensors: add devicetree probing supportLinus Walleij1-0/+30
The I2C devices that make up the STMicroelectronics MEMS sensors may be sneakily enabled by cleverly giving the device node the same name as a string match from the platform device ID table. However the right method is to use the compatible string. On detection, the ST sensors use the ID string to probe and instatiate the right sensor driver, so pass the kernel-internal ID string in the .data field of the OF match table, and set the I2C client name to this name when a compatible match is used. This avoids having misc Linux-specific strings floating around in the device tree. Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-07iio: hid-sensors: make hid_sensor_get_reporting_interval staticDaniel Baluta1-0/+1
This fixes the following sparse warning: CHECK drivers/iio/common/hid-sensors/hid-sensor-attributes.c drivers/iio/common/hid-sensors/hid-sensor-attributes.c:346:5: warning: symbol 'hid_sensor_get_reporting_interval' was not declared. Should it be static? Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-07iio: st_sensors: get platform data from device treeLinus Walleij1-1/+34
Currently the STMicroelectronics sensors only support one single platform data item: configuration of the DRDY (data ready) pin for a particular design. Augment the core to prioritize and take this information from the device tree if the parent device has an assigned device node, else fall back to passed in platform data (usually the default data). Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-07iio:st sensors: remove custom sampling frequence attribute in favour of core support.Jonathan Cameron1-29/+0
This allows in kernel client drivers to access this Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
2014-07-05iio: hid-sensors: Fix compilation warningSachin Kamat1-2/+2
Move the 'static' keyword to beginning of definition to silence the following compilation warning: drivers/iio/common/hid-sensors/hid-sensor-attributes.c:34:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-06-18Merge tag 'iio-fixes-for-3.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman1-0/+3
Jonathan writes: First set of IIO fixes for the 3.16 cycle. A mixed bag of fixes, many of which feel just to late for 3.15. * hid sensors - some devices need a feature report request in order to change power state. This isn't part of the spec, but has been observed on several devices and does no harm to others. * mpl3115 has had two errors in the buffer description fixed. The presure is signed, not unsigned and the temperature has 12 bits rather than 16. These could lead to incorrect interpretation of the data in userspace. * tsl2x7x - the high byte of the proximity thresholds should be written along with the low byte (which was). This could lead to interesting results with large thresholds. * twl4030 - a flag to specify processed values were required was not set when initializing a reading. As such values returned were in an unknown state. Fixed by simply initializing it appropriately. * IIO_SIMPLE_DUMMY_BUFFER did not select IIO_BUFFER leading to randconfig build errors. * ak8975 was applying an unwanted le16_to_cpu conversion as the i2c framework already performs one. As such for big endian systems, the bytes would be in the wrong order in the magnetic field measurements reported. * mxs-lradc - the controllable voltage dividers were not enabled / disabled for later channels than the first one during conversion. * at91_adc error handling returned -ENOMEM in a u8. Return value of at91_adc_get_trigger_value_by_name changed to int thus allowing -ENOMEM and also original values to be returned. * mcb - mcb_request_mem returns and ERR_PTR but the caller was checking for NULL to detect an error.
2014-05-29iio: hid-sensors: Get feature report from sensor hub after changing power stateArchana Patni1-0/+3
Some sensor hubs require a get feature report call to be issued soon after changing the power state of the sensor. Without this, the sensor remains in the current state. This patch adds a call soon after the power state. This is retained as a generic call across all sensor hubs since the behavior has been noticed on more than one implementation. Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-10iio: hid-sensors: Set default unit of measure for report intervalArchana Patni1-2/+15
For PROP_REPORT_INTERVAL, the spec does not mandate the presence of the report interval unit in the feature report and expects the default unit of measure to be used as milliseconds. Currently, when the unit is not present, it gets set as zero leading to issues in sampling frequency. This patch sets the unit of measure to the default unit if it is not defined by firmware. Signed-off-by: Archana Patni <archana.patni@intel.com> Signed-off-by: Subramony Sesha <subramony.sesha@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-10iio: hid-sensors: typo leads to potential forever loopDan Carpenter1-1/+1
The "i < " was missing in this condition. Fixes: 5d02edfc3957 ('iio: hid-sensors: Convert units and exponent') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05iio: hid-sensors: Add API to power on/offSrinivas Pandruvada2-4/+14
Added an API to allow client drivers to turn ON and OFF sensors for quick read. Added data_read as counting varaible instead of boolean, so that sensor is powered off only when last user released it. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05iio: hid-sensors: Add api to get poll valueSrinivas Pandruvada1-0/+20
Added interface to get poll value in milli-seconds. This value is changed by changing sampling frequency. This API allows clients to wait for at least some poll milli seconds before reading a new sample. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05iio: hid-sensors: Convert units and exponentSrinivas Pandruvada1-0/+114
HID sensor hub specify a default unit and alternative units. This along with unit exponent can be used adjust scale. This change change HID sensor data units to IIO defined units for each sensor type. So in this way user space can use a simply use: "(data + offset) * scale" to get final result. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-04-26Merge tag 'iio-for-3.16a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman1-0/+37
Jonathan writes: First round of IIO new driver, functionality and cleanups for the 3.16 cycle. New device support * AS3935 Lightning Sensor * MCP3426/7/8 support added to the existing MCP3422 ADC driver * AK8963 support in the AK8975 driver * MPU6500 support in the MPU6050 driver (the functionality that is different is mostly not supported yet in either part). Staging Graduations * AD799x ADC New functionality * ACPI enumeration for the ak8975 driver Cleanup / tweaks * Use snprintf as a matter of good practice in a few additional places. * Document *_mean_raw attributes. These have been there a while, but were undocumented. * Add an in kernel interface to get the mean values. * Bug in the length of the event info mask that by coincidence wasn't yet actually causing any problems. * itg3000 drop an unreachable return statement. * spear_adc cleanups (heading for a staging graduation but a few more issues showed up in the review of these patches). * Exynos ADC dependencies changed so it is only built when Exynos is present or COMPILE_TEST and OF are set. * tsl2583 cleanups. * Some cut and paste typos in the comments of various drivers still in staging. * Couple of minor improvements to the ST sensor drivers.
2014-04-26iio: st_sensors: move regulator retrieveal to coreLinus Walleij1-0/+37
Currently the pressure sensor has code to retrieve and enable two regulators for Vdd and Vdd IO, but actually these voltage inputs are found on all of these ST sensors, so move the regulator handling to the core and make sure all the ST sensors call these functions on probe() and remove() to enable/disable power. Here also mover over to obtaining the regulator from the *parent* device of the IIO device, as the IIO device is created on-the-fly in this very subsystem it very unlikely evert have any regulators attached to it whatsoever. It is much more likely that the parent is a platform device, possibly instantiated from a device tree, which in turn have Vdd and Vdd IO supplied assigned to it. Cc: Lee Jones <lee.jones@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-17iio: hid-sensor-hub: Remove hard coded indexesSrinivas Pandruvada1-14/+25
Remove the hard coded indexes, instead search for usage id and use the index to set the power and report state. This will fix issue, where the report descriptor doesn't contain the full list of possible selector for power and report state. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-12-02iio: hid-sensors: Fix power and report stateSrinivas Pandruvada2-14/+15
In the original HID sensor hub firmwares all Named array enums were to 0-based. But the most recent hub implemented as 1-based, because of the implementation by one of the major OS vendor. Using logical minimum for the field as the base of enum. So we add logical minimum to the selector values before setting those fields. Some sensor hub FWs already changed logical minimum from 0 to 1 to reflect this and hope every other vendor will follow. There is no easy way to add a common HID quirk for NAry elements, even if the standard specifies these field as NAry, the collection used to describe selectors is still just "logical". Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-11-02iio: hid_Sensors: fix crash during trigger unregisterSrinivas Pandruvada2-6/+5
We can't store the trigger instance created by iio_trigger_alloc, in trig field of iio_device structure. This needs to be stored in the driver private data. Othewise it can result in crash during module unload. Hence created a trig_ptr in the common data structure for each HID sensor IIO driver and storing here. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01IIO: call sensor hub open close functionSrinivas Pandruvada1-0/+6
Call hid_sensor_hub_device_open when user space opens device and call hid_sensor_hub_device_close when device is closed. This helps in saving power. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()Lee Jones1-5/+3
Gets rid of those unnecessary gotos. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()Lee Jones1-5/+4
Strip out all those unnecessary gotos and just return the error right away. Aids to simplicity and reduces code. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>