1
0
Fork 0
Commit Graph

401 Commits (756d097b959aefe69a081496f84cfc14b1397a15)

Author SHA1 Message Date
Julia Lawall d4c65fe4ed iio: adc: spmi-vadc: add missing of_node_put
for_each_available_child_of_node performs an of_node_get on each iteration,
so a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_available_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-21 18:24:44 +00:00
Greg Kroah-Hartman 819db468b2 First set of IIO fixes for the 4.4 cycle.
This set does not include those for issues introduced during the merge
 window.  Fixes of those will follow in a future series.
 
 * ad5064
   - Make sure the local i2c_write returns 0 on success rather than the
     number of bytes transfered.  Otherwise we report an error on all writes.
   - Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
     these parts.
 * ad7793
   - The product ID on the datasheet is wrong.  Fix it in the driver.
 * IIO_DUMMY_EVGEN
   - select IRQ_WORK as a dependency.
 * lpc32xx
   - make sure clock is prepared before enabling.
 * si7020
   - data byte order was reversed. Fix it.
 * vf610
   - Internal temperature calculation was wrong if a different
     reference voltage was used.  Now use a linear interpolation
     function to make it work over the full range.
   - Fix a division by zero in the case of a device tree property
     not being present (same issue two fixes).
 * xilinx XADC
   - VREFN scale was wrong - fix it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWSH0iAAoJEFSFNJnE9BaILcYP/Rb70yJE23oTx6iyMDLip/Im
 7yG+TMh/mFJCrwmpvloRX4IxQ20WApQPEQRaO6ivcoykQ/8eGDK3hrHWiHwYNs9z
 P+q1qxz0F0pnvWHPZ2UZ+p8ZNzuy9ovTSeeuAHQWMVSsPCgiQR3kq0hBVrvV4mVn
 4AQejD0M/x69TWdisZtGJqKBZs44mXHbgqC6Xw/6u0MLpA8ZLHO2XAr9vaSA042T
 PsYXbEMmb/ElRKwadbX4JCqrMsA3FhPx+qD7qPu14bsC8WR4tlNLIBzEmBQJotWf
 8wjK7AF7Af/HMO5KjO6uJe+EdypMq1UjlmqeRWUZIGUlLtmjmkhnRzO4Qahsbx2K
 6TEO1uNhOjg7JQGfeuL9fKMHI6QKkeFIJ/cl2ekRWRwbxS2kOmXA9HTCsxynrdAR
 qC49Eqkbfr/F1vdgDx61JAWgWuZNdxFg3tiD3wP2BMjOipKBuKRt9CvHuOORW7Tp
 aUPruyJduIpcVQBL+wbSElAc4XsjgL4+/KROcfG3x3zWKUjOux73G8WsgaSSQ4Fe
 rP2stYFmZUigIpSW/vTwbdcN8tIT9S/XZjxF/mlP7azIQHyafWTVl6CUlphtewtY
 YZVT2K+t07zQV2NgOi9J+H5yCPG39d1Fb1R4OsWF1Brq2QsQJwqR9Y1ERXiPEJzZ
 DvylTHu0lxP+xgE/Xjuz
 =362F
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of IIO fixes for the 4.4 cycle.

This set does not include those for issues introduced during the merge
window.  Fixes of those will follow in a future series.

* ad5064
  - Make sure the local i2c_write returns 0 on success rather than the
    number of bytes transfered.  Otherwise we report an error on all writes.
  - Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
    these parts.
* ad7793
  - The product ID on the datasheet is wrong.  Fix it in the driver.
* IIO_DUMMY_EVGEN
  - select IRQ_WORK as a dependency.
* lpc32xx
  - make sure clock is prepared before enabling.
* si7020
  - data byte order was reversed. Fix it.
* vf610
  - Internal temperature calculation was wrong if a different
    reference voltage was used.  Now use a linear interpolation
    function to make it work over the full range.
  - Fix a division by zero in the case of a device tree property
    not being present (same issue two fixes).
* xilinx XADC
  - VREFN scale was wrong - fix it.
