1
0
Fork 0
Commit Graph

347 Commits (redonkable)

Author SHA1 Message Date
Lorenzo Bianconi a42174983c iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo()
Add debug info to error conditions in st_lsm6dsx_read_fifo routine

Suggested-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-15 10:11:22 +01:00
Brian Masney de8df0b9c3 iio: imu: mpu6050: add support for 6515 variant
This patch adds support for the MPU 6515 variant. Confirmed that the
driver functions correctly on a LG Nexus 5 (hammerhead) phone.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-15 09:40:54 +01:00
Gustavo A. R. Silva 82d65f9d55 iio:imu:adis: Mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-07 18:01:05 +01:00
Greg Kroah-Hartman 7f5d8f7116 Merge 4.18-rc3 into staging-next
We want the staging/iio fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-02 08:21:54 +02:00
Greg Kroah-Hartman f62252bf39 First set of IIO new device support, features and cleanups in the 4.19 cycle
The usual mixed bunch.  Particular good to see is the generic
 touch screen driver.  Will be interesting to see if this works
 for other ADCs without major changes.
 
 Core features
 * Channel types
   - New position relative channel type primarily for touch screen
     sensors to feed the generic touchscreen driver.
 
 New device support
 * ad5586
   - Add support for the AD5311R DAC.
 
 * Generic touch screen driver as an IIO consumer.
   - Note this is in input, but due to dependencies is coming through
     the IIO tree.
   - Specific support for this added to the at91-sama5d2 ADC.
   - Various necessary DT bindings added.
 
 Staging Drops
 * ADIS16060 gyro
   - A device with a very odd interface that was never cleanly supported.
     It's now very difficult to get, so unlikely it'll ever be fixed up.
 
 Cleanups and minor features and fixes
 * core
   - Fix y2038 timestamp issues now the core support is in place.
 * 104-quad-8
   - Provide some defines for magic numbers to help readability.
   - Fix an off by one error in register selection
 * ad7606
   - Put in a missing function parameter name in a prototype.
 * adis16023
   - Use generic sign_extend function rather than local version.
 * adis16240
   - Use generic sign_extend funciton rather than local version.
 * at91-sama5d2
   - Drop dependency on HAS_DMA now this is handled elsewhere.  Will
     improve build test coverage.
   - Add oversampling ratio control.  Note there is a minor ABI change
     here to increase the apparent depth to 14 bits so as to allow
     for transparent provision of different oversampling ratios that
     drop the actual bit depth to 13 or 12 bits.
 * hx711
   - Add a MAINTAINERS entry for this device.
 * inv_mpu6050
   - Replace the timestamp fifo 'special' code with generic timestamp
     handling.
   - Switch to using local store of timestamp divider rather than rate
     as that is more helpful for accurate time measurement.
   - Fix an unaligned access that didn't seem to be causing any trouble.
   - Use the fifo overflow bit to track the overflow status rather than
     a software counter.
   - New timestamping mechanism to deal with missed sample interrupts.
 * stm32-adc
   - Drop HAS_DMA build dependency.
 * sun4i-gpadc
   - Select REGMAP_IRQ a very rarely hit build issue fix.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlsxT24RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogOHRAAllFPJBoq+nVqGAqe6CjSmWhAFdyv/Ey0
 4iDBsdBHrzhxnDuatqzbFhvu9TgqQxMBSbcRfqrGnJrnCFDNcvo1eJcxq13YFPCy
 EitRhu5kUdZ6Ez+OQOjX77wGlPyh8idZnaUkWjowOjnXztkHQjy6IWTbDKFk9bPY
 9fGBpmPDn1xaVPPWh7lZVAdTwCt2i+efG4sGyZyMQODjtM0q2G1MoHm9ioqgg8lN
 hzO7YIrZmLlXRUhapQ2/61uwa/2WMrcGK5v8eCGphEZnPN5lUWrT//w91+BCQpBC
 A9gRFpWblz5qHaRpNhzNbQjUrGvTAeIhF+bdOV2W+oI8CJhTJ0AlNqtUXs2pbaJn
 FO6jGwkC+jOA3XdE4tbiqenuMSZNggXBCgyRMfIK5WuIeBF02w57KHxgefkGTnQe
 Iqc9QDLLfkGDsOoh1l/+TMWjAxfXJLd7d04wYcRIDy6wumTi6GJxUesiQAnyq5eo
 Rg+o8gbfZcnbgzphBRoQjjftFMPeYdr48bCGCmjFjNnIPnemmUZg988gTggl6NST
 mzbFBsAnejmYpT393FPL0K9dLVUq5cRngQMuLVDjR4VnlQEVMyV0O+CsW83iSM36
 3nqpaUOapqsKJT74n62k1YtzJgxr1uoyMS0LGjldAPLDiTgMf9YiPCCihCpiCY89
 K9gE6lzS70A=
 =SvKj
 -----END PGP SIGNATURE-----

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

Jonathan writes:

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

The usual mixed bunch.  Particular good to see is the generic
touch screen driver.  Will be interesting to see if this works
for other ADCs without major changes.

Core features
* Channel types
  - New position relative channel type primarily for touch screen
    sensors to feed the generic touchscreen driver.

New device support
* ad5586
  - Add support for the AD5311R DAC.

* Generic touch screen driver as an IIO consumer.
  - Note this is in input, but due to dependencies is coming through
    the IIO tree.
  - Specific support for this added to the at91-sama5d2 ADC.
  - Various necessary DT bindings added.

Staging Drops
* ADIS16060 gyro
  - A device with a very odd interface that was never cleanly supported.
    It's now very difficult to get, so unlikely it'll ever be fixed up.

Cleanups and minor features and fixes
* core
  - Fix y2038 timestamp issues now the core support is in place.
* 104-quad-8
  - Provide some defines for magic numbers to help readability.
  - Fix an off by one error in register selection
* ad7606
  - Put in a missing function parameter name in a prototype.
* adis16023
  - Use generic sign_extend function rather than local version.
* adis16240
  - Use generic sign_extend funciton rather than local version.
* at91-sama5d2
  - Drop dependency on HAS_DMA now this is handled elsewhere.  Will
    improve build test coverage.
  - Add oversampling ratio control.  Note there is a minor ABI change
    here to increase the apparent depth to 14 bits so as to allow
    for transparent provision of different oversampling ratios that
    drop the actual bit depth to 13 or 12 bits.
* hx711
  - Add a MAINTAINERS entry for this device.
* inv_mpu6050
  - Replace the timestamp fifo 'special' code with generic timestamp
    handling.
  - Switch to using local store of timestamp divider rather than rate
    as that is more helpful for accurate time measurement.
  - Fix an unaligned access that didn't seem to be causing any trouble.
  - Use the fifo overflow bit to track the overflow status rather than
    a software counter.
  - New timestamping mechanism to deal with missed sample interrupts.
* stm32-adc
  - Drop HAS_DMA build dependency.
* sun4i-gpadc
  - Select REGMAP_IRQ a very rarely hit build issue fix.
2018-06-26 07:47:37 +08:00
Hans de Goede 2a221c0422 iio: imu: inv_mpu6050: Fix probe() failure on older ACPI based machines
Commit 5ec6486daa ("iio:imu: inv_mpu6050: support more interrupt types")
causes inv_mpu_core_probe() to fail if the IRQ does not have a
trigger-type setup.

This happens on machines where the mpu6050 is enumerated through ACPI and
an older Interrupt type ACPI resource is used for the interrupt, rather
then a GpioInt type type, causing the mpu6050 driver to no longer work
there. This happens on e.g. the Asus T100TA.

This commits makes the mpu6050 fallback to the old IRQF_TRIGGER_RISING
default if the irq-type is not setup, fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Fixes: 5ec6486daa ("iio:imu: inv_mpu6050: support more interrupt types")
Reviewed-by: Martin Kelly <mkelly@xevo.com>
Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-24 14:50:52 +01:00
Kees Cook 6396bb2215 treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:

        kzalloc(a * b, gfp)

with:
        kcalloc(a * b, gfp)

as well as handling cases of:

        kzalloc(a * b * c, gfp)

with:

        kzalloc(array3_size(a, b, c), gfp)

