platform/kernel/linux-rpi.git
6 years agoiio: accel: mma8452: Fix code style warning
Harinath Nampally [Sat, 23 Sep 2017 20:56:29 +0000 (16:56 -0400)]
iio: accel: mma8452: Fix code style warning

Replace symbolic permissions with octal permissions
to improve code readability.

Issue found by checkpatch.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: cros_ec: Remove unused variable
Paolo Cretaro [Thu, 14 Sep 2017 21:19:22 +0000 (23:19 +0200)]
iio: cros_ec: Remove unused variable

Fix gcc warning:
cros_ec_baro.c:130:25: warning: variable ‘ec_device’ set but not used

Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: clean up limit checks
Dan Carpenter [Fri, 8 Sep 2017 10:53:43 +0000 (13:53 +0300)]
staging: iio: tsl2x7x: clean up limit checks

The background of this code is that we can either use the default
tables or load our own table with sysfs.  The default tables are three
element arrays of struct tsl2x7x_lux.  If we load the table with sysfs
then we can have as many as nine elements.  Which ever way we do it, the
last element is always zeroed out.

The most interesting part of this patch is in the
in_illuminance0_lux_table_show() function.  We were using the wrong
limit, "TSL2X7X_MAX_LUX_TABLE_SIZE * 3", when it should have been just
"TSL2X7X_MAX_LUX_TABLE_SIZE".  This creates a static checker warning
that we are going of bounds.  However, since the last element is
always zeroed out, that means we hit the break statement and the code
works correctly despite the wrong limit check.

I made several related readability changes.  The most notable that I
changed the MAX_DEFAULT_TABLE_BYTES define which was:

I renamed the define to TSL2X7X_DEFAULT_TABLE_BYTES because it's not the
max size, it's the only size.  Also the size should really be expressed
as sizeof(struct tsl2x7x_lux) * 3.  In other words, 12 * 3 instead of
4 * 9.  It's 36 bytes either way, so this doesn't change the behavior.

Finally, I created the TSL2X7X_DEF_LUX_TABLE_SZ define instead of using
the magic number 3.  I declared the default tables using that define
to hopefully signal to future programmers that if they want to use a
different size they have to update all the related code.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: mcp320x: Document struct mcp320x
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Document struct mcp320x

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: mcp320x: Drop unnecessary of_device_id attributes
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Drop unnecessary of_device_id attributes

The driver sets a .data pointer for each .compatible string but never
calls of_device_get_match_data().  Instead, ADC properties are looked up
with spi_get_device_id().  The .data pointer is therefore unnecessary,
so drop it.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: mcp320x: Speed up readout of single-channel ADCs
Lukas Wunner [Sat, 9 Sep 2017 18:32:41 +0000 (20:32 +0200)]
iio: adc: mcp320x: Speed up readout of single-channel ADCs

Single-channel converters such as mcp3001, mcp3201, mcp3301 and the
upcoming mcp3550/1/3 lack a MOSI pin, so there's no need to call
mcp320x_channel_to_tx_data() for them.

Moreover, instead of calling spi_read() for these converters, which
generates an spi_message and spi_transfer on the stack on every readout,
it's more efficient to use the spi_message and spi_transfer[] included
in struct mcp320x (as we do for multi-channel ADCs), but initialize the
spi_message only with the receive transfer.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: chemical: ccs811: Add support for data ready trigger
Narcisa Ana Maria Vasile [Thu, 7 Sep 2017 18:38:37 +0000 (21:38 +0300)]
iio: chemical: ccs811: Add support for data ready trigger

Add data ready trigger for hardware interrupts that signal
new, available measurement samples.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: accel: mma8452: improvements to handle multiple events
Harinath Nampally [Sat, 9 Sep 2017 19:56:58 +0000 (15:56 -0400)]
iio: accel: mma8452: improvements to handle multiple events

    This driver supports multiple devices like mma8653,
    mma8652, mma8452, mma8453 and fxls8471. Almost all
    these devices have more than one event.

    Current driver design hardcodes the event specific
    information, so only one event can be supported by this
    driver at any given time.
    Also current design doesn't have the flexibility to
    add more events.

    This patch improves by detaching the event related
    information from chip_info struct,and based on channel
    type and event direction the corresponding event
    configuration registers are picked dynamically.
    Hence both transient and freefall events can be
    handled in read/write callbacks.

    Changes are thoroughly tested on fxls8471 device on imx6UL
    Eval board using iio_event_monitor user space program.

    After this fix both Freefall and Transient events are
    handled by the driver without any conflicts.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agodrivers: misc: ti_dac7512: Remove duplicate driver
