Commit Graph

707487 Commits

Author SHA1 Message Date
Kees Cook 96bc1f2ae0 staging: rtl8192e: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: Suniel Mahesh <suniel.spartan@gmail.com>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: devel@driverdev.osuosl.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: Suniel Mahesh <suniel.spartan@gmail.com>
Cc: Malcolm Priestley <tvboxspy@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: Georgiana Rodica Chelu <georgiana.chelu93@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:44:39 +02:00
Kees Cook d2e5af14fc staging: rtl8192u: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Derek Robson <robsonde@gmail.com>
Cc: simran singhal <singhalsimran0@gmail.com>
Cc: Riccardo Marotti <riccardo.marotti@gmail.com>
Cc: Fabrizio Perria <fabrizio.perria@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Baoyou Xie <baoyou.xie@linaro.org>
Cc: Tuomo Rinne <tuomo.rinne@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:44:39 +02:00
Gustavo A. R. Silva fd5b9b83d8 staging: rtl8188eu: usb_ops_linux: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077613
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:43:35 +02:00
Gustavo A. R. Silva 40f0745bb3 staging: rtl8188eu: usb_halinit: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1373894
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:43:35 +02:00
Jia-Ju Bai f3691e0042 rtl8188eu: Fix a possible sleep-in-atomic bug in _rtw_pwr_wakeup
The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_disassociate(acquire the spinlock)
  _rtw_pwr_wakeup
    usleep_range --> may sleep

To fix it, usleep_range is replaced with udelay.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:43:35 +02:00
Jia-Ju Bai 2bf9806d42 rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_createbss_cmd
The driver may sleep under a spinlock, and the function call path is:
rtw_surveydone_event_callback(acquire the spinlock)
  rtw_createbss_cmd
    kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:43:35 +02:00
Jia-Ju Bai 08880f8e08 rtl8188eu: Fix a possible sleep-in-atomic bug in rtw_disassoc_cmd
The driver may sleep under a spinlock, and the function call path is:
rtw_set_802_11_bssid(acquire the spinlock)
  rtw_disassoc_cmd
    kzalloc(GFP_KERNEL) --> may sleep

To fix it, GFP_KERNEL is replaced with GFP_ATOMIC.
This bug is found by my static analysis tool and my code review.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:43:35 +02:00
Aastha Gupta cf2bfebcc3 staging: rtl8188eu: add spaces around algebric and boolean operators
This patch fixes checkpatch.pl warnings about preferring spaces around
algebric and boolean operators.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:40:56 +02:00
Aastha Gupta 0443936b9b staging: rtl8188eu: fix spaces before tabs
This patch fixes checkpatch.pl warning:
WARNING: please, no space before tabs

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:39:53 +02:00
Aastha Gupta 1f8b98943b staging: rtl8188eu: fix space between function name and '('
This patch fixes checkpatch.pl warning:
WARNING: space prohibited between function name and open parenthesis '('

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:38:51 +02:00
Aastha Gupta f6cadc1bb9 staging: rtl8188eu: fix block comment styling in rtl8188eu files
This patch fixes checkpatch.pl warnings for block comment styling.
1. Block comment use a trailing */ on a separate line.
2. Block comment use * on subsequent lines.
3. Block comment should align * on each line.

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:35:59 +02:00
Aastha Gupta 0bb73711b7 staging: lustre: fix comparisons should place the constant on the right side
This patch fixes checkpatch.pl warning:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:34:46 +02:00
Aastha Gupta 8b66d8eb32 staging: lustre: fix incorrect multi-line comment style
This patch fixes the checkpatch.pl warning:

WARNING: block comments use a trailing */ on a separate line