as it's slightly less ugly than:

        kzalloc_array(array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

        kzalloc(4 * 1024, gfp)

though any constants defined via macros get caught up in the conversion.

Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
  kzalloc(
-	(sizeof(TYPE)) * E
+	sizeof(TYPE) * E
  , ...)
|
  kzalloc(
-	(sizeof(THING)) * E
+	sizeof(THING) * E
  , ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
  kzalloc(
-	sizeof(u8) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(__u8) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(char) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(unsigned char) * (COUNT)
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(u8) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(__u8) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(char) * COUNT
+	COUNT
  , ...)
|
  kzalloc(
-	sizeof(unsigned char) * COUNT
+	COUNT
  , ...)
)

// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@

(
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (COUNT_ID)
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * COUNT_ID
+	COUNT_ID, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (COUNT_CONST)
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * COUNT_CONST
+	COUNT_CONST, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (COUNT_ID)
+	COUNT_ID, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * COUNT_ID
+	COUNT_ID, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (COUNT_CONST)
+	COUNT_CONST, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * COUNT_CONST
+	COUNT_CONST, sizeof(THING)
  , ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

- kzalloc
+ kcalloc
  (
-	SIZE * COUNT
+	COUNT, SIZE
  , ...)

// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@

(
  kzalloc(
-	sizeof(TYPE) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(TYPE) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(TYPE))
  , ...)
|
  kzalloc(
-	sizeof(THING) * (COUNT) * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * (COUNT) * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * COUNT * (STRIDE)
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
|
  kzalloc(
-	sizeof(THING) * COUNT * STRIDE
+	array3_size(COUNT, STRIDE, sizeof(THING))
  , ...)
)

// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@

(
  kzalloc(
-	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
  , ...)
|
  kzalloc(
-	sizeof(THING1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(THING1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * COUNT
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
|
  kzalloc(
-	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
  , ...)
)

// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@

(
  kzalloc(
-	(COUNT) * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * (STRIDE) * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * STRIDE * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	(COUNT) * (STRIDE) * (SIZE)
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
|
  kzalloc(
-	COUNT * STRIDE * SIZE
+	array3_size(COUNT, STRIDE, SIZE)
  , ...)
)

// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@

(
  kzalloc(C1 * C2 * C3, ...)
|
  kzalloc(
-	(E1) * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	(E1) * (E2) * E3
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	(E1) * (E2) * (E3)
+	array3_size(E1, E2, E3)
  , ...)
|
  kzalloc(
-	E1 * E2 * E3
+	array3_size(E1, E2, E3)
  , ...)
)

// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@

(
  kzalloc(sizeof(THING) * C2, ...)
|
  kzalloc(sizeof(TYPE) * C2, ...)
|
  kzalloc(C1 * C2 * C3, ...)
|
  kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * (E2)
+	E2, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(TYPE) * E2
+	E2, sizeof(TYPE)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * (E2)
+	E2, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	sizeof(THING) * E2
+	E2, sizeof(THING)
  , ...)
|
- kzalloc
+ kcalloc
  (
-	(E1) * E2
+	E1, E2
  , ...)
|
- kzalloc
+ kcalloc
  (
-	(E1) * (E2)
+	E1, E2
  , ...)
|
- kzalloc
+ kcalloc
  (
-	E1 * E2
+	E1, E2
  , ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 16:19:22 -07:00
Jean-Baptiste Maneyrol 4bcc19f1b2 iio: imu: inv_mpu6050: new timestamp mechanism
Check validity of interrupt timestamps by computing time between
2 interrupts. If it matches the chip frequency modulo 4%, it is
used as the data timestamp and also for estimating the chip
frequency measured from the system. Otherwise timestamp is
computed using the estimated chip frequency.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10 11:52:30 +01:00
Jean-Baptiste Maneyrol f5057e7b2d iio: imu: inv_mpu6050: better fifo overflow handling
Use fifo overflow bit from int status rather than using an
arbitrary threshold.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10 11:52:30 +01:00
Jean-Baptiste Maneyrol 5cba7caaac iio: imu: inv_mpu6050: fix fifo count reading
Use unaligned access since buffer is a bytes table. Truncate fifo
count to read only complete datum.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10 11:52:29 +01:00
Jean-Baptiste Maneyrol 7b782508f8 iio: imu: inv_mpu6050: switch to use sample rate divider
Instead of storing fifo rate in Hz, store the chip internal sample
rate divider. This will be more useful for timestamping. There
are both equivalent.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10 11:52:29 +01:00
Jean-Baptiste Maneyrol 3ca4fb431b iio: imu: inv_mpu6050: replace timestamp fifo by generic timestamp
Using a fifo for storing timestamps is useless since the interrupt
is in one-shot mode, preventing the hard irq handler to be called
when the irq thread is running. Instead use the generic timestamp
function iio_pollfunc_store_time.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10 11:52:28 +01:00
Martin Kelly 96c92d42e9 iio: imu: inv_mpu6050: add comment about frequencies
Although the driver allows frequencies between 4 and 1000 Hz, only the
frequencies advertised in the available frequencies file are backed
properly by a low-pass filter to prevent aliasing, so it's best to use
them. Since this is not obvious to the user, add a comment explaining
what's going on.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-22 18:29:09 +01:00
Martin Kelly cbf73ae59b iio: imu: inv_mpu6050: make loop a do-while
Prior to this loop, we check if fifo_count < bytes_per_datum and bail if
so. This means that when we hit the loop, we know that fifo_count >=
bytes_per_datum, so the check is unneeded and we can turn the loop into
a do-while for a slight performance improvement.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 10:01:41 +01:00
Martin Kelly d8b4018146 iio: imu: inv_mpu6050: minor wording fixes
Just some minor grammar/spelling fixes of things I noticed while reading
the code.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 18:05:51 +01:00
Jean-Baptiste Maneyrol edddddd98c iio: imu: inv_mpu6050: fix user_ctrl register overwritten
When in spi mode, we are setting i2c disable bit in user_ctrl
register. But the register is overwritten after when turning fifo
on. So save user_ctrl init value and always use it when updating
the register.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 18:01:20 +01:00
Jean-Baptiste Maneyrol c2b82a690c iio: imu: inv_mpu6050: skip first sample when gyro is on
Implement generic skip first samples mechanism and use it to
filter out first sample when gyro is on.

The problem for these chips is that the first sample of the gyro
is out of specs, because gyro is not completely stabilized. To
ensure all data are within sensor specs, we just skip the first
sample when turning gyro on.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 17:56:26 +01:00
Jean-Baptiste Maneyrol ca4c8fc97e iio: imu: inv_mpu6050: fix possible deadlock between mutex and iio
Detected by kernel circular locking dependency checker.

We are locking iio mutex (iio_device_claim_direct_mode) after
locking our internal mutex. But when the buffer starts, iio first
locks its mutex and then we lock our internal one.

To avoid possible deadlock, we need to use the same order
everwhere. So we change the ordering by locking first iio mutex,
then our internal mutex.

Fixes: 68cd6e5b20 ("iio: imu: inv_mpu6050: fix lock issues by using our own mutex")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 17:53:32 +01:00
Jean-Baptiste Maneyrol 3b37c41f0e iio: imu: inv_mpu6050: use i2c mux only for chip with i2c aux bus
icm20608 does not have i2c aux bus, so it does not make sense to
allocate an i2c mux for this chip.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 17:48:28 +01:00
Jean-Baptiste Maneyrol 880b2d6cfd iio: imu: inv_mpu6050: clean read channel data error path
Delete the useless ored result and give a second chance to turn
the chip back off at the end.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:55:48 +01:00
Jean-Baptiste Maneyrol 6792b4552b iio: imu: inv_mpu6050: clean read raw by factorizing out raw data
Factorize reading channel data in its own function.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:54:38 +01:00
Jean-Baptiste Maneyrol 57f1677bd7 iio: imu: inv_mpu6050: use devm_* at init and delete remove
Use devm_* for iio_triggered_buffer_setup, iio_device_register,
iio_trigger_register. Delete unneeded inv_mpu6050_remove_trigger,
inv_mpu_core_remove, and inv_mpu_remove for spi driver.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:53:26 +01:00
Jean-Baptiste Maneyrol eaa54d96a4 iio: imu: inv_mpu6050: fix error path not turning chip back off
Some functions are turning the chip on and not back off in error
path. With set_power function using a reference counter that
would keep the chip on forever.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:48:10 +01:00
Martin Kelly 5ec6486daa iio:imu: inv_mpu6050: support more interrupt types
Currently, we support only rising edge interrupts, and in fact we assume
that the interrupt we're given is rising edge (and things won't work if
it's not). However, the device supports rising edge, falling edge, level
low, and level high interrupts.

Empirically, on my system, switching to level interrupts has fixed a
problem I had with significant (~40%) interrupt loss with edge
interrupts. This issue is likely related to the SoC I'm using (Allwinner
H3), but being able to switch the interrupt type is still a very useful
workaround.

I tested this with each interrupt type and verified correct behavior in
a logic analyzer.

Add support for these interrupt types while also eliminating the error
case of the device tree and driver using different interrupt types.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-21 16:24:30 +01:00
Jean-Baptiste Maneyrol 17623d9a23 iio: imu: inv_mpu6050: use set_power_itg function in i2c mux
Set power function is rewritten manually inside i2c mux select.
Better use the already identical existing function.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-21 16:04:01 +01:00
Jean-Baptiste Maneyrol 7fc0168540 iio: imu: inv_mpu6050: clean set_power_itg and fix usage
Rewrite set_power_itg. Failing when turning power off is
no more decreasing the counter now and sleeping only happens
when effectively turning the chip on. Fix also usage in init
function (setting power on one time is sufficient to ensure
chip is effectively on).

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-21 16:02:42 +01:00
Douglas Fischer 685cc61b07 iio: imu: Add mpu9255 support to mpu6050 driver
Added support for the mpu9255 IMU to the mpu6050 driver. The
register map is the same as the other chips; the only driver
difference is the compatible string and the WHOAMI register
value.

Signed-off-by: Douglas Fischer <fischerdouglasc@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15 19:07:38 +01:00
Jean-Baptiste Maneyrol 4efa1a0050 iio: imu: inv_mpu6050: do not flush fifo when iio buffer is full
There is no need to flush fifo and loose all data when the iio
buffer is full. Just drop the data by ignoring the error as
commonly done in other drivers.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Reviewed-by: Martin Kelly <martin@martingkelly.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15 18:06:25 +01:00
Lorenzo Bianconi 179c8d608c iio: imu: st_lsm6dsx: add support to ism330dlc
Add support to STM ISM330DLC 6-axis (acc + gyro) Mems sensor
http://www.st.com/resource/en/datasheet/ism330dlc.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-08 17:27:10 +01:00
Lorenzo Bianconi be75eb86ac iio: imu: st_lsm6dsx: fix FIFO threshold mask for LSM6DSM/LSM6DSL
According to the latest datasheet, LSM6DSM and LSM6DSL imu sensors
export GENMASK(10, 0) for FIFO threshold mask definition. Despite
that is not an actual issue since write on fifo_th register is protected
by max_fifo_size value, fix fifo_th and fifo_diff register definitions

Fixes: 290a6ce11d ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-08 16:48:27 +01:00
Jean-Baptiste Maneyrol d12ceffd33 iio: imu: inv_mpu6050: clean double declaration of set_power_itg
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30 13:50:31 +01:00
Greg Kroah-Hartman 36e9f7203e Merge 4.16-rc3 into staging-next
We want the IIO/Staging fixes in here, and to resolve a merge problem
with the move of the fsl-mc code.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-26 15:32:00 +01:00
Lars-Peter Clausen f027e0b3a7 iio: adis_lib: Initialize trigger before requesting interrupt
The adis_probe_trigger() creates a new IIO trigger and requests an
interrupt associated with the trigger. The interrupt uses the generic
iio_trigger_generic_data_rdy_poll() function as its interrupt handler.

Currently the driver initializes some fields of the trigger structure after
the interrupt has been requested. But an interrupt can fire as soon as it
has been requested. This opens up a race condition.

iio_trigger_generic_data_rdy_poll() will access the trigger data structure
and dereference the ops field. If the ops field is not yet initialized this
will result in a NULL pointer deref.

It is not expected that the device generates an interrupt at this point, so
typically this issue did not surface unless e.g. due to a hardware
misconfiguration (wrong interrupt number, wrong polarity, etc.).

But some newer devices from the ADIS family start to generate periodic
interrupts in their power-on reset configuration and unfortunately the
interrupt can not be masked in the device.  This makes the race condition
much more visible and the following crash has been observed occasionally
when booting a system using the ADIS16460.

	Unable to handle kernel NULL pointer dereference at virtual address 00000008
	pgd = c0004000
	[00000008] *pgd=00000000
	Internal error: Oops: 5 [#1] PREEMPT SMP ARM
	Modules linked in:
	CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-04126-gf9739f0-dirty #257
	Hardware name: Xilinx Zynq Platform
	task: ef04f640 task.stack: ef050000
	PC is at iio_trigger_notify_done+0x30/0x68
	LR is at iio_trigger_generic_data_rdy_poll+0x18/0x20
	pc : [<c042d868>]    lr : [<c042d924>]    psr: 60000193
	sp : ef051bb8  ip : 00000000  fp : ef106400
	r10: c081d80a  r9 : ef3bfa00  r8 : 00000087
	r7 : ef051bec  r6 : 00000000  r5 : ef3bfa00  r4 : ee92ab00
	r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : ee97e400
	Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
	Control: 18c5387d  Table: 0000404a  DAC: 00000051
	Process swapper/0 (pid: 1, stack limit = 0xef050210)
	[<c042d868>] (iio_trigger_notify_done) from [<c0065b10>] (__handle_irq_event_percpu+0x88/0x118)
	[<c0065b10>] (__handle_irq_event_percpu) from [<c0065bbc>] (handle_irq_event_percpu+0x1c/0x58)
	[<c0065bbc>] (handle_irq_event_percpu) from [<c0065c30>] (handle_irq_event+0x38/0x5c)
	[<c0065c30>] (handle_irq_event) from [<c0068e28>] (handle_level_irq+0xa4/0x130)
	[<c0068e28>] (handle_level_irq) from [<c0064e74>] (generic_handle_irq+0x24/0x34)
	[<c0064e74>] (generic_handle_irq) from [<c021ab7c>] (zynq_gpio_irqhandler+0xb8/0x13c)
	[<c021ab7c>] (zynq_gpio_irqhandler) from [<c0064e74>] (generic_handle_irq+0x24/0x34)
	[<c0064e74>] (generic_handle_irq) from [<c0065370>] (__handle_domain_irq+0x5c/0xb4)
	[<c0065370>] (__handle_domain_irq) from [<c000940c>] (gic_handle_irq+0x48/0x8c)
	[<c000940c>] (gic_handle_irq) from [<c0013e8c>] (__irq_svc+0x6c/0xa8)

To fix this make sure that the trigger is fully initialized before
requesting the interrupt.

Fixes: ccd2b52f4a ("staging:iio: Add common ADIS library")
Reported-by: Robin Getz <Robin.Getz@analog.com>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-17 14:16:35 +00:00
Lorenzo Bianconi 213451076b iio: imu: st_lsm6dsx: add hw timestamp support
Introduce hw timestamp support instead of compute sample timestamps
according to interrupt rate and configured watermark. LSM6DSx based
devices are able to queue in hw FIFO the time reference of data
sampling

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-30 18:33:29 +00:00
Venkat Prashanth B U 9bf94f836e imu:adis16480: fix debugfs_simple_attr.cocci warnings
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
for debugfs files.

Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: Venkat Prashanth B U <venkat.prashanth2498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:44 +01:00
Lorenzo Bianconi 5b6c65f41c iio: imu: st_lsm6dsx: remove st_lsm6dsx_write_with_mask() declaration
Remove st_lsm6dsx_write_with_mask() declaration since it has been removed
in commit 6674bef628e6 ("iio: imu: st_lsm6dsx: add regmap API support")

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:43 +01:00
Lorenzo Bianconi 91a6b841a5 iio: imu: st_lsm6dsx: pre-allocate read buffer at bootstrap
Allocate device read buffer at bootstrap and do not put it on the stack
since it is pretty big (~200B) and its size will increase adding support
to device hw timestamp.
Moreover this patch fixes following sparse warnings:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:250:17: warning: Variable length
array is used.
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:283:55: error: cannot size
expression

Fixes: 290a6ce11d ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:43 +01:00
Lorenzo Bianconi 51a8b70762 iio: imu: st_lsm6dsx: add regmap API support
Introduce regmap API support to access to i2c/spi bus instead of
using a custom support. Set max bulk read to
(32 / SAMPLE_SIZE) * SAMPLE_SIZE since spi_write_then_read() used in
regmap_spi indicates that is the max buffer length to use in order to
avoid a kmalloc for each bus access.
Remove lock mutex since concurrency is already managed by regmap API

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:43 +01:00
Lorenzo Bianconi 335eaedce4 iio: imu: st_lsm6dsx: introduce conf_lock mutex
Add conf_lock mutex to prevent concurrent FIFO configuration update

Fixes: 290a6ce11d (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:43 +01:00
Lorenzo Bianconi 7b9ebe4282 iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot()
Apply le16_to_cpu() to data read from the sensor in order to take into
account architecture endianness

Fixes: 290a6ce11d (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08 16:03:43 +01:00
Andy Shevchenko e36c8c161c iio: imu: inv_mpu6050: Remove duplicate NULL check
Since i2c_unregister_device() became NULL-aware we may remove duplicate
NULL check.

Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02 10:40:11 +00:00
Linus Torvalds 449fcf3ab0 Staging/IIO patches for 4.15-rc1
Here is the "big" staging and IIO driver update for 4.15-rc1.
 
 Lots and lots of little changes, almost all minor code cleanups as the
 Outreachy application process happened during this development cycle.
 Also happened was a lot of IIO driver activity, and the typec USB code
 moving out of staging to drivers/usb (same commits are in the USB tree
 on a persistent branch to not cause merge issues.)
 
 Overall, it's a wash, I think we added a few hundred more lines than
 removed, but really only a few thousand were modified at all.
 
 All of these have been in linux-next for a while.  There might be a
 merge issue with Al's vfs tree in the pi433 driver (take his changes,
 they are always better), and the media tree with some of the odd atomisp
 cleanups (take the media tree's version).
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWgnFrg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymxbwCgtNlBkqD2JJYpLRKvI/C4w1vzZsEAnA2THRkt
 g3ioPBqmqC/2DSbldr2o
 =/ebw
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO updates from Greg KH:
 "Here is the "big" staging and IIO driver update for 4.15-rc1.

  Lots and lots of little changes, almost all minor code cleanups as the
  Outreachy application process happened during this development cycle.
  Also happened was a lot of IIO driver activity, and the typec USB code
  moving out of staging to drivers/usb (same commits are in the USB tree
  on a persistent branch to not cause merge issues.)

  Overall, it's a wash, I think we added a few hundred more lines than
  removed, but really only a few thousand were modified at all.

  All of these have been in linux-next for a while. There might be a
  merge issue with Al's vfs tree in the pi433 driver (take his changes,
  they are always better), and the media tree with some of the odd
  atomisp cleanups (take the media tree's version)"

* tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits)
  staging: lustre: add SPDX identifiers to all lustre files
  staging: greybus: Remove redundant license text
  staging: greybus: add SPDX identifiers to all greybus driver files
  staging: ccree: simplify ioread/iowrite
  staging: ccree: simplify registers access
  staging: ccree: simplify error handling logic
  staging: ccree: remove dead code
  staging: ccree: handle limiting of DMA masks
  staging: ccree: copy IV to DMAable memory
  staging: fbtft: remove redundant initialization of buf
  staging: sm750fb: Fix parameter mistake in poke32
  staging: wilc1000: Fix bssid buffer offset in Txq
  staging: fbtft: fb_ssd1331: fix mirrored display
  staging: android: Fix checkpatch.pl error
  staging: greybus: loopback: convert loopback to use generic async operations
  staging: greybus: operation: add private data with get/set accessors
  staging: greybus: loopback: Fix iteration count on async path
  staging: greybus: loopback: Hold per-connection mutex across operations
  staging: greybus/loopback: use ktime_get() for time intervals
  staging: fsl-dpaa2/eth: Extra headroom in RX buffers
  ...
2017-11-13 20:53:28 -08:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Lorenzo Bianconi 92617c158a iio: imu: st_lsm6dsx: add FIFO ops data structure
Introduce FIFO ops data structure to contain FIFO related parameters
in order to properly support more devices in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:51:01 +01:00
Lorenzo Bianconi 7ca3ac9e9e iio: imu: st_lsm6dsx: move decimator info in st_lsm6dsx_sensor_settings
Move FIFO decimator info in st_lsm6dsx_sensor_settings list since
decimator registers are exported in register map just in
lsm6ds3/lsm6ds3h/lsm6dsl/lsm6dsm sensors and not in other compliant
devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:51:01 +01:00
Lorenzo Bianconi ff81a933c1 iio: imu: st_lsm6dsx: split fifo mode and fifo odr configuration
Separate fifo mode and max fifo sample rate configuration.
That change will be necessary to reuse st_lsm6dsx_set_fifo_mode()
routine and to support more devices in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:50:57 +01:00
Lorenzo Bianconi 8f2a88a2b2 iio: imu: st_lsm6dsx: convert max_fifo_size in FIFO sample size
Express max fifo depth in ST_LSM6DSX_SAMPLE_SIZE instead of in bytes.
That change will be necessary to properly support more devices
in st_lsm6dsx driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 20:50:52 +01:00
Greg Kroah-Hartman 069f0e0c06 Round one of new device support, features and cleanup for IIO in the 4.15 cycle.
Note there is a misc driver drop in here given we have support
 in IIO and the feeling is no one will care.
 
 A large part of this series is a boiler plate removal series avoiding
 the need to explicitly provide THIS_MODULE in various locations.
 It's very dull but touches all drivers.
 
 New device support
 * ad5446
   - add ids to support compatible parts DAC081S101, DAC101S101,
     DAC121S101.
   - add the dac7512 id and drop the misc driver as feeling is no
     one is using it (was introduced for a board that is long obsolete)
 * mt6577
   - add bindings for mt2712 which is fully compatible with other
     supported parts.
 * st_pressure
   - add support for LPS33HW and LPS35HW with bindings (ids mostly).
 
 New features
 * ccs811
   - Add support for the data ready trigger.
 * mma8452
   - remove artifical restriction on supporting multiple event types
     at the same time.
 * tcs3472
   - support out of threshold events
 
 Core and tree wide cleanup
 * Use macro magic to remove the need to provide THIS_MODULE as part of
   struct iio_info or struct iio_trigger_ops.  This is similar to
   work done in a number of other subsystems (e.g. i2c, spi).
 
   All drivers are fixed and then the fields in these structures are
   removed.
 
   This will cause build failures for out of tree drivers and any
   new drivers that cross with this work going into the kernel.
 
   Note mostly done with a coccinelle patch, included in the series
   on the mailing list but not merged as the fields no longer exist
   in the structures so the any hold outs will cause a build failure.
 
 Cleanups
 * ads1015
   - avoid writing config register when it doesn't change.
   - add 10% to conversion wait time as it seems it is sometimes
     a little small.
 * ade7753
   - replace use of core mlock with a local lock.  This is part of a
     long term effort to make the use of mlock opaque and single
     purpose.
 * ade7759
   - expand the use of buf_lock to cover previous mlock cases.  This
     is a slightly nicer solution to the same issue as in ade7753.
 * cros_ec
   - drop an unused variable
 * inv_mpu6050
   - add a missing break in a switch for consistency - not actual
     bug,
   - make some local arrays static to save on object code size.
 * max5481
   - drop manual setting of the spi module owner as handled by the
     spi core.
 * max5487
   - drop manual setting of the spi module owner as handled by the
     spi core.
 * max9611
   - drop explicit setting of the i2c module owner as handled by
     the i2c core.
 * mcp320x
   - speed up reads on single channel devices,
   - drop unused of_device_id data elements,
   - document the struct mcp320x,
   - improve binding docs to reflect restrictions on spi setup and
     to make it explicit that the reference regulator is needed.
 * mma8452
   - symbolic to octal permissions,
   - unsigned to unsigned int.
 * st_lsm6dsx
   - avoid setting odr values multiple times,
   - drop config of LIR as it is only ever set to the existing
     defaults,
   - drop rounding configuration as it only ever matches the defaults.
 * ti-ads8688
   - drop manual setting of the spi module owner as handled by the
     spi core.
 * tsl2x7x
   - constify the i2c_device_id,
   - cleanup limit checks to avoid static checker warnings (and generally
     have nicer code).
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlnH4XkRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fogkaw//e3z+4TQT2Hn+550lBYUV8pBR5emDiSe3
 0QTG+ZS7Kh+fPYENLCXtW9ttZicmUSqkTQFvlMTjAxHyj9XzL7+BXS9UlNgVLsqX
 pn9KprPj31lrXpJOXMSgcdiqWMZLtCvprAJgnwfZt1GevS3WbCMmnnoaBuJV61jp
 w0VD+forukTGF7b0OMGB0d5mwtYS0bJYqXRRMPD+2bNeM4hqt5YM3+wHSqP35t3l
 MoaqKlbx7ZtKDF4zIa59nKNP7Ky7IByWogLZRlJ/vD/uKrACckPT22+KT8rX2TwA
 NpZb1Oy/KZBTl5D9iRjZADq4NaRJENFXJiG6GkjoGjrQhUqHaCinHWpLioqLGlRq
 qCPL2nRjqm4Qr7E8sxlwR1Ajlg0utBMY7Oflym/XJMMLF/ZE6HSrzyrxuVMG2EjV
 T7SVIncbfg6kyr/r4kKsAT3BUMV+TdO4sXm+JgphZBUqZLp0nFHnmjP7Rm2j2uWq
 +yLrSuF25RijrRj3sp28zg9dFWlRwRvZvcAx8kEGm1kMjMWr+Q10xTK9o/5LlFEw
 57sUm6qgmigPK8sahDtcdLIwaCPVvAYvJ0e4Mfw5UsPSlZmHmM1mLwjpwiXBZ5ig
 oxnJmTXsn5RcOGiW/mg0VCH26NkBx7H0fsRqQeq9wkxHLrm75vXroIn7YqRIg+Ad
 /Itu6x6fOIg=
 =ik5C
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Round one of new device support, features and cleanup for IIO in the 4.15 cycle.

Note there is a misc driver drop in here given we have support
in IIO and the feeling is no one will care.

A large part of this series is a boiler plate removal series avoiding
the need to explicitly provide THIS_MODULE in various locations.
It's very dull but touches all drivers.

New device support
* ad5446
  - add ids to support compatible parts DAC081S101, DAC101S101,
    DAC121S101.
  - add the dac7512 id and drop the misc driver as feeling is no
    one is using it (was introduced for a board that is long obsolete)
* mt6577
  - add bindings for mt2712 which is fully compatible with other
    supported parts.
* st_pressure
  - add support for LPS33HW and LPS35HW with bindings (ids mostly).

New features
* ccs811
  - Add support for the data ready trigger.
* mma8452
  - remove artifical restriction on supporting multiple event types
    at the same time.
* tcs3472
  - support out of threshold events

Core and tree wide cleanup
* Use macro magic to remove the need to provide THIS_MODULE as part of
  struct iio_info or struct iio_trigger_ops.  This is similar to
  work done in a number of other subsystems (e.g. i2c, spi).

  All drivers are fixed and then the fields in these structures are
  removed.

  This will cause build failures for out of tree drivers and any
  new drivers that cross with this work going into the kernel.

  Note mostly done with a coccinelle patch, included in the series
  on the mailing list but not merged as the fields no longer exist
  in the structures so the any hold outs will cause a build failure.

Cleanups
* ads1015
  - avoid writing config register when it doesn't change.
  - add 10% to conversion wait time as it seems it is sometimes
    a little small.
* ade7753
  - replace use of core mlock with a local lock.  This is part of a
    long term effort to make the use of mlock opaque and single
    purpose.
* ade7759
  - expand the use of buf_lock to cover previous mlock cases.  This
    is a slightly nicer solution to the same issue as in ade7753.
* cros_ec
  - drop an unused variable
* inv_mpu6050
  - add a missing break in a switch for consistency - not actual
    bug,
  - make some local arrays static to save on object code size.
* max5481
  - drop manual setting of the spi module owner as handled by the
    spi core.
* max5487
  - drop manual setting of the spi module owner as handled by the
    spi core.
* max9611
  - drop explicit setting of the i2c module owner as handled by
    the i2c core.
* mcp320x
  - speed up reads on single channel devices,
  - drop unused of_device_id data elements,
  - document the struct mcp320x,
  - improve binding docs to reflect restrictions on spi setup and
    to make it explicit that the reference regulator is needed.
* mma8452
  - symbolic to octal permissions,
  - unsigned to unsigned int.
* st_lsm6dsx
  - avoid setting odr values multiple times,
  - drop config of LIR as it is only ever set to the existing
    defaults,
  - drop rounding configuration as it only ever matches the defaults.
* ti-ads8688
  - drop manual setting of the spi module owner as handled by the
    spi core.
* tsl2x7x
  - constify the i2c_device_id,
  - cleanup limit checks to avoid static checker warnings (and generally
    have nicer code).
2017-09-25 12:56:37 +02:00
Lorenzo Bianconi a678684740 iio: imu: st_lsm6dsx: remove rounding configuration
Remove rounding configuration since it is enabled by default for the
FIFO output registers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24 16:50:24 +01:00
Lorenzo Bianconi ac2561518b iio: imu: st_lsm6dsx: remove LIR configuration
Remove Latched Interrupt configuration since it is enabled by default
for FIFO watermark interrupt

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24 16:49:15 +01:00
Lorenzo Bianconi 5e3c3e3382 iio: imu: st_lsm6dsx: set sensor->odr value just in st_lsm6dsx_write_raw()
Update odr value in st_lsm6dsx_sensor data structure just in
st_lsm6dsx_write_raw() in order to avoid to set the same value
multiple times

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-24 16:24:35 +01:00
Colin Ian King 2711e642ba iio: imu: inv_mpu6050: make arrays hz and d static
Don't populate the arrays on the stack, instead make them static.
Makes the object code smaller by 135 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  15135	   4240	    128	  19503	   4c2f	inv_mpu_core.o

After:
   text	   data	    bss	    dec	    hex	filename
  14840	   4400	    128	  19368	   4ba8	inv_mpu_core.o

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03 18:10:32 +01:00
Gustavo A. R. Silva 4e57562b48 iio: imu: inv_mpu6050: fix missing break in switch
Add missing break statement to prevent the code for case
IIO_CHAN_INFO_CALIBBIAS falling through to the default case.

Also, add a break to the default case for the switch within
case IIO_CHAN_INFO_CALIBBIAS.

Addresses-Coverity-ID: 1357377
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03 18:10:30 +01:00
Greg Kroah-Hartman 8439a69e72 Merge 4.13-rc7 into staging-next
We want the staging and iio fixes in here to handle the merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-28 15:26:48 +02:00
Jonathan Cameron 79978a9bd0 iio:imu: drop assign iio_info.driver_module and iio_trigger_ops.owner
The equivalent of both of these are now done via macro magic when
the relevant register calls are made.  The actual structure
elements will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-22 21:31:01 +01:00
Dragos Bogdan fdd0d32eb9 iio: imu: adis16480: Fix acceleration scale factor for adis16480
According to the datasheet, the range of the acceleration is [-10 g, + 10 g],
so the scale factor should be 10 instead of 5.

Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-20 15:21:47 +01:00
Reno Farnesi aab498ba12 iio: adis16400: Change unsigned to unsigned int
This patch fixes the following checkpatch warnings:

Prefer 'unsigned int' to bare use of 'unsigned

Signed-off-by: Reno Farnesi <nfarnesi4@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-02 10:27:03 +01:00
Lorenzo Bianconi ff5fff4af4 iio: imu: st_lsm6dsx: support open drain mode
Add open drain support in order to share requested IRQ line between
st_lsm6dsx device and other peripherals

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01 10:17:00 +01:00
Greg Kroah-Hartman dd36a2d9ad Second set of IIO new device support, features and cleanups for the 4.13 cycle.
A few reverts here. One was a general failure to notice a device was already
 supported by another driver.  The second is due to a review comment pointing
 out that the original patch was a bad idea and would break existing systems.
 
 Reverts
 * bma180
   - Revert addition of support for the BMA250E it is already supported by
     the bmc150-accel and better supported at that. Oops.
 * hi8435
   - The fix for cleanup of the reset gpio stuff isn't a good way to go.  It
     breaks systems where an inverting level convertor is used.  The right fix
     is to make the original devicetree correct - even if it involves patching
     the devicetree in kernel.
 
 New Device Support
 * stm32-adc
   - STM32H7 support and bindings.
 
 Features
 * core
   - add a hardware triggered operating mode for systems in which the actual
     trigger is never seen by the kernel.  This is typically only used when
     a device 'can' use other triggers, but if a particular magic one is
     enabled the interrupt is effectively handled in hardware and we never see
     it.
 * st-lsm6dsx
   - support active low interrupts.
 * stm32-adc
   - Make the core adc clock optional as not all hardware supported requires it.
   - Make the bus clock optional in the per instance driver as it may be shared
     by all instances of the ADC and is handled by the core.
   - Rework to have a data structure representing the device type specific
     elements.
 * stm32-trigger (and counter)
   - Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
   - Add an attribute to configure device modes for quadrature counting etc.
 
 Clean ups and minor fixes
 * IIO core.
   - use __sysfs_match_string() helper rather than open coding the same.
 * ad7791
   - use sysfs_match_string() helper rather than open coding the same.
 * aspeed-adc
   - handle return value of clk_prepare_enable
 * cpcap
   - Fix default register values and ensure the battery thermistor is enabled
     correctly.
   - Fix the reported die temperature where we can - docs are lacking.
   - Remove the hung interrupt quirk as no longer happens due to fix in the
     mfd driver.
 * hi8435
   - Remove &s from hi8435_info definition as unneeded and inconsistent.
 * hid-sensor-trgger
   - Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
 * ina2xx
   - Make the use of iio_info_mask* elements consistent for all channels.
     This doesn't have any visible effect, but acts as clear documentation of
     which channels various resulting attributes apply to.
 * lpc32xx
   - handle the return value of clk_prepare_enable.
 * meson-saradc
   - NULL instead of 0 for pointer.
 * mma9551
   - use NULL for GPIO connection ID to aid implementation fo ACPI support.
     Here the connection ID doesn't actually tell us anything and it is much
     easier to deal with the driver if it's not there.
 * mpu6050
   - Fix lock issues through use of a local mux.
   - Replace sprintf with scnprintf as appropriate.
   - Check whoami against all known values.  This allows for a small number of
     boards where we are really fishing for the part not being present at all.
     It is unfortunately common to have undescribed changes to use newer chips.
     We paper over this but just emitting a warning for those cases as long as
     we know about.
 * mxs-lradc
   - Fix some non static warnings.
 * rcar-adc
   - Part of making the naming for this part consistent across the kernel.
 * st_accel
   - drop some spi_device_id entries for variants with no SPI support
 * st_magn
   - drop some spi_device_id entries for variants with no SPI support.
 * sx9500
   - Use devm_gpiod_get instead of indexed value with an index of 0 on all
     occasions.
 * twl4030
   - Drop unused twl4030_get_madc_conversion as callers removed now throughout
     kernel.
   - Unexport twl4030_madc_conversion() as no used only within this driver.
   - Drop twl4030_madc_user_params as not used now.
   - Drop twl4030_madc_request.func_cb as not used now.
   - Fold the twl4030-madc.h header into the driver as no longer used anywhere
     else in the kernel.
 * xilinx
   - Handle the return value of clk_prepare_enable
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAllJSCURHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogTTQ//bbAzHKB0qTwusFN5jrz1JqjGj3+bMXH/
 KumP4nj7NzwKBe4tDe40FsdkZ4c+Um8pK2Aj7iJZojwTcCi02VVjbM++Gj0akMTZ
 MIlrEkTvqVsmVFG085hloSiFU2xXfTnfQmp19M9QtyDnHkgBMo9sOFnBK3EG+Se4
 NIliUvq8PJzCjTRVafSeSFNoDMwXXQTIKhfq8TDSeOG9o5mCTgAdy8yGiZ2ag/Ok
 peFfwauGs9Gg6tRour7UxccawuLnuzPNzwzUUSG3gkdIUTQVD6YHAzXzwblnB5P6
 0ZcErJpGSLAYcHQH310ZRTizhhW+vi+ftWUkps81xqpmFp3+EydVnJS0MZXYgM2o
 Cv6wbohp9w22I5/B9TMEfL7vnj1i4iZoJfi00Su1HBDHBiNpXISRc/fnkRMWavhr
 gvypyxngQmXm1JN/R8UMbJQsSpH3TN07AYF1qx0Tktfyx4S18rdW4hwt+kBNe9ni
 5G9xQU8IhmN8yvHMsTvZHbAmbuOR6iaghx3arf65qdHPvKSQ/nTSlran9U1JPvyJ
 tWVKtPaY5zEGgkQBmWee+qWkWOBGYDC4nmTwijB0u61Deq+5hGg55cZPd0fSXLMg
 6ecNg2v7zrdYldulOpfdNUEOrXa/NYBEAuYUNvccp8DArOqdazkCyO3DlDFDUXRw
 RKNE7Btx/rU=
 =2fJI
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of IIO new device support, features and cleanups for the 4.13 cycle.

A few reverts here. One was a general failure to notice a device was already
supported by another driver.  The second is due to a review comment pointing
out that the original patch was a bad idea and would break existing systems.

Reverts
* bma180
  - Revert addition of support for the BMA250E it is already supported by
    the bmc150-accel and better supported at that. Oops.
* hi8435
  - The fix for cleanup of the reset gpio stuff isn't a good way to go.  It
    breaks systems where an inverting level convertor is used.  The right fix
    is to make the original devicetree correct - even if it involves patching
    the devicetree in kernel.

New Device Support
* stm32-adc
  - STM32H7 support and bindings.

Features
* core
  - add a hardware triggered operating mode for systems in which the actual
    trigger is never seen by the kernel.  This is typically only used when
    a device 'can' use other triggers, but if a particular magic one is
    enabled the interrupt is effectively handled in hardware and we never see
    it.
* st-lsm6dsx
  - support active low interrupts.
* stm32-adc
  - Make the core adc clock optional as not all hardware supported requires it.
  - Make the bus clock optional in the per instance driver as it may be shared
    by all instances of the ADC and is handled by the core.
  - Rework to have a data structure representing the device type specific
    elements.
* stm32-trigger (and counter)
  - Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
  - Add an attribute to configure device modes for quadrature counting etc.

Clean ups and minor fixes
* IIO core.
  - use __sysfs_match_string() helper rather than open coding the same.
* ad7791
  - use sysfs_match_string() helper rather than open coding the same.
* aspeed-adc
  - handle return value of clk_prepare_enable
* cpcap
  - Fix default register values and ensure the battery thermistor is enabled
    correctly.
  - Fix the reported die temperature where we can - docs are lacking.
  - Remove the hung interrupt quirk as no longer happens due to fix in the
    mfd driver.
* hi8435
  - Remove &s from hi8435_info definition as unneeded and inconsistent.
* hid-sensor-trgger
  - Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
* ina2xx
  - Make the use of iio_info_mask* elements consistent for all channels.
    This doesn't have any visible effect, but acts as clear documentation of
    which channels various resulting attributes apply to.
* lpc32xx
  - handle the return value of clk_prepare_enable.
* meson-saradc
  - NULL instead of 0 for pointer.
* mma9551
  - use NULL for GPIO connection ID to aid implementation fo ACPI support.
    Here the connection ID doesn't actually tell us anything and it is much
    easier to deal with the driver if it's not there.
* mpu6050
  - Fix lock issues through use of a local mux.
  - Replace sprintf with scnprintf as appropriate.
  - Check whoami against all known values.  This allows for a small number of
    boards where we are really fishing for the part not being present at all.
    It is unfortunately common to have undescribed changes to use newer chips.
    We paper over this but just emitting a warning for those cases as long as
    we know about.
* mxs-lradc
  - Fix some non static warnings.
* rcar-adc
  - Part of making the naming for this part consistent across the kernel.
* st_accel
  - drop some spi_device_id entries for variants with no SPI support
* st_magn
  - drop some spi_device_id entries for variants with no SPI support.
* sx9500
  - Use devm_gpiod_get instead of indexed value with an index of 0 on all
    occasions.
* twl4030
  - Drop unused twl4030_get_madc_conversion as callers removed now throughout
    kernel.
  - Unexport twl4030_madc_conversion() as no used only within this driver.
  - Drop twl4030_madc_user_params as not used now.
  - Drop twl4030_madc_request.func_cb as not used now.
  - Fold the twl4030-madc.h header into the driver as no longer used anywhere
    else in the kernel.
* xilinx
  - Handle the return value of clk_prepare_enable
2017-06-26 07:09:23 +02:00
Greg Kroah-Hartman d06838de4a Merge 4.12-rc6 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-20 10:17:45 +08:00
Jean-Baptiste Maneyrol 881b556f6c iio: imu: inv_mpu6050: test whoami first and against all known values
SPI bus is never generating error during transfer, so to check if
a chip is correctly connected on a SPI bus we enforce whoami check
to be correct. In this way we can assure SPI probe is failing if
there is no chip connected.

Note that this is really papering over boards that claim the device
is there when it isn't.  Not a bad thing to cope with, but not
necessarily stable material.

Fixes: cec0154556 ("iio: inv_mpu6050: Check WHO_AM_I register on probe")
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-13 21:18:17 +01:00
Jean-Baptiste Maneyrol 8a12ed7df7 iio: imu: inv_mpu6050: replace sprintf with scnprintf
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:38 +01:00
Jean-Baptiste Maneyrol 68cd6e5b20 iio: imu: inv_mpu6050: fix lock issues by using our own mutex
There are several locks issues when using buffer and direct polling
data at the same time. Use our own mutex for managing locking and
block simultaneous use of buffer and direct polling by using
iio_device_{claim/release}_direct_mode. This makes chip_config
enable bit obsolete, so delete it.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:37 +01:00
Lorenzo Bianconi 89ca88a7cd iio: imu: st_lsm6dsx: support active-low interrupts
Add support for active low interrupts (IRQF_TRIGGER_LOW and
IRQF_TRIGGER_FALLING). Configure the device as active high or low
according to the requested irq line.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-11 15:07:36 +01:00
Jean-Baptiste Maneyrol 948588e25b iio: imu: inv_mpu6050: add accel lpf setting for chip >= MPU6500
Starting from MPU6500, accelerometer dlpf is set in a separate
register named ACCEL_CONFIG_2.
Add this new register in the map and set it for the corresponding
chips.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-03 09:40:40 +01:00
Lorenzo Bianconi 3cec485017 iio: imu: st_lsm6dsx: substitute ifdef CONFIG_PM with __maybe_unused macro
Get rid of #ifdef CONFIG_PM by adding __maybe_unused macro to
st_lsm6dsx_suspend and st_lsm6dsx_resume function declarations

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21 15:07:59 +01:00
Lorenzo Bianconi d3f770582a iio: imu: st_lsm6dsx: add system power management support
Add system sleep power management support to st_lsm6dsx driver.
In particular during suspend phase each sensor is disabled and
hw fifo is configured in bypass in order to avoid subsequent
I/O operations. The patch has been tested on HiKey board device

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-30 17:55:15 +01:00
Lorenzo Bianconi 535de397b2 iio: imu: st_lsm6dsx: modify st_lsm6dsx_flush_fifo and st_lsm6dsx_set_fifo_mode scope
Remove static qualifier from st_lsm6dsx_flush_fifo() and
st_lsm6dsx_set_fifo_mode() in order to use them in system sleep pm support

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-30 17:55:12 +01:00
Lorenzo Bianconi bf23527798 iio: imu: st_lsm6dsx: simplify data ready pin parsing
Simplify st_lsm6dsx_of_get_drdy_pin routine since of_property_read_u32
error conditions are already managed in st_lsm6dsx_get_drdy_reg()

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14 15:32:43 +01:00
Lorenzo Bianconi 510c010630 iio: imu: st_lsm6dsx: use i2c/spi device name for iio_dev name
Use the correct chip name (e.g. lsm6dsm) as suffix for iio_dev name
instead of a generic one (lsm6dsx)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-08 18:09:40 +01:00
Greg Kroah-Hartman edf5e79422 Third set of new device support, cleanups and features for IIO in the 4.12 cycle
Somewhat dominated in patch numbers of last of the outreachy application
 window related patches (they are still coming, despite window being closed
 which is good to see!)
 
 Good set of new drivers as well.
 
 New device support
 * ASPEED ADC
   - new driver
 * cpcap PMIC ADC
   - new driver
 * hid-humidity
   - driver for HID compatible humidity sensors.
 * ltc2497 ADC
   - new driver
 * mpu6050
   - bring bindings up to date and add trivial support for 9250
 * rockchip-saradc
   - update bindings to cover rk3328
 * vl6180 light, proximity and time of flight sensor.
   - new driver
 
 Features
 * meson-saradc
   - add calibration
 
 Cleanup and minor fixes
 * ad5504
   - constify attribute_group structure
   - drop casting of void *
 * ad7150
   - replace some shifts of 1 by BIT macro usage
 * ad7152
   - blank lines between function definitions
 * ad7280a
   - octal permissions.
 * ad7606
   - replace use of core mlock mutex with a local lock
 * ad7746
   - replace some shifts of 1 by BIT macro usage
   - function parameter alignment
   - drop some excessive brackets (introduced in last pull request)
 * ad7753
   - white space cleanup
 * ad7754
   - includes in alphabetical order and groupped appropriately.
   - change from missuse of internal mlock mutex to using the buffer lock to
   also protect values during frequency update.
 * ad779x
   - constify attribute_group structures
 * ad9832
   - octal permissions
 * adis16060
   - remove use of core mlock mutex in favour of adding a local
   _spi_write_then_read which can use the local buffer protection lock.
   - fix naming of above function.
 * adis16203
   - remove locking during reads of calibbias that doesn't protect anything
   not protected elsewhere.
 * adis16209
   - remove unnecessary braces in single statement if
 * adis16240
   - remove unnecessary braces in single statement if
 * adt7136
   - drop excess blank lines and put some in between functions.
 * ams-iaq
   - replace comma with semi colon. Not actual bug, just unusual syntax.
 * apds9960
   - constify attribute group structure
 * as3935
   - constify attribute group structure
 * bm1750
   - constify attribute group structure
 * cros_ec
   - devm version of triggered buffer setup to simplify code.
 * exynos
   - drop casting of void *
 * hdc100x
   - constify attribute_group structure
 * hid-accel
   - fix wrong scale for newly introduced gravity sensor.
 * hts221
   - drop casting of void *
 * hx711
   - constify attribute_group structure
 * imx7d_adc
   - drop casting of void *
 * lm35333
   - constify attribute_group structure
 * lsm6dsx
   - drop casting of void *
   - hold ODR configuration until enabling to avoid a race condition.
 * max1027
   - drop casting of void *
 * max11100
   - fix a comma where semicolon was intended (no actual bug, just odd)
 * max1363
   - constify attribute_group structure
 * ms sensors
   - drop casting of void *
 * rockchip_saradc
   - drop casting of void *
 * sun4i-gpadc
   - fix missing dependency on THERMAL or presence of stubs (issue only
   introduced in pervious set)
   - drop casting of void *
 * tsl2x7x
   - fix wrong standard deviation calc.  Note these aren't actually used for
   anything at the moment so bug didn't really matter.
   - constify attribute group structure.
 * vf610adc
   - drop casting of void *
 * vz89x
   - replace comma with semicolon. Not actual bug, just odd syntax.
 * zpa2326
   - drop casting of void *
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAljhRoIRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fohx7Q//ZFhtcXjdZhc38u2LbbKYL68PLK2upREm
 2lXOgM7WzRAxWKTk3om2b2Wc289dWclGe5eJp2gpV8HjnoOxiiGFyzZvDOA1mL1E
 rHBhlytSxOqOGs9ELMfkAWYfTtW28LN4+6bYM7kJ0ItDptxvBEyxh4KLYlkWpYpc
 LSk26+N29n2ZMeb0yCmwQgkHMWF6kK7bpDhAF530x8hN6vSd8C+OE0G2pb4SaAn6
 wNANJ2SUwAq6jS2TzcQfjTjKnIK9/jwRZCWoEr/JL/I7M8kpQGXzIapzNhNyCODL
 ymuylr/LP82rf3Kp/himx4wxTHQ99GQHhiQedIJTGSjcCSR6mpTtwYfoMJ6rmoDZ
 t60FC9worLoqTnqIUxaP3yQSqwy/Hj1Kd1IJmiZFJjm4ki8/YxTHbQfFS6OK0s2j
 lZKN8WYvytZNArdrxMKjNGUt8y3dW1orP31ykNoxN4znhVQTGIoSc5D4Oi2NUTmY
 MhM97jzLmlOgMVHp5NAkb9iiz0JccobIFQnwjyiyyS3Q6FW4hQeypzoBO+HhZoYz
 d6+3zK2LAz8+idN8UsiALYtVLII/khhMw0N0/jLiqNW3Ceh4DPdP4BTz8aa8bNNc
 DpzeFjhHzXqmBvwyvneGaUZIRGM1uNR8FO7+qsjmw1uet7Kfyfs2arL6KfeThox7
 nxVGjupwpuo=
 =YYdq
 -----END PGP SIGNATURE-----

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

Third set of new device support, cleanups and features for IIO in the 4.12 cycle

Somewhat dominated in patch numbers of last of the outreachy application
window related patches (they are still coming, despite window being closed
which is good to see!)

Good set of new drivers as well.

New device support
* ASPEED ADC
  - new driver
* cpcap PMIC ADC
  - new driver
* hid-humidity
  - driver for HID compatible humidity sensors.
* ltc2497 ADC
  - new driver
* mpu6050
  - bring bindings up to date and add trivial support for 9250
* rockchip-saradc
  - update bindings to cover rk3328
* vl6180 light, proximity and time of flight sensor.
  - new driver

Features
* meson-saradc
  - add calibration

Cleanup and minor fixes
* ad5504
  - constify attribute_group structure
  - drop casting of void *
* ad7150
  - replace some shifts of 1 by BIT macro usage
* ad7152
  - blank lines between function definitions
* ad7280a
  - octal permissions.
* ad7606
  - replace use of core mlock mutex with a local lock
* ad7746
  - replace some shifts of 1 by BIT macro usage
  - function parameter alignment
  - drop some excessive brackets (introduced in last pull request)
* ad7753
  - white space cleanup
* ad7754
  - includes in alphabetical order and groupped appropriately.
  - change from missuse of internal mlock mutex to using the buffer lock to
  also protect values during frequency update.
* ad779x
  - constify attribute_group structures
* ad9832
  - octal permissions
* adis16060
  - remove use of core mlock mutex in favour of adding a local
  _spi_write_then_read which can use the local buffer protection lock.
  - fix naming of above function.
* adis16203
  - remove locking during reads of calibbias that doesn't protect anything
  not protected elsewhere.
* adis16209
  - remove unnecessary braces in single statement if
* adis16240
  - remove unnecessary braces in single statement if
* adt7136
  - drop excess blank lines and put some in between functions.
* ams-iaq
  - replace comma with semi colon. Not actual bug, just unusual syntax.
* apds9960
  - constify attribute group structure
* as3935
  - constify attribute group structure
* bm1750
  - constify attribute group structure
* cros_ec
  - devm version of triggered buffer setup to simplify code.
* exynos
  - drop casting of void *
* hdc100x
  - constify attribute_group structure
* hid-accel
  - fix wrong scale for newly introduced gravity sensor.
* hts221
  - drop casting of void *
* hx711
  - constify attribute_group structure
* imx7d_adc
  - drop casting of void *
* lm35333
  - constify attribute_group structure
* lsm6dsx
  - drop casting of void *
  - hold ODR configuration until enabling to avoid a race condition.
* max1027
  - drop casting of void *
* max11100
  - fix a comma where semicolon was intended (no actual bug, just odd)
* max1363
  - constify attribute_group structure
* ms sensors
  - drop casting of void *
* rockchip_saradc
  - drop casting of void *
* sun4i-gpadc
  - fix missing dependency on THERMAL or presence of stubs (issue only
  introduced in pervious set)
  - drop casting of void *
* tsl2x7x
  - fix wrong standard deviation calc.  Note these aren't actually used for
  anything at the moment so bug didn't really matter.
  - constify attribute group structure.
* vf610adc
  - drop casting of void *
* vz89x
  - replace comma with semicolon. Not actual bug, just odd syntax.
* zpa2326
  - drop casting of void *
2017-04-03 15:29:12 +02:00
Lorenzo Bianconi 2ccc15036d iio: imu: st_lsm6dsx: do not apply ODR configuration in write_raw handler
This patch allows to avoid a transitory that occurs when a given sensor
has been already enabled (e.g. gyroscope) and the user is configuring
the sample frequency of the other one (e.g. accelerometer).
The transitory lasts until the accelerometer is enabled.
During that time slice the gyroscope ODR is incorrectly modified as well.
At the end of the transitory both sensors work at the right frequency.
Fix it introducing st_lsm6dsx_check_odr() routine to check ODR consistency
in write_raw handler in order to apply frequency configuration just
in st_lsm6dsx_set_odr()

Fixes: 290a6ce11d (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 14:36:06 +01:00
Jonathan Cameron 0c8f492dd7 iio:imu:mpu6050 add explicit mpu9250 support
The mpu9250 is a SIP containing an mpu6500 and an ak8975.  If this was all
there was too it there would be no need for explicit handling in the driver.
Arguably the bindings would also only reflect the presence of an mpu6500 with
the ak8975 hanging off it, as the kernel doesn't care that they are in one
package.

However, the WHOAMI value changes as well so best to add explicit support.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 10:12:08 +01:00
simran singhal 407e0b537e iio: imu: st_lsm6dsx: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 09:51:45 +01:00
Greg Kroah-Hartman 1c816bad41 Merge 4.11-rc4 into staging-next
We need the IIO fixes in here as well to handle merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-27 09:11:25 +02:00
Javier Martinez Canillas 34591a162f iio: imu: inv_mpu6050: Add OF device ID table
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
I2C device registered via OF will always match a legacy I2C device ID and
that the MODALIAS reported will always be of the form i2c:<device>.

But this could change in the future so the correct approach is to have an
OF device ID table if the devices are registered via OF.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 10:54:43 +00:00
Lorenzo Bianconi 6985bd5e21 iio: imu: st_lsm6dsx: fix FIFO_CTRL2 overwrite during watermark configuration
Fixes: 290a6ce11d (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19 10:44:42 +00:00
Lorenzo Bianconi df47710a6e iio: imu: st_lsm6dsx: add support to lsm6ds3h
Add support to STM LSM6DS3H 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6ds3h.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-04 12:25:05 +00:00
Lorenzo Bianconi 0b2a3e5f17 iio: imu: st_lsm6dsx: add support to lsm6dsl
Add support to STM LSM6DSL 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6dsl.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-04 12:23:37 +00:00
Lorenzo Bianconi d068e4a0f9 iio: imu: st_lsm6dsx: add support to multiple devices with the same settings
Add capability to support multiple devices with the same
st_lsm6dsx_settings like LSM6DSM/LSM6DSL

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-04 12:22:51 +00:00
Lorenzo Bianconi dba329048e iio: imu: st_lsm6dsx: add possibility to select drdy pin
Add capability to route data ready signal on pin 1 or pin 2 of the package

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28 12:41:53 +00:00
Greg Kroah-Hartman 08cad739ba Second round of IIO new device support, cleanups and features for the 4.11 cycle
New device support:
 * lsm6dsx imu
   - new driver and bindings.
 * max11100 adc
   - new driver and bindings.
 * tlc4541
   - new driver
 * tmp007 thermopile
   - new driver.
 
 Core
 * in kernel interfaces
   - pass through raw values if no scaling provided and a processed value is
     requested.
 * trigger
   - close a race condition in acquiring trigger reference.
   - constify device_type structures.
   - rework the viio_trigger_alloc function to be much neater and easier to
   read.
   - free trigger resources correctly on some error paths. Avoids putting a
   module we don't have.
 
 Documentation
 * ABI
   - specify a unit for proximity measurements.
 
 Cleanups and features
 * ads1015
   - constify iio_info structure.
 * ads7950 cleanups following merge in previous pull
   - Add device tree bindings
   - Drop the ti prefix from the module name in common with other drivers.
   - Change regulator name to vref to match datasheet and other drivers.
 * ak8974
   - remove a redundant zero timeout check.
 * bmi160
   - use variable names for sizeof instead of types.
 * cm3605
   - mark PM functions as __maybe_unused to avoid a build warning.
 * isl29028 (on it's way towards moving out of staging).
   - alignment fixes and newline improvements.
   - combine proxim_get and read_proxim for simpler code.
   - drop unused ISL29028_DEV_ATTR macro
   - move some error logging into functions to cut out repitition.
   - make error messages more consistent.
   - tidy up some brackets.
   - drop the enable flag that nothing uses.
   - only set proximity rate and ALS scale when relevant channel type is enabled.
   - runtime pm support.
 * lsm6dsx
   - fix wrong values for gyro sensitivitiy.
 * mag3110
   - claim direct mode during sysfs reads to avoid a race condition.
 * max1363
   - export OF device table IDs as module aliases.
 * max30100
   - use msleep for long uncritical delays.
 * mcp4531
   - export OF device table as module aliases.
 * ms5611
   - claim direct mode during sysfs reads to avoid a race condition.
 * opt3001
   - export OF device table as module aliases.
 * sx9500
   - claim direct mode during oversampling changes to avoid a race condition.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAliFK5sRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoixSQ/+PrWf4PWdYSy+YlxxVzWMkJ3QhHYvDxpz
 mmH5GmsUB0RGi205VqAsvEF55Gcp5tzMYPXkjoxD1nXtuZ8sbVzkTSvrEGIqgA8b
 QUDdu76ntzJYWHVqouh8SywCJJbR/ssjZbIMzHvpYL/pty7+ICnaevauQf6n93Hh
 51yaPdtDNu4hq/lQdUz0QySGn9UJG7HUUKIfSDgZCh9q8VcQ8bmCf8MaRilJTzo9
 q8ONaziyB77w07JVeQLR/W8WO+KCRor0qqlokNtGDNAE2EOre6ul64Ded6TXLEez
 9ag/IYkECN3tImuHHJ9AKlCPOl39viZeP6sjvJc4glujZ0WKVuT76tlVP5XknuCE
 myy74d9Jt5/N43SYiQpRRm4Eadje56kCZtZhFidhRaEV74eQaOYG6fMNJ9Q/HJ4B
 d9Ykw7ZjU08DDOdQNtfQ5DGH72bKu94DSImqjmxXskUL6quZbxCnKPvI/vm//9xb
 7jSHtORTT8WxX/Ut9MTE59S0FS5x/8ivNxWxzqLDS0phcA4e1cLXJyFh0npxxYeu
 XdvJb+BefcfsPNbhhPl/anz577TJPTgNL4P2j1ano0duVCNV33p3y9Z2YNCkgaI1
 PtRVCBzMhaV60EQGBzBheNmN1+jeGu7q8o3UDhaoc4sX4ILut0oDE4PIDROmuItc
 QPLTmZkG20o=
 =Wvje
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second round of IIO new device support, cleanups and features for the 4.11 cycle

New device support:
* lsm6dsx imu
  - new driver and bindings.
* max11100 adc
  - new driver and bindings.
* tlc4541
  - new driver
* tmp007 thermopile
  - new driver.

Core
* in kernel interfaces
  - pass through raw values if no scaling provided and a processed value is
    requested.
* trigger
  - close a race condition in acquiring trigger reference.
  - constify device_type structures.
  - rework the viio_trigger_alloc function to be much neater and easier to
  read.
  - free trigger resources correctly on some error paths. Avoids putting a
  module we don't have.

Documentation
* ABI
  - specify a unit for proximity measurements.

Cleanups and features
* ads1015
  - constify iio_info structure.
* ads7950 cleanups following merge in previous pull
  - Add device tree bindings
  - Drop the ti prefix from the module name in common with other drivers.
  - Change regulator name to vref to match datasheet and other drivers.
* ak8974
  - remove a redundant zero timeout check.
* bmi160
  - use variable names for sizeof instead of types.
* cm3605
  - mark PM functions as __maybe_unused to avoid a build warning.
* isl29028 (on it's way towards moving out of staging).
  - alignment fixes and newline improvements.
  - combine proxim_get and read_proxim for simpler code.
  - drop unused ISL29028_DEV_ATTR macro
  - move some error logging into functions to cut out repitition.
  - make error messages more consistent.
  - tidy up some brackets.
  - drop the enable flag that nothing uses.
  - only set proximity rate and ALS scale when relevant channel type is enabled.
  - runtime pm support.
* lsm6dsx
  - fix wrong values for gyro sensitivitiy.
* mag3110
  - claim direct mode during sysfs reads to avoid a race condition.
* max1363
  - export OF device table IDs as module aliases.
* max30100
  - use msleep for long uncritical delays.
* mcp4531
  - export OF device table as module aliases.
* ms5611
  - claim direct mode during sysfs reads to avoid a race condition.
* opt3001
  - export OF device table as module aliases.
* sx9500
  - claim direct mode during oversampling changes to avoid a race condition.
2017-01-23 09:23:23 +01:00
Lorenzo Bianconi dfebd8d81d iio: imu: st_lsm6dsx: fix typo in gyro sensitivity definition
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:21:41 +00:00
Alison Schofield 2d3f956e2e iio: bmi160: use variable names for sizeof() operator
Replace the types with the actual variable names when using the
sizeof() operator.  This is kernel preferred style as it's
more obvious that it is correct.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21 13:06:03 +00:00
Greg Kroah-Hartman 4463c3e72d First round of new device support, features and cleanups for IIO in the 4.11 cycle.
It's shaping to be another fairly busy cycle. Lots more on the way!
 
 New device support
 * ads7950
   - new driver supporting ads7950, ads7951, ads7952, ads7953, ads7954,
   ads7955, ads7956, ads7957, ads7958, ads7959, ads7960, and ads7961 ADCs.
 * cm3605
   - New driver for this light sensor and proximity sensor  which is an
   analog part with some additional digital controls.
 * hx711
   - New driver.
 
 Core new stuff
 * Gravity sensor type.  This is a processed datastream in which the device
 will try to work out which way is down.
 * Split the buffer.h file into two parts. One provides the interface to 'use'
 a buffer, the second provides the internals of the buffer functionality as
 needed by implementations of buffers.
   - Move documentation inline so as to allow use of private: tag when
   generating documentation.
   - Add some utility functions for the few things that are directly done
   with the buffers.
   - Stop exporting functions that no-one uses outside of the core code.
   - Push docs down by the code in the c file where they should have always
   been.
   - Fix typo in kernel-doc for buffer.
   - push down some includes that were previously happening implicitly.
   - stop enabling the timestamp of the dummy device.
 
 Features and cleanups
 * ad5592r
   - ACPI support
 * ad5593r
   -ACPI support.
 * ad5933
   - Fix a false comment about size of a particular register.
 * ad7150
   - replace S_IRUGO | S_IWUSR with 0644.  I'm not that keen on these patches
   in general, but as it was nicely presented I took this one anyway. As a
   general rule will only take these as part of a larger driver cleanup.
   - don't eat an error but rather reutnr it in the write_event_config callback.
 * ad7606
   - replace non standard range attibute with _scale
 * ade7753
   - use usleep_range for short sleeps
 * ade7754
   - use usleep_range for short sleeps
 * ade7758
   - use usleep_range for short sleeps
 * ade7759
   - use usleep_range for short sleeps
 * ade7854
   - use usleep_range for short sleeps
 * adis16201
   - fix description
 * adis16203
   - fix description
   - fix copyright year
 * adis16209
   - fix description
 * adt7316
   - Add braces to arms of if else statement (for consistency)
   - Alignment fixes.
 * axp288
   - Fix up an issue with accidental overwrites of data.
 * bmi160
   - add deivce tables for i2c and spi to support correctly identifying the
   full dt name (including manufacturer).
   - device tree binding.
 * bmp280
   - use usleep_range for short sleeps.
 * cm3232
   - return error from cm3232_reg_init rather than eating it if the last write
   fails.
 * dummy driver
   - remove a semicolor found at end of a function defintition.
 * exynos-adc
   - use usleep_range for short sleeps.
 * hid-sensor (accel)
   - Add timestamp support.  The hardware can provide timestamps so lets support
   them. If not fall back to timestamps estimated in kernel.
 * hid-sensor (light)
   - Add a duplicate ID for the light channels so as to keep existing interface
   whilst also using the more standard IIO interface.
 * hts221
   - acpi probing
 * imx25-gcq
   - Add a macro call to allow this driver to be automatically loaded.
 * isl29028
   - reorganise code to avoid deep nesting of if statements.
   - move chip test and default regs into a function suitable or sharing with
   power management code.
   - tidy up some code alignment.
 * lidar-lite-v3
   - introduce compatible strings that make it clear Garmin have consideral
   friends.
 * mma8452
   - avoid returning signed value when unsigned is appropriate
 * spmi-vadc
   - Update function for generic voltage conversion to take into account that
   different channels on this device should be handled differently.
   - Rework code to allow per channel voltage scaling and support the standard
   options for this hardware.
   - Fixup three minor issues with the above patches for this part. These all
   effect test builds rather than the native builds for the part, but good to
   clean them up anyway.
 * st_sensors
   - support device matching from the ACPI DST tables.
   - acpi based probing for accelerometers
   - acpi based probing for pressure sensors
   - Allow pressure sensors to read negative values.
   - Export sampling frequency for lps25h and lps331ap.
   - Add support for the old DT bindings from the period when these deivces
   were often supported through windows.
 
 Docs fixup:
 * typo in sysfs-bus-iio
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlh2bhcRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogdSQ/9Hyd3ic5AgWyDKr9JI1vJPj3kT0PIYHLk
 4ucbQ8HUJQBBLnsausTb+UwuGV277DkVjGVsI4epn59H3CvkNh3Egl3XCmbhIpt2
 oyl9Pw9dSon6n/7I5pNSwmqD45O+aB7qFLigIfLmciwpMHZly3ExzGBMpqUkgjf9
 bVzndDqrfoNIrU7UaMD6QgrSxrgYJJJJwBDig/0zjAkGvu9L8a8ghrKkrRzMy62O
 nGP5mmEagivFF9lpGzzrw2pYBQWY4AFbsNvuLElE7nUz0PKKG+9J0oaBiglTYv2p
 mkNlYl7iTZfI3eFOXa+7HdSmeNhYX2dvbEM2jAA/Mr6ojWg2mSRu7Y19Kl2KP7K7
 BDRKBw+Cp0wkVvJ8LU/6PiDSmqp09VfjjqevzVGJi/BmWLzG0Mi2OsQmmynbw2SV
 hxiGETRV7vBoyJWDJuwJoftZaRnHWJbiQ6ftEUbWOFA9RIBMgOJBiL+RtxerJkHv
 FWlCFpv/618TUB/uM15+EOLVJAT5b7K+6+l6EGEjWdjiS/7vL7QM5DL8w4zV43zz
 cQ98UeIlqCkvoFmx9uHbl44COLQgzNtxAjytLxqbsOmEb40wlzoNzgSoUGu73SaG
 8qwznH0w0p8P1nyzwe9qKKK6SmFhj/tF6jKVmIi/H7wJdA1J5dAAmwFUBSxLs2DX
 u1eM3ikCl/M=
 =yjUA
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of new device support, features and cleanups for IIO in the 4.11 cycle.

It's shaping to be another fairly busy cycle. Lots more on the way!

New device support
* ads7950
  - new driver supporting ads7950, ads7951, ads7952, ads7953, ads7954,
  ads7955, ads7956, ads7957, ads7958, ads7959, ads7960, and ads7961 ADCs.
* cm3605
  - New driver for this light sensor and proximity sensor  which is an
  analog part with some additional digital controls.
* hx711
  - New driver.

Core new stuff
* Gravity sensor type.  This is a processed datastream in which the device
will try to work out which way is down.
* Split the buffer.h file into two parts. One provides the interface to 'use'
a buffer, the second provides the internals of the buffer functionality as
needed by implementations of buffers.
  - Move documentation inline so as to allow use of private: tag when
  generating documentation.
  - Add some utility functions for the few things that are directly done
  with the buffers.
  - Stop exporting functions that no-one uses outside of the core code.
  - Push docs down by the code in the c file where they should have always
  been.
  - Fix typo in kernel-doc for buffer.
  - push down some includes that were previously happening implicitly.
  - stop enabling the timestamp of the dummy device.

Features and cleanups
* ad5592r
  - ACPI support
* ad5593r
  -ACPI support.
* ad5933
  - Fix a false comment about size of a particular register.
* ad7150
  - replace S_IRUGO | S_IWUSR with 0644.  I'm not that keen on these patches
  in general, but as it was nicely presented I took this one anyway. As a
  general rule will only take these as part of a larger driver cleanup.
  - don't eat an error but rather reutnr it in the write_event_config callback.
* ad7606
  - replace non standard range attibute with _scale
* ade7753
  - use usleep_range for short sleeps
* ade7754
  - use usleep_range for short sleeps
* ade7758
  - use usleep_range for short sleeps
* ade7759
  - use usleep_range for short sleeps
* ade7854
  - use usleep_range for short sleeps
* adis16201
  - fix description
* adis16203
  - fix description
  - fix copyright year
* adis16209
  - fix description
* adt7316
  - Add braces to arms of if else statement (for consistency)
  - Alignment fixes.
* axp288
  - Fix up an issue with accidental overwrites of data.
* bmi160
  - add deivce tables for i2c and spi to support correctly identifying the
  full dt name (including manufacturer).
  - device tree binding.
* bmp280
  - use usleep_range for short sleeps.
* cm3232
  - return error from cm3232_reg_init rather than eating it if the last write
  fails.
* dummy driver
  - remove a semicolor found at end of a function defintition.
* exynos-adc
  - use usleep_range for short sleeps.
* hid-sensor (accel)
  - Add timestamp support.  The hardware can provide timestamps so lets support
  them. If not fall back to timestamps estimated in kernel.
* hid-sensor (light)
  - Add a duplicate ID for the light channels so as to keep existing interface
  whilst also using the more standard IIO interface.
* hts221
  - acpi probing
* imx25-gcq
  - Add a macro call to allow this driver to be automatically loaded.
* isl29028
  - reorganise code to avoid deep nesting of if statements.
  - move chip test and default regs into a function suitable or sharing with
  power management code.
  - tidy up some code alignment.
* lidar-lite-v3
  - introduce compatible strings that make it clear Garmin have consideral
  friends.
* mma8452
  - avoid returning signed value when unsigned is appropriate
* spmi-vadc
  - Update function for generic voltage conversion to take into account that
  different channels on this device should be handled differently.
  - Rework code to allow per channel voltage scaling and support the standard
  options for this hardware.
  - Fixup three minor issues with the above patches for this part. These all
  effect test builds rather than the native builds for the part, but good to
  clean them up anyway.
* st_sensors
  - support device matching from the ACPI DST tables.
  - acpi based probing for accelerometers
  - acpi based probing for pressure sensors
  - Allow pressure sensors to read negative values.
  - Export sampling frequency for lps25h and lps331ap.
  - Add support for the old DT bindings from the period when these deivces
  were often supported through windows.

Docs fixup:
* typo in sysfs-bus-iio
2017-01-19 10:40:44 +01:00
Lorenzo Bianconi 290a6ce11d iio: imu: add support to lsm6dsx driver
Add support to STM LSM6DS3-LSM6DSM 6-axis (acc + gyro) Mems sensor

http://www.st.com/resource/en/datasheet/lsm6ds3.pdf
http://www.st.com/resource/en/datasheet/lsm6dsm.pdf

- continuous mode support
- i2c support
- spi support
- sw fifo mode support
- supported devices: lsm6ds3, lsm6dsm

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-14 12:40:37 +00:00
Marcin Niestroj 01d1f7a99e iio: bmi160: Fix time needed to sleep after command execution
Datasheet specifies typical and maximum execution times for which CMD
register is occupied after previous command execution. We took these
values as minimum and maximum time for usleep_range() call before making
a new command execution.

To be sure, that the CMD register is no longer occupied we need to wait
*at least* the maximum time specified by datasheet.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 10:52:00 +00:00
Marcin Niestroj 75eadb8fe0 iio: bmi160: Add of device table for spi
From now on we can add bmi160 device to device-tree by specifying
compatible string.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 10:38:19 +00:00
Marcin Niestroj 968bdbf8f3 iio: bmi160: Add of device table for i2c
From now on we can add bmi160 device to device-tree by specifying
compatible string.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 10:32:39 +00:00
Peter Rosin 08f3ffce6e iio: imu: inv_mpu6050: inform the i2c mux core about how it is used
The i2c mux core can then take appropriate action depending on if it is
used for an actual i2c mux, or for an arbitrator or gate. In this case
it is used as a gate.

This will make devicetree bindings simpler when they are eventually
added.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 14:44:45 +00:00
sayli karnik dd4ba3fb22 iio: bmi160_core: Fix sparse warning due to incorrect type in assignment
There is a type mismatch between the buffer which is of type s16 and the
samples stored, which are declared as __le16.

Fix the following sparse warning:
drivers/iio/imu/bmi160/bmi160_core.c:411:26: warning: incorrect type
in assignment (different base types)

drivers/iio/imu/bmi160/bmi160_core.c:411:26: expected signed short
[signed] [short] [explicitly-signed] <noident>
drivers/iio/imu/bmi160/bmi160_core.c:411:26: got restricted __le16
[addressable] [usertype] sample

This is a cosmetic-type patch since it does not alter code behaviour.
The le16 is going into a 16bit buf element, and is labelled as IIO_LE in the
channel buffer definition.

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:44 +01:00
Greg Kroah-Hartman 6c71ee3b61 Third set of IIO new device support, features and cleanups for the 4.8 cycle.
New core features
 - Selection of the clock source for IIO timestamps.  This is done per device
   as it makes little sense to have events in one timebase and data timestamped
   on another.  Biggest reason for this is that we currently use a clock
   source which is non monotonic which can result in 'interesting' data sets.
   (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
    in an earlier version.)
 - MAINTAINERS add the git tree to the list for IIO.
 
 New device support + a kind of indirect staging graduation.
 * Broadcom iproc-static-adc
   - new driver
 * mcp4531
   - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
 * mpu6050
   - support the IC20608 6 axis motion tracking device
 * st-sensors
   - support the lis3l02dq + drop the lis3l02dq driver from staging.
   The general purpose driver is missing event support, but good to get
   rid of this driver which was rather long in the tooth.
 
 New driver features
 * ak8975
   - Add vid regulator support and refactor handling in general.
   - Allow a delay after enabling regulators.
   - Runtime and system PM.
 * bmg160
   - filter frequency control support.
 * bmp280
   - SPI device support.
   - EOC interrupt support for the BMP085
   - power management support.
   - supply regulator support.
   - reset gpio support
   - dt bindings for reset gpio and regulators.
   - of table to support device tree registration
 * max1363
   - Device tree bindings.
 * mcp4531
   - Device tree bindings.
 * st-pressure
   - temperature channels as part of triggered buffer (previously not due
   probably to alignment issues - see below).
   - lps22hb open drain interrupt support.
   - lps22hb temperature channel support
 
 Cleanups and reworkings.
 * numerous ADC drivers
   - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
   as to allow client bindings to find the device.
 * ak8975
   - Fix incorrect handling of missing regulator
   - make sure power is down and remove.
 * bmp280
   - read the calibration data only once as it doesn't change.
 * isl29125
   - Use a few macros to make code a touch more readable.
 * mma8452
   - fix a memory leak on error.
   - drop an unecessary bit of return value handling.
 * potentiometer kconfig
   - typo fix.
 * st-pressure
   - drop some uninformative default assignments of elements of the channel
   array structure (aids readability).
 * st-sensors
   - Harden interrupt handling considerably.  These are actually all using
   level interrupts, but at least two known boards have them wired to
   edge only interrupt chips.  Hence a slightly interesting bit of handling
   is needed in which we first allow for the easy option (level triggered) and
   secondly check the status registers before reenabling edge interrupts and
   fall back to a tight loop in the thread until we successfully clear the
   interrupt.  No harm is done if we never succeed in doing so.  It's an odd
   patch that has been through a lot of revisions to reach a consensus on how
   to handle what is basically broken hardware (which the previous defaults
   allowed to kind of work).
   - Fix alignment to defined storagebytes boundaries.
   - Ensure alignment of power of 2 byte boundaries.  This has always in theory
   been part of the ABI of IIO, but we missed a few that snuck in that need
   fixing.  The effect was minor as they were only followed by timestamp
   channels which were correctly aligned,
   - Add some docs to explain the gain calculations.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIuBAABCAAYBQJXfBqnERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIqjwP
 /0OJbr8kIa1i6+iCqCRCPCixdymd6k9wvjDaKSQoDeamen+8iKOLZNhXJJjOX8hd
 eCRMrCJbvY96Bl2Ll51TCEBb8R1xppCwwYIYylKhF9CL6N2ndapzWY0G4XZb6pc0
 e1JIa6uxynAAEsfplBskk4Ytf5PPHDOWER5WsTmxlZcTTAL9gLxIlii2Du0AmeN/
 tANVzwuvK07i5HHuZfYV2h2+OWDSlm4Y5rvE7t8keWpp6wnZ0XtiIw1WjkpR1OY7
 KiKGKRJMomFlp51hP9IKqc20Dweiaf3lHS7BDggvkB11VxyajQTcjvogxQ0BSPUv
 7PTHHlk8txgEUMqrDWP8x0TL97iNt3hiOZ0/rI3IZdFLC8pnibewnB+uHEGCH3tv
 bqToPtpJHjsIiGlCGVxvt8BRgqT5Qq7JT65hYS6774uFcQiPEvPDI44BDqUxaDUf
 /1WFM23VB4KJpx8JnL+nC8iu6DBnVPDWDKAsjGgc+ljnz3VRcSxWz5P0yMFZRMA2
 mbLiG2yiD4oD/LcI8FeZh9X50Irg09ElAWu07VRymrYMRfCYLXO07o5nZJ0bOqOB
 R+1MToYaHz2g6jJ+KGVC0Ul5EuULzymqH0CMbdjWnaD9AaoPuOKkNfUVBkzRK0t/
 TO/wLHm/qNbk+zGZHQFU15mH1Nn9leEJ/uCdnGqkRo7i
 =FxNN
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Third set of IIO new device support, features and cleanups for the 4.8 cycle.

New core features
- Selection of the clock source for IIO timestamps.  This is done per device
  as it makes little sense to have events in one timebase and data timestamped
  on another.  Biggest reason for this is that we currently use a clock
  source which is non monotonic which can result in 'interesting' data sets.
  (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
   in an earlier version.)
- MAINTAINERS add the git tree to the list for IIO.

New device support + a kind of indirect staging graduation.
* Broadcom iproc-static-adc
  - new driver
* mcp4531
  - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
* mpu6050
  - support the IC20608 6 axis motion tracking device
* st-sensors
  - support the lis3l02dq + drop the lis3l02dq driver from staging.
  The general purpose driver is missing event support, but good to get
  rid of this driver which was rather long in the tooth.

New driver features
* ak8975
  - Add vid regulator support and refactor handling in general.
  - Allow a delay after enabling regulators.
  - Runtime and system PM.
* bmg160
  - filter frequency control support.
* bmp280
  - SPI device support.
  - EOC interrupt support for the BMP085
  - power management support.
  - supply regulator support.
  - reset gpio support
  - dt bindings for reset gpio and regulators.
  - of table to support device tree registration
* max1363
  - Device tree bindings.
* mcp4531
  - Device tree bindings.
* st-pressure
  - temperature channels as part of triggered buffer (previously not due
  probably to alignment issues - see below).
  - lps22hb open drain interrupt support.
  - lps22hb temperature channel support

Cleanups and reworkings.
* numerous ADC drivers
  - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
  as to allow client bindings to find the device.
* ak8975
  - Fix incorrect handling of missing regulator
  - make sure power is down and remove.
* bmp280
  - read the calibration data only once as it doesn't change.
* isl29125
  - Use a few macros to make code a touch more readable.
* mma8452
  - fix a memory leak on error.
  - drop an unecessary bit of return value handling.
* potentiometer kconfig
  - typo fix.
* st-pressure
  - drop some uninformative default assignments of elements of the channel
  array structure (aids readability).
* st-sensors
  - Harden interrupt handling considerably.  These are actually all using
  level interrupts, but at least two known boards have them wired to
  edge only interrupt chips.  Hence a slightly interesting bit of handling
  is needed in which we first allow for the easy option (level triggered) and
  secondly check the status registers before reenabling edge interrupts and
  fall back to a tight loop in the thread until we successfully clear the
  interrupt.  No harm is done if we never succeed in doing so.  It's an odd
  patch that has been through a lot of revisions to reach a consensus on how
  to handle what is basically broken hardware (which the previous defaults
  allowed to kind of work).
  - Fix alignment to defined storagebytes boundaries.
  - Ensure alignment of power of 2 byte boundaries.  This has always in theory
  been part of the ABI of IIO, but we missed a few that snuck in that need
  fixing.  The effect was minor as they were only followed by timestamp
  channels which were correctly aligned,
  - Add some docs to explain the gain calculations.
2016-07-14 12:05:29 +09:00
Greg Kroah-Hartman 7813029a50 Merge 4.7-rc6 into staging-next
We want the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-04 08:15:03 -07:00
Gregor Boirie 468c5620d0 iio:imu:mpu6050: icm20608 initial support
Introduce support for Invense ICM20608 IMU, a 6-axis motion tracking device
that combines a 3-axis gyroscope and a 3-axis accelerometer:
http://www.invensense.com/products/motion-tracking/6-axis/icm-20608-2

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-03 12:39:57 +01:00
Gregor Boirie bc2b7dab62 iio:core: timestamping clock selection support
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow
userspace to select a particular POSIX clock for buffered samples and
events timestamping.

Following clocks, as listed in clock_gettime(2), are supported:
CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW,
CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and
CLOCK_TAI.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Acked-by: Sanchayan Maity <maitysanchayan@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30 19:41:38 +01:00
Greg Kroah-Hartman af52739b92 Merge 4.7-rc4 into staging-next
We want the fixes in here, and we can resolve a merge issue in
drivers/iio/industrialio-trigger.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-20 08:25:44 -07:00
Crestez Dan Leonard 6e85dbe4b4 iio: inv_mpu6050: Fix use-after-free in ACPI code
In some cases this can result in incorrectly returning a negative value
from asus_acpi_get_sensor_info and the AK8963 magnetometer failing to
show up.

Note cpm is an alias for buffer.pointer which isn't apparent in this
patch on it's own.

Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-11 17:20:27 +01:00
Greg Kroah-Hartman aabb406008 First round of IIO new device support, features and cleanups for the 4.8 cycle.
New device support
 * ads1015
   - add ads1115 support
 * bma220 accelerometer
   - new driver
   - triggered buffer support.
 * bmc150
   - add bmm150 support.
 * bmp280
   - bme280 support with addition of humidity channel.
 * max5487 potentiometer
   - new driver
 * MMA7660FC accelerometer.
   - New driver
 * st-pressure
   - support for the lps22hb
 * loop trigger.
   - This one is *nasty* but we have real applications (parrot drones) where
   it is useful.  The trigger basically spins as hard as it can firing off
   a new trigger each time all triggered devices come back to say they are
   done.  It doesn't hang a machine even when doing it on a dummy driver.
   A lot nicer than having this implemented within lots of device drivers
   anyway.
 
 Core stuff
 * Add support to create IIO devices via configfs (similar to we did for
 triggers a while back) + docs.
 * New channel types
   - IIO_ELECTRICAL_CONDUCTIVITY
 * Couple of MAINTAINERS patches to list the device tree bindings.
 * Make trigger ops structure non optional (comment fix). It hasn't been for
 an awful long time, but that's not what the description said.
 
 New features
 * ak8975
   - support adapters that are limited to byte data only by allowing the
   emulated block read i2c function that was recently introduced.
 * atlas-ph
   - support atlas-ec (electrical conductivity sensor)
 * bmi160
   - add available frequency and scale attributes to make the driver
   more user friendly (and avoid having to read the datasheet to know
   what will work).
 * dummy
   - move creation to configfs interface.  It's not real hardware so we
   are not that worried about the ABI breakage ;)
 * mma8452
   - oversampling ration support
 * nau7802
   - expose available gains to make life easier for userspace.
 * st-sensors
   - allow use of emulation for SMBus block reads as all the st parts support
   it.
 * ti-ads1015
   - list datasheet names to allow their use by inkernel consumers.
 * Various module alias additions to help auto probing.  Drop one redundant one
 as well.
 
 Cleanups
 * ad7266, ad7476, ad7887, ad7923, ad799x
   - use direct mode claim function rather than open coding it during sensor
   read (prevents switching on buffers mid read).
 * ad7793, ad7791
   - use direct mode claim to prevent frequency changes when buffers running.
 * afe440x - These are ABI breaking but the driver requires custom userspace
   code to do anything useful anyway and that is still being written and under
   control of TI.  Ultimately we may have other libraries to do pulse
   oximetry with these devices but we aren't aware of any yet.
   - kernel-doc format fixes
   - drop ifdef fun around of_match_ptr - it's not worth the mess to save
   a tiny amount of space.
   - drop some unnecessary register initializations.
   - drop the weird locked gain modes as they gain us nothing (can just set
   all gains separately).
   - remove handling of offset attributes seeing as no channels actually have
   them (oops)
   - Drop the LED3 input channel as it's an alias for ALED2.
   - *big one* remove channel names - an experiment that turned out to not
   make sense - see patch for details.
   - use regmap fields to clean up code.
   - tie the tia gain stages to appropriate channels in the ABI as that is
   what they really effect. Same with the LED currents.
   - cleanout some unused defines and fix a missnamed one.
 * atlas-ph
   - reorganise to allow support of other similar parts.
 * bmc150
   - document supported chips in kconfig help.
 * jsa1212
   - drop an unneeded i2c functionality check for functionality the driver
   doesn't use.
 * mxs-lradc
   - simply touch screen registration code.
   - remove the touch screen unregister as all devm based now.
   - disable only those channels that are masked in hardware stop (others
   are already dealt with elsewhere)
 * st-sensors
   - unexport st_sensors_get_buffer_element as nothing outside the st-sensors
   core driver uses it.
   - fix handling of failure to start up regulators.
 * tpl0102
   - drop an i2c functionality test for features that aren't needed.
 * ti-am335x
   - use variable name rather than type in sizeof for clarity.
   - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.
 
 Tools
 * Add install / uninstall to makefile.  Someone cares, so presumably
 some people will find it useful!
 *  generic_buffer
    - rename to iio_generic_buffer to line up with other tools.
    - handle cleanup when receiving signals
    - Add a --device-num option and a --trigger-num option rather than
    relying on naming which doesn't work if you have two of the same part.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXWFXGAAoJEFSFNJnE9BaIQ4kP/jcoVTR8w6EMdcr1BErrvFgm
 IMbMMK8wJtc1dhKcp77h/DQjCunPAaDMgdtg1uJcreRDl1dY1jiFh/PMLrt/eods
 tsJZcN1h40aLlPEdMQFl3oiaWjpUm23gdDtfiCHA+sM/FhQ+A+83EdonU7hbAGT2
 E2NAb5xkC+74WEUit5qEouz++4JRnsJEpBx3A7mwkiUH9RnFA9OflsTdIFSIEbzb
 V4yMWeYBAlhwKPy/7z6/hAMK/+Psabw8FppCAw2HcADVpT517rkl4MpvErSZeFGz
 cr46+ZWhXZ4PaG2jG2xVLpqSbqLSfWp8uqfj0WavW2gFn/1jCB+FST904q7IPVW2
 QPxALqxMAMSzOHxTYmDLfJ4IJ5vvLKroom4ixKgbl7jKXF3+PTooR6U4hGQmLK7K
 VKWjb/kIdHpuRT3/pG2kysMtJkk1av5BBZkl9sWUEFgCd4vYP1eB1Ah3aE/P26OH
 BCueMDaJqKAzmVa6Dx5MCLlJpxHpQl/OBz5wdXiMRbYeky/QHgzaTmi/HZ0wwXvn
 zFHAglWzLq7q0HY+q7wwI20R16cRYIve3HOaLFvQdXd1xpBP1BF+aAxT/vSb+otS
 1OWCEHAxq4XEM7VcRKv9XL59gXuSB8ZaSl6k82+IjjfgOqLHh8BSygVle7iu14TE
 glokfXQRC7xhgfC1zQf9
 =Hq1a
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of IIO new device support, features and cleanups for the 4.8 cycle.

New device support
* ads1015
  - add ads1115 support
* bma220 accelerometer
  - new driver
  - triggered buffer support.
* bmc150
  - add bmm150 support.
* bmp280
  - bme280 support with addition of humidity channel.
* max5487 potentiometer
  - new driver
* MMA7660FC accelerometer.
  - New driver
* st-pressure
  - support for the lps22hb
* loop trigger.
  - This one is *nasty* but we have real applications (parrot drones) where
  it is useful.  The trigger basically spins as hard as it can firing off
  a new trigger each time all triggered devices come back to say they are
  done.  It doesn't hang a machine even when doing it on a dummy driver.
  A lot nicer than having this implemented within lots of device drivers
  anyway.

Core stuff
* Add support to create IIO devices via configfs (similar to we did for
triggers a while back) + docs.
* New channel types
  - IIO_ELECTRICAL_CONDUCTIVITY
* Couple of MAINTAINERS patches to list the device tree bindings.
* Make trigger ops structure non optional (comment fix). It hasn't been for
an awful long time, but that's not what the description said.

New features
* ak8975
  - support adapters that are limited to byte data only by allowing the
  emulated block read i2c function that was recently introduced.
* atlas-ph
  - support atlas-ec (electrical conductivity sensor)
* bmi160
  - add available frequency and scale attributes to make the driver
  more user friendly (and avoid having to read the datasheet to know
  what will work).
* dummy
  - move creation to configfs interface.  It's not real hardware so we
  are not that worried about the ABI breakage ;)
* mma8452
  - oversampling ration support
* nau7802
  - expose available gains to make life easier for userspace.
* st-sensors
  - allow use of emulation for SMBus block reads as all the st parts support
  it.
* ti-ads1015
  - list datasheet names to allow their use by inkernel consumers.
* Various module alias additions to help auto probing.  Drop one redundant one
as well.

Cleanups
* ad7266, ad7476, ad7887, ad7923, ad799x
  - use direct mode claim function rather than open coding it during sensor
  read (prevents switching on buffers mid read).
* ad7793, ad7791
  - use direct mode claim to prevent frequency changes when buffers running.
* afe440x - These are ABI breaking but the driver requires custom userspace
  code to do anything useful anyway and that is still being written and under
  control of TI.  Ultimately we may have other libraries to do pulse
  oximetry with these devices but we aren't aware of any yet.
  - kernel-doc format fixes
  - drop ifdef fun around of_match_ptr - it's not worth the mess to save
  a tiny amount of space.
  - drop some unnecessary register initializations.
  - drop the weird locked gain modes as they gain us nothing (can just set
  all gains separately).
  - remove handling of offset attributes seeing as no channels actually have
  them (oops)
  - Drop the LED3 input channel as it's an alias for ALED2.
  - *big one* remove channel names - an experiment that turned out to not
  make sense - see patch for details.
  - use regmap fields to clean up code.
  - tie the tia gain stages to appropriate channels in the ABI as that is
  what they really effect. Same with the LED currents.
  - cleanout some unused defines and fix a missnamed one.
* atlas-ph
  - reorganise to allow support of other similar parts.
* bmc150
  - document supported chips in kconfig help.
* jsa1212
  - drop an unneeded i2c functionality check for functionality the driver
  doesn't use.
* mxs-lradc
  - simply touch screen registration code.
  - remove the touch screen unregister as all devm based now.
  - disable only those channels that are masked in hardware stop (others
  are already dealt with elsewhere)
* st-sensors
  - unexport st_sensors_get_buffer_element as nothing outside the st-sensors
  core driver uses it.
  - fix handling of failure to start up regulators.
* tpl0102
  - drop an i2c functionality test for features that aren't needed.
* ti-am335x
  - use variable name rather than type in sizeof for clarity.
  - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit.

Tools
* Add install / uninstall to makefile.  Someone cares, so presumably
some people will find it useful!
*  generic_buffer
   - rename to iio_generic_buffer to line up with other tools.
   - handle cleanup when receiving signals
   - Add a --device-num option and a --trigger-num option rather than
   relying on naming which doesn't work if you have two of the same part.
2016-06-09 09:15:58 -07:00
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 Torvalds 2f37dd131c Staging and IIO driver update for 4.7-rc1
Here's the big staging and iio driver update for 4.7-rc1.
 
 I think we almost broke even with this release, only adding a few more
 lines than we removed, which isn't bad overall given that there's a
 bunch of new iio drivers added.  The Lustre developers seem to have
 woken up from their sleep and have been doing a great job in cleaning up
 the code and pruning unused or old cruft, the filesystem is almost
 readable :)
 
 Other than that, just a lot of basic coding style cleanups in the churn.
 All have been in linux-next for a while with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlc/00QACgkQMUfUDdst+ynXYQCdG9oEsw4CCItbjGfQau5YVGbd
 TOcAnA19tZz+Wcg3sLT8Zsm979dgVvDt
 =9UG/
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO driver updates from Greg KH:
 "Here's the big staging and iio driver update for 4.7-rc1.

  I think we almost broke even with this release, only adding a few more
  lines than we removed, which isn't bad overall given that there's a
  bunch of new iio drivers added.

  The Lustre developers seem to have woken up from their sleep and have
  been doing a great job in cleaning up the code and pruning unused or
  old cruft, the filesystem is almost readable :)

  Other than that, just a lot of basic coding style cleanups in the
  churn.  All have been in linux-next for a while with no reported
  issues"

* tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (938 commits)
  Staging: emxx_udc: emxx_udc: fixed coding style issue
  staging/gdm724x: fix "alignment should match open parenthesis" issues
  staging/gdm724x: Fix avoid CamelCase
  staging: unisys: rename misleading var ii with frag
  staging: unisys: visorhba: switch success handling to error handling
  staging: unisys: visorhba: main path needs to flow down the left margin
  staging: unisys: visorinput: handle_locking_key() simplifications
  staging: unisys: visorhba: fail gracefully for thread creation failures
  staging: unisys: visornic: comment restructuring and removing bad diction
  staging: unisys: fix format string %Lx to %llx for u64
  staging: unisys: remove unused struct members
  staging: unisys: visorchannel: correct variable misspelling
  staging: unisys: visorhba: replace functionlike macro with function
  staging: dgnc: Need to check for NULL of ch
  staging: dgnc: remove redundant condition check
  staging: dgnc: fix 'line over 80 characters'
  staging: dgnc: clean up the dgnc_get_modem_info()
  staging: lustre: lnet: enable configuration per NI interface
  staging: lustre: o2iblnd: properly set ibr_why
  staging: lustre: o2iblnd: remove last of kiblnd_tunables_fini
  ...
2016-05-20 22:20:48 -07:00
Linus Torvalds 78975f23cb Merge branch 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:

 - Peter Rosin did some major rework on the locking of i2c muxes by
   seperating parent-locked muxes and mux-locked muxes.

   This avoids deadlocks/workarounds when the mux itself needs i2c
   commands for muxing.  And as a side-effect, other workarounds in the
   media layer could be eliminated.  Also, Peter stepped up as the i2c
   mux maintainer and will keep an eye on these changes.

 - major updates to the octeon driver

 - add a helper to the core to generate the address+rw_bit octal and
   make drivers use it

 - quite a bunch of driver updates

* 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (84 commits)
  i2c: rcar: add DMA support
  i2c: st: Implement bus clear
  i2c: only check scl functions when using generic recovery
  i2c: algo-bit: declare i2c_bit_quirk_no_clk_stretch as static
  i2c: tegra: disable clock before returning error
  [media] rtl2832: regmap is aware of lockdep, drop local locking hack
  [media] rtl2832_sdr: get rid of empty regmap wrappers
  [media] rtl2832: change the i2c gate to be mux-locked
  [media] si2168: change the i2c gate to be mux-locked
  iio: imu: inv_mpu6050: change the i2c gate to be mux-locked
  i2c: mux: document i2c muxes and elaborate on parent-/mux-locked muxes
  i2c: mux: relax locking of the top i2c adapter during mux-locked muxing
  i2c: muxes always lock the parent adapter
  i2c: allow adapter drivers to override the adapter locking
  i2c: uniphier: add "\n" at the end of error log
  i2c: mv64xxx: remove CONFIG_HAVE_CLK conditionals
  i2c: mv64xxx: use clk_{prepare_enable,disable_unprepare}
  i2c: mv64xxx: handle probe deferral for the clock
  i2c: mv64xxx: enable the driver on ARCH_MVEBU
  i2c: octeon: Add workaround for broken irqs on CN3860
  ...
2016-05-19 17:48:12 -07:00
Peter Rosin 1ffcfaf195 iio: imu: inv_mpu6050: change the i2c gate to be mux-locked
The root i2c adapter lock is then no longer held by the i2c mux during
accesses behind the i2c gate, and such accesses need to take that lock
just like any other ordinary i2c accesses do.

So, declare the i2c gate mux-locked, and zap the code that makes the
unlocked i2c accesses and just use ordinary regmap_write accesses.

This also happens to fix the deadlock described in
http://patchwork.ozlabs.org/patch/584776/ authored by
Adriana Reus <adriana.reus@intel.com> and submitted by
Daniel Baluta <daniel.baluta@intel.com>

----------8<----------
iio: imu: inv_mpu6050: Fix deadlock between i2c adapter lock and mpu lock

This deadlock occurs if the accel/gyro and the sensor on the auxiliary
I2C (in my setup it's an ak8975) are working at the same time.

Scenario:

      T1					T2
     ====				       ====
inv_mpu6050_read_fifo                  aux sensor op (eg. ak8975_read_raw)
        |                                     |
mutex_lock(&indio_dev->mlock)           i2c_transfer
        |                                     |
i2c transaction                         i2c adapter lock
        |                                     |
i2c adapter lock                        i2c_mux_master_xfer
                                              |
                                        inv_mpu6050_select_bypass
                                              |
                                        mutex_lock(&indio_dev->mlock)

When we operate on an mpu sensor the order of locking is mpu lock
followed by the i2c adapter lock. However, when we operate the auxiliary
sensor the order of locking is the other way around.

...
----------8<----------

The reason this patch fixes the deadlock is that T2 does not grab the
i2c adapter lock until the very end (and grabs the newfangled i2c mux
lock where it previously grabbed the i2c adapter lock).

Acked-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Tested-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-05-04 22:39:30 +02:00
Daniel Baluta 216912e3f1 imu: bmi160: Add avail frequency and scale attributes
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04 10:51:39 +01:00
Daniel Baluta c25d3f37be iio: bmi160: Fix ODR setting
mask and val parameters of regmap_update_bits were reveresed.

Fixes: 77c4ad2d6a ("iio: imu: Add initial support for Bosch BMI160")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04 10:50:36 +01:00
Daniel Baluta 5ec97ba071 iio: bmi160: Fix output data rate for accel
Format is INT_PLUS_MICRO and micro odr part of ODR should
be parts of a micro.

Also s/8000/800 this is obviously a typo.

Fixes: 77c4ad2d6a ("iio: imu: Add initial support for Bosch BMI160")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04 10:49:00 +01:00
Daniel Baluta 393dbe4e18 iio: imu: mpu6050: Fix name/chip_id when using ACPI
When using ACPI, id is NULL and the current code automatically
defaults name to NULL and chip id to 0. We should instead use
the data provided in the ACPI device table.

Fixes: c816d9e7a5 ("iio: imu: mpu6050: fix possible NULL dereferences")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-By: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04 08:44:27 +01:00
Matt Ranostay 140afdd962 iio: imu: mpu6050: fix possible NULL dereferences
Fix possible null dereferencing of i2c and spi driver data.

Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04 08:42:00 +01: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
Crestez Dan Leonard fbced0e946 iio: inv_mpu6050: Add explicit support for MPU9150
This device is a package containing a MPU6050-like sensor and an AK8975
magnetometer. The magnetometer component is supported by the existing
ak8975 driver.

This patch also rephrases the Kconfig descriptions.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25 20:19:38 +01:00
Crestez Dan Leonard bf1eb91274 iio: inv_mpu6050: Add spi_device_id for INV_MPU6500
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25 20:19:29 +01:00
Crestez Dan Leonard cec0154556 iio: inv_mpu6050: Check WHO_AM_I register on probe
This can be used to distinguish mpu6500. This is a warning rather than
an error because the differences are mostly irrelevant and it's nice to
avoid breaking users with slightly incorrect ACPI/DT.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25 20:19:15 +01:00
Crestez Dan Leonard 7bdd318159 iio: inv_mpu6050: Remove inv_mpu6050_hw.num_reg
This field was unused and incorrect for mpu6500.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25 19:40:05 +01:00
Crestez Dan Leonard aadd3076db iio: inv_mpu6050: Cleanup hw_info mapping
The hw_info array was indexed by enum inv_devices chip_type despite the
fact that the enumeration had more members than the array and was
ordered differently.

The patch cleans this up and adds explicit chip_types to i2c/spi/acpi
IDs. It also adds some stricter checks inside the driver core.

This happened to work so far because the differences between the
supported models are very minor.

Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Acked-by: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25 19:38:52 +01:00
Gregor Boirie eb3798463f iio:imu:mpu6050: enhance mounting matrix support
Add a new rotation matrix sysfs attribute compliant with IIO core
mounting matrix API.
Matrix is retrieved from "in_anglvel_mount_matrix" and
"in_accel_mount_matrix" sysfs attributes. It is declared into mpu6050 DTS
entry as a "mount-matrix" property.

Old interface is kept for backward userspace compatibility and may be
retrieved from legacy platform_data mechanism only.

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:16:01 +01:00
Peter Rosin 51f97f6dd7 iio: imu: inv_mpu6050: convert to use an explicit i2c mux core
Allocate an explicit i2c mux core to handle parent and child adapters
etc. Update the select/deselect ops to be in terms of the i2c mux core
instead of the child adapter.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Tested-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-22 15:00:05 +02:00
Lars-Peter Clausen af8a41271b iio:adis: Add support for manual self-test flag clear
Some variants of the devices from the ADIS family don't auto-clear the
self-test bit after the self-test has completed. Instead we have to
manually clear. Add support for this to the ADIS library.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:42:43 +01:00
Daniel Baluta 77c4ad2d6a iio: imu: Add initial support for Bosch BMI160
BMI160 is an Inertial Measurement Unit (IMU) which provides acceleration
and angular rate measurement. It also offers a secondary I2C interface
for connecting a magnetometer sensor (usually BMM160).

Current driver offers support for accelerometer and gyroscope readings
via sysfs or via buffer interface using an external trigger (e.g.
hrtimer). Data is retrieved from IMU via I2C or SPI interface.

Datasheet is at:
	http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16 13:39:21 +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
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
Richard Weinberger f7072198f2 iio: imu: Fix inv_mpu6050 dependencies
Not all archs have io memory.
Instead of selecting I2C_MUX (and bypassing the HAS_IOMEM dependency)
depend directly on it.

Fixes the following kconfig warning:
warning: (MEDIA_SUBDRV_AUTOSELECT && VIDEO_CX231XX && INV_MPU6050_I2C) selects I2C_MUX which has unmet direct dependencies (I2C && HAS_IOMEM)
And this build error:
ERROR: "devm_ioremap_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined!
ERROR: "of_address_to_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined!

Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28 09:52:09 +01:00
Daniel Baluta 718ba46e5f iio: imu: mpu6050: Fix name/chip_id when using ACPI
When using ACPI, id is NULL and the current code automatically
defaults name to NULL and chip id to 0. We should instead use
the data provided in the ACPI device table.

Fixes: c816d9e7a5 ("iio: imu: mpu6050: fix possible NULL dereferences")
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-By: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20 10:39:49 +00:00
Matt Ranostay c816d9e7a5 iio: imu: mpu6050: fix possible NULL dereferences
Fix possible null dereferencing of i2c and spi driver data.

Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05 17:51:10 +00:00
Matt Ranostay f8d9d3b434 iio: convert to common i2c_check_functionality() return value
Previously most drivers that used a i2c_check_functionality() check
condition required various error codes on failure. This patchset
converts to a standard of -EOPNOTSUPP

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27 17:17:43 +00:00
Matt Ranostay 33da559f86 iio: imu: mpu6050: add mpu6500 register settings
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25 19:54:27 +00:00
Matt Ranostay d509844714 iio: imu: mpu6050: add calibration offset support
Allow setting of the x/y/z axes calibration offsets for the gyroscope
and accelerometer.

Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25 19:53:30 +00:00
Matt Ranostay 725f645d87 iio: imu: mpu6050: add missing docstring for int_pin_cfg
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25 19:48:57 +00:00
Matt Ranostay 8f356be3fe iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delay
replace msleep(INV_MPU6050_REG_UP_TIME) with usleep_range calls
due to fact the wait time is under 20 milliseconds.

Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25 19:48:47 +00:00
Matt Ranostay 115f0341bc iio: imu: mpu6050: use inv_mpu6050_sensor_show return code
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25 19:48:30 +00:00
Matt Ranostay 3afdf6cf9d iio: imu: mpu6050: remove trailing whitespaces
removed several trailing whitespaces before assignment operations

Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:48 +00:00
Daniel Baluta fc0dccdda1 iio: imu: inv_mpu6050: Fix alignment with open parenthesis
This makes code consistent around inv_mpu6050 driver and
fixes the following checkpatch.pl warning:
CHECK: Alignment should match open parenthesis

Note that there were few cases were it was not possible to
fix this due to making the line too long, but we can live with that.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:45 +00:00
Daniel Baluta 371a76603c iio: imu: inv_mpu6050: Fix code indent for if statement
This fixes the following checkpatch.pl warning:

WARNING: suspect code indent for conditional statements (8, 24)
+       if (kfifo_len(&st->timestamps) >
[...]
+                       goto flush_fifo;

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:44 +00:00
Daniel Baluta aeeb18fcf6 iio: imu: inv_mpu6050: Delete space before comma
This fixes the following checkpatch.pl warning:

ERROR: space prohibited before that ',' (ctx:WxE)
		.shift = 0 ,

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:44 +00:00
Daniel Baluta 0e79137531 iio: imu: inv_mpu6050: Remove unnecessary parentheses
Fixes the following checkpatch warning:
CHECK: Unnecessary parentheses around cpm->package.elements[i]

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:43 +00:00
Daniel Baluta d92241a0dc iio: imu: inv_mpu6050: Fix newlines to make code easier to read
This fixes the following checkpatch.pl warnings:
	* WARNING: Missing a blank line after declarations
	* CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:43 +00:00
Daniel Baluta acf7146ec9 iio: imu: inv_mpu6050: Fix Yoda conditions
This fixes the following checkpatch warning:
	* WARNING: Comparisons should place the constant
	  on the right side of the test

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Acked-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:42 +00:00
Daniel Baluta 23c5edccbf iio: imu: inv_mpu6050: Fix multiline comments style
The preffered style for long (multi-line) comments is:

/*
 * this is a multiline
 * comment
 */

This also fixes checkpatch.pl warning:
WARNING: Block comments use * on subsequent lines

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24 20:40:41 +00:00
Adriana Reus fd64df16f4 iio: imu: inv_mpu6050: Add SPI support for MPU6000
The only difference between the MPU6000 and the
MPU6050 is that the first also supports SPI.
Add SPI driver for this chip.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13 20:54:07 +00:00
Adriana Reus b3eea8dacf iio: imu: inv_mpu6050: Separate driver into core and i2c functionality.
Separate this driver into core and i2c functionality.
This is in preparation for adding spi support.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13 20:54:00 +00:00
Adriana Reus d430f3c36c iio: imu: inv_mpu6050: Use regmap instead of i2c specific functions
Use regmap instead of i2c specific functions.
This is in preparation of splitting this driver into core and
i2c specific functionality.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Acked-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13 20:53:50 +00:00
Adriana Reus c278ac0ecd iio: imu: inv-mpu6050: Fix interrupt pin configuration
The select/deselect_bypass duo writes the irq number into the interrupt
configuration register.
If there is a i2c slave device connected to the mpu (eg. a magnetometer)
then this can hinder interrupt delivery for the accelerometer and
gyroscope.
Set this register to the default configuration.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13 20:52:47 +00:00
Greg Kroah-Hartman fec2f3335c First round of new IIO device support, features and cleanups for the 4.6 cycle.
Device Support
 * ad5761
   - new driver
 * at91_sama5d2 ADC.
   - new driver and MAINTAINERS entry.
   - minor cleanups followed.
 * atlas pH-SM
   - new driver (this has possibly the prettiest data sheet I've ever seen)
 * mcp3422
   - mcp3425 ADC added.
 * mcp4725
   - mcp4726 DAC added.
 * mma8452
   - mma8451q accelerometer added.
 * mpl115
   - mpl115a1 added (a lot bigger than it seems as this is an SPI part whereas
     previous parts were i2c).
 * si7005
   - Hoperf th02 (seems to be a repackaged part)
 * si7020
   - Hoperf th06 (seems to be a repackaged part)
 
 New features
 * Core
   - IIO_PH type. Does what it says on the tin.
 * max30100
   - LED current configuration support.
 * mcp320x
   - more differential measurement combinations.
 * mma8452
   - free fall deteciton
 - opt3001
   - enable operation without a IRQ line.
   - device tree docs.  Somehow the original docs have disappeared down
     a rabbit hole, so here is a new set.
 * st-sensors
   - Support active-low interrupts.
 
 Cleanups and minor / not so minor reworks
 * Documentation
   - drop some defunct ABI from the docs in staging.
 * presure / Kconfig
   - white space cleanup.
 * ad7150
   - BIT macro usage
   - Alignment fixes
 * ad7192
   - false indent fixed.
 * ak8975
   - constify the ak_def structures
 * axp288
   - drop a redundant double const.
 * dht11
   - substantial reliability improvements by being more tolerant
     of missing start bits.
   - simplify the decoding algorithm
 * mma8452
   - whitespace cleanup
 * mpl115
   - don't bother setting i2c_client_data as nothing uses it.
 * mpu6050
   - drop unused function parameter.
 * opt3001
   - extract integration time as constants.
   - trivial refactoring.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWr8HEAAoJEFSFNJnE9BaIIWMP/A6hJdAi3QOipB75QYBHL3R2
 7fe7Bcd83i2to/Ohk9XirRwyP7kCqt1ZP7cnaIAevNxmwQ9fqIFgrxCK8BfF+lMk
 60PXfEdinPk1rWguqEMwaYq1xVAOTgWYl8F4GVG3nGIvTHovAYaZW0UcTUl5Gz+l
 WErEZQ5xgnf7e/29ds74eD3YaOti8E1mzhBLXFJH7lllsSMJttbp9Xb5J0QJrv4a
 Ly8Ru5DBRGZYKi0VplFIjncKLZgX/VUUSPNL+NXtPnGD2Qp2zx0bJ3eIqNmeEYZl
 isAGIc6l4XPXQLczyRaPbcQLobMxOHMP2uuXxY/OAbe2DX9/6ILcB2QigARAFHf2
 7vVcx3JlxXUtwS/bPpZSd5hHrvjWLR7+gyuZTA4b/scV4+GvknMl8e6IIh4Ux3/T
 d24V37bOIENrXCoyf81veap0xca6xQNSzCVuo8+1+QYqn6DxvoJw3p38Cmxb8eB8
 7M+nQJP9SwLtbSUak8g1KVrtWBNsMrMGwoiuZq5SkK1PQTSXnSaJPTL0OoPoefNi
 uIY5qD5FrUp9jlNbBP2M2E3CcG5CJcMElxyBgd7F5lEVxSWPOuyOcpJHIoCCCgIf
 o6vwOYXXfD4ytv/E6jg+Bbv3ZYCylFhcoZOqPgTC/sOnSI9RwhJ6XdAg6VU8sv07
 piH1AVWb91HKRN2dt2ZB
 =fgTH
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of new IIO device support, features and cleanups for the 4.6 cycle.

Device Support
* ad5761
  - new driver
* at91_sama5d2 ADC.
  - new driver and MAINTAINERS entry.
  - minor cleanups followed.
* atlas pH-SM
  - new driver (this has possibly the prettiest data sheet I've ever seen)
* mcp3422
  - mcp3425 ADC added.
* mcp4725
  - mcp4726 DAC added.
* mma8452
  - mma8451q accelerometer added.
* mpl115
  - mpl115a1 added (a lot bigger than it seems as this is an SPI part whereas
    previous parts were i2c).
* si7005
  - Hoperf th02 (seems to be a repackaged part)
* si7020
  - Hoperf th06 (seems to be a repackaged part)

New features
* Core
  - IIO_PH type. Does what it says on the tin.
* max30100
  - LED current configuration support.
* mcp320x
  - more differential measurement combinations.
* mma8452
  - free fall deteciton
- opt3001
  - enable operation without a IRQ line.
  - device tree docs.  Somehow the original docs have disappeared down
    a rabbit hole, so here is a new set.
* st-sensors
  - Support active-low interrupts.

Cleanups and minor / not so minor reworks
* Documentation
  - drop some defunct ABI from the docs in staging.
* presure / Kconfig
  - white space cleanup.
* ad7150
  - BIT macro usage
  - Alignment fixes
* ad7192
  - false indent fixed.
* ak8975
  - constify the ak_def structures
* axp288
  - drop a redundant double const.
* dht11
  - substantial reliability improvements by being more tolerant
    of missing start bits.
  - simplify the decoding algorithm
* mma8452
  - whitespace cleanup
* mpl115
  - don't bother setting i2c_client_data as nothing uses it.
* mpu6050
  - drop unused function parameter.
* opt3001
  - extract integration time as constants.
  - trivial refactoring.
2016-02-01 13:10:03 -08:00
Linus Torvalds 8c4e378e42 Staging fixes for 4.5-rc2
Here are some small staging driver fixes for 4.5-rc2.  One of them
 predated 4.4-final, but I missed that merge window due to the holliday.
 The others fix reported issues that have come up recently.  The tty
 change is needed for the speakup driver fix and has the ack of the tty
 driver maintainer as well, i.e. myself :)
 
 All have been in linux-next with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlauWLoACgkQMUfUDdst+ynHbQCfWlGgQhtadfhtiaIKLwqy9NPG
 PksAn3/z4mXX037sfm2kZrcqtcNlv9zf
 =Vdai
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging fixes from Greg KH:
 "Here are some small staging driver fixes for 4.5-rc2.

  One of them predated 4.4-final, but I missed that merge window due to
  the holliday.  The others fix reported issues that have come up
  recently.  The tty change is needed for the speakup driver fix and has
  the ack of the tty driver maintainer as well, i.e.  myself :)

  All have been in linux-next with no reported issues"

* tag 'staging-4.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  Staging: speakup: fix read scrolled-back VT
  Staging: speakup: Fix getting port information
  Revert "Staging: panel: usleep_range is preferred over udelay"
  iio: adis_buffer: Fix out-of-bounds memory access
2016-01-31 17:00:27 -08:00
Adriana Reus c2472d0bbc iio: inv_mpu6050: Remove unused parameter
The inv_check_and_setup_chip function does not use the i2c_device_id
parameter. Therefore remove it.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 17:17:37 +00:00
Lars-Peter Clausen d590faf9e8 iio: adis_buffer: Fix out-of-bounds memory access
The SPI tx and rx buffers are both supposed to be scan_bytes amount of
bytes large and a common allocation is used to allocate both buffers. This
puts the beginning of the tx buffer scan_bytes bytes after the rx buffer.
The initialization of the tx buffer pointer is done adding scan_bytes to
the beginning of the rx buffer, but since the rx buffer is of type __be16
this will actually add two times as much and the tx buffer ends up pointing
after the allocated buffer.

Fix this by using scan_count, which is scan_bytes / 2, instead of
scan_bytes when initializing the tx buffer pointer.

Fixes: aacff892cb ("staging:iio:adis: Preallocate transfer message")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-05 17:32:04 +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
Ioana Ciornei 72a868b38b iio: imu: check sscanf return value
This patch fixes the following checkpatch warning:
WARNING: unchecked sscanf return value

Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08 15:44:10 +00: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