Lukas Wunner [Tue, 5 Sep 2017 09:44:00 +0000 (11:44 +0200)]
drivers: misc: ti_dac7512: Remove duplicate driver

The Texas Instruments DAC7512 has the exact same pinout, programming
interface and power-down modes as the Texas Instruments DAC121S101 and
Analog Devices AD5320, which are already supported by the IIO driver
ad5446.c.  Remove the duplicate misc driver.

This requires user space to migrate to the standardized IIO sysfs ABI.
(In other words, it needs to change a filename.)

The IIO driver supports the chip's features more fully, e.g. the ability
to power down the output or choose one of the available powerdown modes.

There is an oddity with the misc driver in that it initializes the SPI
slave to SPI_MODE_0, in contradiction to the datasheet which specifies
that data is latched in on the falling edge, implying that SPI_MODE_1
or SPI_MODE_2 must be used.  Another oddity is that Kconfig and the
MODULE_DESCRIPTION() claim the chip has 16-bit resolution although it
actually has 12-bit.

Datasheets:
http://www.ti.com/lit/ds/symlink/dac7512.pdf
http://www.ti.com/lit/ds/symlink/dac121s101.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5320.pdf

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Daniel Mack <daniel@zonque.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: dac: ad5446: Add IDs of compatible Texas Instruments chips
Lukas Wunner [Tue, 5 Sep 2017 09:44:00 +0000 (11:44 +0200)]
iio: dac: ad5446: Add IDs of compatible Texas Instruments chips

The Texas Instruments DAC081S101, DAC101S101 and DAC121S101 have the
exact same pinout, programming interface and power-down modes as the
AD5300, AD5310 and AD5320, respectively, and their datasheets declare
them "a direct replacement" for the Analog Devices chips.  This may
not be immediately obvious to a casual observer, so add them to the
supported modalias strings.

Datasheets:
http://www.ti.com/lit/ds/symlink/dac081s101.pdf
http://www.ti.com/lit/ds/symlink/dac101s101.pdf
http://www.ti.com/lit/ds/symlink/dac121s101.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5300.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5310.pdf
http://www.analog.com/media/en/technical-documentation/data-sheets/AD5320.pdf

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agodt-bindings: iio: pressure: add LPS33HW and LPS35HW device bindings
Lorenzo Bianconi [Sat, 2 Sep 2017 17:39:15 +0000 (19:39 +0200)]
dt-bindings: iio: pressure: add LPS33HW and LPS35HW device bindings

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: pressure: add support to LPS33HW and LPS35HW
Lorenzo Bianconi [Sat, 2 Sep 2017 17:39:14 +0000 (19:39 +0200)]
iio: pressure: add support to LPS33HW and LPS35HW

add support to STMicroelectronics LPS33HW and LPS35HW pressure sensors
to st_pressure framework

http://www.st.com/resource/en/datasheet/lps33hw.pdf
http://www.st.com/resource/en/datasheet/lps35hw.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: inv_mpu6050: make arrays hz and d static
Colin Ian King [Wed, 30 Aug 2017 11:16:16 +0000 (12:16 +0100)]
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>
6 years agoiio: adc: ti-ads1015: add 10% to conversion wait time
Ladislav Michl [Fri, 25 Aug 2017 05:39:16 +0000 (07:39 +0200)]
iio: adc: ti-ads1015: add 10% to conversion wait time

As user's guide "ADS1015EVM, ADS1115EVM, ADS1015EVM-PDK, ADS1115EVM-PDK
User Guide (Rev. B)" (http://www.ti.com/lit/ug/sbau157b/sbau157b.pdf)
states at page 16:
"Note that both the ADS1115 and ADS1015 have internal clocks with a ±10%
accuracy. If performing FFT tests, frequencies may appear to be incorrect
as a result of this tolerance range.", add those 10% to converion wait
time.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: write config register only on change
Ladislav Michl [Thu, 24 Aug 2017 08:25:51 +0000 (10:25 +0200)]
iio: adc: ti-ads1015: write config register only on change

There is no point writing ADS1015_CFG_REG when configuration
didn't change. Avoid that.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: imu: inv_mpu6050: fix missing break in switch
Gustavo A. R. Silva [Tue, 22 Aug 2017 19:13:25 +0000 (14:13 -0500)]
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>
6 years agoiio: multiplexer: add NULL check on devm_kzalloc() and devm_kmemdup() return values
Gustavo A. R. Silva [Fri, 7 Jul 2017 04:53:11 +0000 (23:53 -0500)]
iio: multiplexer: add NULL check on devm_kzalloc() and devm_kmemdup() return values