Signed-off-by: Aastha Gupta <aastha.gupta4104@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:34:41 +02:00
Frank A. Cancio Bello bb1960bbcf staging: rtlwifi: rtl8822be: Align the * in block comment
Align the * on each line of a block comment to comply with kernel coding
style and address the following checkpatch message:
'WARNING: Block comments should align the * on each line'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Frank A. Cancio Bello d8f36e803a staging: rtlwifi: rtl8822be: Remove useless parentheses
Remove unnecessary parentheses to comply with preferred coding style for
the linux kernel and avoid the following checkpatch's message:
'CHECK: Unnecessary parentheses around'.

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Frank A. Cancio Bello 778fbddd31 staging: rtlwifi: rtl8822be: Use __func__ instead of hardcoded name
Switch hardcoded function name with a reference to __func__ making
the code more maintenable and addressing the checkpatch warning:

WARNING: Prefer using '"%s...", __func__' to using 'rtl8822be_sc_mapping', this function's name, in a string
+                                       "rtl8822be_sc_mapping: Not Correct Primary40MHz Setting\n");

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Frank A. Cancio Bello 85d007756f staging: rtlwifi: rtl8822be: Balance braces in else statement
Add braces to else statements to comply with section 3) of  'Linux
kernel coding style' and avoid the following checkpatch message:
'CHECK: Unbalanced braces around else statement'

Credits to checkpatch.

Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Larry Finger 43d15c2013 staging: rtl8822be: Keep array subscript no lower than zero
The kbuild test robot reports the following:
   drivers/staging//rtlwifi/phydm/phydm_dig.c: In function 'odm_pause_dig':
   drivers/staging//rtlwifi/phydm/phydm_dig.c:494:45: warning: array subscript is below array bounds [-Warray-bounds]
      odm_write_dig(dm, dig_tab->pause_dig_value[max_level]);

This condition is caused when a loop falls through. The fix is to pin
max_level to be >= 0.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
c: kbuild test robot <fengguang.wu@intel.com>
Fixes: 9ce99b04b5 staging: r8822be: Add phydm mini driver
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Suniel Mahesh 78cd0ddc67 staging: ccree: fix boolreturn.cocci warning
This fixes the following coccinelle warning:
WARNING: return of 0/1 in function 'ssi_is_hw_key' with return type bool.

return "false" instead of 0.

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Suniel Mahesh 8fc9772543 staging: ccree: Fix bool comparison
Comparision operator "equal to" not required on a variable
"foo" of type "bool". Bool has only two values, can be used
directly or with logical not.

This fixes the following coccinelle warning:
WARNING: Comparison of bool to 0/1

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Rishabh Hardas 37ba0e399c staging/ccree: Declare compiled out functions static inline
Sparse was giving out a warning for symbols
'cc_set_ree_fips_status' and 'fips_handler'
that they were not declared and need to be
made static. This patch makes both the symbols
static inline, to remove the warnings.

