summaryrefslogtreecommitdiff
path: root/drivers/iio
AgeCommit message (Collapse)AuthorFilesLines
2016-05-04iio: imu: mpu6050: Fix name/chip_id when using ACPIDaniel Baluta1-3/+26
When using ACPI, id is NULL and the current code automatically defaults name to NULL and chip id to 0. We should instead use the data provided in the ACPI device table. Fixes: c816d9e7a57b ("iio: imu: mpu6050: fix possible NULL dereferences") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Reviewed-By: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: imu: mpu6050: fix possible NULL dereferencesMatt Ranostay2-2/+4
Fix possible null dereferencing of i2c and spi driver data. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18iio:adc:at91-sama5d2: Repair crash on module removalMarek Vasut1-0/+2
The driver never calls platform_set_drvdata() , so platform_get_drvdata() in .remove returns NULL and thus $indio_dev variable in .remove is NULL. Then it's only a matter of dereferencing the indio_dev variable to make the kernel blow as seen below. This patch adds the platform_set_drvdata() call to fix the problem. root@armhf:~# rmmod at91-sama5d2_adc Unable to handle kernel NULL pointer dereference at virtual address 000001d4 pgd = dd57c000 [000001d4] *pgd=00000000 Internal error: Oops: 5 [#1] ARM Modules linked in: at91_sama5d2_adc(-) CPU: 0 PID: 1334 Comm: rmmod Not tainted 4.6.0-rc3-next-20160418+ #3 Hardware name: Atmel SAMA5 task: dd4fcc40 ti: de910000 task.ti: de910000 PC is at mutex_lock+0x4/0x24 LR is at iio_device_unregister+0x14/0x6c pc : [<c05f4624>] lr : [<c0471f74>] psr: a00d0013 sp : de911f00 ip : 00000000 fp : be898bd8 r10: 00000000 r9 : de910000 r8 : c0107724 r7 : 00000081 r6 : bf001048 r5 : 000001d4 r4 : 00000000 r3 : bf000000 r2 : 00000000 r1 : 00000004 r0 : 000001d4 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c53c7d Table: 3d57c059 DAC: 00000051 Process rmmod (pid: 1334, stack limit = 0xde910208) Stack: (0xde911f00 to 0xde912000) 1f00: bf000000 00000000 df5c7e10 bf000010 bf000000 df5c7e10 df5c7e10 c0351ca8 1f20: c0351c84 df5c7e10 bf001048 c0350734 bf001048 df5c7e10 df5c7e44 c035087c 1f40: bf001048 7f62dd4c 00000800 c034fb30 bf0010c0 c0158ee8 de910000 31397461 1f60: 6d61735f 32643561 6364615f 00000000 de911f90 de910000 de910000 00000000 1f80: de911fb0 10c53c7d de911f9c c05f33d8 de911fa0 00910000 be898ecb 7f62dd10 1fa0: 00000000 c0107560 be898ecb 7f62dd10 7f62dd4c 00000800 6f844800 6f844800 1fc0: be898ecb 7f62dd10 00000000 00000081 00000000 7f62dd10 be898bd8 be898bd8 1fe0: b6eedab1 be898b6c 7f61056b b6eedab6 000d0030 7f62dd4c 00000000 00000000 [<c05f4624>] (mutex_lock) from [<c0471f74>] (iio_device_unregister+0x14/0x6c) [<c0471f74>] (iio_device_unregister) from [<bf000010>] (at91_adc_remove+0x10/0x3c [at91_sama5d2_adc]) [<bf000010>] (at91_adc_remove [at91_sama5d2_adc]) from [<c0351ca8>] (platform_drv_remove+0x24/0x3c) [<c0351ca8>] (platform_drv_remove) from [<c0350734>] (__device_release_driver+0x84/0x110) [<c0350734>] (__device_release_driver) from [<c035087c>] (driver_detach+0x8c/0x90) [<c035087c>] (driver_detach) from [<c034fb30>] (bus_remove_driver+0x4c/0xa0) [<c034fb30>] (bus_remove_driver) from [<c0158ee8>] (SyS_delete_module+0x110/0x1d0) [<c0158ee8>] (SyS_delete_module) from [<c0107560>] (ret_fast_syscall+0x0/0x3c) Code: e3520001 1affffd5 eafffff4 f5d0f000 (e1902f9f) ---[ end trace 86914d7ad3696fca ]--- Signed-off-by: Marek Vasut <marex@denx.de> Cc: Ludovic Desroches <ludovic.desroches@atmel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-17iio: ak8975: fix maybe-uninitialized warningRichard Leitner1-1/+1
If i2c_device_id *id is NULL and acpi_match_device returns NULL too, then chipset may be unitialized when accessing &ak_def_array[chipset] in ak8975_probe. Therefore initialize chipset to AK_MAX_TYPE, which will return an error when not changed. This patch fixes the following maybe-uninitialized warning: drivers/iio/magnetometer/ak8975.c: In function ‘ak8975_probe’: drivers/iio/magnetometer/ak8975.c:788:14: warning: ‘chipset’ may be used uninitialized in this function [-Wmaybe-uninitialized] data->def = &ak_def_array[chipset]; Signed-off-by: Richard Leitner <dev@g0hl1n.net> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-17iio: ak8975: Fix NULL pointer exception on early interruptKrzysztof Kozlowski1-2/+2
In certain probe conditions the interrupt came right after registering the handler causing a NULL pointer exception because of uninitialized waitqueue: $ udevadm trigger i2c-gpio i2c-gpio-1: using pins 143 (SDA) and 144 (SCL) i2c-gpio i2c-gpio-3: using pins 53 (SDA) and 52 (SCL) Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = e8b38000 [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Modules linked in: snd_soc_i2s(+) i2c_gpio(+) snd_soc_idma snd_soc_s3c_dma snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer snd soundcore ac97_bus spi_s3c64xx pwm_samsung dwc2 exynos_adc phy_exynos_usb2 exynosdrm exynos_rng rng_core rtc_s3c CPU: 0 PID: 717 Comm: data-provider-m Not tainted 4.6.0-rc1-next-20160401-00011-g1b8d87473b9e-dirty #101 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) (...) (__wake_up_common) from [<c0379624>] (__wake_up+0x38/0x4c) (__wake_up) from [<c0a41d30>] (ak8975_irq_handler+0x28/0x30) (ak8975_irq_handler) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389c40>] (handle_edge_irq+0xf0/0x19c) (handle_edge_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c05ee360>] (exynos_eint_gpio_irq+0x50/0x68) (exynos_eint_gpio_irq) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389a70>] (handle_fasteoi_irq+0xb4/0x194) (handle_fasteoi_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c03860b4>] (__handle_domain_irq+0x5c/0xb4) (__handle_domain_irq) from [<c0301774>] (gic_handle_irq+0x54/0x94) (gic_handle_irq) from [<c030c910>] (__irq_usr+0x50/0x80) The bug was reproduced on exynos4412-trats2 (with a max77693 device also using i2c-gpio) after building max77693 as a module. Cc: <stable@vger.kernel.org> Fixes: 94a6d5cf7caa ("iio:ak8975 Implement data ready interrupt handling") Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Tested-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-04Merge tag 'iio-fixes-for-4.6b' of ↵Greg Kroah-Hartman7-10/+15
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: Second set of IIO fixes for the 4.6 cycle. This lot are either dependent on patches from the merge window or just came in recently enough that they ended up in this tree. * core - The watermark for the buffers was given a value that meant that it was impossible to actually set the watermark to anything sensible. * at91_adc - Fix a build config dependency on HAS_IOMEM * bmc150 - Fix wrong output on big endian systems * bmg160 - Fix wrong output on big endian systems - Fix an issue in which the regmap return value was stored to the buffer rather than the value actually being read in a bulk read. * inv_mpu6050 - Fix an indirect build config dependency on HAS_IOMEM * max30100 - Fix an error in fifo check condition that leads to a double read of the final reading. * st_magn - Make sure ST_MAGN_TRIGGER_SET_STATE is always defined to avoid a build error for relatively obscure config combinations.
2016-04-04Merge tag 'iio-fixes-for-4.6a' of ↵Greg Kroah-Hartman2-5/+10
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into usb-linus Jonathan writes: First round of IIO fixes for the 4.6 cycle. Again I've ended up with two early fix sets, depending on whether they are dependent on elements of the merge window or simply came in after I had patches with that dependency already, vs older fixes that were just too late for the last cycle. This first set is for the older ones. - max1353 * Add a missing adc to max1363_id - the driver has supported the max11644-11647 for a while, but as they weren't in the id table there was no way of actually initializing it. * Fix a wrong reference voltage for the above models. Given you couldn't initialize the driver for these parts without patching, no one noticed that the reference voltage used in computing the scaling was wrong. - apds9960 * The fifo last enelement was read twice (and hence pushed out twice) due to a small logic bug.
2016-04-03iio: gyro: bmg160: fix buffer read valuesIrina Tirdea1-1/+1
When reading gyroscope axes using iio buffers, the values returned are always 0. In the interrupt handler, the return value of the read operation is returned to the user instead of the value read. Return the value read to the user. This is also fixed in commit 82d8e5da1a33 ("iio: accel: bmg160: optimize transfers in trigger handler"). Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: gyro: bmg160: fix endianness when reading axesIrina Tirdea1-3/+4
For big endian platforms, reading the axes will return invalid values. The device stores each axis value in a 16 bit little endian register. The driver uses regmap_read_bulk to get the axis value, resulting in a 16 bit little endian value. This needs to be converted to cpu endianness to work on big endian platforms. Fix endianness for big endian platforms by converting the values for the axes read from little endian to cpu. This is also partially fixed in commit 82d8e5da1a33 ("iio: accel: bmg160: optimize transfers in trigger handler"). Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: bmc150: fix endianness when reading axesIrina Tirdea1-3/+4
For big endian platforms, reading the axes will return invalid values. The device stores each axis value in a 16 bit little endian register. The driver uses regmap_read_bulk to get the axis value, resulting in a 16 bit little endian value. This needs to be converted to cpu endianness to work on big endian platforms. Fix endianness for big endian platforms by converting the values for the axes read from little endian to cpu. This is also partially fixed in commit b6fb9b6d6552 ("iio: accel: bmc150: optimize transfers in trigger handler"). Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: st_magn: always define ST_MAGN_TRIGGER_SET_STATEArnd Bergmann1-0/+1
When CONFIG_IIO_TRIGGER is enabled but CONFIG_IIO_BUFFER is not, we get a build error in the st_magn driver: drivers/iio/magnetometer/st_magn_core.c:573:23: error: 'ST_MAGN_TRIGGER_SET_STATE' undeclared here (not in a function) .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, ^~~~~~~~~~~~~~~~~~~~~~~~~ Apparently, this ST_MAGN_TRIGGER_SET_STATE macro was meant to be set to NULL when the definition is not available because st_magn_buffer.c is not compiled, but the alternative definition was not included in the original patch. This adds it. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 74f5683f35fe ("iio: st_magn: Add irq trigger handling") Acked-by: Denis Ciocca <denis.ciocca@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28iio: fix config watermark initial valueIrina Tirdea1-0/+1
config structure is set to 0 when updating the buffers, so by default config->watermark will be 0. When computing the minimum between config->watermark and the buffer->watermark or insert_buffer-watermark, this will always be 0 regardless of the value set by the user for the buffer. Set as initial value for config->watermark the maximum allowed value so that the minimum value will always be set from one of the buffers. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Fixes: f0566c0c405d ("iio: Set device watermark based on watermark of all attached buffers") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28iio: health: max30100: correct FIFO check conditionMatt Ranostay1-1/+2
Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28iio: imu: Fix inv_mpu6050 dependenciesRichard Weinberger1-2/+1
Not all archs have io memory. Instead of selecting I2C_MUX (and bypassing the HAS_IOMEM dependency) depend directly on it. Fixes the following kconfig warning: warning: (MEDIA_SUBDRV_AUTOSELECT && VIDEO_CX231XX && INV_MPU6050_I2C) selects I2C_MUX which has unmet direct dependencies (I2C && HAS_IOMEM) And this build error: ERROR: "devm_ioremap_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined! ERROR: "of_address_to_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined! Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28iio: adc: Fix build error of missing devm_ioremap_resource on UMKrzysztof Kozlowski1-0/+1
The devres.o gets linked if HAS_IOMEM is present so on ARCH=um allyesconfig (COMPILE_TEST) failed with: drivers/built-in.o: In function `at91_adc_probe': at91-sama5d2_adc.c:(.text+0x48f548): undefined reference to `devm_ioremap_resource' Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: light: apds9960: correct FIFO check conditionMatt Ranostay1-1/+2
Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: adc: max1363: correct reference voltageStefan Eichenberger1-4/+4
Swap max11644/max11645 and max 11646/max11647 reference voltages according to datasheet. Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: adc: max1363: add missing adc to max1363_idStefan Eichenberger1-0/+4
max11644-max11647 had an enum value but were not added to the max1363_id, so they where not selectable in the devictree. Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-18Merge tag 'mfd-for-linus-4.6' of ↵Linus Torvalds3-0/+425
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Drivers: - Freescale Touch Screen ADC - X-Powers AXP PMIC with RSB - TI TPS65086 Power Management IC (PMIC) New Device Support: - Supply device PCI IDs for Intel Broxton Fix-ups: - Move to clkdev_create() API; intel_quark_i2c_gpio - Complete re-write of TI's TPS65912 Power Management IC (PMIC) - Remove unnecessary function argument; axp20x - Separate out bus related code; axp20x - Coding Style changes; axp20x - Allow more drivers to be compiled as modules - Work around false positive 'used uninitialised' warning; db8500-prcmu Bug Fixes: - Remove do_div(); fsl-imx25-gcq - Fix driver init when built-in; tps65010 - Fix clock-unregister leak; intel-lpss" * tag 'mfd-for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (53 commits) mfd: intel-lpss: Pass I2C configuration via properties on BXT mfd: imx6sx: Add PCIe register definitions for iomuxc gpr mfd: ipaq-micro: Use __maybe_unused to hide pm functions mfd: max77686: Add max77802 to I2C device ID table mfd: max77686: Export OF module alias information mfd: max77686: Allow driver to be built as a module mfd: stmpe: Add the proper PWM resources mfd: tps65090: Set regmap config reg counts properly mfd: syscon: Return ENOTSUPP instead of ENOSYS when disabled mfd: as3711: Set regmap config reg counts properly mfd: rc5t583: Set regmap config reg counts properly gpio: tps65086: Add GPO driver for the TPS65086 PMIC mfd: mt6397: Add platform device ID table mfd: da9063: Fix missing volatile registers in the core regmap_range volatile lists mfd: mt6397: Add MT6323 support to MT6397 driver mfd: mt6397: Add support for different Slave types mfd: mt6397: int_con and int_status may vary in location dt-bindings: mfd: Add bindings for the MediaTek MT6323 PMIC mfd: da9062: Fix missing volatile registers in the core regmap_range volatile lists mfd: Add documentation for ACT8945A DT bindings ...
2016-03-09iio: adc/imx25-gcq: Move incorrect do_divArnd Bergmann1-1/+1
The newly added driver uses do_div() to device a 32-bit number, which now provokes a warning: drivers/iio/adc/fsl-imx25-gcq.c: In function 'mx25_gcq_setup_cfgs': include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ This replaces the do_div() call with a straight division operator. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 6df2e98c3ea5 ("iio: adc: Add imx25-gcq ADC driver") Signed-off-by: Lee Jones <lee.jones@linaro.org>
2016-02-27iio: adc: palmas: Drop IRQF_EARLY_RESUME flagGrygorii Strashko1-3/+3
Palmas gpadc IRQs are nested threaded and this flag is not required for nested irqs anymore, since commit 3c646f2c6aa9 ("genirq: Don't suspend nested_thread irqs over system suspend") was merged. Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: Lee Jones <lee.jones@linaro.org> Cc: Nishanth Menon <nm@ti.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27iio: convert to common i2c_check_functionality() return valueMatt Ranostay20-20/+20
Previously most drivers that used a i2c_check_functionality() check condition required various error codes on failure. This patchset converts to a standard of -EOPNOTSUPP Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add mpu6500 register settingsMatt Ranostay4-6/+34
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add calibration offset supportMatt Ranostay2-2/+59
Allow setting of the x/y/z axes calibration offsets for the gyroscope and accelerometer. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add missing docstring for int_pin_cfgMatt Ranostay1-0/+1
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delayMatt Ranostay3-3/+10
replace msleep(INV_MPU6050_REG_UP_TIME) with usleep_range calls due to fact the wait time is under 20 milliseconds. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: use inv_mpu6050_sensor_show return codeMatt Ranostay1-1/+1
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: dac: vf610_dac: Add IIO DAC driver for Vybrid SoCSanchayan Maity3-0/+309
Add driver support for DAC peripheral on Vybrid SoC. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: ina2xx: Remove trace_printk debug statmentsAndrew F. Davis1-14/+7
These are generally for devlopment use only, remove these from performance-critical code, convert to dev_dbg elswhere. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: ina2xx: Fix whitespace and re-order codeAndrew F. Davis1-69/+65
Group of probably overly rigorous whitespace and code cleanups. - Alphabetize includes - Assign to variables in the order they are defined - Alignment issues - Group alike statements together - Use helper macros Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: potentiometer: add TI tpl0102 supportMatt Ranostay3-0/+179
Add support for the TI family of digital potentiometers. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: mpu6050: remove trailing whitespacesMatt Ranostay1-4/+4
removed several trailing whitespaces before assignment operations Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: power regulator supportGrégor Boirie1-0/+13
Add support for an optional regulator which, if found into device-tree, will power on device at probing time. The regulator is declared into ms5611 DTS entry as a "vdd-supply" property. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: use probed device nameGrégor Boirie4-6/+8
Use name of probed device instead of driver's one when registering device. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio:pressure:ms5611: fix ms5607 temp compensationGregor Boirie1-6/+6
Computation of sens2 was wrong and is fixed by this patch, sens2 should be: 2 * (t - 2000)^2 See page 8 of ms5607 datasheet here: http://www.meas-spec.com/product/pressure/MS5607-02BA03.aspx Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Lucas De Marchi <lucas.demarchi@intel.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix alignment with open parenthesisDaniel Baluta4-49/+49
This makes code consistent around inv_mpu6050 driver and fixes the following checkpatch.pl warning: CHECK: Alignment should match open parenthesis Note that there were few cases were it was not possible to fix this due to making the line too long, but we can live with that. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix code indent for if statementDaniel Baluta1-2/+2
This fixes the following checkpatch.pl warning: WARNING: suspect code indent for conditional statements (8, 24) + if (kfifo_len(&st->timestamps) > [...] + goto flush_fifo; Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Delete space before commaDaniel Baluta1-1/+1
This fixes the following checkpatch.pl warning: ERROR: space prohibited before that ',' (ctx:WxE) .shift = 0 , Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Remove unnecessary parenthesesDaniel Baluta1-2/+2
Fixes the following checkpatch warning: CHECK: Unnecessary parentheses around cpm->package.elements[i] Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix newlines to make code easier to readDaniel Baluta2-1/+2
This fixes the following checkpatch.pl warnings: * WARNING: Missing a blank line after declarations * CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix Yoda conditionsDaniel Baluta2-4/+4
This fixes the following checkpatch warning: * WARNING: Comparisons should place the constant on the right side of the test Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Acked-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix multiline comments styleDaniel Baluta1-14/+23
The preffered style for long (multi-line) comments is: /* * this is a multiline * comment */ This also fixes checkpatch.pl warning: WARNING: Block comments use * on subsequent lines Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: chemical: atlas-ph-sensor: use regmap_bulk_readMatt Ranostay1-3/+3
Replaced i2c_smbus_read_i2c_block_data() with regmap_bulk_read() function call. This is to make the driver code more consistent. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: hmc5843: Move hmc5843 out of stagingCristina Moraru6-0/+991
This patch moves hmc5843 driver from staging/iio/magnetometer to iio/magnetometer, updates the corresponding Makefiles and moves the hmc5843* entries to the 'Industrial I/O support -> Magnetometer sensors' menu. Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com> Cc: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-19iio: chemical: atlas-ph-sensor: switch regmap cacheMatt Ranostay1-3/+1
switch from using REGCACHE_FLAT to REGCACHE_RBTREE so initial hw values are read from device. This also allows some volatile ranges to be dropped. Note that REGCACHE_FLAT is intended only for very low lag cases so doesn't do nice things like read initial values from the device. Hence this change. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-17iio: pressure: ms5611: select IIO_BUFFERArnd Bergmann1-0/+1
The ms5611 driver started using the IIO_TRIGGERED_BUFFER infrastructure which in turn depend on IIO_BUFFER, and it produces a build error now if that is not enabled: warning: (... && MS5611 && ...) selects IIO_TRIGGERED_BUFFER which has unmet direct dependencies (IIO && IIO_BUFFER) buffer/industrialio-triggered-buffer.c: In function 'iio_triggered_buffer_setup': buffer/industrialio-triggered-buffer.c:58:2: error: implicit declaration of function 'iio_device_attach_buffer' [-Werror=implicit-function-declaration] pressure/ms5611_core.c: In function 'ms5611_trigger_handler': pressure/ms5611_core.c:193:2: error: implicit declaration of function 'iio_push_to_buffers_with_timestamp' [-Werror=implicit-function-declaration] This adds the second select. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 713bbb4efb9d ("iio: pressure: ms5611: Add triggered buffer support") Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-17iio: health/afe4404: mark suspend/resume functions __maybe_unusedArnd Bergmann1-2/+2
The newly added afe4404 driver implements suspend/resume using the SIMPLE_DEV_PM_OPS() macro, which leaves out references to the actual functions when CONFIG_PM is disabled, causing a harmless warning: health/afe4404.c:509:12: error: 'afe4404_suspend' defined but not used health/afe4404.c:530:12: error: 'afe4404_resume' defined but not used This marks the functions as __maybe_unused so we don't get those warnings. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 87aec56e27ef ("iio: health: Add driver for the TI AFE4404 heart monitor") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-17iio: health/afe4403: mark suspend/resume functions __maybe_unusedArnd Bergmann1-2/+2
The newly added afe4403 driver implements suspend/resume using the SIMPLE_DEV_PM_OPS() macro, which leaves out references to the actual functions when CONFIG_PM is disabled, causing a harmless warning: health/afe4403.c:509:12: error: 'afe4403_suspend' defined but not used health/afe4403.c:530:12: error: 'afe4403_resume' defined but not used This marks the functions as __maybe_unused so we don't get those warnings. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: eec96d1e2d31 ("iio: health: Add driver for the TI AFE4403 heart monitor") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-17iio: health/afe4403: select REGMAP_SPIArnd Bergmann1-0/+1
The newly added afe4403 driver uses the regmap facility to abstract the I2C and SPI access. However, it fails to ensure that regmap_spi is actually present: drivers/iio/built-in.o: In function `afe4403_probe': :(.text+0x9bf8): undefined reference to `__devm_regmap_init_spi' This adds a Kconfig select statement like the afe4404 I2C driver has. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: eec96d1e2d31 ("iio: health: Add driver for the TI AFE4403 heart monitor") Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-14Merge tag 'iio-for-4.6b' of ↵Greg Kroah-Hartman31-325/+5411
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 2nd round of new IIO device support, features and cleanups for the 4.6 cycle. New Device Support * Apex stx104 DAC - new driver for this PC104 board. Right now DAC support only. * ADI ad5064 - Add support for ad5625, ad5627, ad5645, ad5665, ad5667 DACs. - Add support for Linear Technology ltc2606, ltc2607, ltc2609, ltc2616, ltc2617, ltc2619, ltc2626, ltc2627 and ltc2629. * ADI ad7192 - add support for the ad7193 * Invensense mpu6050 - substantial rework of driver to use regmap allowing SPI support extending the now split driver to cover the MPU6000. * TI adc0832 - new driver supporting ADC0831, ADC0832, ADC0834 and ADC0838 ADCs. * TI ads1015 - new driver, note that there is an existing hwmon driver. The long term intention is to probably remove the hwmon driver but for now we just have guards in place to ensure this driver is not built if that one is enabled. * TI afe4403 - new driver for this heart rate monitor / pulse oximeter front end chip. * TI afe4404 - new driver for this heart rate monitor / pulse oximeter front end chip. Staging Graduations * mxs-lradc - A combined general purpose and touch screen (input) device driver. Originally held in staging to allow reworking into and MFD but as that wasn't happening and isn't an absolute requirement we are moving it out of staging. Driver new features * ms5611 - triggered buffer support - IIO_CHAN_INFO_SCALE to aid the triggered buffer support. Driver cleanups / reworks / fixes * ad5064 - Use an enum for the register map layout to allow support of additional chips (precursor to the new support listed above). - Structural driver changes to allow support of the slightly different handling for the ltc parts above. * ad5933 - drop an exceptional & unnecessary for a function pointer. * ad7606 - Cleanup the repeated copies of pm ops. - consolidate the various channels specs via a sport of rearranging so only one version is needed. * atlas ph sensor - add select IRQ_WORK * hmc8543 (soon to move out of staging) - Comment style fixes - functionality of suspend and resume was swapped. * spear-adc - use devm_clk_dev instead of managing the clk lifetime by hand. Core * Use new dmaengine_terminate_sync call to avoid a theoretical race. * Fix docs for mlock in struct iio_dev as it is correctly taken in some drivers (docs used to say for core only). * Add a helper function for calculating the scan index storage size within the core cutting out some cut and paste versions of the same code.