Check return values from call to devm_kzalloc() and devm_kmemup()
in order to prevent a NULL pointer dereference.

This issue was detected using Coccinelle and the following semantic patch:

@@
expression x;
identifier fld;
@@

* x = devm_kzalloc(...);
   ... when != x == NULL
   x->fld

Fixes: 7ba9df54b091 ("iio: multiplexer: new iio category and iio-mux driver")
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: tcs3472: support out-of-threshold events
Akinobu Mita [Mon, 26 Jun 2017 15:44:55 +0000 (00:44 +0900)]
iio: light: tcs3472: support out-of-threshold events

The TCS3472 device provides interrupt signal for out-of-threshold events
with persistence filter.

This change adds interrupt support for the threshold events and enables
to configure the period of time by persistence filter.

Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging: iio: tsl2x7x: constify i2c_device_id
Arvind Yadav [Mon, 21 Aug 2017 16:43:51 +0000 (22:13 +0530)]
staging: iio: tsl2x7x: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:docs: drop setting of THIS_MODULE from staging docs.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:27 +0000 (17:26 +0100)]
staging:iio:docs: drop setting of THIS_MODULE from staging docs.

These docs need to be cleaned up properly, but for now lets drop
this entry as it is definitely no longer true.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agostaging:iio:docs: drop reference to setting trig_ops->owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:26 +0000 (17:26 +0100)]
staging:iio:docs: drop reference to setting trig_ops->owner

Whilst these docs have lots of other flaws, this element is definitely
no longer true.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:potentiometer:max5487: Drop explicit setting of module owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:25 +0000 (17:26 +0100)]
iio:potentiometer:max5487: Drop explicit setting of module owner

The SPI core has handled this for some time.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:potentiometer:max5481 drop explicit setting of the owner module.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:24 +0000 (17:26 +0100)]
iio:potentiometer:max5481 drop explicit setting of the owner module.

This has been handled by the spi core for some time.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:adc:ti-ads8688: Drop manual setting of the driver owner field.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:23 +0000 (17:26 +0100)]
iio:adc:ti-ads8688: Drop manual setting of the driver owner field.

This has been handled by the spi core for some time now.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio:adc:max9611: Drop explicit setting of the i2c module owner.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:22 +0000 (17:26 +0100)]
iio:adc:max9611: Drop explicit setting of the i2c module owner.

This has been handled by the i2c core for some time.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio: drop iio_info.driver_module and iio_trigger_ops.owner.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:21 +0000 (17:26 +0100)]
iio: drop iio_info.driver_module and iio_trigger_ops.owner.

The equivalents are now assigned automatically in the relevant
registration calls and so are not needed in these operations
structures.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio: multiplexer: drop the manual assignment of THIS_MODULE
Jonathan Cameron [Sun, 3 Sep 2017 17:08:10 +0000 (18:08 +0100)]
iio: multiplexer: drop the manual assignment of THIS_MODULE

This is now done through some macro magic by the core.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Peter Rosin <peda@axentia.se>
6 years agoplatform/x86: toshiba_acpi: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:20 +0000 (17:26 +0100)]
platform/x86: toshiba_acpi: drop assignment of iio_info.driver_module

This is now handled by use of a macro for device registration.  The field
in iio_info will be going away shortly as it is no longer used.

Cc: <platform-driver-x86@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Azael Avalos <coproscefalo@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoinput: tsc2007 - drop the driver_module assignment in iio interface.
Jonathan Cameron [Sun, 23 Jul 2017 16:26:19 +0000 (17:26 +0100)]
input: tsc2007 - drop the driver_module assignment in iio interface.

This is now handled via some macro magic during the register.  The
field in iio_info will be removed shortly.

Cc: Linux Input <linux-input@vger.kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agostaging:iio:light:tsl2x7x drop assignment of driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:18 +0000 (17:26 +0100)]
staging:iio:light:tsl2x7x drop assignment of driver_module

The equivalent is now done via macro magic in the register call.

Note this is the only case not found by the coccinelle script
suggesting that perhaps that script needs to be a little more
clever!

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agostaging:trigger: drop assignment of iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:17 +0000 (17:26 +0100)]
staging:trigger: drop assignment of iio_trigger_ops.owner

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agoiio:resolver: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:16 +0000 (17:26 +0100)]
iio:resolver: drop assignment of iio_info.driver_module