Signed-off-by: Rishabh Hardas <rishabhhardas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Kees Cook b7749656e9 staging: rtl8188eu: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Juliana Rodrigues <juliana.orod@gmail.com>
Cc: Ivan Safonov <insafonov@gmail.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Cc: sayli karnik <karniksayli1995@gmail.com>
Cc: Yamanappagouda Patil <goudapatilk@gmail.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Victor Carvajal <carva005@gmail.com>
Cc: Sebastian Haas <sehaas@deebas.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Gustavo A. R. Silva c8454682c7 staging: lustre: rpc: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077604
Addresses-Coverity-ID: 1077605
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:15 +02:00
Gustavo A. R. Silva d227bd400c staging: lustre: ptlrpc: 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 <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva e2c3238769 staging: lustre: osc: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1077598
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva be7a34f4ed staging: lustre: ldlm: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva 6efc6b8a60 staging: lustre: lprocfs: mark expected switch fall-throughs
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1271166
Addresses-Coverity-ID: 1271167
Addresses-Coverity-ID: 1271168
Addresses-Coverity-ID: 1271169
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva 207f6b61bf staging: lustre: llite: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva f85dff843c staging: lustre: lnet: selftest: 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 <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:11 +02:00
Gustavo A. R. Silva 7a6d76a9b4 staging: lustre: lnet: selftest: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:10 +02:00
Gustavo A. R. Silva 503764ec26 staging: lustre: lnet: net_fault: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:10 +02:00
Gustavo A. R. Silva 96aff92b31 staging: lustre: lnet: socklnd: mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-18 15:33:10 +02:00
Greg Kroah-Hartman c9a934b069 Second set of IIO new device support, features and cleanup for 4.15
New device support
 * cros_ec_accel_legacy
   - New driver for this older chromebook accelerometer.
 * ds4422 dac driver
   - New driver and bindings for the Maxim ds4422 and ds4424 I2C DACs.
 * kxcjk1013
   - Support the KXTF9 accelerometers.
 * mcp320x
   - support mcp3550, mcp3551, mcp3553 21 bit ADCs.
 * rfd77402
   - new driver for this laser range finder.
 * st-sensors-accel
   - add support for the LIS2DW12 accelerometer with bindings
   - add support for the LIS3DHH accelerometer with bindings
 
 New features
 * core
   - Drop a duplicate forward declaration in iio.h
 * Docs
   - add a clarification of the meaning of IIO_DISTANCE to reflect
     existing use in various range finding devices.
 * st-sensors
   - add a register mask for the status register to correctly support
     2 channel devices.
   - decouple the irq1 and irq2 configuration parameters.
   - do not always write the enable_axis register as some newer devices
     are always on and don't support such configuration.
   - split open-drain control for irq1 and irq2
   - make sampling frequency control optional as non all hardware
     supports it.
 * st-sensors-gyro
   - support 3 wire SPI mode
 * st-sensors-magn
   - support 3 wire SPI mode
 * st-sensors-pressure
   - support 3 wire SPI mode.
 
 Cleanups and fixes
 * ad7192
   - expand the buffer lock to cover device state protection rather than
     using core mlock to provide the state protection.
 * ade7753
   - expand the buffer lock to cover device state protection as well
     rather than having an additional lock.
 * dummy-evgen
   - Use the new irq_sim infrastructure rather than having our
     own local version of the same thing.
 * hid-sensor-trigger
   - avoid touching sensors ever if user hasn't requested it.  This
     is a work around for one reported issue where turning a sensor
     off wasn't sufficient to make it actually switch off.  As we
     have only one report from what looks like buggy hardware we
     are sending this upstream the slow way.
 * ina2xx
   - Adhere to the published ABI docs and use Ohms instead of
     microohms.  We don't think that anyone will notice this ABI fix
     but are sending it the slow route to reduce fallout if someone
     does!
 * kxcjk1013 - refactors to support the KXTF9 being added.
   - Refactor ODR support.
   - Fix INT_CTRL/INT_SRC1 bit names to match the register name.
   - Extract code for reporting motion events as this isn't present
     on some parts to be supported.
   - Make the sysfs sampling_frequency_available stuff not a fixed
     string so as to allow for it to be chip type dependent.
   - Make the sampling frequency_available per type to match
     the sampling_frequency attributes.
 * lsm6dsx - rework prior to new device support.
   - express the max fifo depth in 'scans' rather than bytes.
   - split control of the fifo mode fifo output data rate.
   - move decimator registers into the sensor_settings structure
     as this will make it easier to support devices that don't have
     this function.
   - add a fifo ops datastructure to allow for inter-part variations.
 * max30100
   - fix i2c chip address in dt example
 * max30102
   - use correct binding name for max30102 in example
 * mma8452
   - Rename read/write event value callbacks to be more generic
     reflecting what they actually do now.
 * rcar-gyroadc
   - pointer case to fix warnings when moving to 64 bit as this IP is
     present on new 64 bit SOCs
   - enable compile-testing to improve build coverage on this driver.
   - use the of_device_get_match_data helper instead of open coding
 * sun4i-gpadc-iio
   - Register in the thermal framework after pm. Otherwise the IP is not
     enabled.
   - Don't fail probing if no thermal DT node is present.
 * tsl2x7x
   - renaming tsl2x7x_settings to settings to avoid excessive line
     lengths.
   - Use IIO core to generate the integration_time sysfs attributes
     rather than hand rolling.
 * vf6180
   - Move the range check on integration time to the setter function.
   - Refactor the code around integration time to be clearer including
     caching current integration time avoiding unnecessary chip reads.
   - cleanup the als_gain lookup avoiding reading registers on chip.
   - use rounded matching rather than precise values for als_gain
     lookup.
   - Correct the ALS  scale when non-default gain or integration time
     is used.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlnjRVkRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoifyBAAnbTAYPeu1ofyl5FQG4uTyLVQpd7F26tj
 SnZXEdi6FZ00m70Da/GDHvEe/ZZwvmaegYzmghJb+c/BAMzcspflMJxiclTRXeVL
 Q9hh6dG97cbEhjtSR+cQVQJtHUN16vFYbkPIZq5gLi2tk0rweS4GwZkN873uf0kE
 FMbOZCl1cOUS55TNg3rt8ucaVEHRkehQPXdrC53o+IckoE/7TyHbewAVyPJfT5u8
 zvA2sXnRZIePg6ONrXwheiIN4jCPPIfjhEDt34r2VeCMsdz1RdDWaZVBEgMC00P/
 GIChztLO5ISPeeGJrB7Huf5FTYTF+VK9kOCvYxP98KTOu9a/6oVFdNw9a9J8bRWR
 PJog+xQlMXKc+ojaqZrkCjS3cIaRgcYD9au3UVMsXEi3/PgFGp5EH0w6iOrMT6z6
 FcS9WDCdtys2qa1m2n3nG8eYXih7G2nWT74M3euTQqmJeudYXvjbe+IZlqMvuHaG
 1AptNw3sBOXI4DTbTt3KuGnyF3yKhnZzZW63g/55hoG67w1JodgKeMgZrXRhMXaG
 lrUP878noH8NIWwaUwwPwbewjljaOrd5B1bZXPbkr2bwATdnzXfIZVuqHobQi77b
 bbOoeWkmC6v9Np+UfWuQJ4SdN37NDpbfScIPYwY16TdsE3yghr67nLQRd25IIyGO
 0oRc/bk0Y9s=
 =ru5b
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.15b' 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 cleanup for 4.15

