Commit Graph

168 Commits

Author SHA1 Message Date
Greg Kroah-Hartman 03cce00b4b First round of iio fixes for the 4.7 cycle.
A slightly bumper set due to travel delaying the pull request and a fair few
 issues with the recent merge window patches.  Patches all over the place.
 The st-sensors one is probably the most involved, but definitly solves the
 issues seen.  Note there are some other issues around that handler
 (and the fact that a lot of boards tie a level interrupt chip to an
 edge interrupt only irq chip).  These are not regressions however, so
 will turn up the slow route.
 
 * core
   - iio_trigger_attach_pollfunc had some really badly wrong error handling.
   Another nasty triggered whilst chasing down issues with the st sensors
   rework below.
 * ad5592r
   - fix an off by one error when allocating channels.
 * am2315
   - a stray mutex unlock before we ever take the lock.
 * apds9960
   - missing a parent in the driver model (which should be the i2c device).
   Result is it doesn't turn up under /sys/bus/i2c/devices which some
   userspace code uses for repeatable device identification.
 * as3935
   - ABI usage bug which meant a processed value was reported as raw. Now
     reporting scale as well to ensure userspace has the info it needs.
   - Don't return processed value via the buffer - it doesn't conform to
     the ABI and will overflow in some cases.
   - Fix a wrongly sized buffer which would overflow trashing part of the
     stack.  Also move it onto the heap as part of the fix.
 * bh1780
   - a missing return after write in debugfs lead to an incorrect read and
     a null pointer dereference.
   - dereferencing the wrong pointer in suspend and resume leading to
     unpredictable results.
   - assign a static name to avoid accidentally ending up with no name if
     loaded via device tree.
 * bmi160
   - output data rate for the accelerometer was incorrectly reported. Fix it.
   - writing the output data rate was also wrong due to reverse parameters.
 * bmp280
   - error message for wrong chip ID gave the wrong expected value.
 * hdc100x
   - mask for writing the integration time was wrong allowin g us to get
   'stuck' in a particular value with no way back.
   - temperature reported in celsius rather than millicelsius as per the
   ABI.
   - Get rid of some incorrect data shifting which lead to readings being
   rather incorrect.
 * max44000
   - drop scale attribute for proximity as it is an unscaled value (depends
     on what is in range rather than anything knowable at the detector).
 * st-pressure
   - ABI compliance fixes - units were wrong.
 * st-sensors
   - We introduced some nasty issues with the recent switch over to a
   a somewhat threaded handler in that we broke using a software trigger
   with these devices.  Now do it properly.  It's a larger patch than ideal
   for a fix, but the logic is straight forward.
   - Make sure the trigger is initialized before requesting the interrupt.
   This matters now the interrupt can be shared. Before it was ugly and wrong
   but short of flakey hardware could not be triggered.
   - Hammer down the dataready pin at boot - otherwise with really
   unlucky timing things could get interestingly wedged requiring a hard power
   down of the chip.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXVxMzAAoJEFSFNJnE9BaI3QUP/2TLXJ4S+jNFSGslMmq9Ztqm
 fPGoyPf2nfJCzwgPFK7Yku8mFhqaRbbZrM0m1IA7hYbuZMXZjjQnSrIiDqsDuvXy
 1mK3mieCu8hPFTcvVUp1q9HwrrEFIke52LIH6urSDpr1IIbhJQ2ZwXjZIJGhlukc
 yFwMuA7gz/akc3war+OlS1bbEOe4OuikWMP3Fc3QGKPR7C92M0S8oRyZwBmB2vqu
 1lqCzS0JxL3Lz3TqDXkBd+77My7S4af/F7l8JfeCDBoE4zycASP1LUgiSD2aB3Rq
 hi7hrQjPCFk6rxZ+wFIyC8V0AGeGdEDpQ4JW9rgzDC/KO9Z3Wyq/h5UrQqsnZW0G
 xbJgLF3Wa0noh/bT0yIGZGcenM57QIJ0vTEymmikbWCNQfzqSG9a0SM7zMukB6Lr
 IAvMbF3Q3n/d4rzVOE5C9vRPRnG2jICxmA3EKp7blV0hRdd197J7UfN8ExG+9zC7
 JxqQh5LLu76Ql7TJqQh7sZl/6Xi0DnUm+wqaxyCgtaZjmsVZ58S6G6E2eefO5Hma
 r3VUfthe7N0wnWwCs2RMBkBynhb7+4G11m2jp1a4PMYCYg4FhYP7QdDkeDiOSXbG
 s9Y1ILLI7ufzCyKf5GID7/FtAjdJahVR2ldIy7MwUqw7zAyjsm+ujIpTGZ8iYUvb
 whHwMtLLTnyB8Zj81LRD
 =EEPO
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-4.7a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First round of iio fixes for the 4.7 cycle.

A slightly bumper set due to travel delaying the pull request and a fair few
issues with the recent merge window patches.  Patches all over the place.
The st-sensors one is probably the most involved, but definitly solves the
issues seen.  Note there are some other issues around that handler
(and the fact that a lot of boards tie a level interrupt chip to an
edge interrupt only irq chip).  These are not regressions however, so
will turn up the slow route.

* core
  - iio_trigger_attach_pollfunc had some really badly wrong error handling.
  Another nasty triggered whilst chasing down issues with the st sensors
  rework below.
* ad5592r
  - fix an off by one error when allocating channels.
* am2315
  - a stray mutex unlock before we ever take the lock.
* apds9960
  - missing a parent in the driver model (which should be the i2c device).
  Result is it doesn't turn up under /sys/bus/i2c/devices which some
  userspace code uses for repeatable device identification.
* as3935
  - ABI usage bug which meant a processed value was reported as raw. Now
    reporting scale as well to ensure userspace has the info it needs.
  - Don't return processed value via the buffer - it doesn't conform to
    the ABI and will overflow in some cases.
  - Fix a wrongly sized buffer which would overflow trashing part of the
    stack.  Also move it onto the heap as part of the fix.
* bh1780
  - a missing return after write in debugfs lead to an incorrect read and
    a null pointer dereference.
  - dereferencing the wrong pointer in suspend and resume leading to
    unpredictable results.
  - assign a static name to avoid accidentally ending up with no name if
    loaded via device tree.
* bmi160
  - output data rate for the accelerometer was incorrectly reported. Fix it.
  - writing the output data rate was also wrong due to reverse parameters.
* bmp280
  - error message for wrong chip ID gave the wrong expected value.
* hdc100x
  - mask for writing the integration time was wrong allowin g us to get
  'stuck' in a particular value with no way back.
  - temperature reported in celsius rather than millicelsius as per the
  ABI.
  - Get rid of some incorrect data shifting which lead to readings being
  rather incorrect.
* max44000
  - drop scale attribute for proximity as it is an unscaled value (depends
    on what is in range rather than anything knowable at the detector).
* st-pressure
  - ABI compliance fixes - units were wrong.
* st-sensors
  - We introduced some nasty issues with the recent switch over to a
  a somewhat threaded handler in that we broke using a software trigger
  with these devices.  Now do it properly.  It's a larger patch than ideal
  for a fix, but the logic is straight forward.
  - Make sure the trigger is initialized before requesting the interrupt.
  This matters now the interrupt can be shared. Before it was ugly and wrong
  but short of flakey hardware could not be triggered.
  - Hammer down the dataready pin at boot - otherwise with really
  unlucky timing things could get interestingly wedged requiring a hard power
  down of the chip.