The equivalent is now done via macro magic when
the relevant register call is 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>
6 years agostaging:iio:meter: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:15 +0000 (17:26 +0100)]
staging:iio:meter: 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>
6 years agostaging:iio:ad5933: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:14 +0000 (17:26 +0100)]
staging:iio:ad5933: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agostaging:iio:gyro:adis16060 drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:13 +0000 (17:26 +0100)]
staging:iio:gyro:adis16060 drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agostaging:iio:frequency: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:12 +0000 (17:26 +0100)]
staging:iio:frequency: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agostaging:iio:cdc: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:11 +0000 (17:26 +0100)]
staging:iio:cdc: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agostaging:iio:adc: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:10 +0000 (17:26 +0100)]
staging:iio:adc: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is made.  The actual structure
element will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agostaging:iio:accel: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:09 +0000 (17:26 +0100)]
staging:iio:accel: drop assignment of iio_info.driver_module

The equivalent this is now done via macro magic when
the relevant register call is 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>
6 years agoiio:triggers: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:08 +0000 (17:26 +0100)]
iio:triggers: 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.

Note that stm32-timer-trigger has expanded rather beyond triggers
(to include encoder input counting for example) and hence has an
iio_info structure.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:temperature: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:07 +0000 (17:26 +0100)]
iio:temperature: drop assignment of iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agoiio:proximity: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:06 +0000 (17:26 +0100)]
iio:proximity: 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>
6 years agoiio:pressure: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:05 +0000 (17:26 +0100)]
iio:pressure: 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>
6 years agoiio:potentiostat:lmp91000 drop assign iio_info.driver_module and iio_trigger_ops...
Jonathan Cameron [Sun, 23 Jul 2017 16:26:04 +0000 (17:26 +0100)]
iio:potentiostat:lmp91000 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>
6 years agoiio:dpot: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:03 +0000 (17:26 +0100)]
iio:dpot: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agoiio:orientation: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:26:02 +0000 (17:26 +0100)]
iio:orientation: drop assign iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is 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>
6 years agoiio:magnetometer: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:01 +0000 (17:26 +0100)]
iio:magnetometer: 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>
6 years agoiio:light: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:26:00 +0000 (17:26 +0100)]
iio:light: 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>
6 years agoiio:imu: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:59 +0000 (17:25 +0100)]
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>
6 years agoiio:humidity: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:58 +0000 (17:25 +0100)]
iio:humidity: 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>
6 years agoiio:health: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:57 +0000 (17:25 +0100)]
iio:health: 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>
6 years agoiio:gyro: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:56 +0000 (17:25 +0100)]
iio:gyro: 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>
6 years agoiio:frequency: drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:25:55 +0000 (17:25 +0100)]
iio:frequency: drop assign iio_info.driver_module

The equivalent is now done via macro magic when
the relevant register call is made.  The actual structure
element will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:dummy: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:25:54 +0000 (17:25 +0100)]
iio:dummy: drop assignment of iio_info.driver_module

The equivalent is now done via macro magic when
the relevant register call is made.  The actual structure
element will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:dac: drop assignment of iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:25:53 +0000 (17:25 +0100)]
iio:dac: drop assignment of iio_info.driver_module

The equivalent of this is now done via macro magic when
the relevant register call is made.  The actual structure
element will shortly go away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:counter:104-quad-8 drop assign iio_info.driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:25:52 +0000 (17:25 +0100)]
iio:counter:104-quad-8 drop assign iio_info.driver_module

The equivalent is 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>
6 years agoiio:common: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:51 +0000 (17:25 +0100)]
iio:common: 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.

Clearly this set jumps across multiple areas, but inherently it
can't be grouped like the other sets in this series so I've done
all the stuff in the common directory together.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio:chemical: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:50 +0000 (17:25 +0100)]
iio:chemical: 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>
6 years agoiio:amplifiers:ad8366 drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:49 +0000 (17:25 +0100)]
iio:amplifiers:ad8366 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>
6 years agoiio:accel: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:48 +0000 (17:25 +0100)]
iio:accel: 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>
6 years agoiio:adc: drop assign iio_info.driver_module and iio_trigger_ops.owner
Jonathan Cameron [Sun, 23 Jul 2017 16:25:47 +0000 (17:25 +0100)]
iio:adc: 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>
6 years agoiio:trigger: Remove necessity to have a trig->ops structure.
Jonathan Cameron [Sun, 23 Jul 2017 16:25:45 +0000 (17:25 +0100)]
iio:trigger: Remove necessity to have a trig->ops structure.

There are a few cases where none of the callbacks are supplied and the
ops structure purely existed to provide the driver module.