New device support
* cros_ec_accel_legacy
  - New driver for this older chromebook accelerometer.
* ds4422 dac driver
  - New driver and bindings for the Maxim ds4422 and ds4424 I2C DACs.
* kxcjk1013
  - Support the KXTF9 accelerometers.
* mcp320x
  - support mcp3550, mcp3551, mcp3553 21 bit ADCs.
* rfd77402
  - new driver for this laser range finder.
* st-sensors-accel
  - add support for the LIS2DW12 accelerometer with bindings
  - add support for the LIS3DHH accelerometer with bindings

New features
* core
  - Drop a duplicate forward declaration in iio.h
* Docs
  - add a clarification of the meaning of IIO_DISTANCE to reflect
    existing use in various range finding devices.
* st-sensors
  - add a register mask for the status register to correctly support
    2 channel devices.
  - decouple the irq1 and irq2 configuration parameters.
  - do not always write the enable_axis register as some newer devices
    are always on and don't support such configuration.
  - split open-drain control for irq1 and irq2
  - make sampling frequency control optional as non all hardware
    supports it.
* st-sensors-gyro
  - support 3 wire SPI mode
* st-sensors-magn
  - support 3 wire SPI mode
* st-sensors-pressure
  - support 3 wire SPI mode.

Cleanups and fixes
* ad7192
  - expand the buffer lock to cover device state protection rather than
    using core mlock to provide the state protection.
* ade7753
  - expand the buffer lock to cover device state protection as well
    rather than having an additional lock.
* dummy-evgen
  - Use the new irq_sim infrastructure rather than having our
    own local version of the same thing.
* hid-sensor-trigger
  - avoid touching sensors ever if user hasn't requested it.  This
    is a work around for one reported issue where turning a sensor
    off wasn't sufficient to make it actually switch off.  As we
    have only one report from what looks like buggy hardware we
    are sending this upstream the slow way.
* ina2xx
  - Adhere to the published ABI docs and use Ohms instead of
    microohms.  We don't think that anyone will notice this ABI fix
    but are sending it the slow route to reduce fallout if someone
    does!