2016-06-07 22:26:20 -07:00
Linus Walleij 65925b65ed iio: st_sensors: switch to a threaded interrupt
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 <linus.walleij@linaro.org>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Reported-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Crestez Dan Leonard <cdleonard@gmail.com>
Tested-by: Jonathan Cameron <jic23@kernel.org>
Fixes: 97865fe413 ("iio: st_sensors: verify interrupt event to status")
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29 20:21:41 +01:00
Greg Kroah-Hartman 4096e645d8 Merge 4.6-rc7 into staging-next
This fixes some merge issues with some iio drivers that were found in
linux-next.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-05-09 13:20:04 +02:00
Greg Kroah-Hartman 5a45e01d41 2nd set of new device support, features and cleanup for IIO in the 4.7 cycle.
Bit of a bumper set for new drivers but plenty of other stuff here as well!
 
 New device support
 * ad5592R ADC/DAC
   - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips.
 * Aosong am2315 relative humidity
   - new driver with triggered buffer support in follow up patch.
 * bmi160 imu
   - new driver
 * bmp280
   - bmp180 support - note there is support in the misc/bmp085 driver. Intent
     is to remove that driver long term.
 * invensense mpu6050
   - cleanup leading to explicit support of mpu9150 with a good few cleanups
     along the way.
 * Hope RF hp03 pressure and temperature sensor.
   - new driver
 * maxim DS1803 potentiometer
   - new driver
 * maxim max44000 light and proximity sensor
   - new driver built in a series of steps to support pretty much everything.
 * ROHM BH1780 light sensor
   - new driver. There is an existing driver in misc that this is pretty much
     intended to replace.  The discussion on whether to support the non standard
     interface of that driver is some way is continuing.
 * st-gyro
   - lsm9ds0-gyro.  The accel/magn side of this will take a while longer as
     extensions to the st library are needed for cases where two types of sensor
     share a single i2c address.
 * ti-adc081c
   - support the adc101c and adc121c
 * Vishay VEML6070 UV sensor
   - new driver.
 
 New features
 * core
   - devm_ APIs for channel_get and channel_get_all.  The first user of these
     is the generic ADC based thermal driver.  As it is going through the
     thermal tree these will be picked up as a patch to that next cycle as that
     is how the author preferred to do it.
   - mounting matrix support.  This new core support allows devices to provide
     to userspace (typically from the device tree) allowing compensation for how
     the sensor is mounted on the device.  First examples are on UAVs but it
     has a more mundane use on typical phone where the chip may be on the front
     or the back of the circuit board and soldered at any angle. Includes
     support for this ABI in ak8975 (which has an older interface, now
     deprecated) and mpu6050.
 * tools
   - add a -a option to enable all available channels in generic_buffer sample.
     Makes it somewhat easier to use.
 * adis library and drivers
   - support manual self test flag clearing.  This has technically been broken
     for a very long time - result is an offset on readings as the applied field
     is on all the time.
 * ak8975
   - triggered buffer support
 * bmc150
   - spi support (including splitting the driver into core and i2c parts)
 * bmp280
   - oversampling support.
 * dht11
   - improved logging - useful to debug timing issues on this quirky device.
 * st-sensors
   - read each channel invidivually as not all support the optimization of
   reading in bulk.  This is technically a fix, but will need to be backported
   if desired.
   - support open drain and shared interrupts.
 * ti-adc081c
   - triggered buffer support.
 
 Cleanups
 * inkern
   - white space fix.
 * ad7606
   - use the iio_device_claim_direct_mode call rather than open coding equiv.
 * ad799x
   - white space fix.
 * ad9523
   - unsigned -> unsigned int
 * apds9660
   - brace location tidying up.
   - silence an uninitialized variable warning.
 * ak8975
   - else and brace on same line fix.
 * at91_adc
   - white space fixes.
 * bmc150
   - use regmap stored copy of the device pointer rather than having an
     additional copy.
 * bmg160
   - use regmap stored copy of the device pointer rather than having an
     additional copy.
 * hid-sensors
   - white space fixes.
 * mcp3422
   - white space fix.
 * mma7455
   - use regmap to retrieve the device struct rather than carrying another copy
     in the private data.
 * ms_sensors
   - white space fix.
 * mxs-lradc
   - move current bindings out of staging - some will be shortly deprecated but
     the reality is that we have device trees out there using them so they will
     need to be supported for some time.  They accidentally got left behind
     when the driver graduated from staging.
   - white space cleanup.
   - set INPUT_PROP_DIRECT.
   - move ts config into a better function.
   - move the STMP reset out of the ADC init.
 * vf610_adc
   - case label indenting fix.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXHnw8AAoJEFSFNJnE9BaIDsIP/jbvOSDgOyvh4iNqV3ppAfvL
 yw/CWfKB5oMiqq/ENBNyMcD7kpGoh6ad/2JV1eXRnZsKArTwX6iN0Nu3yPxa+ySn
 xYc/BoGFwnNei+FqnFEqvK9RFZ3okQEkTW+OJg6eDMGDdL9HojZnALX4BE66QF3E
 W699vd3nA9SXqQ1UkQ+ozWdybBh2ksOfXknyN/S0sioIeG4MopCIyLMZzBGcDOCN
 EjdBudZla8VGTWcrp1ofOap6gJ7wKpbtlTPXuAEXtAypnDvuRdH7loTxtzSovNYd
 u6r9bujc1KUE4ilkYqODd5de4HvKm7aCR2ojlXeKlj+BNaF/uxQoYV/Al5e9CwR8
 nnz7c0rVAWIGc2tCiejJOMXB0t4TjVdzXZG9G/maKk1PNFOdUPb9Ul9BsjM28q5s
 yUneBuKlGFj2K/+E1AmTDRMhStMCMgrXZgyh0GSI07UZsVRnJR7ikUw7tly+J4ki
 21qKvTgXMKU+Fzh1HeqVcocq2AHsjlnKWuaB4/YiQzG5V0oGM4rvt78ewSMkmVkR
 IcIF9yI5XUfDAFdQUtvRlLP6p+qHylMH72aYq8pkMZ43Dq6hukyfx4vkc0Ztw7yS
 A655/frXiGeU2MFVSM2PYVloLQ5sftL5jDSBiDunzXHAl2WoXppu5Rjc7QvLnzLr
 vxvvN7MyGvi1GnKxcnYw
 =zzV9
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.7b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

2nd set of new device support, features and cleanup for IIO in the 4.7 cycle.

Bit of a bumper set for new drivers but plenty of other stuff here as well!

New device support
* ad5592R ADC/DAC
  - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips.
* Aosong am2315 relative humidity
  - new driver with triggered buffer support in follow up patch.
* bmi160 imu
  - new driver
* bmp280
  - bmp180 support - note there is support in the misc/bmp085 driver. Intent
    is to remove that driver long term.
* invensense mpu6050
  - cleanup leading to explicit support of mpu9150 with a good few cleanups
    along the way.
* Hope RF hp03 pressure and temperature sensor.
  - new driver
* maxim DS1803 potentiometer
  - new driver
* maxim max44000 light and proximity sensor
  - new driver built in a series of steps to support pretty much everything.
* ROHM BH1780 light sensor
  - new driver. There is an existing driver in misc that this is pretty much
    intended to replace.  The discussion on whether to support the non standard
    interface of that driver is some way is continuing.
* st-gyro
  - lsm9ds0-gyro.  The accel/magn side of this will take a while longer as
    extensions to the st library are needed for cases where two types of sensor
    share a single i2c address.
* ti-adc081c
  - support the adc101c and adc121c
* Vishay VEML6070 UV sensor
  - new driver.

New features
* core
  - devm_ APIs for channel_get and channel_get_all.  The first user of these
    is the generic ADC based thermal driver.  As it is going through the
    thermal tree these will be picked up as a patch to that next cycle as that
    is how the author preferred to do it.
  - mounting matrix support.  This new core support allows devices to provide
    to userspace (typically from the device tree) allowing compensation for how
    the sensor is mounted on the device.  First examples are on UAVs but it
    has a more mundane use on typical phone where the chip may be on the front
    or the back of the circuit board and soldered at any angle. Includes
    support for this ABI in ak8975 (which has an older interface, now
    deprecated) and mpu6050.
* tools
  - add a -a option to enable all available channels in generic_buffer sample.
    Makes it somewhat easier to use.
* adis library and drivers
  - support manual self test flag clearing.  This has technically been broken
    for a very long time - result is an offset on readings as the applied field
    is on all the time.
* ak8975
  - triggered buffer support
* bmc150
  - spi support (including splitting the driver into core and i2c parts)
* bmp280
  - oversampling support.
* dht11
  - improved logging - useful to debug timing issues on this quirky device.
* st-sensors
  - read each channel invidivually as not all support the optimization of
  reading in bulk.  This is technically a fix, but will need to be backported
  if desired.
  - support open drain and shared interrupts.
* ti-adc081c
  - triggered buffer support.

Cleanups
* inkern
  - white space fix.
* ad7606
  - use the iio_device_claim_direct_mode call rather than open coding equiv.
* ad799x
  - white space fix.
* ad9523
  - unsigned -> unsigned int