Given that is done differently now, we don't need to have a trig_ops structure.
Allow for it not being there required a few additional sanity checks when
trying check if particular callbacks are set.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio: triggers: Use macros to avoid boilerplate assignment of owner.
Jonathan Cameron [Sun, 23 Jul 2017 16:25:44 +0000 (17:25 +0100)]
iio: triggers: Use macros to avoid boilerplate assignment of owner.

This trig_ops.owner assignment occurs in all trigger drivers and
can be simply automated using a macro as has been done in many
other places in the kernel.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agoiio: Use macro magic to avoid manual assign of driver_module
Jonathan Cameron [Sun, 23 Jul 2017 16:25:43 +0000 (17:25 +0100)]
iio: Use macro magic to avoid manual assign of driver_module

Starting point in boiler plate reduction similar to that done for
many similar cases elsewhere in the kernel.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
6 years agostaging: rtlwifi: Reviewers fixes
Larry Finger [Thu, 17 Aug 2017 17:46:52 +0000 (12:46 -0500)]
staging: rtlwifi: Reviewers fixes

This commit adds the TODO file and implements some reviewers comments
made against some patches to the wireless tree.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add Makefiles and Kconfig for new driver
Larry Finger [Thu, 17 Aug 2017 17:46:51 +0000 (12:46 -0500)]
staging: r8822be: Add Makefiles and Kconfig for new driver

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit enables building of the new driver. For this version, all
routines are built into a single module r8822be. When this driver is
moved to the wireless tree, halmac, phydm, and rtl8822be will become
new modules.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add the driver code
Ping-Ke Shih [Thu, 17 Aug 2017 17:46:50 +0000 (12:46 -0500)]
staging: r8822be: Add the driver code

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit adds the code for the new r8822be driver.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add phydm mini driver
Ping-Ke Shih [Thu, 17 Aug 2017 17:46:49 +0000 (12:46 -0500)]
staging: r8822be: Add phydm mini driver

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

New Realtek wireless devices have a new method for PHY control and
dynamic management. The RTL8822BE is the first of these devices, thus
there is additional code required.

In the final version, this code will be a separate module; however,
it is combined with the r8822be driver to minimize the interference
with the drivers in the wireless tree.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add code for halmac sub-driver
Ping-Ke Shih [Thu, 17 Aug 2017 17:46:48 +0000 (12:46 -0500)]
staging: r8822be: Add code for halmac sub-driver

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

New Realtek devices implement a common sub-driver to control the MAC
layer. The RTL8822BE is the first of these devices, thus its introduction
involves some extra code. In the wireless tree, this will be a separate
module; however, it is compiled into the 8822be driver here.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add r8822be btcoexist routines to staging
Ping-Ke Shih [Thu, 17 Aug 2017 17:46:47 +0000 (12:46 -0500)]
staging: r8822be: Add r8822be btcoexist routines to staging

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit adds the routines needed for BT coexistence with the
new driver.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Copy existing btcoexist code into staging
Larry Finger [Thu, 17 Aug 2017 17:46:46 +0000 (12:46 -0500)]
staging: r8822be: Copy existing btcoexist code into staging

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit copies the existing routines from .../rtlwifi/btcoexist/
into staging. There are no changes other than removing all EXPORT
statements, and the fixing of checkpatch messages. The latter will
be backported to the wireless tree.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ping-Ke Shih <pkshih@realtek.com>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver
Ping-Ke Shih [Thu, 17 Aug 2017 17:46:45 +0000 (12:46 -0500)]
staging: r8822be: Add existing rtlwifi and rtl_pci parts for new driver

The RTL8822BE, an 802.11ac wireless network card, is now appearing in
new computers. Its driver is being placed in staging to reduce the time
that users of this new card will have access to in-kernel drivers.

This commit copies the code that currently constitutes the rtlwifi and
rtl_pci mini drivers. This material is copied into staging to prevent
any undo interaction between the existing drivers and this new one.
The only changes in this code are the removal of all export statements,
and the fixing of some checkpatch messages. The latter will be backported
into the wireless tree.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Yan-Hsuan Chuang <yhchuang@realtek.com>
Cc: Birming Chiu <birming@realtek.com>
Cc: Shaofu <shaofu@realtek.com>
Cc: Steven Ting <steventing@realtek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wlan-ng: hfa384x_usb: Fix multiple line dereference
Alex Briskin [Fri, 18 Aug 2017 12:27:35 +0000 (15:27 +0300)]
staging: wlan-ng: hfa384x_usb: Fix multiple line dereference

