summaryrefslogtreecommitdiff
path: root/drivers/iio/pressure
AgeCommit message (Collapse)Author
2020-12-29iio:pressure:mpl3115: Force alignment of bufferJonathan Cameron
commit 198cf32f0503d2ad60d320b95ef6fb8243db857f upstream. Whilst this is another case of the issue Lars reported with an array of elements of smaller than 8 bytes being passed to iio_push_to_buffers_with_timestamp(), the solution here is a bit different from the other cases and relies on __aligned working on the stack (true since 4.6?) This one is unusual. We have to do an explicit memset() each time as we are reading 3 bytes into a potential 4 byte channel which may sometimes be a 2 byte channel depending on what is enabled. As such, moving the buffer to the heap in the iio_priv structure doesn't save us much. We can't use a nice explicit structure on the stack either as the data channels have different storage sizes and are all separately controlled. Fixes: cc26ad455f57 ("iio: Add Freescale MPL3115A2 pressure / temperature sensor driver") Reported-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: <Stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200920112742.170751-7-jic23@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-28iio: st_pressure: st_accel: pass correct platform data to initMichael Nosthoff
commit 8b438686a001db64c21782d04ef68111e53c45d9 upstream. Commit 7383d44b added a pointer pdata which get set to the default platform_data when non was defined in the device. But it did not pass this pointer to the st_sensors_init_sensor call but still used the maybe uninitialized platform_data from dev. This breaks initialization when no platform_data is given and the optional st,drdy-int-pin devicetree option is not set. This commit fixes this. Cc: stable@vger.kernel.org Fixes: 7383d44b ("iio: st_pressure: st_accel: Initialise sensor platform data properly") Signed-off-by: Michael Nosthoff <committed@heine.so> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-24iio: st_pressure: st_accel: Initialise sensor platform data properlyShrirang Bagul
[ Upstream commit 7383d44b84c94aaca4bf695a6bd8a69f2295ef1a ] This patch fixes the sensor platform data initialisation for st_pressure and st_accel device drivers. Without this patch, the driver fails to register the sensors when the user removes and re-loads the driver. 1. Unload the kernel modules for st_pressure $ sudo rmmod st_pressure_i2c $ sudo rmmod st_pressure 2. Re-load the driver $ sudo insmod st_pressure $ sudo insmod st_pressure_i2c Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12iio: pressure: mpl3115: do not rely on structure field orderingPeter Rosin
commit 9cf6cdba586ced75c69b8314b88b2d2f5ce9b3ed upstream. Fixes a regression triggered by a change in the layout of struct iio_chan_spec, but the real bug is in the driver which assumed a specific structure layout in the first place. Hint: the two bits were not OR:ed together as implied by the indentation prior to this patch, there was a comma between them, which accidentally moved the ..._SCALE bit to the next structure field. That field was .info_mask_shared_by_type before the _available attributes was added by commit 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes") and .info_mask_separate_available afterwards, and the regression happened. info_mask_shared_by_type is actually a better choice than the originally intended info_mask_separate for the ..._SCALE bit since a constant is returned from mpl3115_read_raw for the scale. Using info_mask_shared_by_type also preserves the behavior from before the regression and is therefore less likely to cause other interesting side effects. The above mentioned regression causes an unintended sysfs attibute to show up that is not backed by code, in turn causing the following NULL pointer defererence to happen on access. Segmentation fault Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ecc3c000 [00000000] *pgd=87f91831 Internal error: Oops: 80000007 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1051 Comm: cat Not tainted 4.10.0-rc5-00009-gffd8858-dirty #3 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) task: ed54ec00 task.stack: ee2bc000 PC is at 0x0 LR is at iio_read_channel_info_avail+0x40/0x280 pc : [<00000000>] lr : [<c06fbc1c>] psr: a0070013 sp : ee2bdda8 ip : 00000000 fp : ee2bddf4 r10: c0a53c74 r9 : ed79f000 r8 : ee8d1018 r7 : 00001000 r6 : 00000fff r5 : ee8b9a00 r4 : ed79f000 r3 : ee2bddc4 r2 : ee2bddbc r1 : c0a86dcc r0 : ee8d1000 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 10c5387d Table: 3cc3c04a DAC: 00000051 Process cat (pid: 1051, stack limit = 0xee2bc210) Stack: (0xee2bdda8 to 0xee2be000) dda0: ee2bddc0 00000002 c016d720 c016d394 ed54ec00 00000000 ddc0: 60070013 ed413780 00000001 edffd480 ee8b9a00 00000fff 00001000 ee8d1018 dde0: ed79f000 c0a53c74 ee2bde0c ee2bddf8 c0513c58 c06fbbe8 edffd480 edffd540 de00: ee2bde3c ee2bde10 c0293474 c0513c40 c02933e4 ee2bde60 00000001 ed413780 de20: 00000001 ed413780 00000000 edffd480 ee2bde4c ee2bde40 c0291d00 c02933f0 de40: ee2bde9c ee2bde50 c024679c c0291ce0 edffd4b0 b6e37000 00020000 ee2bdf78 de60: 00000000 00000000 ed54ec00 ed013200 00000817 c0a111fc edffd540 ed413780 de80: b6e37000 00020000 00020000 ee2bdf78 ee2bded4 ee2bdea0 c0292890 c0246604 dea0: c0117940 c016ba50 00000025 c0a111fc b6e37000 ed413780 ee2bdf78 00020000 dec0: ee2bc000 b6e37000 ee2bdf44 ee2bded8 c021d158 c0292770 c0117764 b6e36004 dee0: c0f0d7c4 ee2bdfb0 b6f89228 00021008 ee2bdfac ee2bdf00 c0101374 c0117770 df00: 00000000 00000000 ee2bc000 00000000 ee2bdf34 ee2bdf20 c016ba04 c0171080 df20: 00000000 00020000 ed413780 b6e37000 00000000 ee2bdf78 ee2bdf74 ee2bdf48 df40: c021e7a0 c021d130 c023e300 c023e280 ee2bdf74 00000000 00000000 ed413780 df60: ed413780 00020000 ee2bdfa4 ee2bdf78 c021e870 c021e71c 00000000 00000000 df80: 00020000 00020000 b6e37000 00000003 c0108084 00000000 00000000 ee2bdfa8 dfa0: c0107ee0 c021e838 00020000 00020000 00000003 b6e37000 00020000 0001a2b4 dfc0: 00020000 00020000 b6e37000 00000003 7fffe000 00000000 00000000 00020000 dfe0: 00000000 be98eb4c 0000c740 b6f1985c 60070010 00000003 00000000 00000000 Backtrace: [<c06fbbdc>] (iio_read_channel_info_avail) from [<c0513c58>] (dev_attr_show+0x24/0x50) r10:c0a53c74 r9:ed79f000 r8:ee8d1018 r7:00001000 r6:00000fff r5:ee8b9a00 r4:edffd480 [<c0513c34>] (dev_attr_show) from [<c0293474>] (sysfs_kf_seq_show+0x90/0x110) r5:edffd540 r4:edffd480 [<c02933e4>] (sysfs_kf_seq_show) from [<c0291d00>] (kernfs_seq_show+0x2c/0x30) r10:edffd480 r9:00000000 r8:ed413780 r7:00000001 r6:ed413780 r5:00000001 r4:ee2bde60 r3:c02933e4 [<c0291cd4>] (kernfs_seq_show) from [<c024679c>] (seq_read+0x1a4/0x4e0) [<c02465f8>] (seq_read) from [<c0292890>] (kernfs_fop_read+0x12c/0x1cc) r10:ee2bdf78 r9:00020000 r8:00020000 r7:b6e37000 r6:ed413780 r5:edffd540 r4:c0a111fc [<c0292764>] (kernfs_fop_read) from [<c021d158>] (__vfs_read+0x34/0x118) r10:b6e37000 r9:ee2bc000 r8:00020000 r7:ee2bdf78 r6:ed413780 r5:b6e37000 r4:c0a111fc [<c021d124>] (__vfs_read) from [<c021e7a0>] (vfs_read+0x90/0x11c) r8:ee2bdf78 r7:00000000 r6:b6e37000 r5:ed413780 r4:00020000 [<c021e710>] (vfs_read) from [<c021e870>] (SyS_read+0x44/0x90) r8:00020000 r7:ed413780 r6:ed413780 r5:00000000 r4:00000000 [<c021e82c>] (SyS_read) from [<c0107ee0>] (ret_fast_syscall+0x0/0x1c) r10:00000000 r8:c0108084 r7:00000003 r6:b6e37000 r5:00020000 r4:00020000 Code: bad PC value ---[ end trace 9c4938ccd0389004 ]--- Fixes: cc26ad455f57 ("iio: Add Freescale MPL3115A2 pressure / temperature sensor driver") Fixes: 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes") Reported-by: Ken Lin <ken.lin@advantech.com> Tested-by: Ken Lin <ken.lin@advantech.com> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-12iio: pressure: mpl115: do not rely on structure field orderingPeter Rosin
commit 6a6e1d56a0769795a36c0461c64bf5e5b9bbb4c0 upstream. Fixes a regression triggered by a change in the layout of struct iio_chan_spec, but the real bug is in the driver which assumed a specific structure layout in the first place. Hint: the three bits were not OR:ed together as implied by the indentation prior to this patch, there was a comma between the first two, which accidentally moved the ..._SCALE and ..._OFFSET bits to the next structure field. That field was .info_mask_shared_by_type before the _available attributes was added by commit 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes") and .info_mask_separate_available afterwards, and the regression happened. info_mask_shared_by_type is actually a better choice than the originally intended info_mask_separate for the ..._SCALE and ..._OFFSET bits since a constant is returned from mpl115_read_raw for the scale/offset. Using info_mask_shared_by_type also preserves the behavior from before the regression and is therefore less likely to cause other interesting side effects. The above mentioned regression causes unintended sysfs attibutes to show up that are not backed by code, in turn causing a NULL pointer defererence to happen on access. Fixes: 3017d90e8931 ("iio: Add Freescale MPL115A2 pressure / temperature sensor driver") Fixes: 51239600074b ("iio:core: add a callback to allow drivers to provide _available attributes") Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-27iio:st_pressure: fix sampling gains (bring inline with ABI)Gregor Boirie
commit d43a41152f8e9e4c0d19850884d1fada076dee10 upstream. Temperature channels report scaled samples in Celsius although expected as milli degree Celsius in Documentation/ABI/testing/sysfs-bus-iio. Gains are not implemented at all for LPS001WP pressure and temperature channels. This patch ensures that proper offsets and scales are exposed to userpace for both pressure and temperature channels. Also fix a NULL pointer exception when userspace reads content of sysfs scale attribute when gains are not defined. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25iio: pressure: mpl115: fix temperature offset signAkinobu Mita
commit 431386e783a3a6c8b7707bee32d18c353b8688b2 upstream. According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C. (https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow) Temp [C] = (Tadc - 472) / -5.35 + 25 = (Tadc - 605.750000) * -0.186915888 So the correct offset is -605.750000. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-05Merge tag 'spi-v4.4' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "Quite a lot of activity in SPI this cycle, almost all of it in drivers with a few minor improvements and tweaks in the core. - Updates to pxa2xx to support Intel Broxton and multiple chip selects. - Support for big endian in the bcm63xx driver. - Multiple slave support for the mt8173 - New driver for the auxiliary SPI controller in bcm2835 SoCs. - Support for Layerscale SoCs in the Freescale DSPI driver" * tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits) spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI spi: pxa2xx: Add support for Intel Broxton spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals spi: pxa2xx: Add output control for multiple Intel LPSS chip selects spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific spi: Add DSPI support for layerscape family spi: ti-qspi: improve ->remove() callback spi/spi-xilinx: Fix race condition on last word read spi: Drop owner assignment from spi_drivers spi: Add THIS_MODULE to spi_driver in SPI core spi: Setup the master controller driver before setting the chipselect spi: dw: replace magic constant by DW_SPI_DR spi: mediatek: mt8173 spi multiple devices support spi: mediatek: handle controller_data in mtk_spi_setup spi: mediatek: remove mtk_spi_config spi: mediatek: Update document devicetree bindings to support multiple devices spi: fix kernel-doc warnings about missing return desc in spi.c spi: fix kernel-doc warnings about missing return desc in spi.h spi: pxa2xx: Align a few defines spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select ...
2015-10-28spi: Drop owner assignment from spi_driversAndrew F. Davis
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-11Add ms8607 meas-spec driver supportLudovic Tancerel
Support for MS8607 temperature, pressure & humidity sensor. This part is using functions from MS5637 for temperature and pressure and HTU21 for humidity Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11Add ms5637 meas-spec driver supportLudovic Tancerel
Support for MS5637 temperature & pressure sensor Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16iio: st_sensors: add debugfs register read hookLinus Walleij
This adds a debugfs hook to read/write registers in the ST sensors using debugfs. Proved to be awesome help when trying to debug why IRQs do not arrive. 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-07-23iio: st-sensors: add configuration for WhoAmI addressGiuseppe Barba
This patch permits to configure the WhoAmI register address because some device could have not a standard address for this register. Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com> Reviewed-by: Denis Ciocca <denis.ciocca@st.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11iio: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-05iio: pressure: ms5611: add support for MS5607 temperature and pressure sensorTomasz Duszynski
MS5607 is temperature and pressure sensor which hardware is similar to MS5611. Both sensors share command protocol and support both I2C and SPI serial protocols. They only differ in compensation algorithms. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-05iio: pressure: ms5611: remove IIO_CHAN_INFO_SCALE from maskTomasz Duszynski
IIO_CHAN_INFO_SCALE is useful whenever conversion to standard units is done in userspace. In this case conversion is handled by driver so this bit is unnecessary. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-21iio: pressure: Fix Measurement Specialties vendor namePeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-24Merge tag 'iio-for-v4.2b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle. Core functionality * i and q modifiers from quadrature channels. * IIO_CHAN_INFO_OVERSAMPLING_RATIO added. * High pass filter attributes added to mirror the existing low pass filter ones. Core cleanups * Make IIO tools building more cross compiler friendly. * Substantial rework of the function __iio_update_buffers to greatly simplify a hideously evolved function. New drivers and support * ACPI0008 ambient light sensor driver. This one has been around a long time to will be good to finally get it into mainline. * Berlin SOC ADC support. * BMC150 magnetometer. The accelerometer in the same package has been supported for quite some time, so good to have this half as well. * m62332 DAC driver * MEMSIC MMC35420 magnetometer. * ROHM BH1710 and similar ambient light sensors. * Sensortek STK3310 light sensor. * Sensortek STK8312 accelerometer. * Sensortek STK8BA50 accelerometer. * ti-adc128s052 gains support form the adc122s021 2 channel ADC. Driver cleanups and functionality. * Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled. * bmc150 - decouple trigger from buffer to allow other triggers to be used. * bmg160 - decouple trigger from buffer to allow other triggers to be used. Fix a trivial unused field. * Constify a load of platform_device_id structures. * inv_mpu6050 - device tree bindings. * hid-sensors - fix a memory leak during probe if certain errors occur. * ltr501 - illuminance channel derived (in an non obvious fashion) from the intensity channels. * ltr501 - fix a boundary check on the proximity threshold. * mlx90614 - drop a pointless return. * mma8452 - Debugfs register access and fix a bug that had no effect (by coincidence) * ti_am335x_adc - add device tree bindings for sample-delay, open-delay and averaging. The ideal settings for these tend to be board design specific.
2015-05-17iio: pressure: hid-sensor-press: Fix memory leak in probe()Fabio Estevam
'channels' is allocated via kmemdup and it is never freed in the subsequent error paths. Use 'indio_dev->channels' directly instead, so that we avoid such memory leak problem. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-13Merge tag 'iio-fixes-for-4.1a-take2' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 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-10iio: hid-sensor-press: Constify platform_device_idKrzysztof Kozlowski
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio:st_sensors: Fix oops when probing SPI devicesAlban Bedel
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-18iio: pressure: hid-sensor-press: Fix modifierSrinivas Pandruvada
Fix "null" in the raw attribute and scan elements. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-14Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 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 Kosina
Conflicts: drivers/iio/common/hid-sensors/hid-sensor-trigger.c include/linux/hid-sensor-hub.h
2015-04-09iio: pressure: bmp280: fix temp compensationIrina Tirdea
Temperature reads on bmp280 device always return 0, due to a missing step in the compensation formula (data->tfine is never initialized). Initialize data->tfine value so we get correct temperature and pressure values. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-15iio: pressure: add support for MS5611 pressure and temperature sensorTomasz Duszynski
Add support for Measurement Specialities MS5611 pressure and temperature sensor. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-23HID: hid-sensor-hub: Extend API for async readsSrinivas Pandruvada
Add additional flag to read in async mode. In this mode the caller will get reply via registered callback for capture_sample. Callbacks can be registered using sensor_hub_register_callback function. The usage id parameter of the capture_sample can be matched with the usage id of the requested attribute. 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-01-25iio: hid-sensor-press: Introduce PMSrinivas Pandruvada
Use common hid sensor iio pm functions. Also the poll time read and wait is part of power up function of hid sensor iio pm function, so remove from the client drivers. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26iio:pressure:bmp280: cleanupHartmut Knaack
The calculations for temperature and pressure compensation were already slightly optimized in comparison to the datasheet. So, it makes sense to optimize even a bit more, making proper use of C operators: - variable t in bmp280_compensate_temp() can be eliminated by directly returning the result of the relevant equation. - make use of the += operator and eliminate an unnecessary parenthesis level in bmp280_compensate_press(). When the initialization of the ctrl_meas register fails, the error message will now mention the right register name. During probe, i2c_set_clientdata() is called, although it is not necessary. Drop it. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12iio: bmp280: refactor compensation codeVlad Dogaru
This version of the code avoids extra memory copy operations and is somewhat smaller in code size. Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-11-05iio:pressure:bmp280: fix pressure calculationHartmut Knaack
According to the datasheet and as defined in struct bmp280_comp_press, dig_p1 is of type u16, while dig_p2 to dig_p9 are of type s16. In bmp280_read_compensation_press(), values read from the device were treated as the wrong type. In bmp280_read_press() the fractional part of the measured pressure is calculated wrong. A better way is to use *val for the raw pressure and *val2 for the quotient and let the core do the proper conversion using IIO_VAL_FRACTIONAL. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-25bmp280: use correct routine for divisionVlad Dogaru
The proper way to divide two signed 64-bit values is to use div64_s64. Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-22iio: add bmp280 pressure and temperature driverVlad Dogaru
Minimal implementation, can read temperature and data using direct mode. Datasheet available at <http://ae-bst.resource.bosch.com/media/products/dokumente/bmp280/BST-BMP280-DS001-09.pdf> Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:common: Set the device pointer into ST common sensors libraryDenis CIOCCA
Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:pressure: Changed pressure data variable name to press_dataDenis CIOCCA
This patch fix pressure data variable name. Usually pdata name it is used for platform data. Signed-off-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-10-04iio:pressure: Removed unnecessary parameter on common_probe functionDenis CIOCCA
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 CIOCCA
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-08-26iio: remove .owner field for driver using module_platform_driverSanjeev Sharma
This patch removes the .owner field for drivers which use the platform_driver_register api because this is overriden in _platform_driver_register. Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-13Merge 3.16-rc5 into staging-nextGreg Kroah-Hartman
We want the fixes in -rc5 in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-11iio: st_sensors: add devicetree probing supportLinus Walleij
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:st sensors: remove custom sampling frequence attribute in favour of core ↵Jonathan Cameron
support. 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-sensor-press: Fix return valuesSachin Kamat
IIO_CHAN_INFO_SAMP_FREQ and IIO_CHAN_INFO_HYSTERESIS cases ignored the actual return values (which could be -EINVAL) and instead returned IIO_VAL_INT_PLUS_MICRO always. Return the actual value obtained from the functions. Both functions return IIO_VAL_INT_PLUS_MICRO upon success. Agreed with by Srinivas. 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-22Merge 3.16-rc2 into staging-nextGreg Kroah-Hartman
We want the staging fixes here as well.
2014-06-18Merge tag 'iio-fixes-for-3.16a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 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-06-14iio: Add t5403 barometric pressure sensor driverPeter Meerwald
16-bit pressure and temperature sensor the chip can do I2C and SPI, only the I2C interface is supported by the driver at the moment datasheet: http://www.epcos.com/inf/57/ds/T5400.pdf application note: http://www.epcos.com/blob/993154/download/1/t5403-applicationnote.pdf an out-of-tree driver targetting the input subsystem is at https://github.com/unixphere/t5400, it was rejected here: http://comments.gmane.org/gmane.linux.kernel.input/28107 v2: (thanks Hartmut Knaack) * fix MODE_HIGH, equals 2 * check INT_TIME mask in write_raw() Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Stefan Nilsson <stefan.nilsson@unixphere.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-29iio: Fix two mpl3115 issues in measurement conversionPeter Meerwald
(i) pressure is 20-bit unsigned, not signed; the buffer description is incorrect; for raw reads, this is just cosmetic (ii) temperature is 12-bit signed, not 16-bit; this affects readout of temperatures below zero as the sign bit is incorrectly processed reported via private mail Cc: stable@vger.kernel.org Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Reported-by: Robert Deliën <robert@delien.nl> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-05iio: hid-sensors: Pressure: Raw read supportiio-for-3.16bSrinivas Pandruvada
Added support for raw reading of channel. If the sensor is powered off, it will turn on for reading value. 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 power on/offSrinivas Pandruvada
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: Pressure: adjust scale and offsetSrinivas Pandruvada
Using units and unit exponent to calculate scale which is compliant to IIO ABI. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>