30 May, 2016
1 commit
-
commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded
("iio: st_sensors: verify interrupt event to status") caused
a regression when reading ST sensors from a HRTimer trigger
rather than the intrinsic interrupts: the HRTimer may
trigger faster than the sensor provides new values, and
as the check against new values available as a cause of
the interrupt trigger was done in the poll function,
this would bail out of the HRTimer interrupt with
IRQ_NONE.So clearly we need to only check the new values available
from the proper interrupt handler and not from the poll
function, which should rather just read the raw values
from the registers, put them into the buffer and be happy.To achieve this: switch the ST Sensors over to using a true
threaded interrupt handler.In the interrupt thread, check if new values are available,
else yield to the (potential) next device on the same
interrupt line to check the registers. If the interrupt
was ours, proceed to poll the values.Instead of relying on iio_trigger_generic_data_rdy_poll() as
a top half to wake up the thread that polls the sensor for
new data, have the thread call iio_trigger_poll_chained()
after determining that is is the proper source of the
interrupt. This is modelled on drivers/iio/accel/mma8452.c
which is already using a properly threaded interrupt handler.In order to get the same precision in timestamps as
previously, where samples would be timestamped in the
poll function pf->timestamp when calling
iio_trigger_generic_data_rdy_poll() we introduce a
local timestamp in the sensor data, set it in the top half
(fastpath) of the interrupt handler and provide that to the
core when calling iio_push_to_buffers_with_timestamp().Additionally: if the active scanmask is not set for the
sensor no IRQs should be enabled and we need to bail out
with IRQ_NONE. This can happen if spurious IRQs fire when
installing the threaded interrupt handler.Tested with hard interrupt triggers on LIS331DL, then also
tested with hrtimers on the same sensor by creating a 75Hz
HRTimer and using it to poll the sensor.Signed-off-by: Linus Walleij
Cc: Giuseppe Barba
Cc: Denis Ciocca
Reported-by: Crestez Dan Leonard
Tested-by: Crestez Dan Leonard
Tested-by: Jonathan Cameron
Fixes: 97865fe41322 ("iio: st_sensors: verify interrupt event to status")
Signed-off-by: Jonathan Cameron
29 May, 2016
1 commit
-
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
Cc:
Signed-off-by: Jonathan Cameron
15 May, 2016
1 commit
-
The bmp280 driver also supports BMP180 which has a different chip id
with BMP280. The probe routine verifies that the device reports the
correct chip id but the error message is confusing as if BMP280's chip
id is always expected.Reported-by: Matt Ranostay
Signed-off-by: Akinobu Mita
Cc: Matt Ranostay
Cc: Vlad Dogaru
Cc: Christoph Mair
Cc: Jonathan Cameron
Cc: Hartmut Knaack
Cc: Lars-Peter Clausen
Cc: Peter Meerwald
Signed-off-by: Jonathan Cameron
26 Apr, 2016
2 commits
-
This adds ability to control the oversampling ratio of the temperature
and pressure measurement for both bmp180 and bmp280.Signed-off-by: Akinobu Mita
Acked-by: Vlad Dogaru
Cc: Christoph Mair
Signed-off-by: Jonathan Cameron -
This adds support for the BMP180 to the bmp280 iio driver.
The BMP180 has already been supported by misc/bmp085 driver but it
doesn't use iio framework. This change adds the kconfig dependency
not to be selected both of them in order to avoid any issues.Signed-off-by: Akinobu Mita
Acked-by: Vlad Dogaru
Cc: Christoph Mair
Signed-off-by: Jonathan Cameron
24 Apr, 2016
1 commit
-
Add support for HopeRF pressure and temperature sensor.
This device uses two fixed I2C addresses, one for storing
calibration coefficients and another for accessing the ADC.Signed-off-by: Marek Vasut
Cc: Matt Ranostay
Cc: Jonathan Cameron
Signed-off-by: Jonathan Cameron
20 Apr, 2016
2 commits
-
Some types of ST Sensors can be connected to the same IRQ line
as other peripherals using open drain. Add a device tree binding
and a sensor data property to flip the right bit in the interrupt
control register to enable open drain mode on the INT line.If the line is set to be open drain, also tag on IRQF_SHARED
to the IRQ flags when requesting the interrupt, as the whole
point of using open drain interrupt lines is to share them with
more than one peripheral (wire-or).Cc: devicetree@vger.kernel.org
Cc: Giuseppe Barba
Cc: Denis Ciocca
Acked-by: Rob Herring
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This makes all ST sensor drivers check that they actually have
new data available for the requested channel(s) before claiming
an IRQ, by reading the status register (which is conveniently
the same for all ST sensors) and check that the channel has new
data before proceeding to read it and fill the buffer.This way sensors can share an interrupt line: it can be flaged
as shared and then the sensor that did not fire will return
NO_IRQ, and the sensor that fired will handle the IRQ and
return IRQ_HANDLED.Cc: Giuseppe Barba
Cc: Denis Ciocca
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron
16 Apr, 2016
1 commit
-
This fixes the errors reported by checkpatch.pl:
ERROR: code indent should use tabs where possible
Signed-off-by: Slawomir Stepien
Signed-off-by: Jonathan Cameron
03 Apr, 2016
1 commit
-
Signed-off-by: Crestez Dan Leonard
Signed-off-by: Jonathan Cameron
20 Mar, 2016
1 commit
-
Ensure optional regulator is properly disabled when present.
Fixes: 3145229f9191 ("iio:pressure:ms5611: power regulator support")
Signed-off-by: Gregor Boirie
Signed-off-by: Jonathan Cameron
05 Mar, 2016
2 commits
-
Add support for setting and retrieving OverSampling Rate independently for
each of the temperature and pressure channels. This allows userspace to
fine tune hardware sampling process according to the following tradeoffs :
* the higher the OSR, the finer the resolution ;
* the higher the OSR, the lower the noise ;
BUT:
* the higher the OSR, the larger the drift ;
* the higher the OSR, the longer the response time, i.e. less samples per
unit of time.Signed-off-by: Gregor Boirie
Signed-off-by: Jonathan Cameron -
Add device-tree ID tables and document bindings.
Signed-off-by: Gregor Boirie
Acked-by: Rob Herring
Signed-off-by: Jonathan Cameron
28 Feb, 2016
1 commit
-
Previously most drivers that used a i2c_check_functionality() check
condition required various error codes on failure. This patchset
converts to a standard of -EOPNOTSUPPSigned-off-by: Matt Ranostay
Signed-off-by: Jonathan Cameron
25 Feb, 2016
3 commits
-
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
Signed-off-by: Jonathan Cameron -
Use name of probed device instead of driver's one when registering device.
Signed-off-by: Gregor Boirie
Signed-off-by: Jonathan Cameron -
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.aspxSigned-off-by: Gregor Boirie
Acked-by: Lucas De Marchi
Acked-by: Peter Meerwald-Stadler
Signed-off-by: Jonathan Cameron
18 Feb, 2016
1 commit
-
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
Fixes: 713bbb4efb9d ("iio: pressure: ms5611: Add triggered buffer support")
Acked-by: Daniel Baluta
Signed-off-by: Jonathan Cameron
15 Feb, 2016
1 commit
-
…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.
08 Feb, 2016
1 commit
-
We want the upstream staging fixes in here as well.
Signed-off-by: Greg Kroah-Hartman
07 Feb, 2016
2 commits
-
This will be used together with an external trigger (e.g hrtimer
based software trigger).Signed-off-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
This allows data exported via buffer interface to be converted
to standard units in userspace.Signed-off-by: Daniel Baluta
Signed-off-by: Jonathan Cameron
31 Jan, 2016
4 commits
-
Clearly a high degree of cut and paste has gone on in this file, propogating
a particularly random combination of tabs and spaces. This patch at least
should make it all consistent going forward.Signed-off-by: Jonathan Cameron
-
mpl115 driver currently supports i2c interface (MPL115A2).
There is also SPI version (MPL115A1). The difference between them
is only physical transport so we can easily support both while sharing
most of the code.Split the driver into a core support module and one module each for I2C
and SPI support.Signed-off-by: Akinobu Mita
Cc: Jonathan Cameron
Cc: Hartmut Knaack
Cc: Lars-Peter Clausen
Cc: Peter Meerwald
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron -
mpl115 sets i2c clientdata, but it is not used anywhere. So remove it.
Signed-off-by: Akinobu Mita
Cc: Jonathan Cameron
Cc: Hartmut Knaack
Cc: Lars-Peter Clausen
Cc: Peter Meerwald
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron -
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.186915888So the correct offset is -605.750000.
Signed-off-by: Akinobu Mita
Acked-by: Peter Meerwald-Stadler
Cc:
Signed-off-by: Jonathan Cameron
10 Jan, 2016
1 commit
-
Most ST MEMS Sensors that support interrupts can also handle sending
an active low interrupt, i.e. going from high to low on data ready
(or other interrupt) and thus triggering on a falling edge to the
interrupt controller.Set up logic to inspect the interrupt line we get for a sensor: if
it is triggering on rising edge, leave everything alone, but if it
triggers on falling edges, set up active low, and if unsupported
configurations appear: warn with errors and reconfigure the interrupt
to a rising edge, which all interrupt generating sensors support.Create a local header for st_sensors_core.h to share functions
between the sensor core and the trigger setup code.Cc: Giuseppe Barba
Cc: Denis Ciocca
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron
06 Nov, 2015
1 commit
-
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
...
28 Oct, 2015
1 commit
-
An spi_driver does not need to set an owner, it will be populated by the
driver core.Signed-off-by: Andrew F. Davis
Acked-by: Jonathan Cameron
Signed-off-by: Mark Brown
11 Oct, 2015
2 commits
-
Support for MS8607 temperature, pressure & humidity sensor.
This part is using functions from MS5637 for temperature and pressure
and HTU21 for humiditySigned-off-by: Ludovic Tancerel
Signed-off-by: Jonathan Cameron -
Support for MS5637 temperature & pressure sensor
Signed-off-by: Ludovic Tancerel
Signed-off-by: Jonathan Cameron
16 Aug, 2015
1 commit
-
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
Acked-by: Denis Ciocca
Signed-off-by: Jonathan Cameron
24 Jul, 2015
1 commit
-
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
Reviewed-by: Denis Ciocca
Acked-by: Denis Ciocca
Signed-off-by: Jonathan Cameron
12 Jul, 2015
1 commit
-
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.Signed-off-by: Krzysztof Kozlowski
Signed-off-by: Jonathan Cameron
05 Jul, 2015
2 commits
-
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
Signed-off-by: Jonathan Cameron -
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
Signed-off-by: Jonathan Cameron
21 Jun, 2015
1 commit
-
Signed-off-by: Peter Meerwald
Signed-off-by: Jonathan Cameron
25 May, 2015
1 commit
-
…/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.
17 May, 2015
1 commit
-
'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
Reviewed-by: Srinivas Pandruvada
Signed-off-by: Jonathan Cameron
14 May, 2015
1 commit
-
…l/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.