2015-11-18 13:15:50 -08:00
Thomas Betker a57f8dac46 iio: adc: xilinx: Fix VREFN scale
The scaling factor for VREFN is 3.0/4096 (not 1.0/4096), just as for
VREFP. This is not immediately obvious from the specification (Xilinx
UG480), but has been confirmed by Xilinx support.

Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-15 12:36:20 +00:00
Sanchayan Maity 8546d2e5b1 iio: adc: vf610_adc: Fix division by zero error
In case the fsl,adck-max-frequency property is not present in
the device tree, a division by zero error results during the
probe call on kernel boot (see below). This patch fixes it and
also restores device tree compatibility in case kernels are
booting with old device trees without this property specified.

[    1.063229] Division by zero in kernel.
[    1.067152] CPU: 0 PID: 1 Comm: swapper Not tainted
4.3.0-rc5-00212-gcc88cef #37
[    1.074650] Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
[    1.081135] Backtrace:
[    1.083694] [<800134a4>] (dump_backtrace) from [<8001369c>]
(show_stack+0x18/0x1c)
[    1.091340]  r7:00000008 r6:8e0ae210 r5:00000000 r4:8e299800
[    1.097146] [<80013684>] (show_stack) from [<80297b1c>]
(dump_stack+0x24/0x28)
[    1.104483] [<80297af8>] (dump_stack) from [<80013608>]
(__div0+0x1c/0x20)
[    1.111421] [<800135ec>] (__div0) from [<802968b4>] (Ldiv0+0x8/0x10)
[    1.117865] [<80424350>] (vf610_adc_probe) from [<803153b4>]
(platform_drv_probe+0x4c/0xac)
[    1.126311]  r10:00000000 r9:8076a5ec r8:00000000 r7:fffffdfb
r6:807cc67c r5:8e0ae210
[    1.134319]  r4:807f6c54
[    1.136915] [<80315368>] (platform_drv_probe) from [<803138bc>]
(driver_probe_device+0x20c/0x2f8)
[    1.145882]  r7:807cc67c r6:00000000 r5:8e0ae210 r4:807f6c54
[    1.151657] [<803136b0>] (driver_probe_device) from [<80313a3c>]
(__driver_attach+0x94/0x98)
[    1.160190]  r9:8076a5ec r8:00000098 r7:00000000 r6:8e0ae244
r5:807cc67c r4:8e0ae210
[    1.168112] [<803139a8>] (__driver_attach) from [<80311cb8>]
(bus_for_each_dev+0x70/0xa4)
[    1.176383]  r7:00000000 r6:803139a8 r5:807cc67c r4:00000000
[    1.182159] [<80311c48>] (bus_for_each_dev) from [<80313318>]
(driver_attach+0x24/0x28)
[    1.190260]  r6:807bb568 r5:8e2a5b00 r4:807cc67c
[    1.194996] [<803132f4>] (driver_attach) from [<80312f50>]
(bus_add_driver+0x1a4/0x21c)
[    1.203113] [<80312dac>] (bus_add_driver) from [<803142a8>]
(driver_register+0x80/0x100)
[    1.211275]  r7:8e2a7dc0 r6:807a8160 r5:80789e14 r4:807cc67c
[    1.217075] [<80314228>] (driver_register) from [<803152f8>]
(__platform_driver_register+0x5c/0x64)
[    1.226216]  r5:80789e14 r4:807a8160
[    1.229877] [<8031529c>] (__platform_driver_register) from
[<80789e30>] (vf610_adc_driver_init+0x1c/0x20)
[    1.239556] [<80789e14>] (vf610_adc_driver_init) from [<800095f8>]
(do_one_initcall+0x94/0x1dc)
[    1.248365] [<80009564>] (do_one_initcall) from [<8076ae34>]
(kernel_init_freeable+0x13c/0x1e0)
[    1.257155]  r10:80794830 r9:8076a5ec r8:00000098 r7:807d5780
r6:807d5780 r5:00000006
[    1.265153]  r4:807a0ee8
[    1.267753] [<8076acf8>] (kernel_init_freeable) from [<80590ef0>]
(kernel_init+0x18/0xf0)
[    1.276021]  r10:00000000 r9:00000000 r8:00000000 r7:00000000
r6:00000000 r5:80590ed8
[    1.284015]  r4:807d5780
[    1.286615] [<80590ed8>] (kernel_init) from [<8000f878>]
(ret_from_fork+0x14/0x3c)
[    1.294278]  r5:80590ed8 r4:00000000

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Acked-by: Fugang Duan <B38611@freescale.com>
Acked-by: Stefan Agner <stefan@agner.ch>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:41:09 +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
Mark Brown 4c84518523 Merge remote-tracking branches 'spi/topic/omap-100k', 'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next 2015-11-04 11:02:12 +00: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
Greg Kroah-Hartman cf516d08ec Merge 4.3-rc7 into staging-next
We want the other staging patches in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-27 09:13:38 +09:00
Lars-Peter Clausen 785171fd6c iio:ad7793: Fix ad7785 product ID
While the datasheet for the AD7785 lists 0xXB as the product ID the actual
product ID is 0xX3.