* kxcjk1013 - refactors to support the KXTF9 being added.
  - Refactor ODR support.
  - Fix INT_CTRL/INT_SRC1 bit names to match the register name.
  - Extract code for reporting motion events as this isn't present
    on some parts to be supported.
  - Make the sysfs sampling_frequency_available stuff not a fixed
    string so as to allow for it to be chip type dependent.
  - Make the sampling frequency_available per type to match
    the sampling_frequency attributes.
* lsm6dsx - rework prior to new device support.
  - express the max fifo depth in 'scans' rather than bytes.
  - split control of the fifo mode fifo output data rate.
  - move decimator registers into the sensor_settings structure
    as this will make it easier to support devices that don't have
    this function.
  - add a fifo ops datastructure to allow for inter-part variations.
* max30100
  - fix i2c chip address in dt example
* max30102
  - use correct binding name for max30102 in example
* mma8452
  - Rename read/write event value callbacks to be more generic
    reflecting what they actually do now.
* rcar-gyroadc
  - pointer case to fix warnings when moving to 64 bit as this IP is
    present on new 64 bit SOCs
  - enable compile-testing to improve build coverage on this driver.
  - use the of_device_get_match_data helper instead of open coding
* sun4i-gpadc-iio
  - Register in the thermal framework after pm. Otherwise the IP is not
    enabled.
  - Don't fail probing if no thermal DT node is present.
* tsl2x7x
  - renaming tsl2x7x_settings to settings to avoid excessive line
    lengths.
  - Use IIO core to generate the integration_time sysfs attributes
    rather than hand rolling.
* vf6180
  - Move the range check on integration time to the setter function.
  - Refactor the code around integration time to be clearer including
    caching current integration time avoiding unnecessary chip reads.
  - cleanup the als_gain lookup avoiding reading registers on chip.
  - use rounded matching rather than precise values for als_gain
    lookup.
  - Correct the ALS  scale when non-default gain or integration time
    is used.