Refactor code to be more readable and eliminate the checkpatch
warning

Signed-off-by: Alex Briskin <br.shurik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: greybus: vibrator.c: Fixed alignment to match open parenthesis.
Srishti Sharma [Sat, 19 Aug 2017 08:42:50 +0000 (14:12 +0530)]
Staging: greybus: vibrator.c: Fixed alignment to match open parenthesis.

Fixed alignment so that it matched open parenthesis

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: greybus: make device_type const
Bhumika Goyal [Sat, 19 Aug 2017 08:22:25 +0000 (13:52 +0530)]
staging: greybus: make device_type const

Make this const as it is only stored in the type field of a device
structure, which is const.
Done using Coccinelle.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging/rts5208: fix incorrect shift to extract upper nybble
Colin Ian King [Fri, 18 Aug 2017 13:34:16 +0000 (14:34 +0100)]
staging/rts5208: fix incorrect shift to extract upper nybble

The mask of sns_key_info1 suggests the upper nybble is being extracted
however the following shift of 8 bits is too large and always results in
0.  Fix this by shifting only by 4 bits to correctly get the upper nybble.

Detected by CoverityScan, CID#142891 ("Operands don't affect result")

Fixes: fa590c222fba ("staging: rts5208: add support for rts5208 and rts5288")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: pi433: fixed coding style issues
Xiangyang Zhang [Fri, 18 Aug 2017 03:27:40 +0000 (11:27 +0800)]
staging: pi433: fixed coding style issues

space required before the open parenthesis, open brace should be
on previous line.

Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging:rtl8188eu: fix coding style issue
Jamie Huang [Fri, 18 Aug 2017 00:49:45 +0000 (08:49 +0800)]
staging:rtl8188eu: fix coding style issue

checkpatch.pl gave
ERROR: open brace '{' following function definitions go on the next line.

Signed-off-by: Jamie Huang <jamienstar@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: lustre: lustre: Off by two in lmv_fid2path()
Dan Carpenter [Fri, 28 Jul 2017 14:42:27 +0000 (17:42 +0300)]
staging: lustre: lustre: Off by two in lmv_fid2path()

We want to concatonate join string one, a '/' character, string two and
then a NUL terminator.  The destination buffer holds ori_gf->gf_pathlen
characters.  The strlen() function returns the number of characters not
counting the NUL terminator.  So we should be adding two extra spaces,
one for the foward slash and one for the NUL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: frank zago <fzago@cray.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoMerge tag 'iio-for-4.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Sun, 20 Aug 2017 17:42:42 +0000 (10:42 -0700)]
Merge tag 'iio-for-4.14b' of git://git./linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of IIO new device support, features and cleanup for the 4.14 cycle.

New device support:
* ak8974
  - support the AMI306.
* st_magnetometer
  - add support for the LIS2MDL with bindings.
* rockchip-saradc
  - add binding for rv1108 SoC (no driver change).
* srf08
  - add srf02 (i2c only) and srf10 support.
* stm32-timer
  - support for the STM32H7 to existing driver.

Features:
* tools
  - move over to the tools buildsystem rather than hand rolling.
  - add an install section to the build.
* ak8974
  - use serial number to add device randomness.
  - add AMI306 calibration data output.
* ccs811
  - triggered buffer support.
* srf08
  - add a device tree table as the old style i2c probing is going away,
  - add triggered buffer support
* st32-adc
  - add optional st,min-sample-time-nsecs binding to allow control of
    sampling against analog circuitry.
* stm32-timer
  - add output compare triggers.
* ti-ads1015
  - add threshold event support.
* ti-ads7950
  - Allow use on ACPI platforms including providing a default reference
    voltage as there is no way to obtain this on ACPI currently.

Cleanup and fixes:
* ad7606
  - fix an error return code in probe.
* ads1015
  - fix incorrect data rate setting update when capture in progress,
  - fix wrong scale information for the ADS1115,
  - make conversions work when CONFIG_PM is not set,
  - make sure we don't get a stale result after a runtime resume by
    ensuring we wait long enough,
  - avoid returning a false error form the buffer setup callbacks,
  - add enough wait time to get the correct conversion,
  - remove an unnecessary config register update,
  - add a helper to set conversion mode reducing repeated boilerplate,
  - use devm_iio_triggered_buffer_setup to simplify error and remove
    paths,
  - use iio_device_claim_direct_mode instead of opencoding the same.
* ak8974
  - mark the INT_CLEAR register as precious to prevent debugfs access.
* apds9300
  - constify the i2c_device_id.