Fix the product ID otherwise the driver will reject the device due to non
matching IDs.

Fixes: e786cc26dc ("staging:iio:ad7793: Implement stricter id checking")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-25 13:39:42 +00:00
Bhuvanchandra DV 6219f432ec vf610_adc: Fix internal temperature calculation
Calculate ADCR_VTEMP25 using VTEMP25 at VREFH_ADC 3V3. Existing
calculations consider the typical values provided in datasheet.
Those typical values are valid for VREFH_ADC at 3.0V. VTEMP25
is different for different VREFH_ADC voltages. With VREFH_ADC
at 3.3V, voltage at 25°C is 0.699V. Hence update the VTEMP25
to 0.699V which gives ADCR@Temp25 as 867.

Formula for finding ADCR@Temp25:
ADCR@Temp25 = (ADCR@Vdd * V@TEMP25 * 10) / VDDconv

ADCR@Vdd for 12-Bit ADC = 4095
VDDconv = VREFH_ADC * 10

VREFH_ADC@3.3V
ADCR@Temp25 = (4095 * .699 * 10) / 33
ADCR@Temp25 ~= 867

| VREFH_ADC | V@TEMP25 | VDDconv | ADCR@Temp25 |
|   3.0V    | 0.696mV  |    30   |     950     |
|   3.3V    | 0.699mV  |    33   |     867     |

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Fugang Duan <B38611@freescale.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-25 12:12:29 +00:00
Adam YH Lee 7cc97d77ee iio: adc: twl4030: Fix ADC[3:6] readings
MADC[3:6] reads incorrect values without these two following changes:

- enable the 3v1 bias regulator for ADC[3:6]
- configure ADC[3:6] lines as input, not as USB

Signed-off-by: Adam YH Lee <adam.yh.lee@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-03 10:27:18 +01:00
Martin Kepplinger d2654817ea iio: adc: max1363: leave sysfs naming to the core
This shouldn't actually change anything since the core calls the events
sysfs folder "events" anyways.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-30 18:20:53 +01:00
Martin Kepplinger 443f33e958 iio: adc: ad799x: leave sysfs naming to the core
This shouldn't change anything since the core calls the events folder
"events" anyways.