* apds9660
  - brace location tidying up.
  - silence an uninitialized variable warning.
* ak8975
  - else and brace on same line fix.
* at91_adc
  - white space fixes.
* bmc150
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* bmg160
  - use regmap stored copy of the device pointer rather than having an
    additional copy.
* hid-sensors
  - white space fixes.
* mcp3422
  - white space fix.
* mma7455
  - use regmap to retrieve the device struct rather than carrying another copy
    in the private data.
* ms_sensors
  - white space fix.
* mxs-lradc
  - move current bindings out of staging - some will be shortly deprecated but
    the reality is that we have device trees out there using them so they will
    need to be supported for some time.  They accidentally got left behind
    when the driver graduated from staging.
  - white space cleanup.
  - set INPUT_PROP_DIRECT.
  - move ts config into a better function.
  - move the STMP reset out of the ADC init.
* vf610_adc
  - case label indenting fix.
2016-04-26 15:07:23 -07:00
Gregor Boirie 97eacb9166 iio:ak8975: add mounting matrix support
Expose a rotation matrix to indicate userspace the chip orientation with
respect to the overall hardware system.
Matrix is retrieved from "in_mount_matrix". It is declared into ak8975 DTS
entry as a "mount-matrix" property.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-23 22:14:34 +01:00
Linus Walleij 97865fe413 iio: st_sensors: verify interrupt event to status
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 <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19 19:58:12 +01:00
Daniel Baluta 534536acdb iio: magn: bmc150: Introduce SPI support
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18 20:44:47 +01:00
Daniel Baluta 761b7910d4 iio: magn: Split bmc150 driver in common/i2c parts
This is useful for easily adding SPI support in later patches.