* at91-sama5 adc
  - add missing Kconfig dependency.
* bma180 accel
  - constify the i2c_device_id.
* rockchip_saradc
  - explicitly request exclusive reset control as part of the reset rework
    on going throughout the kernel.
* st_accel
  - fix drdy configuration for a load of accelerometers that only have
    the int1 line.  Fix is unimportant as presumably no deviec tree actually
    used the non existent hardware line.
* st_pressure
  - fix drdy configuration for LPS22HB and LPS25H by dropping int2 support
    as they don't have this. Fix is unimportant as presumably no device tree
    actually used the non existent hardware line.
* stm32-dac
  - explicitly request exclusive reset control (part of reset being reworked).
* tsl2583
  - constify the i2c_device_id.
* xadc
  - coding style fixes.

6 years agoiio: adc: rockchip_saradc: explicitly request exclusive reset control
Philipp Zabel [Wed, 19 Jul 2017 15:25:35 +0000 (17:25 +0200)]
iio: adc: rockchip_saradc: explicitly request exclusive reset control

Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.

No functional changes.

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: Heiko Stuebner <heiko@sntech.de>
Cc: linux-iio@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: dac: stm32-dac-core: explicitly request exclusive reset control
Philipp Zabel [Wed, 19 Jul 2017 15:25:36 +0000 (17:25 +0200)]
iio: dac: stm32-dac-core: explicitly request exclusive reset control

Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.