Signed-off-by: Martin Kepplinger <martink@posteo.de>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-30 18:20:53 +01:00
kbuild test robot 36736cc66b iio: adc: vf610: fix simple_return.cocci warnings
drivers/iio/adc/vf610_adc.c:766:1-4: WARNING: end returns can be simpified and declaration on line 755 can be dropped

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.

Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-23 20:23:28 +01:00
Luis de Bethencourt 0df5a5488b iio: adc: twl6030-gpadc: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-23 20:23:24 +01:00
Vladimir Barinov 72aa29ce0a iio: adc: hi8435: Holt HI-8435 threshold detector
Add Holt threshold detector driver for HI-8435 chip

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-23 20:23:18 +01:00
Sanchayan Maity 0010d6b444 iio: adc: vf610: Add IIO buffer support for Vybrid ADC
This patch adds support for IIO buffer to the Vybrid ADC driver.
IIO triggered buffer infrastructure along with iio sysfs trigger
is used to leverage continuous sampling support provided by the
ADC block.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-31 16:19:30 +01:00
Javier Martinez Canillas ab6ff6c6ca iio: adc: mcp320x: Set struct spi_driver .of_match_table
The driver has an OF id table but the .of_match_table is not set so
the SPI core can't do an OF style match and the table was unused.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-22 19:09:02 +01:00
Javier Martinez Canillas 9e611c9e5a iio: adc128s052: Add OF match table
The Documentation/devicetree/bindings/iio/adc/ti-adc128s052.txt DT binding
doc lists "ti,adc128s052" or "ti,adc122s021" as compatible strings but the
corresponding driver does not have an OF match table. Add the table to the
driver so the SPI core can do an OF style match.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-22 19:03:04 +01:00
Javier Martinez Canillas d1b895feda iio: adc: max1027: Set struct spi_driver .of_match_table
The driver has an OF id table but the .of_match_table is not set so
the SPI core can't do an OF style match and the table was unused.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-22 19:00:02 +01:00
Xander Huff 70581e0ef8 iio: adc: xilinx-xadc: Push interrupts into hardirq context
The driver currently registers a pair of irq handlers using
request_threaded_irq(), however the synchronization mechanism between the
hardirq and the threadedirq handler is a regular spinlock.

Unfortunately, this breaks PREEMPT_RT builds, where a spinlock can sleep,
and is thus not able to be acquired from a hardirq handler. This patch gets
rid of the threaded handler and pushes all interrupt handling into the
hardirq context, and uses request_irq().

To validate that this change has no impact on RT performance, here are
cyclictest values with no processes running:

$ sudo cyclictest -S -m -p 98
policy: fifo: loadavg: 0.00 0.01 0.05 1/174 2539
T: 0 ( 1405) P:98 I:1000 C:167010520 Min: 9 Act: 12 Avg: 12 Max: 75
T: 1 ( 1862) P:98 I:1500 C:111340339 Min: 9 Act: 12 Avg: 12 Max: 73

Then, all xadc raw handles were accessed in a continuous loop via
/sys/bus/iio/devices/iio:device0:

$ sudo cyclictest -S -m -p 98
policy: fifo: loadavg: 7.84 7.70 7.63 3/182 4260
T: 0 ( 2559) P:98 I:1000 C:241557018 Min: 11 Act: 18 Avg: 21 Max: 74
T: 1 ( 2560) P:98 I:1500 C:161038006 Min: 10 Act: 21 Avg: 20 Max: 73

Signed-off-by: Xander Huff <xander.huff@ni.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-16 10:51:27 +01:00
Hartmut Knaack 47d5e30ae3 iio:adc:cc10001_adc: resort entry in Kconfig and Makefile
Move the entry for the CC 10001 ADC driver in Kconfig and Makefile up to
maintain alphabetic order.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:20:42 +01:00
Hartmut Knaack b465fc5499 iio:adc:berlin2-adc: coding style cleanup
Some adjustment of indentation to make checkpatch.pl happy in strict mode.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:13:57 +01:00
Hartmut Knaack 3ac065224f iio:adc:berlin2-adc: enable interrupts with mutex locked
Move the call to enable channel interrupts into its _read() function to
have it protected by a mutex. This ensures that only one channel is
sampled at a time.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:13:06 +01:00
Hartmut Knaack 4b308e8c39 iio:adc:berlin2-adc: use GENMASK and BIT for masks
Make use of GENMASK for consecutive bitmasks and BIT for single bitmasks.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 22:11:38 +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
Hartmut Knaack 57cb06762d iio:adc:berlin2-adc: Fix register definition
Active channel number is stored in BERLIN2_SM_CTRL as value, instead of a
bit map.
The masks for channel interrupts and data ready are a 16 bits wide bit
map each, instead of just 4 bits.

