19 Jul, 2015
31 commits
-
Data is stored in the device in be16 format. Make use of be16_to_cpu and
cpu_to_be16 to have correct endianness on any host architecture.Signed-off-by: Hartmut Knaack
Reviewed-by: Tiberiu Breana
Signed-off-by: Jonathan Cameron -
iio_device_register should be the last operation during probe. Therefor
move up interrupt setup code and while at it, change the check for invalid
values of client->irq to be smaller than zero.
Fixes: 3dd477acbdd1 ("iio: light: Add threshold interrupt support for STK3310")As the device_register makes the userspace interfaces of the device available
it is possible for requests to come in before the probe sequence has finished.
This can lead to unhandled interrupts and similar.Signed-off-by: Hartmut Knaack
Reviewed-by: Tiberiu Breana
Signed-off-by: Jonathan Cameron -
IIO_EV_TYPE_THRESH in rising direction describes an event where the
threshold is crossed in rising direction, positive or negative values
being possible. This is not the case here.Since the threshold is no signed value and only the magnitude is compared,
IIO_EV_TYPE_MAG is what describes the behaviour of these devices, see the
sysfs-bus-iio ABI Documentation.Signed-off-by: Martin Kepplinger
Signed-off-by: Christoph Muellner
Cc:
Signed-off-by: Jonathan Cameron -
On reading in_voltage_scale of we got an NULL pointer dereference Oops.
The reason for this is, that mcp320x_read_raw tries to access
chip_info->resolution from struct mcp320x, but chip_info is never set.chip_info was never set since the driver was added, but there was no
acute problem, because it was not referenced.
The acute problem exists since
b12206e917ac34bec41b9ff93d37d8bd53a2b3bc
iio: adc: mcp320x. Add support for more ADCsThis patch fixes the issue by setting chip_info in mcp320x_probe.
Signed-off-by: Manfred Schlaegl
Reviewed-by: Michael Welling
Signed-off-by: Jonathan Cameron -
Read the register only when the adc register address is 4 byte aligned.
(rather than the other way around).Signed-off-by: Haibo Chen
Signed-off-by: Fugang Duan
Cc:
Signed-off-by: Jonathan Cameron -
Changed the offset to negative as usual equation is: (raw +
offset)*scale and in this
case offset should be negative (as we deduct 273.15 Kelvin to get temperature
in Celsius).Signed-off-by: Crt Mori
Acked-by: Peter Meerwald
Signed-off-by: Jonathan Cameron -
The RESET operation invoked in the last instance will align
in the natural way all 3 axis and the chip top view.Without this, north and south are swapped.
Signed-off-by: Viorel Suman
Signed-off-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
This fixes setting the SET/RESET bit in the REG_CTRL0
register.Signed-off-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
We must set i2c client private data at probe in order to
correctly retrieve it in pm suspend/resume, preventing
the following crash:[ 321.790582] PM: Syncing filesystems ... done.
[ 322.364440] PM: Preparing system for mem sleep
[ 322.400047] PM: Entering mem sleep
[ 322.462178] BUG: unable to handle kernel NULL pointer dereference at 0000036c
[ 322.469119] IP: [] mmc35240_suspend+0x12/0x30
[ 322.474291] *pdpt = 000000002fd6f001 *pde = 0000000000000000
[ 322.479967] Oops: 0000 1 PREEMPT SMP
[ 322.496516] task: a86d0df0 ti: a8766000 task.ti: a8766000
[ 322.570744] Call Trace:
[ 322.573217] [] pm_generic_suspend+0x21/0x30
[ 322.578284] [] i2c_device_pm_suspend+0x1b/0x30Signed-off-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
According to the debug/error string, the content of chip_id is supposed to
be output, rather than the return value of the previous operation.Fixes: c91746a2361d ("iio: magn: Add support for BMC150 magnetometer")
Signed-off-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
bmc150_magn makes use of REGMAP_I2C, so select it to build always without
errors.Fixes: c91746a2361d ("iio: magn: Add support for BMC150 magnetometer")
Signed-off-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
only SAMP_FREQ is writable
Will lead to SAMP_FREQ being written by any attempt to write
to the other exported attributes and hence a rather unexpected
result!Signed-off-by: Peter Meerwald
Cc:
Signed-off-by: Jonathan Cameron -
drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_preenable’:
drivers/iio/proximity/sx9500.c:682: warning: ‘ret’ may be used uninitialized in this function
drivers/iio/proximity/sx9500.c: In function ‘sx9500_buffer_predisable’:
drivers/iio/proximity/sx9500.c:706: warning: ‘ret’ may be used uninitialized in this functionIf active_scan_mask is empty, it will loop once more over all channels,
doing nothing.Signed-off-by: Geert Uytterhoeven
Reviewed-by: Vlad Dogaru
Signed-off-by: Jonathan Cameron -
The use of regmap in commit 2f2c96338afc requires REGMAP_I2C to be selected, in
order to meet all dependencies.Fixes: 2f2c96338afc ("iio: ltr501: Add regmap support.")
Signed-off-by: Hartmut Knaack
Acked-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
When filling data->als_contr, the register content read into status needs
to be used, instead of the return status value of regmap_read.Fixes: 8592a7eefa540 ("iio: ltr501: Add support for ltr559 chip")
Signed-off-by: Hartmut Knaack
Acked-by: Daniel Baluta
Signed-off-by: Jonathan Cameron -
The initial compensation was mistakingly toggling an extra bit in the
control register. Fix this and make sure it's less likely to happen by
introducing an additional macro.Reported-by: Hartmut Knaack
Signed-off-by: Vlad Dogaru
Acked-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
Fix error handling so that we can power the chip down even if a raw read
fails.Reported-by: Hartmut Knaack
Signed-off-by: Vlad Dogaru
Acked-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
Fix the sampling frequencies according to the datasheet (page 8). The
datasheet specifies the following available frequencies for continuous
mode: 1.5 Hz, 13 Hz, 25 Hz, and 50 Hz.Also fix comments about the ODR to comply with datasheet.
Signed-off-by: Teodora Baluta
Signed-off-by: Jonathan Cameron -
The stk3310 driver makes use of regmap_i2c, so this dependency needs to be
reflected in Kconfig.Signed-off-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
In accordance with the recent proximity ABI changes,
STK3310's proximity readings should be un-inversed
in order to return low values for far-away objects
and high values for close ones.As consequences of this change, iio event directions
have been switched and maximum proximity sensor
reference values have also been adjusted in accordance
with the real readings.Signed-off-by: Tiberiu Breana
Acked-by: Hartmut Knaack
Signed-off-by: Jonathan Cameron -
The Cosmic Circuits 10001 ADC driver depends on HAS_IOMEM, HAVE_CLK and
REGULATOR together, not just any of these.Signed-off-by: Hartmut Knaack
Cc:
Signed-off-by: Jonathan Cameron -
the millisecond values in tcs3414_times should be checked against
val2, not val, which is always zero.Signed-off-by: Peter Meerwald
Reported-by: Stephan Kleisinger
Cc:
Signed-off-by: Jonathan Cameron -
In bmc150_accel_unregister_triggers() triggers should be unregistered in
reverse order of registration. Trigger registration starts with number 0,
counting up. In consequence, trigger number needs to be count down here.Signed-off-by: Hartmut Knaack
Reviewed-by: Octavian Purdila
Cc:
Signed-off-by: Jonathan Cameron -
When setting the bits for integration time, the appropriate bitmask needs
to be cleared first.Signed-off-by: Hartmut Knaack
Cc:
Signed-off-by: Jonathan Cameron -
The DT-Property "atmel,adc-startup-time" is stored in an u8 for a microsecond
value. When trying to increase the value of STARTUP in Register AT91_ADC_MR
some higher values can't be reached.Change the type in function parameter and private structure field from u8 to
u32.Signed-off-by: Jan Leupold
[nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre
Acked-by: Alexandre Belloni
Cc:
Signed-off-by: Jonathan Cameron -
The value sent on the SPI bus is shifted by an erroneous number of bits.
The shift value was already computed in the iio_chan_spec structure and
hence subtracting this argument to 16 yields an erroneous data position
in the SPI stream.Signed-off-by: JM Friedt
Acked-by: Lars-Peter Clausen
Cc:
Signed-off-by: Jonathan Cameron -
Because of the ABI confusion proximity value exposed by SX9500
was inverted.Signed-off-by: Daniel Baluta
Reviewed-by: Vlad Dogaru
Cc:
Signed-off-by: Jonathan Cameron -
The gyroscope needs IIO_VAL_INT_PLUS_NANO for the scale channel and
unless specified write returns MICRO by default.
This needs to be properly specified so that write operations into scale
have the expected behaviour.Signed-off-by: Adriana Reus
Cc:
Signed-off-by: Jonathan Cameron -
Since commit 1c6c69525b40 ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.So pass the IRQF_ONESHOT flag in this case.
The semantic patch that makes this change is available
in scripts/coccinelle/misc/irqf_oneshot.cocci.Signed-off-by: Fabio Estevam
Cc:
Signed-off-by: Jonathan Cameron -
The module-data is currently missing. This includes the license-information
which makes the driver taint the kernel and miss symbols when compiled as
module.Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
Signed-off-by: Heiko Stuebner
Cc:
Signed-off-by: Jonathan Cameron -
By default all the sensors are runtime suspended state (lowest power
state). During Linux suspend process, all the run time suspended
devices are resumed and then suspended. This caused all sensors to
power up and introduced delay in suspend time, when we introduced
runtime PM for HID sensors. The opposite process happens during resume
process.To fix this, we do powerup process of the sensors only when the request
is issued from user (raw or tiggerred). In this way when runtime,
resume calls for powerup it will simply return as this will not match
user requested state.Note this is a regression fix as the increase in suspend / resume
times can be substantial (report of 8 seconds on Len's laptop!)Signed-off-by: Srinivas Pandruvada
Tested-by: Len Brown
Cc:
Signed-off-by: Jonathan Cameron
11 Jun, 2015
1 commit
-
…/iio into staging-next
Jonathan writes:
Third round of new IIO drivers, cleanups and functionality for the 4.2 cycle.
Given Linus announced a 4.8rc coming up, hopefully time for one more
lot of IIO patches this cycle. Some of these are actually
improvements / fixes for patches earlier in the cycle.New device support
* st_accel driver - support devices with 8 bit channels.Cleanup
* A general cleanup of the iio tools under /tools/ from Hartmut.
I'm more than a little embarassed by how bad some of these were! Are well,
much more refined and less bug prone now.
These cover lots of stuff like unhandled error returns, memory leaks as
well as general refactoring to tidy the code up.
* iio_simple_dummy - fix memory leaks in the init functions, drop some
pointless error returns from functions that never generate errors and
make the module parameter explicitly unsigned.
* More buffer handling reworks from Lars-Peter, this time targetting hardware
buffers (a little used corner that looks likely to get more use in the near
future). Specifically:
- Always compute the masklength as inkernel buffer users may need it.
- Add a means of labeling which buffer modes a given buffer implementation
supports.
- In the case of hardware buffers, require strict scan matching rather than
matching to a superset. Currently the demux is bypassed by these drivers
(this may well not change for efficiency reasons) so allowing a superset
of channels to be selected would otherwise lead to more data than requested
confusing userspace.Driver funcationality improvments
* mmc35240 - adds a compensation to the raw values as borrowed form Memsic's
own input driver.
* mma8452
- event support
- event debouncing
- high pass filter configuration
- triggers
* vf610 - allow conversion mode to be adjustedFixlets
* mmc35240
- Off by one error that by coincidence had no real effect.
- i2c_device_name should be lowercase.
- Lack of null terminator at end of attributes array.
- Avoid computing the fractional part of the magnetic field by moving
the scaling into userspace where floating point is available to simplify
the maths.
- Use a smaller sleep before assuming the measurement is done. This is
safe and improves the possible polling rate.
- Fix sensitivity on z-axis - datasheet disagrees with Memsic's releasedd
code and the value used in the code seems to be correct.
* stk3310 - make a local variable signed to ensure error handling works.
* twl4030
- fix calculation of the temperature sense current - bug unlikely
to have ever been noticed as the difference is small.
- Fix errors in descriptions.
09 Jun, 2015
2 commits
-
This adds support for the LIS331DL sensor version. This is
a simple 8bit-only accelerometer.Signed-off-by: Linus Walleij
Acked-by: Denis Ciocca
Signed-off-by: Jonathan Cameron -
We want the staging tree fixes in here too to help with testing and
merge issues.Signed-off-by: Greg Kroah-Hartman
08 Jun, 2015
6 commits
-
Some sensors like the LIS331DL only support 8bit data by a single
register per axis. These utilize the MSB byte. Make it possible
to register these apropriately.A oneliner change is needed in the ST sensors core to handle 8bit
reads as this is the first supported 8bit sensor.Signed-off-by: Linus Walleij
Acked-by: Denis Ciocca
Signed-off-by: Jonathan Cameron -
Support configurable conversion mode through sysfs. So far, the
mode used was low-power, which is enabled by default now. Beside
that, the modes normal and high-speed are selectable as well.Use the new device tree property which specifies the maximum ADC
conversion clock frequencies. Depending on the mode used, the
available resulting conversion frequency are calculated
dynamically.Acked-by: Fugang Duan
Signed-off-by: Stefan Agner
Signed-off-by: Jonathan Cameron -
The @chan parameter can be 0 or 1 and not a bit mask. Fix wrong description.
Signed-off-by: H. Nikolaus Schaller
Signed-off-by: Marek Belisko
Signed-off-by: Jonathan Cameron -
The bit mask to read the setting of the constant current source
for measuring the NTC voltage was the wrong one. Since default
value is initialized to the lowest level (000 = 10uA) the difference
was probably never noticed in practice.Signed-off-by: H. Nikolaus Schaller
Signed-off-by: Marek Belisko
Signed-off-by: Jonathan Cameron -
Implement interrupt driven trigger for data ready.
This allows more efficient access to the sample data.Signed-off-by: Martin Fuzzey
Signed-off-by: Jonathan Cameron -
Allow the cutoff frequency of the high pass filter to be configured.
Signed-off-by: Martin Fuzzey
Signed-off-by: Jonathan Cameron