2017-10-15 15:46:32 +02:00
Gwendal Grignou 11b86c7004 platform/chrome: Add cros_ec_accel_legacy driver
Add driver to support older EC firmware that only support deprecated
ec command. Rely on ACPI memory map register to access sensor
information.
Present same interface as the regular cros_ec sensor stack:
- one iio device per accelerometer
- use HTML5 axis definition
- use iio abi units
- accept calibration calls, but do nothing
Chrome can use the same code than regular cros_ec sensor stack to
calculate orientation and lid angle.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 20:34:01 +01:00
Srinivas Pandruvada ad7532cefd iio: hid-sensor-trigger: Don't touch sensors unless user space requests
One of the user complained that on his system Thinkpad Yoga S1, with
commit f1664eaace ("iio: hid-sensor-trigger: Fix the race with user
space powering up sensors") causes the system to resume immediately
on suspend (S3 operation). On this system the sensor hub is on USB
and is a wake up device from S3. So if any sensor sends data on
motion, the system will wake up. This can be a legitimate use case
to wake up device motion, but that needs proper user space support
to set right thresholds.

In fact the above commit didn't cause this regression, but any operation
which cause sensors to wake up would have caused the same issue. So if
user reads the raw sensor data, same issue occurs, with or without this
commit. Only difference is that the above commit by default will trigger
a power up and power down of sensors as part of runtime pm enable
(runtime enable will cause a runtime resume callback followed by
runtime_suspend callback). Previously user has to do some action on
sensors.

On investigation it was observed that the current driver correctly
changing the state of all sensors to power off but then also some sensor
will still send some data. Only option is to never power up any sensor.

Only good option is to:
- Using sysfs interface disable USB as a wakeup device (This will not
need any driver change)

Since some user don't care about sensors. So for those users this change
brings back old functionality. As long as they don't cause any operation
to power up sensors (like raw read or start iio-sensor-proxy service),
the sensors will not be to touched. This is done by delaying run time
enable till user space does some operation with sensors.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=196853
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 19:29:50 +01:00
Peter Meerwald-Stadler 446b3217a9 dt-bindings: iio: health: Use binding name for max30102 in example
Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 19:24:12 +01:00
Peter Meerwald-Stadler 6d39a6cc38 dt-bindings: iio: health: Fix max30100 I2C chip address in example
Should be in hex, not decimal or even octal

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 19:22:31 +01:00
Lukas Wunner e0005bd93a iio: Drop duplicate forward declaration
Commit 5f420b4207 ("staging:iio: Add extended IIO channel info") added
a forward declaration for struct iio_dev to <linux/iio/iio.h> but forgot
to remove an existing forward declaration further down originating from
commit 7ae8cf6275 ("staging: iio: chrdev.h rationalization").

Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 18:29:20 +01:00
Peter Meerwald-Stadler 79e6418866 iio: proximity: Add rfd77402 driver
Driver for RF Digital RFD77402 VCSEL (vertical-cavity surface-emitting
laser) Time-of-Flight (ToF) sensor to measure distance up to 2 m with
millimeter precision

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 18:28:51 +01:00
Peter Meerwald-Stadler d35d43d783 Documentation: iio: Clarify meaning of IIO_DISTANCE channel type
IIO_DISTANCE is used for two purposes: for pedometers to record the
distance covered by a walker, and to measure the distance to an object

IIO_DISTANCE is in meters while IIO_PROXIMITY is a unitless measure
indirectly proportional to distance (higher value relates to a closer
object)

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-14 18:19:09 +01:00
Lorenzo Bianconi 3888ffd0c7 dt-bindings: iio: accel: add LIS3DHH 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>
2017-10-10 20:41:20 +01:00
Lorenzo Bianconi fea4d48661 iio: accel: add support to LIS3DHH
add support to STMicroelectronics LIS3DHH accel sensor

http://www.st.com/resource/en/datasheet/lis3dhh.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:40:54 +01:00
Lorenzo Bianconi 7d24517267 iio: common: st_sensors: check odr address value in st_sensors_set_odr()
Do not try to configure sample frequency if the sensor do not export
odr register address in register map. That change will be used to
properly support LIS3DHH accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:39:28 +01:00
Lorenzo Bianconi a542f9a04d iio: st_sensors: split open-drain parameters for irq1 and irq2
Define st_sensor_int_drdy structure in st_sensor_data_ready_irq in order
to contain irq line parameters of the device.
Moreover separate data-ready open-drain configuration parameters for INT1
and INT2 pins in st_sensor_data_ready_irq data structure.
That change will be used to properly support LIS3DHH accel sensor.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:38:39 +01:00
Lorenzo Bianconi 6f66700461 iio: pressure: st_pressure: add SPI-3wire support to st_pressure framework
Add SPI Serial Interface Mode (SIM) register information
to STM pressure framework

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:37:20 +01:00
Lorenzo Bianconi 9915c19056 iio: magnetometer: st_magn: add SPI-3wire support to LIS3MDL
Add SPI Serial Interface Mode (SIM) register information to
LIS3MDL magn sensor

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:36:33 +01:00
Lorenzo Bianconi 281dbadb5f iio: gyro: st_gyro: add SPI-3wire support to st_gyro framework
Add SPI Serial Interface Mode (SIM) register information
to STM gyroscope framework

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-10 20:32:28 +01:00
Lorenzo Bianconi 7886082dfb dt-bindings: iio: accel: add LIS2DW12 sensor device binding
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 22:00:56 +01:00
Lorenzo Bianconi f94124f9fb iio: accel: add support to LIS2DW12
add support to STMicroelectronics LIS2DW12 accelerometer in
st_accel framework

http://www.st.com/resource/en/datasheet/lis2dw12.pdf

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 21:59:48 +01:00
Lorenzo Bianconi 2e8325f489 iio: st_sensors: do not always write enable_axis register
New devices (e.g. LIS2DW12) enable all axis by default and do not export
that capability in register map. Check if the enable_axis register
address has been declared in st_sensor_settings map in order to verify if
the driver needs to enable all sensor axis

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09 21:58:47 +01:00