Also correct the data mask for the temperature sensor, which was
Reported-by: Antoine Tenart <antoine.tenart@free-electrons.com>

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-12 19:24:08 +01:00
Hartmut Knaack 546384c968 iio:adc:berlin2-adc: use channel-array size directly
Drop the otherwise unused definition of the channel-array size and use it
directly in _probe - makes it a bit more obvious.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 19:08:45 +01:00
Hartmut Knaack 609e9d88f2 iio:adc:berlin2-adc: use short operator format
Use augmented assignment to subtract the offset for negative temperature
values.
Specify the amount of private data to be allocated through
devm_iio_device_alloc() with sizeof(*priv), as it is shorter and common
practice in IIO.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 19:08:13 +01:00
Hartmut Knaack 688febbd16 iio:adc:berlin2-adc: constify iio_chan_spec
Mark berlin2_adc_channels array as constant.

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 19:07:50 +01:00
Hartmut Knaack 19d566420b iio:adc:berlin2-adc: pass up real error code
Pass up the real error code returned by platform_get_irq_byname().

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02 19:05:51 +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
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
Sanchayan Maity 5e9972cd6f iio: adc: vf610: Determine sampling frequencies by using minimum sample time
The driver currently does not take into account the minimum sample time
as per the Figure 6-8 Chapter 9.1.1 12-bit ADC electrical characteristics.
We set a static amount of cycles instead of considering the sample time
as a given value, which depends on hardware characteristics.

Determine sampling frequencies by first reading the device tree property
node and then calculating the required Long Sample Time Adder (LSTAdder)
value, based on the ADC clock frequency and sample time value obtained
from the device tree. This LSTAdder value is then used for calculating
the sampling frequencies possible.

In case the sample time property is not specified through the device
tree, a safe default value of 1000ns is assumed.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
Acked-by: Stefan Agner <stefan@agner.ch>
Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-20 18:41:16 +01:00
Andrea Galbusera f686a36b4b iio: adc: mcp320x: Add support for mcp3301
This adds support for Microchip's 13 bit 1 channel AD converter MCP3301

Signed-off-by: Andrea Galbusera <gizero@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-20 18:41:16 +01:00
Manfred Schlaegl 41be6a0d5a iio: mcp320x: Fix NULL pointer dereference
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
b12206e917
iio: adc: mcp320x. Add support for more ADCs

This patch fixes the issue by setting chip_info in mcp320x_probe.