Now bmc150_magn exports core functions to be used by I2C/SPI drivers
instances. For the moment only I2C driver is supported.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-18 20:44:40 +01:00
Richard Leitner 05be8d4101 iio: ak8975: fix maybe-uninitialized warning
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-17 12:16:36 +01:00
Krzysztof Kozlowski 07d2390e36 iio: ak8975: Fix NULL pointer exception on early interrupt
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: 94a6d5cf7c ("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-17 12:16:36 +01:00
Slawomir Stepien 26b89d7d2b iio: magnetometer: ak8975: put else and brace at the same line
This fixes the error reported by checkpatch.pl:

ERROR: else should follow close brace '}'

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:39:27 +01:00
Greg Kroah-Hartman 5f47992491 Merge 4.6-rc3 into staging-next
This resolves a lot of merge issues with PAGE_CACHE_* changes, and an
iio driver merge issue.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-11 09:30:50 -07:00
Gregor Boirie bc11ca4a0b iio:magnetometer:ak8975: triggered buffer support
This will be used together with an external trigger (e.g hrtimer based
software trigger).

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-10 13:36:23 +01:00
Arnd Bergmann 9b090a98e9 iio: st_magn: always define ST_MAGN_TRIGGER_SET_STATE
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: 74f5683f35 ("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-04-03 10:56:42 +01:00
Irina Tirdea b1532909de iio: remove unused gpio consumer.h include
GPIO handling code has been removed from the drivers (since
this is now handled by the ACPI core) in commit 0f0796509c ("iio:
remove gpio interrupt probing from drivers that use a single interrupt").

Remove the include for linux/gpio/consumer.h since it is no longer
used.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03 10:27:47 +01:00
Gregor Boirie a9b72c90fc iio:magnetometer:ak8975: fix missing regulator_disable
Ensure optional regulator is properly disabled when present.

Fixes: 63d5d525cb ("iio:magnetometer:ak8975: power regulator support")
Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20 11:06:15 +00:00
Gregor Boirie 63d5d525cb iio:magnetometer:ak8975: power regulator support
Add support for an optional regulator which, if found into device-tree,
will power on device at probing time.
The regulator is declared into ak8975 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-03-05 15:25:58 +00:00
Gregor Boirie d3546af67f iio:magnetometer:ak8975: remove unused field
Remove unused struct ak8975_data attrs field.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05 15:25:10 +00:00
Gregor Boirie 55c0c530f7 iio:magnetometer:ak8975: fix uninitialized chipset
ak_def_array bounds are not properly checked in case of ACPI matching
failure. GCC warns with the following message at line 799:
‘chipset’ may be used uninitialized in this function.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05 15:18:05 +00:00
Cristina Moraru 7247645f68 iio: hmc5843: Move hmc5843 out of staging
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-24 20:40:39 +00:00
Julia Lawall f78c5f9654 iio: ak8975: constify ak_def structures
The ak_def structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-10 12:35:33 +00:00
Linus Walleij a9fd053b56 iio: st_sensors: support active-low interrupts
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 <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-10 12:35:32 +00:00
Greg Kroah-Hartman f3cf3fb7ec First set of new device support, features and cleanups for IIO in the 4.5 cycle
Usual mixed bag, but the big item perhaps in this series is the DMA buffer
 support added by Lars-Peter Clausen. It's been in the works for a long time
 and it will be interesting to see what hardware support shows up now that
 this is available.
 
 New core features + associate cleanup.
 * Add generic DMA buffer infrastructure
 * Add a DMAengine framework based buffer
  Also associated minor changes.
    - Set the device buffer watermark based on the minimum watermark for all
      attached buffers rather than just the 'primary' one.
    - iio_buffer_init - only set the watermark default if one hasn't already
      been provided.  This allows simple support for devices with a fixed
      watermark.
    - read only attribute for watermark on fixed watermark devices.
    - add explicit buffer enable/disable callbacks to allow the buffer to
      do more than trivial actions when it is being turned on and off.
 * IIO_VAL_INT support in write_raw_get_fmt function.
 
 New device support
 * Freescale MMA7455/7456L accelerometers
 * Memsic MXC6255XC accelerometer
 * ST lis2dh12 accelerometer
 * TI ADS8688 ADC
 * TI Palamas (twl6035/7) gpadc
 
 New driver features
 * mma8452
   - support either of the available interrupt pins to cope with the case
     where board layout has lead to a particular one being connected.
 
 Staging graduation
 * Dummy driver
   - this driver acts as both an example and a test device for those with
     out hardware to develop userspace code against.
 
 Cleanups and minor bits and bobs.
 * treewide
   - Sort out the ordering of iio_device_register/unregister vs runtime
     pm function calls so that it's all nice and consistent and not race
     prone.
   - Check sscanf return values.  None of the cases will actually happen as
     the strings are supplied internally, but best to be consistent on this.
 * ad7780
   - switch over to the gpio descriptor interface and remove the now unused
     platform data which gets rid of a header entirely.
 * ad7793
   - drop a pointless else statement.
 * at91_adc
   - Swap kmalloc_array in for a kmalloc doing the same job.
 * dummy
   - get rid of some commented out lines that snuck in during the move of
     the driver.
 * lm3533-als
   - Print an error message on provision of an invalid resistance.
 * mcp320x
   - Add compatible strings with vendor prefix and deprecate those with
     no vendor prefix.
 * mxs-lradc
   - Use BIT macro in various places rather than shifted ones.
 * pa12203001
   - Power off the chip if the registration fails.
 * pulsedlight-lidar-lite
   - add runtime PM support.
 * xilinx XADC
   - constify an iio_buffer_setup_ops structure.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWUcmhAAoJEFSFNJnE9BaIyjYP/0A+CZMUqIGbYG9qFxnq7yYZ
 977Wt/gGI8+Jq5RwNw6gTfhp2GrCN+5gzDbE2mBEn94c6SKBrj2Q9trW1FQ+Nhfx
 9bZoyq3ZPRCV+efEDGfeK/JWRwv+V6IWwAF2J/iCPWpRMTEsIW5kM1JSO3ISlnma
 diyil1hefGTJY8aCqGApthfX4fyZK98oCV6zojxpCZfFPdsa+vf5n1RQ143odnOk
 6NSfXHYLI+2e+mJ1lw4GdpZdF+rF+7jWsUYC5EDNmvlIJYiKmm13whSQeWO0NHo8
 oD0pYboSIWnmdXx4s3RbWF2+Y28O1+oJDKZfXabB8DjVwtvlGnmWBRhgKji2e6E6
 Hhct83YbDWtEpbNkXcWpnc5v5ynmAMTYTxADhinTGUtVQh3Q4wWduuoHK6IyeI4s
 dbfpO2Wh6N/5k3a4UoA69IcI2DzPzb2sIFWpdS8wuNv5xDhV2OmmY2PjTfq2w+Qz
 hEoMCNDUG6rQAYf4auXK5JjhI4CaG/mz/qjIibTUqGODYECzQQyvq+c2Gdq0S8O/
 CUHOgui6aHbyuhWmXlEzhhkjuvBQZYaTxCA+LGMzy8w7UY9m4n5L/fX9M9IfFsMH
 NFCPrUfmxKPQj/mHlhu7KHaTMUlQ0pTqV5flSwqsjstZ2QddvI5EAKiLwIEhg7/2
 RpnOZoiFIxykduEYLxeh
 =CfCl
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.5a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 4.5 cycle

Usual mixed bag, but the big item perhaps in this series is the DMA buffer
support added by Lars-Peter Clausen. It's been in the works for a long time
and it will be interesting to see what hardware support shows up now that
this is available.

New core features + associate cleanup.
* Add generic DMA buffer infrastructure
* Add a DMAengine framework based buffer
 Also associated minor changes.
   - Set the device buffer watermark based on the minimum watermark for all
     attached buffers rather than just the 'primary' one.
   - iio_buffer_init - only set the watermark default if one hasn't already
     been provided.  This allows simple support for devices with a fixed
     watermark.
   - read only attribute for watermark on fixed watermark devices.
   - add explicit buffer enable/disable callbacks to allow the buffer to
     do more than trivial actions when it is being turned on and off.
* IIO_VAL_INT support in write_raw_get_fmt function.

New device support
* Freescale MMA7455/7456L accelerometers
* Memsic MXC6255XC accelerometer
* ST lis2dh12 accelerometer
* TI ADS8688 ADC
* TI Palamas (twl6035/7) gpadc

New driver features
* mma8452
  - support either of the available interrupt pins to cope with the case
    where board layout has lead to a particular one being connected.

Staging graduation
* Dummy driver
  - this driver acts as both an example and a test device for those with
    out hardware to develop userspace code against.

Cleanups and minor bits and bobs.
* treewide
  - Sort out the ordering of iio_device_register/unregister vs runtime
    pm function calls so that it's all nice and consistent and not race
    prone.
  - Check sscanf return values.  None of the cases will actually happen as
    the strings are supplied internally, but best to be consistent on this.
* ad7780
  - switch over to the gpio descriptor interface and remove the now unused
    platform data which gets rid of a header entirely.
* ad7793
  - drop a pointless else statement.
* at91_adc
  - Swap kmalloc_array in for a kmalloc doing the same job.
* dummy
  - get rid of some commented out lines that snuck in during the move of
    the driver.
* lm3533-als
  - Print an error message on provision of an invalid resistance.
* mcp320x
  - Add compatible strings with vendor prefix and deprecate those with
    no vendor prefix.
* mxs-lradc
  - Use BIT macro in various places rather than shifted ones.
* pa12203001
  - Power off the chip if the registration fails.
* pulsedlight-lidar-lite
  - add runtime PM support.
* xilinx XADC
  - constify an iio_buffer_setup_ops structure.
2015-12-01 09:13:29 -08:00
Adriana Reus 7d0ead5c3f iio: Reconcile operation order between iio_register/unregister and pm functions
At probe, runtime pm should be setup before registering the sysfs interface so
that all the power attributes are accurate and functional when registering.
Also, when removing the device we should unregister first to make sure
that the interfaces that may result in wakeups are no longer available.

Fix this behaviour for the following drivers: bmc150, bmg160, kmx61,
kxcj-1013, mma9551, mma9553, rpr0521.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:36:53 +00:00
Linus Torvalds 75f5db39ff spi: Updates for v4.4
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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWOehzAAoJECTWi3JdVIfQTPYH+wYMDG8gAIw2s0AJ4DvVe4qZ
 sOAm1UgUJZxssrEA6BNqbfM0dfRo+oQJKmRd0Dc5n7LEMsYHdI/5yKHk8PCS6ZzD
 iQyQCzbd0thDAqwuPaMP62cyPDHwyJX22VGTsgVnj6AZqAQ+9+g4SPKhFnm1Mlm4
 hmDi6fdSrsqo8k8gkpVN8RFOfVsjAV1dLtAauQRWDHrqMxXURSrKG76eqAqUa5bn
 BLPXBoj5PA0DMLPO2j+ADZwWN723LrI2mSSlc+ThjEX/OIt2OhAoiOTV5RPqaafy
 TIsCkh68q/gYAsL5HtvvmgZByl41FLYiO0Z+rXmWUyMMbnvhZTLws9S2BNpBLuk=
 =DgXG
 -----END PGP SIGNATURE-----

Merge tag 'spi-v4.4' of 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-11-05 13:15:12 -08:00
Andrew F. Davis 3821a065f5 spi: Drop owner assignment from spi_drivers
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-28 10:30:17 +09:00
Octavian Purdila 0f0796509c iio: remove gpio interrupt probing from drivers that use a single interrupt
Commit 845c877009 ("i2c / ACPI: Assign IRQ for devices that have
GpioInt automatically") automatically assigns the first ACPI GPIO
interrupt in client->irq, so we can remove the probing code from
drivers that use only one interrupt.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-03 12:05:51 +01:00
Greg Kroah-Hartman 9f827d8099 First round of new driver, new functionality and cleanups for IIO in the 4.4 cycle
New device support
 * APDS9960 ALS + proximity driver
 * bmg160 SPI devices.
 * HDC100x humidity sensors
 * Holt HI-8435 threshold detector
 * mma8453Q accelerometer added to the mma8452 driver
 * mma86452FC and mma8653FC accelerometers added to the mma8452 driver
 * mxc4005 accelerometer
 * PulsedLight LIDAR
 * SensorTech VZ89x volatile organic compound sensor
 * UPISEMI uS5182d ALS and proximity sensors
 
 New core functionality
 * triggered events - use triggers to check for changes in threshold type
   detectors on devices with out interrupt support.  First user is the holt
   comparator.
 * chemical concentration and resistance channel types.
 
 New driver functionality
 * vf610
   - buffer support.
   - followup coccinelle warning fix.
 
 Core rework
 * buffers
   - break out callback buffer to own module.
   - move buffer implementations to a new subdirectory
 * percolate the error code form iio_event_getfd out to userspace
   rather than giving a missleading error later on.
 
 Cleanups
 * adddac drivers
   - use BIT macro where appropriate.
 * meter drivers
   - use BIT macro where appropriate.
 
 * ad7303
  - add an OF match table to line up with the binding docs.
 * adc128s052
   - add an OF match table to line up with the binding docs.
 * adf4350
   - add an OF match table to line up with the binding docs
 * as3935
   - add an OF match table to line up with the binding docs.
 * berlin2-adc
   - use GENMASK and BIT for masks
   - prevent attempting to sample multiple channels at once by moving a
     mutex scop
   - coding style cleanups
 * bmg150_magn
   - kconfig sort order was wrong - fix it.
 * bmg160
   - use i2c regmap and drop all uses of i2c_client
   - separate i2c and core driver
 * cc10001_adc
   - kconfig sort order was wrong - fix it.
 * evgen (dummy driver helper module)
   - move interrupt generation to irq_work to reduce differences between
     the dummy driver and real hardware drivers.
 * hmc5843
   - set the name dynamically rather than to a fixed value for one of the
     suported parts.
   - export module alias information to allow autoprobing of module.
 * lpc32xx
   - on failure to get resource or irq return -ENXIO as uppose to -EBUSY
 * max1027
   - set .of_match_table to actually allow OF style matching.
 * max5821
   - add MODULE_DEVICE_TABLE for OF table.
 * mma8452
   - refactor to separate out chip specific data.
   - add freefall / motion interrupt source for devices that do their
     interrupts slightly differently.
   - update copywrite notice.
   - leave naming of events directory in sysfs to the core
 * mcp320x
   - set .of_match_table so that it can be use for OF style matching.
 * mlx90614
   - Implement filter configuration (note the datasheet changed as a result
     of the driver reviews to include the values we needed ;)
 * opt3001
   - drop .owner field as assigned by platform driver core.
 * si7020
   - replace a bitmask on the humidity values with a more correct range
     check.
 * stk310
   - improved error handling.
   - use BIT macro where appropriate and use the resulting defines
     instead of magic numbers in the code.
   - fix indentation
 * st-sensors
   - add debugfs register read hook
 * tsl4531
   - fix error handling in check_id
 * twl6030
   - fix module autoload for OF
 * iio-trig-sysfs
   - document add and remove attribute
 * trigger in staging
   - code alignment fixes.
   - braces on both branches of if statement if needed for one.
 * xilinx-xadc
   - push interrupts into hardirq context as there isn't much in them
     any more and it avoids breaking PREEMPT_RT builds due to the use
     of a spinlock between the hardirq and the thread.
 
 Tools
 * event-monitor
   - report unsupported events.  We keep expanding what can come from drivers
     so give a helpful error if one turns up in an out of date userspace
     program.
 * generic-buffer
   - helpful message about needing to enable a channel to start the buffer.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWBDeHAAoJEFSFNJnE9BaIgSQP/183S1WJTqpsrz3APZY4qQLU
 m8Jv6VCvtSENpryUxn6MtfPuVeBa8LwhciAtelsJfVvu2O902VAOcsgMhgp3cz7Y
 daTXio/XhdA7YJvuOkycLD3CdWJ7Gb3+nieBmcEb0YMAMIgchMR+gI/LYR/htISz
 Req9EM8C/4sU5hn3r92mVZFMiV5XWsApCv61A6IzXdaz4YgiEjtFb8NF87IPlFq0
 Rpg3BG4/9Ka1tUaZs6a98sWXqudCzHSetKk9GLFbnhoo6xC+C33b06Z+fSinAZmn
 FsVGfQ/I6xhFJmCJLifLq/voN9gbDuebUQCPIYPfu7Oby29JcK95P60ZHM954s2M
 DGTCQ44GTReA2IqRvxlgQDU/TBUTwWKKDnuelw6+387t/wT0tnnfkwFrps1xPqGy
 k1qHVViofzf3iSKdDKeQyMjDoO+nMUv0DdkzYNz4xCPQIhGMRXA/Q+U81tJvJHZl
 rwhHVruFHyhI1/sTvTMJ/5+F7lL7LieFdCTVnzl0QblzMskGpLy5d/fMJn8OLVqa
 6PiA5x3799U2o67wtCYH+RoSdQj1U+qEFkg7Oe+nVvlpbs/vfdR2dI3wYfp8459l
 mjafTgW8R+7tXYKU+iSKA4660QIN9LR6byBqyxX97mjyYxn3ml3VWJ44ztqfhjZd
 1ZyZxsWa2y5b6L017kJN
 =E+jf
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.4a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First round of new driver, new functionality and cleanups for IIO in the 4.4 cycle

New device support
* APDS9960 ALS + proximity driver
* bmg160 SPI devices.
* HDC100x humidity sensors
* Holt HI-8435 threshold detector
* mma8453Q accelerometer added to the mma8452 driver
* mma86452FC and mma8653FC accelerometers added to the mma8452 driver
* mxc4005 accelerometer
* PulsedLight LIDAR
* SensorTech VZ89x volatile organic compound sensor
* UPISEMI uS5182d ALS and proximity sensors

New core functionality
* triggered events - use triggers to check for changes in threshold type
  detectors on devices with out interrupt support.  First user is the holt
  comparator.
* chemical concentration and resistance channel types.

New driver functionality
* vf610
  - buffer support.
  - followup coccinelle warning fix.

Core rework
* buffers
  - break out callback buffer to own module.
  - move buffer implementations to a new subdirectory
* percolate the error code form iio_event_getfd out to userspace
  rather than giving a missleading error later on.

Cleanups
* adddac drivers
  - use BIT macro where appropriate.
* meter drivers
  - use BIT macro where appropriate.

* ad7303
 - add an OF match table to line up with the binding docs.
* adc128s052
  - add an OF match table to line up with the binding docs.
* adf4350
  - add an OF match table to line up with the binding docs
* as3935
  - add an OF match table to line up with the binding docs.
* berlin2-adc
  - use GENMASK and BIT for masks
  - prevent attempting to sample multiple channels at once by moving a
    mutex scop
  - coding style cleanups
* bmg150_magn
  - kconfig sort order was wrong - fix it.
* bmg160
  - use i2c regmap and drop all uses of i2c_client
  - separate i2c and core driver
* cc10001_adc
  - kconfig sort order was wrong - fix it.
* evgen (dummy driver helper module)
  - move interrupt generation to irq_work to reduce differences between
    the dummy driver and real hardware drivers.
* hmc5843
  - set the name dynamically rather than to a fixed value for one of the
    suported parts.
  - export module alias information to allow autoprobing of module.
* lpc32xx
  - on failure to get resource or irq return -ENXIO as uppose to -EBUSY
* max1027
  - set .of_match_table to actually allow OF style matching.
* max5821
  - add MODULE_DEVICE_TABLE for OF table.
* mma8452
  - refactor to separate out chip specific data.
  - add freefall / motion interrupt source for devices that do their
    interrupts slightly differently.
  - update copywrite notice.
  - leave naming of events directory in sysfs to the core
* mcp320x
  - set .of_match_table so that it can be use for OF style matching.
* mlx90614
  - Implement filter configuration (note the datasheet changed as a result
    of the driver reviews to include the values we needed ;)
* opt3001
  - drop .owner field as assigned by platform driver core.
* si7020
  - replace a bitmask on the humidity values with a more correct range
    check.
* stk310
  - improved error handling.
  - use BIT macro where appropriate and use the resulting defines
    instead of magic numbers in the code.
  - fix indentation
* st-sensors
  - add debugfs register read hook
* tsl4531
  - fix error handling in check_id
* twl6030
  - fix module autoload for OF
* iio-trig-sysfs
  - document add and remove attribute
* trigger in staging
  - code alignment fixes.
  - braces on both branches of if statement if needed for one.
* xilinx-xadc
  - push interrupts into hardirq context as there isn't much in them
    any more and it avoids breaking PREEMPT_RT builds due to the use
    of a spinlock between the hardirq and the thread.

Tools
* event-monitor
  - report unsupported events.  We keep expanding what can come from drivers
    so give a helpful error if one turns up in an out of date userspace
    program.
* generic-buffer
  - helpful message about needing to enable a channel to start the buffer.
2015-09-30 03:37:48 +02:00
Linus Torvalds 8d2faea672 This is the bulk of GPIO changes for the v4.3 kernel cycle:
Core changes:
 
 - Root out the wrapper devm_gpiod_get() and gpiod_get() etc
   versions of the descriptor calls that did not use the flags
   argument on the end. This was around for too long and eventually
   Uwe Kleine-König took the time to clean it out and the last
   users are removed along with the macros in this tag. In several
   cases the use of flags simplifies the code. For this reason we
   have (ACKed) patches hitting in DRM, IIO, media, NFC, USB+PHY
   up until we hammer in the nail with removing the macros.
 
 - Add a fat document describing how much ready-made GPIO stuff
   we have i the kernel to discourage people from reinventing
   a square wheel in userspace, as so often happens.
 
 - Create a separate lockdep class for each instance of a GPIO
   IRQ chip instead of using one class for all chips, as the current
   code will not work with systems with several GPIO chips doing
   lockdep debugging.
 
 - Protect against driver unloading also when a GPIO line is only
   used as IRQ for the GPIOLIB_IRQCHIP helpers.
 
 - If the GPIO chip has no designated owner, assign the parent
   device driver owner as owner.
 
 - Consolidation of chained IRQ handler install/remove replacing
   all call sites where irq_set_handler_data() and
   irq_set_chained_handler() were done in succession with a
   combined call to irq_set_chained_handler_and_data(). This
   series was created by Thomas Gleixner after the problem was
   observed by Russell King.
 
 - Tglx also made another series of patches switching
   __irq_set_handler_locked() for irq_set_handler_locked() which
   is way cleaner.
 
 - Tglx and Jiang Liu wrote a good bunch of patches to make use of
   irq_desc_get_xxx() accessors and avoid looking up irq_descs
   from IRQ numbers. The goal is to get rid of the irq number
   from the handlers in the IRQ flow which is nice.
 
 - Rob Herring killed off the set_irq_flags() for all GPIO
   drivers. This was an ARM specific function that is replaced
   with the generic irq_modify_status() where special flags
   are actually needed.
 
 - When an OF node has a pin range for its GPIOs, return
   -EPROBE_DEFER if the pin controller isn't available.
   Pretty logical, yet needed to be fixed.
 
 - If a driver using GPIOLIB_IRQCHIP has its own
   irq_*_resources call back, then call these instead of the
   defaults provided by the GPIOLIB.
 
 - Fix an undocumented ABI hole: named GPIOs were not
   properly documented.
 
 Driver improvements:
 
 - Add get_direction() support to the generic GPIO driver, it's
   strange that we didn't have that before.
 
 - Make it possible to have input-only GPIO chips using the
   generic GPIO driver.
 
 - Clean out platform data support from the Emma Mobile (EM)
   driver
 
 - Finegrained runtime PM support for the RCAR driver.
 
 - Support r8a7795 (R-car H3) in the RCAR driver.
 
 - Support interrupts on GPIOs 16 thru 31 in the DaVinci driver.
 
 - Some consolidation and new support in the MPC8xxx driver,
   we now support MPC5125.
 
 - Preempt-RT-friendly patches: the OMAP, MPC8xxx, drivers uses raw
   spinlocks making it work better with the realime patches.
 
 - Interrupt support for the EXTRAXFS GPIO driver.
 
 - Make the ETRAXFS GPIO driver support also ARTPEC-3.
 
 - Interrupt and wakeup support for the BRCMSTB driver, also for
   wakeup from S5 cold boot.
 
 - Mask MXC IRQs during suspend.
 
 - Improve OMAP2 GPIO set_debounce() to work according to spec.
 
 - The VF610 driver handles IRQs properly.
 
 New drivers:
 
 - ZTE ZX GPIO driver.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJV52lvAAoJEEEQszewGV1zOVcP/2ZgkfRgl119LZnWShfrEJWq
 UXaNzSaPNgvDzvGaqqi62SZQuhrdIWRKfMPtAuMGbEn5aJx0JC5UAOYjjfkKBqpO
 toqc1w2DScc0JTorY8qgczIBDO1A3ZBAcIvXXpOduy/JaKPoQteRN8WYTynPw48/
 0+97ZODwhyOkfeqmvUClkc9gW4XT68dudb0Lv1nQjsZmd1dHF2PZlwH3aL9sV68j
 GJAqf09xNqZaWWQBhs+J3ptsYjaJfYjo9NOOUf0Y/UgqXO3vB+2S4EmRATaRHS2F
 aHdj03sNZCNSDEa35WwetbLRGxPzSWmfxmBzQQ1baGdcJICn7Yv58EklPKRvwtMo
 ZpUsgiOV4OUIEClPJohs4xbl2HRsOYB3VbcihkXjVAxS6i2/jgA3Tn8ATvUSZ8wq
 TX8D6BfciigRCkT2G+B0TQBmcX1IQsMd1DBUNfw7Dk1TK/vxH4UYWbke422RjKGz
 ORJ+0DfShMCdYjrCVlt7UbFcqE3L5CnrztLQ3oFt0om2JsSWztV9V579G+Dqo9CI
 fE4G3xlsF33UCvXcmnOp6PuU+ZYBodLggkmK4REy2D3LCOnkcKq0U8Fj5RssApZ9
 FdqVYck555ZpcBiN8ihB97WsmU+0XhBjblCbgzr6GxUw8EJ4x8H9nlraA6bluFoP
 9c2qgPxjCq/VWA/F0YOU
 =iQ2P
 -----END PGP SIGNATURE-----

Merge tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.3 kernel cycle.

  There is quite a lot going on in the GPIO subsystem this merge window,
  so the main matter is decribed below.

  The hits in other subsystems when making the GPIO flags optional are
  all ACKed by their respective subsystem maintainers.

  Core changes:

   - Root out the wrapper devm_gpiod_get() and gpiod_get() etc versions
     of the descriptor calls that did not use the flags argument on the
     end.  This was around for too long and eventually Uwe Kleine-König
     took the time to clean it out and the last users are removed along
     with the macros in this tag.  In several cases the use of flags
     simplifies the code.  For this reason we have (ACKed) patches
     hitting in DRM, IIO, media, NFC, USB+PHY up until we hammer in the
     nail with removing the macros.

   - Add a fat document describing how much ready-made GPIO stuff we
     have i the kernel to discourage people from reinventing a square
     wheel in userspace, as so often happens.

   - Create a separate lockdep class for each instance of a GPIO IRQ
     chip instead of using one class for all chips, as the current code
     will not work with systems with several GPIO chips doing lockdep
     debugging.

   - Protect against driver unloading also when a GPIO line is only used
     as IRQ for the GPIOLIB_IRQCHIP helpers.

   - If the GPIO chip has no designated owner, assign the parent device
     driver owner as owner.

   - Consolidation of chained IRQ handler install/remove replacing all
     call sites where irq_set_handler_data() and
     irq_set_chained_handler() were done in succession with a combined
     call to irq_set_chained_handler_and_data().

     This series was created by Thomas Gleixner after the problem was
     observed by Russell King.

   - Tglx also made another series of patches switching
     __irq_set_handler_locked() for irq_set_handler_locked() which is
     way cleaner.

   - Tglx and Jiang Liu wrote a good bunch of patches to make use of
     irq_desc_get_xxx() accessors and avoid looking up irq_descs from
     IRQ numbers.  The goal is to get rid of the irq number from the
     handlers in the IRQ flow which is nice.

   - Rob Herring killed off the set_irq_flags() for all GPIO drivers.
     This was an ARM specific function that is replaced with the generic
     irq_modify_status() where special flags are actually needed.

   - When an OF node has a pin range for its GPIOs, return -EPROBE_DEFER
     if the pin controller isn't available.  Pretty logical, yet needed
     to be fixed.

   - If a driver using GPIOLIB_IRQCHIP has its own irq_*_resources call
     back, then call these instead of the defaults provided by the
     GPIOLIB.

   - Fix an undocumented ABI hole: named GPIOs were not properly
     documented.

  Driver improvements:

   - Add get_direction() support to the generic GPIO driver, it's
     strange that we didn't have that before.

   - Make it possible to have input-only GPIO chips using the generic
     GPIO driver.

   - Clean out platform data support from the Emma Mobile (EM) driver

   - Finegrained runtime PM support for the RCAR driver.

   - Support r8a7795 (R-car H3) in the RCAR driver.

   - Support interrupts on GPIOs 16 thru 31 in the DaVinci driver.

   - Some consolidation and new support in the MPC8xxx driver, we now
     support MPC5125.

   - Preempt-RT-friendly patches: the OMAP, MPC8xxx, drivers uses raw
     spinlocks making it work better with the realime patches.

   - Interrupt support for the EXTRAXFS GPIO driver.

   - Make the ETRAXFS GPIO driver support also ARTPEC-3.

   - Interrupt and wakeup support for the BRCMSTB driver, also for
     wakeup from S5 cold boot.

   - Mask MXC IRQs during suspend.

   - Improve OMAP2 GPIO set_debounce() to work according to spec.

   - The VF610 driver handles IRQs properly.

  New drivers:

   - ZTE ZX GPIO driver"

* tag 'gpio-v4.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits)
  Revert "gpio: extraxfs: fix returnvar.cocci warnings"
  gpio: tc3589x: use static container helper
  gpio: xlp: fix error return code
  gpio: vf610: handle level IRQ's properly
  gpio: max732x: Fix error handling in probe()
  gpio: omap: fix clk_prepare/unprepare usage
  gpio: omap: protect regs access in omap_gpio_irq_handler
  gpio: omap: fix omap2_set_gpio_debounce
  gpio: omap: switch to use platform_get_irq
  gpio: omap: remove wrong irq_domain_remove usage in probe
  gpiolib: add description for gpio irqchip fields in struct gpio_chip
  gpio: extraxfs: fix returnvar.cocci warnings
  gpiolib: irqchip: use different lockdep class for each gpio irqchip
  gpio/grgpio: fix deadlock in grgpio_irq_unmap()
  Documentation: gpio: consumer: describe active low property
  gpio: mxc: fix section mismatch warning
  gpio/mxc: mask gpio interrupts in suspend
  gpio: omap: Fix missing raw locks conversion
  gpio: brcmstb: support wakeup from S5 cold boot
  gpio: brcmstb: Add interrupt and wakeup source support
  ...
2015-09-04 10:07:45 -07:00
Linus Walleij a0175b9c76 iio: st_sensors: add debugfs register read hook
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-08-16 10:51:25 +01:00
Linus Walleij 5f6f02cd49 Linux 4.2-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJVtTRqAAoJEHm+PkMAQRiGN+wH/1mPJBCvt7DqvV90+/QKPEA6
 KXWtiy+oDavOv1vPcwL4gdYmMqXd2fSv82Zv5+E5ABFHXSyZvG5eCZvQLPz0V73f
 ldrSgTYVfbYb0W+TnaC1gr8aMS38i4F/eXCoPZMtO8WyUn7xhJZS9Y3U8Ff4/gp3
 to+4TaHhsnv2R79UyoR4elObo2n6aMkBSertjndbYoEQ4Zgr5iIoxbMDi4raeghP
 BLB6Mh50tqNMxE5OL/ERj1oHmJK9TIy2sNmOhP/1xp7XGK/KZm8Z+CIglaf1gOcM
 IM8pEgwDIlxp78MERn/PB/+xDkgUw0W9OqKPcUxiIt+M7TNRQ9UTb4Tn1SR2/cE=
 =fHSS
 -----END PGP SIGNATURE-----

Merge tag 'v4.2-rc4' into devel

Linux 4.2-rc4
2015-08-13 14:42:55 +02:00
Hartmut Knaack 2427d22de8 iio:magnetometer:bmc150_magn: sort entry alphabetically
Sort the entry for bmc105_magn in Kconfig and Makefile to its correct
position. Also add the minor module information for completeness.

Fixes: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:18:21 +01:00
Greg Kroah-Hartman 1c46ae0af6 Second set of new device support, features and cleanup for the 4.3 cycle.
Take 2 also includes a fix set that was too late for the 4.2 cycle.
 
 As we had a lot of tools and docs work in this set, I have broken those
 out into their own categories in this description.
 
 Fixes from the pull request '4th set of IIO fixes for the 4.2 cycle'.
 * Poll functions for both event chardev and the buffer one were returning
   negative error codes (via a positive value).
 * A recent change to lsiio adding some error handling that was wrong and
   stopped the tool working.
 * bmg160 was missing some dependencies in Kconfig
 * berlin2-adc had a misshandled register (wrote a value rather than a bitmap)
 
 New device support
 * TI opt3001 light sensor
 * TXC PA12 ALS and proximity sensor.
 * mcp3301 ADC support (in mcp320x driver)
 * ST lsm303agr accelerometer and magnetometer drivers (plus some st-sensors
   common support to allow different WHOAMI register addresses, devices with
   fixed scale and allow interrupt equiped magnetometers).
 * ADIS16305, ADIS16367, ADIS16445IMUs (in the adis16400 driver)
 * ADIS16266 gyro (in the adis16260 driver)
 * ADIS16137 gyro (in the adis16136 driver)
 
 New functionality
 * mmc35240 DT bindings.
 * Inverse unit conversion macros to aid handing of values written to sysfs
   attributes.
 
 Core cleanup
 * Forward declaration of struct iio_trigger to avoid a compile warning.
 
 Driver cleanup / fixes
 * mxs-lradc
   - Clarify which parts are supported.
   - Fix spelling erorrs.
   - Missing/extra includes
   - reorder includes
   - add datasheet name listings for all usable channels (to allow them
     to be bound by name from consumer drivers)
 * acpi-als - add some function prefixes as per general iio style.
 * bmc150_magn - replace a magic value with the existing define.
 * vf610 - determine possible sample frequencies taking into account the
   electrical characteristics (defining a minimum sample time)
 * dht11
   - whitespace
   - additional docs
   - avoid mulitple assignments in one line
   - Use the new funciton ktime_get_resolution_ns to cleanup a nasty trick
     previously used for timing.
 * Fix all drivers that consider 0 a valid IRQ for historical reasons.
 * Export I2C module alias info where previously missing (to allow autoprobing)
 * Export OF module alias info where previously missing.
 * mmc35240 - switch some variables into arrays to improve readability.
 * mlx90614 - define some magic numbers for readability.
 * bmc150_magn
   - expand area locked by a mutex to cover all the use of the
     data->buffer.
   - use descriptive naming for a mask instead of a magic value.
 * berin2-adc
   - pass up an error code rather that a generic error
   - constify the iio_chan_spec
   - some other little tidy ups.
 * stk8312
   - fix a dependency on triggered buffers in kconfig
   - add a check for invalid attribute values
   - improve error handling by returning error codes where possible and
     return immediately where relevant
   - rework macro defs to use GENMASK etc
   - change some variable types to reduce unnecessary casting
   - clean up code style
   - drop a local buffer copy for bulk reads and use the one in data->buffer
      instead.
 * adis16400 - the adis16448 gyroscope scale was wrong.
 * adis16480 - some more wrong scales for various parts.
 * adis16300 - has an undocumented product id and serial number registers so
   use them.
 * iio_simple_dummy - fix some wrong code indentation.
 * bmc150-accel - use the chip ID to detect the chip present rather than
   verifying the expected part was there.  This was in response to a wrong
   ACPI entry on the WinBook TW100.
 * mma8452
   - fix _get_hp_filter_index
   - drop a double include
   - pass up an error code rather than rewriting it
   - range check input values to attribute writes
   - register defs tidy up using GENMASK and reordering them to be easier to
     follow.
   - various coding style cleanups
   - put the Kconfig entry in the write place (alphabetically).
 
 Tools related
 * Tools cleanup - drop an explicity NULL comparison, some unnecessary braces,
   use the ARRAY_SIZE macro, send error messages to stderr instead of dropping
   them in the middle of normal output.
 * Fix tools to allow that scale and offset attributes are optional.
 * More tools fixes including allowing true 32bit data (previously an overflow
   prevented more than 31bits)
 * Drop a stray header guard that ended up in a c file.
 * Make calc_digits static as it isn't exported or in the header.
 * Set ci_array pointer to NULL after free as a protection against non safe
   usage of the tools core code.  Also convert a double pointer to a single
   one as the extra level of indirection was unnecessary.
 
 Docs
 * DocBook introduction by Daniel Baluta.  Glad we are beginning to
   draw together some more introductory docs to suplement the various
   tools / examples.
 * Drop bytes_per_datum sysfs attribute docs as it no longer exists.
 * A whole load of missing / fixing of kernel-doc for the core of IIO.
 * Document the trigger name sysfs attribute in the ABI docs.
 * Minor typos in the ABI docs related to power down modes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVy5EbAAoJEFSFNJnE9BaIyjEQAIXc+mjgdyMJEXLKlKKGCSY5
 EX7saX91IeSK5y0CWX0hd0VPewaj4ExG7PWo3gqUSm1L9zmusLcyJm8W2pev3CGE
 m7s40efxZJw0Jmmu18a3LCfcHUu/LWl4mHQtZy/AFGgWhZzWIyKA2XLqgc+Wu9qb
 sjzleSJ05etDksyA7JWFCrrwBnJlW4lD25o0nD0kt3Wry2wlbN2JvZ9QLmmoc0ex
 shvtI556Ew0FRywT9ir555EoJNAQQMW85Ft0dWFBnLwgc67nFTa4YNRXgoRlzhh/
 sRnGKzrs5SVc1c9sxiVS4utiazxy/irHgZ5FkvTTq7F+GXeIwPK9Xv/SXZTmvs5w
 lrSazRIjiLqWgpv/5oaOOGlikbpctI2kSXO0GbCW8th+l3KnKcKfComa3fnU7dca
 /lofp/JzpIfwM+Bnjl1nlNuEbT0mlfJySfhUSSu/kHJxOcvDfkK4vv3oSfFp5nbF
 rhA9vbVEfopXTGIOwWDjV4j0HtMCEHgOPN3T0kuyiYiWZUIjfJXchXG8e5h9/ncd
 ACjH3fg6FQtHzTtzqLQky/NVAKcnFrgJSokN25GXF7R95TxufYJ6RIfnenJiCd2n
 QCIdPam4bZh3/C2QYtiqWKY5e+zfkqs88/Er/HGgvxRUhKCbTvCcey1RY7FEDFHY
 +9nMx/Yts8L1ulUEMjsm
 =/b3G
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.3b-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new device support, features and cleanup for the 4.3 cycle.
Take 2 also includes a fix set that was too late for the 4.2 cycle.

As we had a lot of tools and docs work in this set, I have broken those
out into their own categories in this description.

Fixes from the pull request '4th set of IIO fixes for the 4.2 cycle'.
* Poll functions for both event chardev and the buffer one were returning
  negative error codes (via a positive value).
* A recent change to lsiio adding some error handling that was wrong and
  stopped the tool working.
* bmg160 was missing some dependencies in Kconfig
* berlin2-adc had a misshandled register (wrote a value rather than a bitmap)

New device support
* TI opt3001 light sensor
* TXC PA12 ALS and proximity sensor.
* mcp3301 ADC support (in mcp320x driver)
* ST lsm303agr accelerometer and magnetometer drivers (plus some st-sensors
  common support to allow different WHOAMI register addresses, devices with
  fixed scale and allow interrupt equiped magnetometers).
* ADIS16305, ADIS16367, ADIS16445IMUs (in the adis16400 driver)
* ADIS16266 gyro (in the adis16260 driver)
* ADIS16137 gyro (in the adis16136 driver)

New functionality
* mmc35240 DT bindings.
* Inverse unit conversion macros to aid handing of values written to sysfs
  attributes.

Core cleanup
* Forward declaration of struct iio_trigger to avoid a compile warning.

Driver cleanup / fixes
* mxs-lradc
  - Clarify which parts are supported.
  - Fix spelling erorrs.
  - Missing/extra includes
  - reorder includes
  - add datasheet name listings for all usable channels (to allow them
    to be bound by name from consumer drivers)
* acpi-als - add some function prefixes as per general iio style.
* bmc150_magn - replace a magic value with the existing define.
* vf610 - determine possible sample frequencies taking into account the
  electrical characteristics (defining a minimum sample time)
* dht11
  - whitespace
  - additional docs
  - avoid mulitple assignments in one line
  - Use the new funciton ktime_get_resolution_ns to cleanup a nasty trick
    previously used for timing.
* Fix all drivers that consider 0 a valid IRQ for historical reasons.
* Export I2C module alias info where previously missing (to allow autoprobing)
* Export OF module alias info where previously missing.
* mmc35240 - switch some variables into arrays to improve readability.
* mlx90614 - define some magic numbers for readability.
* bmc150_magn
  - expand area locked by a mutex to cover all the use of the
    data->buffer.
  - use descriptive naming for a mask instead of a magic value.
* berin2-adc
  - pass up an error code rather that a generic error
  - constify the iio_chan_spec
  - some other little tidy ups.
* stk8312
  - fix a dependency on triggered buffers in kconfig
  - add a check for invalid attribute values
  - improve error handling by returning error codes where possible and
    return immediately where relevant
  - rework macro defs to use GENMASK etc
  - change some variable types to reduce unnecessary casting
  - clean up code style
  - drop a local buffer copy for bulk reads and use the one in data->buffer
     instead.
* adis16400 - the adis16448 gyroscope scale was wrong.
* adis16480 - some more wrong scales for various parts.
* adis16300 - has an undocumented product id and serial number registers so
  use them.
* iio_simple_dummy - fix some wrong code indentation.
* bmc150-accel - use the chip ID to detect the chip present rather than
  verifying the expected part was there.  This was in response to a wrong
  ACPI entry on the WinBook TW100.
* mma8452
  - fix _get_hp_filter_index
  - drop a double include
  - pass up an error code rather than rewriting it
  - range check input values to attribute writes
  - register defs tidy up using GENMASK and reordering them to be easier to
    follow.
  - various coding style cleanups
  - put the Kconfig entry in the write place (alphabetically).

Tools related
* Tools cleanup - drop an explicity NULL comparison, some unnecessary braces,
  use the ARRAY_SIZE macro, send error messages to stderr instead of dropping
  them in the middle of normal output.
* Fix tools to allow that scale and offset attributes are optional.
* More tools fixes including allowing true 32bit data (previously an overflow
  prevented more than 31bits)
* Drop a stray header guard that ended up in a c file.
* Make calc_digits static as it isn't exported or in the header.
* Set ci_array pointer to NULL after free as a protection against non safe
  usage of the tools core code.  Also convert a double pointer to a single
  one as the extra level of indirection was unnecessary.

Docs
* DocBook introduction by Daniel Baluta.  Glad we are beginning to
  draw together some more introductory docs to suplement the various
  tools / examples.
* Drop bytes_per_datum sysfs attribute docs as it no longer exists.
* A whole load of missing / fixing of kernel-doc for the core of IIO.
* Document the trigger name sysfs attribute in the ABI docs.
* Minor typos in the ABI docs related to power down modes.
2015-08-12 12:43:41 -07:00
Irina Tirdea 5ab744d0d6 iio: magn: bmc150_magn: do not set power state twice when setting trigger state
When setting the trigger state, the device power state is set through
buffer preenable and postdisable hooks. There is no need
to also set it in the trigger set state call.

Remove duplicate set power state from the trigger set
state call.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 18:19:57 +01:00
Irina Tirdea 019cc46d0a iio: magn: bmc150_magn: add locking comment for runtime resume
Runtime resume function is called with the data->mutex lock held.
Add a comment to indicate this.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 18:18:59 +01:00
Hartmut Knaack 1506f3cd0b iio:magnetometer:bmc150_magn: use descriptive name for mask
Define and use a descriptive name for the repetition registers data mask,
instead of a 'magic' value.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 18:04:29 +01:00
Hartmut Knaack 3021678a94 iio:magnetometer:bmc150_magn: expand mutex in trigger_handler
Keep the mutex locked, until the content of data->buffer has been pushed
out.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 18:03:30 +01:00
Teodora Baluta 9e35d366a1 iio: mmc35240: minor change to improve code readibility
This patch changes two variables to arrays to improve code readibility.

Signed-off-by: Teodora Baluta <teodora.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 17:35:11 +01:00
Greg Kroah-Hartman 6e64e22449 Merge 4.2-rc4 into staging-next
We want the iio and other fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-27 11:10:05 -07:00
Giuseppe Barba 1e9676a847 iio: st-magn: add support for lsm303agr magnetometer
This adds support for the lsm303agr magnetometer.

Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-23 20:43:27 +01:00
Giuseppe Barba 74f5683f35 iio: st_magn: Add irq trigger handling
Add irq trigger handling for magnetometer also

Signed-off-by: Giuseppe Barba <giuseppe.barba@st.com>
Acked-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-23 20:43:13 +01:00
Giuseppe Barba bc27381edb iio: st-sensors: add configuration for WhoAmI address
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-23 20:43:04 +01:00
Greg Kroah-Hartman ed15e8880f Merge 4.2-rc3 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-20 13:21:28 -07:00
Viorel Suman 354c879dbd iio: magnetometer: mmc35240: fix SET/RESET sequence
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 <viorel.suman@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:54:29 +01:00
Daniel Baluta 3ceaa2c207 iio: magnetometer: mmc35240: Fix SET/RESET mask
This fixes setting the SET/RESET bit in the REG_CTRL0
register.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:36 +01:00
Daniel Baluta 8b14821a5c iio: magnetometer: mmc35240: Fix crash in pm suspend
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: [<80e0b3d2>] 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] [<80c0d2d1>] pm_generic_suspend+0x21/0x30
[ 322.578284] [<80d042ab>] i2c_device_pm_suspend+0x1b/0x30

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:35 +01:00
Hartmut Knaack 6a14925ef2 iio:magnetometer:bmc150_magn: output intended variable
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: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:35 +01:00
Hartmut Knaack 2e187a0284 iio:magnetometer:bmc150_magn: add regmap dependency
bmc150_magn makes use of REGMAP_I2C, so select it to build always without
errors.

Fixes: c91746a236 ("iio: magn: Add support for BMC150 magnetometer")

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:53:31 +01:00
Teodora Baluta c99389ad3d iio: magnetometer: mmc35240: fix available sampling frequencies
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 <teodora.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:14 +01:00
Hartmut Knaack 47764c7918 iio:magnetometer:bmc150_magn: replace magic value
Construct the scanmask using its descriptive axis names (as used in
iio_chan_spec) instead of a 'magic' value.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:04:15 +01:00