No functional changes.

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: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: add threshold event support
Akinobu Mita [Thu, 20 Jul 2017 15:24:27 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: add threshold event support

The ADS1015 device provides programmable comparator that can issue an
interrupt on the ALERT pin.  This change adds the iio threshold event
support for that feature.

The ADS1015 device only have a single config register which contains an
input multiplexer selection, comparator settings, and etc.  So only a
single event channel can be enabled at a time.  Also enabling both buffer
and event are prohibited for simplicity.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: use iio_device_claim_direct_mode()
Akinobu Mita [Thu, 20 Jul 2017 15:24:26 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: use iio_device_claim_direct_mode()

While the iio buffer for the ti-ads1015 driver is enabled, reading the
raw ADC channel data is restricted.  We usually use the
iio_device_claim_direct_mode()/iio_device_release_direct_mode() pair for
that.

This change consequently reverses the locking order for the driver's
private lock and indio_dev->mlock which acquired by
iio_device_claim_direct_mode() internally. But it's safe because there is
no other dependency between these locks.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: use devm_iio_triggered_buffer_setup
Akinobu Mita [Thu, 20 Jul 2017 15:24:25 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: use devm_iio_triggered_buffer_setup

Use devm_iio_triggered_buffer_setup to simplify the error path in the
probe() and remove() function.

This changes the remove order, but the end result of remove function
actually does the reverse of probe.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: add helper to set conversion mode
Akinobu Mita [Thu, 20 Jul 2017 15:24:24 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: add helper to set conversion mode

This adds a helper function to set conversion mode as there are a fair
number of users.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: remove unnecessary config register update
Akinobu Mita [Thu, 20 Jul 2017 15:24:23 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: remove unnecessary config register update

The ti-ads1015 driver has eight iio voltage channels and each iio channel
can hold own scale information.

The ADS1015 device only have a single config register which contains an
input multiplexer selection, PGA and data rate settings.  So the driver
should load the correct settings when the input multiplexer selection is
changed.

However, regardless of which channlel is currently selected, changing any
iio channel's scale information immediately overwrites the current PGA
setting in the config register.

It is harmless because the correct PGA settings are reloaded just before
getting adc result anyway.  But it is unnecessary register update and
should be removed.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: add adequate wait time to get correct conversion
Akinobu Mita [Thu, 20 Jul 2017 15:24:22 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: add adequate wait time to get correct conversion

This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously.  So this driver
inserts a wait time before reading the conversion register if the
configuration is changed from a previous request.

Currently, the wait time is only the period required for a single
conversion that is calculated as the reciprocal of the sampling frequency.
However we also need to wait for the the previous conversion to complete.
Otherwise we probably get the conversion result for the previous
configuration when the sampling frequency is lower.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: don't return invalid value from buffer setup callbacks
Akinobu Mita [Thu, 20 Jul 2017 15:24:21 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: don't return invalid value from buffer setup callbacks

pm_runtime_get_sync() and pm_runtime_put_autosuspend() return 0 on
success, 1 if the device's runtime PM status was already requested status
or error code on failure.  So a positive return value doesn't indicate an
error condition.

However, any non-zero return values from buffer preenable and postdisable
callbacks are recognized as an error and this driver reuses the return
value from pm_runtime_get_sync() and pm_runtime_put_autosuspend() in
these callbacks.  This change fixes the false error detections.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: avoid getting stale result after runtime resume
Akinobu Mita [Thu, 20 Jul 2017 15:24:20 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: avoid getting stale result after runtime resume

This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously.  So this driver
doesn't insert a wait time before reading the conversion register if the
configuration is not changed from a previous request.

This assumption is broken if the device is runtime suspended and entered
a power-down state.  The forthcoming request causes reading a stale result
from the conversion register as the device is runtime resumed just before.

Fix it by adding a flag to detect that condition and insert a necessary
wait time.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: enable conversion when CONFIG_PM is not set
Akinobu Mita [Thu, 20 Jul 2017 15:24:19 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: enable conversion when CONFIG_PM is not set

The ADS1015 device have two operating modes, continuous conversion mode
and single-shot mode.  This driver assumes that the continuous conversion
mode is selected by runtime resume callback when the ADC result is
requested.

If CONFIG_PM is disabled, the device is always in the default single-shot
mode and no one begins a single conversion.  So the conversion register
doesn't contain valid ADC result.  Fix it by changing the continuous mode
in probe function.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: fix scale information for ADS1115
Akinobu Mita [Thu, 20 Jul 2017 15:24:18 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: fix scale information for ADS1115

The ti-ads1015 driver supports ADS1015 and ADS1115 devices.  The same
scale information is used for both devices in this driver, however they
have actually different values and the ADS1115's one is not correct.

These devices have the same full-scale input voltage range for each PGA
selection.  So instead of adding another hardcoded scale information,
compute a correct scale on demand from each device's resolution.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads1015: fix incorrect data rate setting update
Akinobu Mita [Thu, 20 Jul 2017 15:24:17 +0000 (00:24 +0900)]
iio: adc: ti-ads1015: fix incorrect data rate setting update

The ti-ads1015 driver has eight iio voltage channels and each iio channel
can hold own sampling frequency information.

The ADS1015 device only have a single config register which contains an
input multiplexer selection, PGA and data rate settings.  So the driver
should load the correct settings when the input multiplexer selection is
changed.

However, regardless of which channlel is currently selected, changing any
iio channel's sampling frequency information immediately overwrites the
current data rate setting in the config register.

It breaks the current data rate setting if the different channel's sampling
frequency information is changed because the data rate setting is not
reloaded when the input multiplexer is switched.

This removes the unexpected config register update and correctly load the
data rate setting before getting adc result.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: adc: ti-ads7950: Allow to use on ACPI platforms
Andy Shevchenko [Fri, 28 Jul 2017 22:20:14 +0000 (01:20 +0300)]
iio: adc: ti-ads7950: Allow to use on ACPI platforms

ACPI enabled platforms do not have a mean of regulators. Instead we use
hard coded voltage value for reference pin. When value is 0 (default) we
fall back to request a regulator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: magnetometer: ak8974: debug AMI306 calibration data
Michał Mirosław [Thu, 17 Aug 2017 13:56:12 +0000 (15:56 +0200)]
iio: magnetometer: ak8974: debug AMI306 calibration data

Use AMI306 calibration data for randomness and debugging.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: magnetometer: ak8974: mark INT_CLEAR as precious
Michał Mirosław [Thu, 17 Aug 2017 13:56:11 +0000 (15:56 +0200)]
iio: magnetometer: ak8974: mark INT_CLEAR as precious

Reading INT_CLEAR has side effects - disallow reading it via debugfs.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: magnetometer: ak8974: add_device_randomness (serial number)
Michał Mirosław [Thu, 17 Aug 2017 13:56:11 +0000 (15:56 +0200)]
iio: magnetometer: ak8974: add_device_randomness (serial number)

Mix device-specific data into randomness pool.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: magnetometer: ak8974: support AMI306 variant
Michał Mirosław [Thu, 17 Aug 2017 13:56:10 +0000 (15:56 +0200)]
iio: magnetometer: ak8974: support AMI306 variant

Add support for AMI306 magnetometer - very similar to AMI305.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: tsl2583: constify i2c_device_id
Arvind Yadav [Sat, 19 Aug 2017 18:47:38 +0000 (00:17 +0530)]
iio: light: tsl2583: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
6 years agoiio: light: apds9300: constify i2c_device_id
Arvind Yadav [Sat, 19 Aug 2017 18:47:37 +0000 (00:17 +0530)]
iio: light: apds9300: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>