Signed-off-by: Manfred Schlaegl <manfred.schlaegl@gmx.at>
Reviewed-by: Michael Welling <mwelling@ieee.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 13:58:51 +01:00
Fugang Duan bf604a4c44 iio: adc: vf610: fix the adc register read fail issue
Read the register only when the adc register address is 4 byte aligned.
(rather than the other way around).

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Cc: <Stable.vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 13:35:26 +01:00
Hartmut Knaack 5646e856db iio:adc:cc10001_adc: fix Kconfig dependency
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 <knaack.h@gmx.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:12 +01:00
Jan Leupold 815983e9af iio: adc: at91_adc: allow to use full range of startup time
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 <leupold@rsi-elektrotechnik.de>
[nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:06 +01:00
Fabio Estevam b220da654d iio: twl4030-madc: Pass the IRQF_ONESHOT flag
Since commit 1c6c69525b ("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 <fabio.estevam@freescale.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:48:00 +01:00
Heiko Stuebner c11e28f959 iio: adc: rockchip_saradc: add missing MODULE_* data
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: 44d6f2ef94 ("iio: adc: add driver for Rockchip saradc")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-19 11:47:58 +01:00
Greg Kroah-Hartman a732cd437b First set of IIO fixes for the 4.2 cycle.
* Fix a regression in hid sensors suspend time as a result of adding runtime
   pm.  The normal flow of waking up devices in order to go into suspend
   (given the devices are normally suspended when not reading) to a regression
   in suspend time on some laptops (reports of an additional 8 seconds).
   Fix this by checking to see if a user action resulting in the wake up, and
   make it a null operation if it didn't.  Note that for hid sensors, there is
   nothing useful to be done when moving into a full suspend from a runtime
   suspend so they might as well be left alone.
 * rochip_saradc: fix some missing MODULE_* data including the licence so that
   the driver does not taint the kernel incorrectly and can build as a module.
 * twl4030 - mark irq as oneshot as it always should have been.
 * inv-mpu - write formats for attributes not specified, leading to miss
   interpretation of the gyro scale channel when written.
 * Proximity ABI clarification.  This had snuck through as a mess.  Some
   drivers thought proximity went in one direction, some the other.  We went
   with the most common option, documented it and fixed up the drivers going
   the other way.  Fix for sx9500 included in this set.
 * ad624r - fix a wrong shift in the output data.
 * at91_adc - remove a false limit on the value of the STARTUP register
   applied by too small a type for the device tree parameter.
 * cm3323 - clear the bits when setting the integration time (otherwise
   we can only ever set more bits in the relevant field).
 * bmc150-accel - multiple triggers are registered, but on error were not being
   unwound in the opposite order leading to removal of triggers that had not
   yet successfully been registered (count down instead of up when unwinding).
 * tcs3414 - ensure right part of val / val2 pair read so that the integration
   time is not always 0.
 * cc10001_adc - bug in kconfig dependency. Use of OR when AND was intended.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVpA2CAAoJEFSFNJnE9BaIJGEP/2uXFSqOZhmJ9sGqICSgKj4W
 OUjDtpXpKWxLC3Fypzvzg5u00R1t2likfvhXP2RsF5+/mqPb8NS6qzdcKMPCyxEl
 5tvsmYHm9yxN8o3ZZqtgYaR4mYt5tH4dFZ9qHpbFeNAXGjTRrYhGbgmLnND0v7cA
 5L1ABLls8ntoJ1aZZDsofwnmnUgclW5yqQZZ+huNkwaOpUQLke9tEL18cv+bsVgS
 zw7j/t3oJVdcUB9OTB7T/sW9J0+W7XnXogATHksHdHh2cd5N7wh/EZ1bet69QUrI
 PD2q2+0MUwyBMWDPveyWfm7XbS66lYxIRCmWZp+69Q1c/V91srhSPfh0kPcvHSQ1
 Uzpba6oSFPlFyDAtXWhaSEBzjXaHwKBIQvIVYOKiE6JdrbsnSg4GHAcF8TMhGtwT
 SDDgfb+cxOm6Vb4ws0+i15HMEiXpeK8AiJfHmLvau3OnA69/xzxHqqSg/oCO6/ES
 IzoAMqIVEk3L5gu88qgnmWzmyWp1pyTf1u+Kr+gAXNdSF/b3wgVkGn2X9hNRQ4g/
 XEFAD1PzarBnv1ce/HfWi+9/aUwv08nXHxBe4Yx3bfle2RUQKmFSbksVkCwu+ha3
 E4jPs5Cf9MrHO4gbuFaZX2+bFYlMdbcEWVRcP/3CHUuxeixGwemOsak1L+J5h6+e
 2xVEkGeywVdmDOsan1B8
 =mBqw
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of IIO fixes for the 4.2 cycle.

* Fix a regression in hid sensors suspend time as a result of adding runtime
  pm.  The normal flow of waking up devices in order to go into suspend
  (given the devices are normally suspended when not reading) to a regression
  in suspend time on some laptops (reports of an additional 8 seconds).
  Fix this by checking to see if a user action resulting in the wake up, and
  make it a null operation if it didn't.  Note that for hid sensors, there is
  nothing useful to be done when moving into a full suspend from a runtime
  suspend so they might as well be left alone.
* rochip_saradc: fix some missing MODULE_* data including the licence so that
  the driver does not taint the kernel incorrectly and can build as a module.
* twl4030 - mark irq as oneshot as it always should have been.
* inv-mpu - write formats for attributes not specified, leading to miss
  interpretation of the gyro scale channel when written.
* Proximity ABI clarification.  This had snuck through as a mess.  Some
  drivers thought proximity went in one direction, some the other.  We went
  with the most common option, documented it and fixed up the drivers going
  the other way.  Fix for sx9500 included in this set.
* ad624r - fix a wrong shift in the output data.
* at91_adc - remove a false limit on the value of the STARTUP register
  applied by too small a type for the device tree parameter.
* cm3323 - clear the bits when setting the integration time (otherwise
  we can only ever set more bits in the relevant field).
* bmc150-accel - multiple triggers are registered, but on error were not being
  unwound in the opposite order leading to removal of triggers that had not
  yet successfully been registered (count down instead of up when unwinding).
* tcs3414 - ensure right part of val / val2 pair read so that the integration
  time is not always 0.
* cc10001_adc - bug in kconfig dependency. Use of OR when AND was intended.
2015-07-13 14:18:07 -07:00
Krzysztof Kozlowski 2155971a66 iio: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11 18:50:07 +01:00
Hartmut Knaack 12ebb05246 iio:adc:Kconfig: rework help descriptions
Rework the help text of several ADCs to make sure that:
  - the module name is mentioned, if the driver can be built as a module
  - "If unsure, say N" messages are dropped
  - right indentation is maintained

Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-28 18:23:22 +01:00
Hartmut Knaack b2b3c3dc6a iio:adc:cc10001_adc: fix Kconfig dependency
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 <knaack.h@gmx.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-21 16:15:20 +01:00
Jan Leupold 2ab5f39bc7 iio: adc: at91_adc: allow to use full range of startup time
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 <leupold@rsi-elektrotechnik.de>
[nicolas.ferre@atmel.com: change commit message, increase u16 to u32 for startup time]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-21 14:06:15 +01:00
Naidu Tellapati ae35496230 iio: adc: cc10001: Power-up the ADC at probe time when used remotely
The ADC is typically shared with remote CPUs not running Linux.
However, there is only one register to power-up/power-down. Remote CPUs
aren't able to power-up the ADC, and rely in Linux doing it instead.

This commit uses the adc-reserved-channels devicetree property to
distinguish shared usage. In this case, the ADC is powered up at
probe time.

If the ADC is used only by the CPU running Linux, power-up/down
at runtime, only when neeeded.

Signed-off-by: Naidu Tellapati <naidu.tellapati@imgtec.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-14 12:21:22 +01:00
Greg Kroah-Hartman 78a66b00d9 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 adjusted
 
 Fixlets
 * 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVdgz8AAoJEFSFNJnE9BaIMSoP/RYq9yzkRtQ+T7ZnxdW0uaVK
 W8zhcg9W62dKbu0ccMVI+ESv9bg+3Ti/ZHE2251olYzXER5qrUUqB7llpgJeoni+
 ft1RyOZYYTWqv/2fx9Jdn+h4792tv4nykdgY3YhxR3anPD5Tb3PcRryCJ739d6xL
 c8HZedMP9znbC7BiEzRcLBPiyiv+NFKHF0T6LCkwlTGoe6q+8yaW1blmxTRmtpnD
 Wpf08/vafBmbjUmxfcvtgyOr73D6/kNOk9xYtvbQguD5nG5oHRe96nlaTtW7//hi
 ybP0q+UPV7Hss1pgufEZufPfWglsqOpIWJ7diUyXzvf9x7FAUd2nuiAHKybUg4bT
 yC2dSCVgRAa1zLEwcTub5MNtjkcfM0l9wsnCCIssD5p9s4EEenge1UjHsV7zm/KA
 JzBKBRz98Mo6m+F2gWZkkpuIb9UbI99oLBVDzhFBYf77b1L8curJ+pBH2lcICMun
 K5+WC3itkl7QImbyrCXdHmu9/oWS2+MSVHsmmL4omMFb071/C1iAUCIJahJrbgcy
 jIjaNJp3WgOplQp4tlP6WtsbzHh0DzjjLj+RKFv2mqYMlHhhAFdoH68qXPxG3kYo
 IxyGh7sH7ic5BQyt4B8/GhxakDuf55O/kyS7t01B3c5JbJp/IAbobfWkpCtuICYV
 GIIZTKI5kJb1Q8P7AbUD
 =sNVc
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-v4.2c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/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 adjusted

Fixlets
* 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.
2015-06-10 20:48:34 -07:00
Greg Kroah-Hartman 6394d6d01b Merge 4.1-rc7 into staging-testing
We want the staging tree fixes in here too to help with testing and
merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-08 10:34:44 -07:00
Stefan Agner bf04c1a367 iio: adc: vf610: implement configurable conversion modes
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 <B38611@freescale.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-07 17:53:25 +01:00