aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-10-25iio: gyro: Add driver for the MPU-3050 gyroscopeLinus Walleij5-0/+1549
This adds a new driver for the Invensense MPU-3050 gyroscope. This driver is based on information from the rough input driver in drivers/input/misc/mpu3050.c and the scratch misc driver posted by Nathan Royer in 2011. Some years have passed but this is finally a fully-fledged driver for this gyroscope. It was developed and tested on the Qualcomm APQ8060 Dragonboard. The driver supports both raw and buffered input. It also supports the internal trigger mechanism by registering a trigger that can fire in response to the internal sample engine of the component. In addition to reading out the gyroscope sensor values, the driver also supports reading the temperature from the sensor. The driver currently only supports I2C but the MPU-3050 can also be used from SPI, so the I2C portions are split in their own file and we just use regmap to access all registers, so it will be trivial to plug in SPI support if/when someone has a system requiring this. To conserve power, the driver utilizes the runtime PM framework and will put the sensor in off mode and disable the regulators when unused, after a timeout of 10 seconds. The fullscale can be set for the sensor to 250, 500, 1000 or 2000 deg/s. This corresponds to scale values of rougly 0.000122, 0.000275, 0.000512 or 0.001068. By writing such values (or close to these) into "in_anglevel_scale", the corresponding fullscale can be chosen. It will default to 2000 deg/s (~35 rad/s). The gyro component can have DC offsets on all axes. These can be compensated using the standard sysfs ABI property "in_anglevel_[xyz]_calibbias". This is in positive/negative values of the raw values, so a suitable calibration bias can be determined by userspace by reading the "in_anglevel_[xyz]_raw" for a few iterations while holding the sensor still, create an average integer, and writing the negative inverse of that into "in_anglevel_[xyz]_calibbias". After this the hardware will automatically subtract the bias, also when using buffered readings. Since the MPU-3050 has an outgoing I2C port it needs to act as an I2C mux. This means that the device is switching I2C traffic to devices beyond it. On my system this is the only way to reach the accelerometer. The "sensor fusion" ability of the MPU-3050 to directly talk to the device on the outgoing I2C port is currently not used by the driver, but it has code to allow I2C traffic to pass through so that the Linux kernel can reach the device on the other side with a kernel driver. Example usage with the native trigger: $ generic_buffer -a -c10 -n mpu3050 iio device number being used is 0 iio trigger number being used is 0 No channels are enabled, enabling all channels Enabling: in_anglvel_z_en Enabling: in_timestamp_en Enabling: in_anglvel_y_en Enabling: in_temp_en Enabling: in_anglvel_x_en /sys/bus/iio/devices/iio:device0 mpu3050-dev0 29607.142578 -0.117493 0.074768 0.012817 180788797150 29639.285156 -0.117493 0.076904 0.013885 180888982335 29696.427734 -0.116425 0.076904 0.012817 180989178039 29742.857422 -0.117493 0.076904 0.012817 181089377742 29764.285156 -0.116425 0.077972 0.012817 181189574187 29860.714844 -0.115356 0.076904 0.012817 181289772705 29864.285156 -0.117493 0.076904 0.012817 181389971520 29910.714844 -0.115356 0.076904 0.013885 181490170483 29917.857422 -0.116425 0.076904 0.011749 181590369742 29975.000000 -0.116425 0.076904 0.012817 181690567075 Disabling: in_anglvel_z_en Disabling: in_timestamp_en Disabling: in_anglvel_y_en Disabling: in_temp_en Disabling: in_anglvel_x_en The first column is the temperature in millidegrees, then the x,y,z axes in succession followed by the timestamp. Also tested successfully using the HRTimer trigger. Cc: Nick Vaccaro <nvaccaro@google.com> Cc: Ge Gao <ggao@invensense.com> Cc: Anna Si <asi@invensense.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Crestez Dan Leonard <leonard.crestez@intel.com> Cc: Daniel Baluta <daniel.baluta@intel.com> Cc: Gregor Boirie <gregor.boirie@parrot.com> Cc: Peter Rosin <peda@axentia.se> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-24Merge tag 'iio-for-4.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman51-196/+6800
Jonathan writes: First round of IIO new device support, features and cleanups for the 4.10 cycle. Fair number of outreachy related patches in here. Some of these may well have already been picked up by Greg but git will sort that out for us. Also some good staging cleanup work from other sources. Thanks Brian and Lars in particular for this. New device support * ACCES 104-quad-8 - New driver for this 8 channel encoder input board. Lots of new ABI with this one. * AD7766 - New driver supporting AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1 and AD7767-2 24 bit ADCs. * dmard 10 - New driver for this 3 axis accelerometer. * Honeywell ABP pressure sensors. - New driver covering 56 parts in this series (too many to list here!) * HTS221 - New driver to support this relative humidiy and temperature device. * LMP91000 - New driver for this potentiostat (form of chemical sensor). Nice example of use of the buffered consumer interfaces and the use of a consumer provided trigger. * MiraMEMS DA311 - New driver for this 3 axis accelerometer. * MiraMEMS DA280 - New driver for this 3 axis accelerometer. Follow up caught up with vendor prefixes for these. Staging graduations * isl29018 light sensor - Fixes and cleanups listed below (thanks for your hard work on this Brian!) * sca3000 - Fixes and cleanups listed below. This was one of the small set of drivers that went into staging when IIO was first added. Turns out it had a few bugs and needed to be brought into the modern era! Not clear if I am the only person who actually has one of these still wired to a board. New features (Core) - Add an iio_trigger_validate_own_device helper which relies on the device and trigger having the same parent. Convenient to have this for some of the more complex trigger / device interactions. Was hand rolled in a few drivers already so good to bring it into the core. - Add an iio_read_channel_offset in kernel access helper (similar to the existing one for scale). - IIO_ATTR_{RO, WO, RW} and IIO_DEVICE_ATTR_{RO, WO, RW} macros. These lead some rather contrived function naming, but there is no denying they do reduced boilerplate. I'm going to resist their introduction in drivers 'unless' they form part of a larger set of cleanups. - Counter channel type and index type. New features (Drivers) * hdc100x - Triggered buffer support. * mcp4725 - Device tree bindings and support. - Voltage reference selection. * ti-adc0832 - Triggered buffer support. * ti-adc161s626 - Add regulator support allowing _scale and _offset values to be established and exported. New features (Tools) * iio_generic_buffer - -A option to force enable all channels rather than faulting if some are already enabled (like -a does). Followup patches tidied this support up. Cleanups (Core) - Use kmalloc_array in iio_scan_mask_set. - Take event_attrs field of iio_info structure constant - Staging todo list updates. Most of it was long done. - MAINTAINERS had a wrong directory listing. Cleanups (Drivers) * Missing i2c trivial devices entries. * ad5592r - Fix an endian type related sparse warnings. * ad7150 - Constify the event attribute_group structures. * ad7152 - Add some blank lines to improve readability. - Sampling frequency control via chan-info element rather than hand rolled attributes. - add a new lock to avoid use of mlock for non state change related locking. * ad7280 - Constify atrribute_group structure (second patch covers the event ones) * ad7606 (Lars is driving most of the cleanup on this with some additions from Eva) - Fix improper setting of oversampling pins. This has been broken a very long time in this staging driver, so not going to push this back to stable. - Implement oversampling configuration via the chan_info mask element. - Remove an unused int_vref_mv field. - Remove a reundant name field from ad7606_chip_info. - Remove default device configuration from platform_data in favour of whatever the power on defaults are. - Remove out of band error reporting in the kernel log as not providing much information. - Fix oversampling ratio by having 1 be the value for no oversampling. - Avoid allocating buffer for each data capture. - Factor out common code between periodic and one-shot capture. - Move set_drvdat into common code. - Let the common probe function return int rather than jumping through an ERR_PTR. - Pass struct device * into common remove to simplify code. - Always run trigger handler only once per event (no one can remember why it was being possibly done twice). - Move over to the GPIO descriptor API to shorten and clarify code. - Move the buffer code into the main file as it's not optional and is now rather short in this driver. - Fix the naming of the supply regulator. - Rework regulator handling to handle errors including deferred probing. - Tidy up a ptr_err or 0 return. * ad7746 - Sampling frequency control via info_mask element rather than hand rolled * ad7758 - Sampling frequency control via info_mask element rather than hand rolled attributes. * ad7816 - Constify the event attribute_group structure. * adt7316 - Constify the event attribute group structures. * ak8974 - Cleanup some sparse warnings about endian types. * ak8975 - Cleanup some sparse warnings about endian types. * bmi160 - Spare endian warning cleanups. * isl29018 (towards staging graduation) - Remove unusedvariables and defines. - Improve consistency of error handling. - Signed / unsigned comparison fixes. - Use the IIO_DEVICE_ATTR_{RO, RW} macros - Fix a race in in_illuminance_scale_available_show. - Cleanup exit points of _read_raw - Sanity check if in suspended state during a write_raw call as was already done for read_raw. - Document device tree bidnings. - Document infrared supression controls. - Add some newlines to improve readability and drop one that shouldn't be there. - Fix a poorly named functions name. - Fix multiline coment syntax. - Tidy up a pair or return statements by unifying them. - Rename description in Kconfig for consistency with similar drivers. * lidar - cleanup power management by dropping unnecessary call. * ltr501 - Use the claim_direct_mode helpers. Fix a race condition along the way. * max1027 - Fix a dubious x | !y sparse warning. - Use the new iio_trigger_validate_own_device helper. * max440000 - Clean up some sparse warnings about endian types. * mcp4725 - Use the regulator framework to establish the reference voltage rather than getting it from platform data. - Tidy up a comment typo. - Fix a wrong PTR_ERR query (wrong regulator). * mma7660 - Take a mma7660_nscale static. * mma8452 - Use the new iio_trigger_validate_own_device helper. - Use claim_direct_mode helpers - fix a race condition along the way. * mpl3115 - Use claim_direct_mode helpers - fix a race condition along the way. * ms65611 - Tidy up regulator error handling and clean out a static warning in the mix. * sca3000 - Avoid a potential unitialized variable if a hardware read returns a value that isn't actually supported (mostly warning supression). - Fix a use before setting of the indio_dev->buffer pointer. Broken for a very long time so not going to rush this into stable. - Merge buffer file with core file. We used to always split these. Sometimes it's just not worth the hassle. In this case the device's main feature is it's hardware fifos so unlikely anyone would want to run it without. - Drop the sca3000_register_ring_funcs function as it's a pointless wrapper once we have only one file. - Fix cleaning of flag + setting of size of scan. Without this you can't start the buffer twice and expect sensible (or any) results. Again, broken for a long time so not heading for stable. - Drop the custom watershed setting ABI - for now we'll just support one value. - Move to a hybrid hard / soft buffer design (how we've been doing it for similar devices for a while now!) - Cleanup some unusued variables. - Use a fake channel to support core handling of freefall event registration. - Cleanup the register defines. - Fix an off by one error in axis due to IIO_NO_MOD taking up the 0 value. Been broken since first admission of IIO to the staging tree. - Add readback of the 3db low pass filter frequency and later writing allowing droppign of custom measurement mode attributes as they can be represented by the filter choices that is their main characteristic. - Drop non standard revision attr and replace with dev_info on probe. - Avoid a race in probe. - Various formatting fixes. - Kernel-docify docs that were very nearly in the write format. * tsl2583 - Constify attribute_group structure. * zpa2326 - Drop a redundant DEBUG ifdef. Cleanups (Tools) * iio_generic_buffer - Fix the ? arguement. Previously it sort of worked as you got the help message as a result of it not recognising the arguement.
2016-10-24Merge tag 'iio-fixes-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman3-10/+15
Jonathan writes: First set of IIO fixes for the 4.9 cycle. * atlas chemical - Fix alignment of big endian values in a larger storage (by using the right size storage) * maxim thermocouple - Fix alignment of big endian values in larger (by using the correct sized storage). * sca3000 - Handle unexpected mode values. * ti-adc081 - Select IIO_TRIGGERED_BUFFER to avoid build errors
2016-10-23iio:chemical:atlas-ph-sensor: Fix use of 32 bit int to hold 16 bit big endian valueSandhya Bankar1-3/+4
This will result in a random value being reported on big endian architectures. (thanks to Lars-Peter Clausen for pointing out the effects of this bug) Only effects a value printed to the log, but as this reports the settings of the probe in question it may be of direct interest to users. Also, fixes the following sparse endianness warnings: drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16 Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Fixes: e8dd92bfbff25 ("iio: chemical: atlas-ph-sensor: add EC feature") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: dac: mcp4725: fix odd_ptr_err.cocci warningsJulia Lawall1-1/+1
PTR_ERR should access the value just tested by IS_ERR Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci CC: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: proximity: pulsedlight-lidar-lite-v2: cleanup power managementMatt Ranostay1-2/+0
Remove pm_runtime_mark_last_busy() call that wasn't need in the probe since the device should be put to sleep. Clarification from Matt: Basically it going to be suspended once pm_runtime_idle() is called, and setting the last busy is useless and not needed. Clearly this doesn't affect the device running but just makes the code more consistent with other uses. Signed-off-by: Matt Ranostay <matt@ranostay.consulting> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: ti-adc0832: add triggered buffer supportAkinobu Mita2-19/+89
This adds triggered buffer support for the ti-adc0832 driver. Tested with ADC0831 and ADC0832 by using SYSFS trigger. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: humidity: hdc100x: add triggered buffer support for HDC100XAlison Schofield2-2/+130
Triggered buffer support uses the HDC100X's dual acquisition mode to read both humidity and temperature in one shot. This patch depends on 447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of temp and humidity") Signed-off-by: Alison Schofield <amsfield22@gmail.com> Cc: Daniel Baluta <daniel.baluta@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: dac: mcp4725: add devicetree supportTomas Novotny1-6/+37
Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: dac: mcp4725: support voltage reference selectionTomas Novotny1-7/+92
MCP47x6 chip supports selection of a voltage reference (VDD, VREF buffered or unbuffered). MCP4725 doesn't have this feature thus the eventual setting is ignored and user is warned. The setting is stored only in the volatile memory of the chip. You need to manually store it to the EEPROM of the chip via 'store_eeprom' sysfs entry. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: dac: mcp4725: fix incorrect commentTomas Novotny1-1/+1
Number 2 is referencing to the settings with the largest available resistor. No functional change. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: humidity: add support to hts221 rh/temp combo deviceLorenzo Bianconi7-0/+1193
Add support to STM HTS221 humidity + temperature sensor http://www.st.com/resource/en/datasheet/hts221.pdf - continuous mode support - i2c support - spi support - trigger mode support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: light: ltr501: claim direct mode during raw writesAlison Schofield1-30/+51
Driver was checking for direct mode but not locking it. Use claim/release helper functions to guarantee the device stays in direct mode during all raw write operations. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: light: ltr501: claim direct mode during select raw readsAlison Schofield1-10/+20
Driver was checking for direct mode but not locking it. Use claim/release helper functions to guarantee the device stays in direct mode during required raw read cases. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23staging:iio:accel:sca3000 Move out of staging.Jonathan Cameron3-0/+1590
Now the driver is in a reasonable state, lets get it (finally) out of staging. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2016-10-23staging: iio: isl29018: move out of stagingBrian Masney3-0/+860
Move ISL29018/ISL29023/ISL29035 driver out of staging into mainline. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: pressure: mpl3115: claim direct mode during raw readsAlison Schofield1-9/+17
Driver was checking for direct mode but not locking it. Use claim/release helper functions to guarantee the device stays in direct mode during raw reads. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: accel: mma8452: claim direct mode during write rawJonathan Cameron1-22/+38
Driver was checking for direct mode but not locking it. Use claim/release helper functions to guarantee the device stays in direct mode during all write raw operations. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: accel: mma8452: claim direct mode during raw readsAlison Schofield1-2/+4
Driver was checking for direct mode but not locking it. Use claim/release helper functions to guarantee the device stays in direct mode during raw reads. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: dac: mcp4725: use regulator frameworkTomas Novotny1-9/+37
Use a standard framework to get the reference voltage. It is done that way in the iio subsystem and it will simplify extending of the driver. Structure mcp4725_platform_data is left undeleted because it used in the next patch. This change breaks the current users of the driver, but there is no mainline user of struct mcp4725_platform_data. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: ms65611_core: Fixes dereferencing regulator pointerCrt Mori1-11/+8
Change in handling of the regulator description means that static checkers correctly assume we could be using dereferenced pointer to the regulator. In reality we will never get the -ENODEV error, as current behavior flow does not predict it, because: If the device tree or board file does not define suitable regulators for the component, it will be substituted by a dummy regulator, or, if regulators are disabled altogether, by stubs. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23iio: bmi160_core: Fix sparse warning due to incorrect type in assignmentsayli karnik1-1/+2
There is a type mismatch between the buffer which is of type s16 and the samples stored, which are declared as __le16. Fix the following sparse warning: drivers/iio/imu/bmi160/bmi160_core.c:411:26: warning: incorrect type in assignment (different base types) drivers/iio/imu/bmi160/bmi160_core.c:411:26: expected signed short [signed] [short] [explicitly-signed] <noident> drivers/iio/imu/bmi160/bmi160_core.c:411:26: got restricted __le16 [addressable] [usertype] sample This is a cosmetic-type patch since it does not alter code behaviour. The le16 is going into a 16bit buf element, and is labelled as IIO_LE in the channel buffer definition. Signed-off-by: sayli karnik <karniksayli1995@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11iio: accel: Add driver for the MiraMEMS DA280 3-axis 14-bit digital accelerometerHans de Goede3-0/+194
Add an iio driver for the MiraMEMS DA280 3-axis 14-bit accelerometer, as well as for the DA226 which is a fully compatible 2-axis version. Datasheets for the DA280 and DA226 can be found at the manufacturers site: http://www.miramems.com/en/products.asp?list=1 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11iio: accel: Add driver for the MiraMEMS DA311 3-axis 12-bit digital accelerometerHans de Goede3-0/+316
This driver is based on the DA311 Android driver which can be found here: https://git.matricom.net/Firmware/kernel_amlogic_meson-common/tree/1e70113a5befd07debb68f537156def84c5be57a/drivers/amlogic/input/sensor the mir3da_* files are the DA311 driver. Unfortunately there is no datasheet. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-11iio: accel: Add driver for dmard10 3-axis AccelerometerHans de Goede3-0/+277
Add a driver for the Domintech ARD10 3-axis Accelerometer, based on the android driver found here: https://github.com/domintech/dmard10 Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-09iio: adc: ti-adc081c: Select IIO_TRIGGERED_BUFFER to prevent build errorsMika Westerberg1-0/+2
Commit 08e05d1fce5c ("ti-adc081c: Initial triggered buffer support") added triggered buffer support but that also requires CONFIG_IIO_TRIGGERED_BUFFER, otherwise we get errors from linker such as: drivers/built-in.o: In function `adc081c_remove': drivers/iio/adc/ti-adc081c.c:225: undefined reference to `iio_triggered_buffer_cleanup' Fix these by explicitly selecting both CONFIG_IIO_TRIGGERED_BUFFER and CONFIG_IIO_BUFFER in Kconfig for the driver. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-05Merge tag 'staging-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds69-324/+8182
Pull staging and IIO updates from Greg KH: "Here is the big staging and IIO driver pull request for 4.9-rc1. There are a lot of patches in here, the majority due to the drivers/staging/greybus/ subsystem being merged in with full development history that went back a few years, in order to preserve the work that those developers did over time. Lots and lots of tiny cleanups happened in the tree as well, due to the Outreachy application process and lots of other developers showing up for the first time to clean code up. Along with those changes, we deleted a wireless driver, and added a raspberrypi driver (currently marked broken), and lots of new iio drivers. Overall the tree still shrunk with more lines removed than added, about 10 thousand lines removed in total. Full details are in the very long shortlog below. All of this has been in the linux-next tree with no issues. There will be some merge problems with other subsystem trees, but those are all minor problems and shouldn't be hard to work out when they happen (MAINTAINERS and some lustre build problems with the IB tree)" And furter from me asking for clarification about greybus: "Right now there is a phone from Motorola shipping with this code (a slightly older version, but the same tree), so even though Ara is not alive in the same form, the functionality is happening. We are working with the developers of that phone to merge the newer stuff in with their fork so they can use the upstream version in future versions of their phone product line. Toshiba has at least one chip shipping in their catalog that needs/uses this protocol over a Unipro link, and rumor has it that there might be more in the future. There are also other users of the greybus protocols, there is a talk next week at ELC that shows how it is being used across a network connection to control a device, and previous ELC talks have showed the protocol stack being used over USB to drive embedded Linux boards. I've also talked to some people who are starting to work to add a host controller driver to control arduinos as the greybus PHY protocols are very useful to control a serial/i2c/spio/whatever device across a random physical link, as it is a way to have a self-describing device be attached to a host without needing manual configuration. So yes, people are using it, and there is still the chance that it will show up in a phone/laptop/tablet/whatever from Google in the future as well, the tech isn't dead, even if the original large phone project happens to be" * tag 'staging-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (3703 commits) Staging: fbtft: Fix bug in fbtft-core staging: rtl8188eu: fix double unlock error in rtw_resume_process() staging:r8188eu: remove GEN_MLME_EXT_HANDLER macro staging:r8188eu: remove GEN_DRV_CMD_HANDLER macro staging:r8188eu: remove GEN_EVT_CODE macro staging:r8188eu: remove GEN_CMD_CODE macro staging:r8188eu: remove pkt_newalloc member of the recv_buf structure staging:r8188eu: remove rtw_handle_dualmac declaration staging:r8188eu: remove (RGTRY|BSSID)_(OFT|SZ) macros staging:r8188eu: change rtl8188e_process_phy_info function argument type Staging: fsl-mc: Remove blank lines Staging: fsl-mc: Fix unaligned * in block comments Staging: comedi: Align the * in block comments Staging : ks7010 : Fix block comments warninig Staging: vt6655: Remove explicit NULL comparison using Coccinelle staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants staging: rtl8188eu: core: rtw_xmit: Move constant of the right side staging: dgnc: Fix lines longer than 80 characters Staging: dgnc: constify attribute_group structures Staging: most: hdm-dim2: constify attribute_group structures ...
2016-10-03Merge tag 'char-misc-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-miscLinus Torvalds1-2/+0
Pull char/misc driver updates from Greg KH: "Here's the "big" char and misc driver update for 4.9-rc1. Lots of little things here, all over the driver tree for subsystems that flow through me. Nothing major that I can discern, full details are in the shortlog. All have been in the linux-next tree with no reported issues" * tag 'char-misc-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (144 commits) drivers/misc/hpilo: Changes to support new security states in iLO5 FW at25: fix debug and error messaging misc/genwqe: ensure zero initialization vme: fake: remove unexpected unlock in fake_master_set() vme: fake: mark symbols static where possible spmi: pmic-arb: Return an error code if sanity check fails Drivers: hv: get rid of id in struct vmbus_channel Drivers: hv: make VMBus bus ids persistent mcb: Add a dma_device to mcb_device mcb: Enable PCI bus mastering by default mei: stop the stall timer worker if not needed clk: probe common clock drivers earlier vme: fake: fix build for 64-bit dma_addr_t ttyprintk: Neaten and simplify printing mei: me: add kaby point device ids coresight: tmc: mark symbols static where possible coresight: perf: deal with error condition properly Drivers: hv: hv_util: Avoid dynamic allocation in time synch fpga manager: Add hardware dependency to Zynq driver Drivers: hv: utils: Support TimeSync version 4.0 protocol samples. ...
2016-10-03iio: magnetometer: ak8974: small endianness fixesIco Doornekamp1-4/+4
Fixes two cases of 'cast to restricted __le16' as reported by sparse. Signed-off-by: Ico Doornekamp <ico@pruts.nl> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8William Breathitt Gray5-0/+626
The ACCES 104-QUAD-8 is a general purpose quadrature encoder counter/interface board. The 104-QUAD-8 is capable of monitoring the outputs of eight encoders via four on-board LSI/CSI LS7266R1 24-bit dual-axis quadrature counter chips. Core functions handled by the LS7266R1, such as direction and total count, are available. Performing a write to a counter's IIO_CHAN_INFO_RAW sets the counter and also clears the counter's respective error flag. Although the counters have a 25-bit range, only the lower 24 bits may be set, either directly or via a counter's preset attribute. Interrupts are not supported by this driver. This driver adds IIO support for the ACCES 104-QUAD-8 and ACCES 104-QUAD-4. The base port addresses for the devices may be configured via the base array module parameter. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01iio: Implement counter channel type and info constantsWilliam Breathitt Gray1-0/+2
Quadrature encoders, such as rotary encoders and linear encoders, are devices which are capable of encoding the relative position and direction of motion of a shaft. This patch introduces several IIO constants for supporting quadrature encoder counter devices. IIO_COUNT: Current count (main data provided by the counter device) IIO_INDEX: Counter device index value Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01iio: pressure: Add driver for Honeywell ABP familyMarcin Malagowski3-0/+287
This patch adds minimal driver for the Honeywell Amplified Basic Pressure sensors series. Sensors are pretty simple but are available in many variants: - psi/mbar/kPa output, - analog/i2c/spi, - gage/differential measurement, - different measure ranges etc. Refer to datasheets for more details: http://sensing.honeywell.com/honeywell-sensing-basic-board-mount-pressure-sensors-abp-series-datasheet-323005128-c-en.pdf http://sensing.honeywell.com/index.php%3Fci_id%3D45841 Driver internals: - i2c only. measure request is done by the SMBUS QUICK cmd, so if the i2c bus doesn't support it, it is required to send a dummy byte to trigger measurement, - since iio sysfs expects kilopascals, mbar-variants are treated as their respective kPa-s, hence i2c id-table has doubled entries in one line: { "abp060mg", ABP006KG }, { "abp006kg", ABP006KG }, - psi-variants have prescaled values in config, - no temperature reads yet. Work remained: - optional temperature channel, - SPI support, - DT binding. Changes since v1: - mutex is now locked in read_raw(), - corrected error codes, - fixed coding style issues, - renamed few defines and functions abp -> abp060mg (some structs left as they were to keep the sensible meaning). Signed-off-by: Marcin Malagowski <mrc@bourne.st> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-01iio: maxim_thermocouple: Align 16 bit big endian value of raw readssayli karnik1-7/+9
Driver was reporting invalid raw read values for MAX6675 on big endian architectures. MAX6675 buffered mode is not affected, nor is the MAX31855. The driver was losing a 2 byte read value when it used a 32 bit integer buffer to store a 16 bit big endian value. Use big endian types to properly align buffers on big endian architectures. Fixes following sparse endianness warnings: warning: cast to restricted __be16 warning: cast to restricted __be32 Fixes checkpatch issue: CHECK: No space is necessary after a cast Signed-off-by: sayli karnik <karniksayli1995@gmail.com> Fixes: 1f25ca11d84a ("iio: temperature: add support for Maxim thermocouple chips") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27drivers: iio: magnetometer: Fix sparse endianness warnings cast to restricted __be16Sandhya Bankar1-7/+9
Fix the following sparse endianness warnings: drivers/iio/magnetometer/ak8975.c:716:16: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:837:19: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:838:19: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:839:19: warning: cast to restricted __le16 Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio: potentiostat: add LMP91000 supportMatt Ranostay5-0/+476
Add support for the LMP91000 potentiostat which is used for chemical sensing applications. Signed-off-by: Matt Ranostay <matt@ranostay.consulting> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio: adc: ti-adc161s626: add regulator supportMatt Ranostay1-11/+44
Allow IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_OFFSET attributes for processing by checking voltage from a regulator. Signed-off-by: Matt Ranostay <matt@ranostay.consulting> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio: inkern: add iio_read_channel_offset helperMatt Ranostay1-13/+26
Allow access to underlying channel IIO_CHAN_INFO_OFFSET from a consumer. Signed-off-by: Matt Ranostay <matt@ranostay.consulting> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27drivers: iio: light: Fix sparse warningsSandhya Bankar1-2/+3
Fixing below warnings: drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16 drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16 drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16 drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16 Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio:adc: Add support for AD7766/AD7767Lars-Peter Clausen3-0/+343
Add support for the AD7766, AD7766-1, AD7766-2, AD7767, AD7767-1, AD7767-2 Analog to Digital converters. It's a family of single channel 24-bit SAR ADCs. They are all digital interface compatible and the main difference is the internal decimation rate and analog performance. For communication with the host processor a SPI interface is used. In addition the part has a data ready pin that is pulsed for one MCLK cycle when a conversion has completed and can be used as a IIO trigger. Datasheets: http://www.analog.com/media/en/technical-documentation/data-sheets/AD7766.pdf http://www.analog.com/media/en/technical-documentation/data-sheets/AD7767.pdf Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio:max1027: Use iio_trigger_validate_own_device() helperLars-Peter Clausen1-12/+1
Use the new iio_trigger_validate_own_device() to verify that the trigger can only be attached to the matching IIO device rather than using a custom variant. While the implementation of iio_trigger_validate_own_device() and the custom variant and are not identical their behaviour is. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio:mma8452: Use new iio_trigger_validate_own_device() helperLars-Peter Clausen1-12/+1
Use the new iio_trigger_validate_own_device() to verify that the trigger can only be attached to the matching IIO device rather than using a custom variant. While the implementation of iio_trigger_validate_own_device() and the custom variant and are not identical their behaviour is. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27iio:trigger: Add helper function to verify that a trigger belongs to the same deviceLars-Peter Clausen1-0/+21
Some triggers can only be attached to the IIO device that corresponds to the same physical device. Currently each driver that requires this implements its own trigger validation function. Introduce a new helper function called iio_trigger_validate_own_device() that can be used to do this check. Having a common implementation avoids code duplication and unnecessary boiler-plate code. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27drivers: iio: dac: Fix sparse warningSandhya Bankar1-1/+1
Fixing below warnings: drivers/iio/dac/ad5592r.c:58:41: warning: incorrect type in argument 2 (different base types) drivers/iio/dac/ad5592r.c:58:41: expected unsigned short [usertype] *buf drivers/iio/dac/ad5592r.c:58:41: got restricted __be16 *<noident> drivers/iio/dac/ad5592r.c:62:41: warning: incorrect type in argument 2 (different base types) drivers/iio/dac/ad5592r.c:62:41: expected unsigned short [usertype] *buf drivers/iio/dac/ad5592r.c:62:41: got restricted __be16 *<noident> drivers/iio/dac/ad5592r.c:92:41: warning: incorrect type in argument 2 (different base types) drivers/iio/dac/ad5592r.c:92:41: expected unsigned short [usertype] *buf drivers/iio/dac/ad5592r.c:92:41: got restricted __be16 *<noident> drivers/iio/dac/ad5592r.c:110:41: warning: incorrect type in argument 2 (different base types) drivers/iio/dac/ad5592r.c:110:41: expected unsigned short [usertype] *buf drivers/iio/dac/ad5592r.c:110:41: got restricted __be16 *<noident> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-24drivers: iio: max1027: Fix sparse warning: "dubious: x | !y"Sandhya Bankar1-1/+3
Fixing below warning: drivers/iio/adc/max1027.c:241:34: warning: dubious: x | !y . Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-24iio: Use kmalloc_array() in iio_scan_mask_set()Markus Elfring1-4/+3
A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-24iio: accel: mma7660: fix non static symbol warningWei Yongjun1-1/+1
Fixes the following sparse warning: drivers/iio/accel/mma7660.c:42:11: warning: symbol 'mma7660_nscale' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-22iio:pressure: zpa2326: remove redundant "DEBUG" ifdefArnd Bergmann1-4/+0
The -Wempty-body gcc warning triggers in the newly added zpa2326 driver: drivers/iio/pressure/zpa2326.c: In function 'zpa2326_dequeue_pressure': drivers/iio/pressure/zpa2326.c:578:3: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body] The use of an empty statement behind 'if (...)' is harmless here, but it shows that the dev_dbg() macro is not used correctly: when the "DEBUG" macro is not set, dev_dbg() already defaults to a no-operation, though one that lets the compiler know that the arguments are used, and lets it check the format string. Fixing this also simplifies the driver. Fixes: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18iio: light: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensorsPeter Meerwald-Stadler3-0/+1418
The si114x supports x=1,2,3 IR LEDs for proximity sensing together with visible and IR ambient light sensing (ALS). Newer parts (si1132, si1145/6/7) can measure UV light and compute an UV index This was tested on si1143 and si1145 Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18iio:pressure: initial zpa2326 barometer supportGregor Boirie6-0/+2051
Introduce driver for Murata ZPA2326 pressure and temperature sensor: http://www.murata.com/en-us/products/productdetail?partno=ZPA2326-0311A-R Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18iio: accel: Add driver for the mCube MC3230 3-axis accelerometerHans de Goede3-0/+222
Add an IIO driver for the mCube MC3230 3-axis accelerometer. A datasheet for the mCube MC3230 can be found here: http://www.mcubemems.com/wp-content/uploads/2014/10/MC3230_2-Datasheet-APS-048-0007v1.6.pdf Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>