Commit graph

950 commits

Author SHA1 Message Date
Vladimir Petrigo bf2da97079 iio: adc: ad7780: Add parentheses to macros
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues

Slightly modified by Jonathan to take into account the staging graduation
and a copy and paste version of the same item on the following line.

Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:30 +01:00
Renato Lui Geh 9fb27f807e staging: iio: ad7780: moving ad7780 out of staging
Move ad7780 ADC driver out of staging and into the mainline.

The ad7780 is a sigma-delta analog to digital converter. This driver provides
reading voltage values and status bits from both the ad778x and ad717x series.
Its interface also allows writing on the FILTER and GAIN GPIO pins on the
ad778x.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:06 +01:00
Gregory CLEMENT e32cff6f61 iio: adc: lpc32xx: Add scale feature
Until now this driver only exposed the raw value of the channels. With
this patch, the scale value is also exposed.

It depends of a regulator supply, and unlike most of the other driver, do
not having this regulator won't prevent to use the driver. The reason for
it is to allow to continue to use this driver with an old device tree. If
there is no regulator supply then the scale won't be exposed.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:02 +01:00
Gregory CLEMENT 9f29b00c58 iio: adc: lpc32xx: Cleanup headers
A few headers is useless: remove them.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:01 +01:00
Gregory CLEMENT 163321094b iio: adc: lpc32xx: Sort headers
Sort the headers in alphabetic order in order to ease the maintenance for
this part.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:01 +01:00
Colin Ian King b34d6c835d iio: adc: ad7124 fix indentation issue, remove extra tab
A return statement is indented one level too deeply; clean this
up by removing a tab.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:59 +01:00
Enrico Weigelt, metux IT consult d626be00e8 drivers: iio: Kconfig: pedantic cleanup
Formatting of Kconfig files doesn't look so pretty, so just
take damp cloth and clean it up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:56 +01:00
Nathan Chancellor 17104ca271 iio: adc: stmpe-adc: Shuffle an if statement around in stmpe_adc_isr
When building with -Wsometimes-uninitialized, Clang warns:

drivers/iio/adc/stmpe-adc.c:204:13: warning: variable 'data' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Clang can't tell that data will never be used uninitialized because the
two if statements take care of all cases. Remove the first if statement
and make it the else branch of the second one so that it is apparent to
Clang that all cases are covered.

Link: https://github.com/ClangBuiltLinux/linux/issues/387
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: NIck Desaulniers <ndesaulniers@google.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:56 +01:00
Justin Chen c97dce792d iio: adc: ti-ads7950: add GPIO support
The ADS79XX has GPIO pins that can be used. Add support for the GPIO
pins using the GPIO chip framework.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:53 +01:00
Kangjie Lu 13814627c9 iio: adc: fix a potential NULL pointer dereference
devm_iio_trigger_alloc may fail and return NULL. The fix returns
ENOMEM when it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:53 +01:00
Sean Nyekjaer bcccd7ab3d iio: adc: ti-ads8688: Update the module author email address
Update the module author to the current email address.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:53 +01:00
Neil Armstrong e415a1659e iio: adc: meson-saradc: add support for Meson G12A
Add the SAR ADC driver for the Amlogic Meson-G12A SoC.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:51 +01:00
Bárbara Fernandes 0a39ac29e0 iio:adc:ad7923: Rewrite comparison to NULL
Solves checkpath.pl's message:

CHECK: Comparison to NULL could be written "!indio_dev"

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:46 +01:00
Bárbara Fernandes 385c301cec iio:adc:ad7923: Put macro argument between ()'s
Put macro argument between parenthesis in order to avoid precedence
issues. Solves the following checkpath.pl's messages:

CHECK: Macro argument 'mode' may be better as '(mode)' to avoid
precedence issues
CHECK: Macro argument 'channel' may be better as '(channel)' to
avoid precedence issues
CHECK: Macro argument reuse 'sequence' - possible side-effects?
CHECK: Macro argument 'sequence' may be better as '(sequence)' to
avoid precedence issues
CHECK: Macro argument 'val' may be better as '(val)' to avoid
precedence issues
CHECK: Macro argument 'dec' may be better as '(dec)' to avoid precedence
issues
CHECK: Macro argument 'bits' may be better as '(bits)' to avoid
precedence issues

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:46 +01:00
Bárbara Fernandes c1fc8bb0f6 iio:adc:ad7923: Use BIT macro instead of bitshift
Replace use of the operation '<<' by the BIT macro. Solves checkpath.pl's
message:

CHECK: Prefer using the BIT macro

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:45 +01:00
Bárbara Fernandes 66deb5c170 iio:adc:ad7923: Align broken line to parenthesis
Get broken line aligned with parenthesis on upper line. Solves
checkpatch.pl's message:

CHECK: Alignment should match open parenthesis

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:45 +01:00
Justin Chen abbde27929 iio: adc: ti-ads7950: Fix improper use of mlock
Indio->mlock is used for protecting the different iio device modes.
It is currently not being used in this way. Replace the lock with
an internal lock specifically used for protecting the SPI transfer
buffer.

Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:41 +01:00
Wei Yongjun 76838a8f29 iio: adc: ingenic: remove redundant dev_err call in ingenic_adc_probe()
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:40 +01:00
Linus Torvalds cf2e8c544c - New Drivers
- Add STMPE ADC Input driver
    - Add STMicroelectronics STPMIC1 Parent driver
    - Add STMicroelectronics STPMIC1 OnKey Misc driver
    - Add STMicroelectronics STPMIC1 Watchdog driver
    - Add Cirrus Logic Lochnagar Parent driver
    - Add TQ-Systems TQMX86 Parent driver
 
  - New Device Support
    - Add support for ADC to STMPE
 
  - New (or moved) Functionality
    - Move Lightbar functionality to its own driver; cros_ec_lightbar
    - Move VBC functionality to its own driver; cros_ec_vbc
    - Move VBC functionality to its own driver; cros_ec_vbc
    - Move DebugFS functionality to its own driver; cros_ec_debugfs
    - Move SYSFS functionality to its own driver; cros_ec_sysfs
    - Add support for input voltage options; tps65218
 
  - Fix-ups
    - Use devm_* managed resources; cros_ec
    - Device Tree documentation; stmpe, aspeed-lpc, lochnagar
    - Trivial Clean-ups; stmpe
    - Rip out broken modular code; aat2870-core, adp5520, as3711,
          db8500-prcmu, htc-i2cpld, max8925-core, rc5t583, sta2x11-mfd,
 	 syscon, tps65090, tps65910, tps68470 tps80031, wm831x-spi,
 	 wm831x-i2c, wm831x-core, wm8350-i2c, wm8350-core, wm8400-core
    - Kconfig fixups; INTEL_SOC_PMIC
    - Improve error path; sm501, sec-core
    - Use struct_size() helper; sm501
    - Constify; at91-usart
    - Use pointers instead of copying data; at91-usart
    - Deliver proper return value; cros_ec_dev
    - Trivial formatting/whitespace; sec-core
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAlyA5j4ACgkQUa+KL4f8
 d2EAyw/+N7N77ex5Ryxmyn61SWvgTL221tj+olw6RqC92Vfw6S2ZFP1CsM/E7tZb
 qCLYkkJSgBLKoOCI5OLiXsvWCPjyLU33nG/oS0SSiMJ1Fp9M0h7uRnOtOio3z31i
 w9MJAvEY3RN8I1bRGMO6aWUtT0q3AzHNtdl+7BqAkjjeXiUE0lGd5eARRS1zRWSa
 ki0OzUkJeszPk+6E6N0K+BQZxcL3cBEsR8ZAif903cMEbqsJIv4nmif4b5D63BKH
 PtOLn+6HVMG4bzqRRytVhcO/z2uj2jlLCHH9wBnyd4b7SoLFuz15yN5DhD4bKLt7
 0UMqiBlC2MeaTv3wyKjeNPQtaMY7zJNUpdFly1PHAYR4oy5kbqk2IAv30N/zRfPK
 zLmWWq7DYdazBxSSGKmpGEW63Dkr/MQY2oj4nUlcank/X0K7LvmXv7kIxp9jJhA5
 bE76f77uHneHvq5OTc5CZtaYNqZbE6tO8rqZ2QlfCqa0M8VxbcrYiym0fQFJBdsH
 eFtaTG162ssZq1npV759c4/2E3zQ3EW+rj89/AWp8ViJULQLyPY2nUYddx+w04Se
 kSdgYCvMI5byvF+Tuq/CbUWz7kyca3D+EFiYTkzIfrZr+4yiG2VO8wEO1knkEUVo
 9X/wnAD5hQJePEM8CyPZrnirndB0W6SAvSmRZlF/OAbuCBz1DkQ=
 =tUge
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Drivers:
   - Add STMPE ADC Input driver
   - Add STMicroelectronics STPMIC1 Parent driver
   - Add STMicroelectronics STPMIC1 OnKey Misc driver
   - Add STMicroelectronics STPMIC1 Watchdog driver
   - Add Cirrus Logic Lochnagar Parent driver
   - Add TQ-Systems TQMX86 Parent driver

  New Device Support:
   - Add support for ADC to STMPE

  New (or moved) Functionality:
   - Move Lightbar functionality to its own driver; cros_ec_lightbar
   - Move VBC functionality to its own driver; cros_ec_vbc
   - Move VBC functionality to its own driver; cros_ec_vbc
   - Move DebugFS functionality to its own driver; cros_ec_debugfs
   - Move SYSFS functionality to its own driver; cros_ec_sysfs
   - Add support for input voltage options; tps65218

  Fixes:
   - Use devm_* managed resources; cros_ec
   - Device Tree documentation; stmpe, aspeed-lpc, lochnagar
   - Trivial Clean-ups; stmpe
   - Rip out broken modular code; aat2870-core, adp5520, as3711,
         db8500-prcmu, htc-i2cpld, max8925-core, rc5t583, sta2x11-mfd,
	 syscon, tps65090, tps65910, tps68470 tps80031, wm831x-spi,
	 wm831x-i2c, wm831x-core, wm8350-i2c, wm8350-core, wm8400-core
   - Kconfig fixups; INTEL_SOC_PMIC
   - Improve error path; sm501, sec-core
   - Use struct_size() helper; sm501
   - Constify; at91-usart
   - Use pointers instead of copying data; at91-usart
   - Deliver proper return value; cros_ec_dev
   - Trivial formatting/whitespace; sec-core"

* tag 'mfd-next-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (53 commits)
  mfd: mxs-lradc: Mark expected switch fall-through
  mfd: sec-core: Cleanup formatting to a consistent style
  mfd: tqmx86: IO controller with I2C, Wachdog and GPIO
  mfd: intel-lpss: Move linux/pm.h to the local header
  mfd: cros_ec_dev: Return number of bytes read with CROS_EC_DEV_IOCRDMEM
  mfd: tps68470: Drop unused MODULE_DEVICE_TABLE
  mfd: at91-usart: No need to copy mfd_cell in probe
  mfd: at91-usart: Constify at91_usart_spi_subdev and at91_usart_serial_subdev
  mfd: lochnagar: Add support for the Cirrus Logic Lochnagar
  mfd: lochnagar: Add initial binding documentation
  dt-bindings: mfd: aspeed-lpc: Make parameter optional
  mfd: sec-core: Return gracefully instead of BUG() if device cannot match
  mfd: sm501: Use struct_size() in devm_kzalloc()
  mfd: sm501: Fix potential NULL pointer dereference
  mfd: Kconfig: Fix I2C_DESIGNWARE_PLATFORM dependencies
  mfd: tps65218.c: Add input voltage options
  mfd: wm8400-core: Make it explicitly non-modular
  mfd: wm8350-core: Drop unused module infrastructure from non-modular code
  mfd: wm8350-i2c: Make it explicitly non-modular
  mfd: wm831x-core: Drop unused module infrastructure from non-modular code
  ...
2019-03-08 10:02:58 -08:00
Linus Torvalds e266ca36da Staging/IIO patches for 5.1-rc1
Here is the big staging/iio driver pull request for 5.1-rc1.
 
 Lots of good IIO driver updates and cleanups in here as always.
 Combined with the removal of the xgifb driver, we have a net "loss" of
 over 9000 lines in the pull request, always a nice thing.
 
 As the outreachy application process is currently happening, there are
 loads of tiny checkpatch cleanup fixes all over the staging tree, which
 accounts for the majority of the fixups.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXH+gLQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymBiQCeJpoBhG+W3r+kP8w65ZY8qU+/liIAn0Tkl4/k
 IX1dQzCsEpO1jA8AHj6n
 =7wCH
 -----END PGP SIGNATURE-----

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

Pull staging/IIO updates from Greg KH:
 "Here is the big staging/iio driver pull request for 5.1-rc1.

  Lots of good IIO driver updates and cleanups in here as always.
  Combined with the removal of the xgifb driver, we have a net "loss" of
  over 9000 lines in the pull request, always a nice thing.

  As the outreachy application process is currently happening, there are
  loads of tiny checkpatch cleanup fixes all over the staging tree,
  which accounts for the majority of the fixups"

* tag 'staging-5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (341 commits)
  staging: mt7621-dma: remove license boilerplate text
  staging: mt7621-dma: add SPDX GPL-2.0+ license identifier
  Staging: ks7010: Replace typecast to int
  Staging: vt6655: Align a static function declaration
  staging: speakup: fix line over 80 characters.
  staging: mt7621-eth: Remove license boilerplate text
  staging: mt7621-eth: Add SPDX license identifier
  staging: ks7010: removed custom Michael MIC implementation.
  staging: rtl8192e: Fix space and suspect issue
  Staging: vt6655: Modify comment style of SPDX License Identifier
  Staging: vt6655: Modify comment style for SPDX-License-Identifier
  Staging: vt6655: Align a function declaration
  Staging: vt6655: Alignment of function declaration
  staging: rtl8712: Fix indentation issue
  staging: wilc1000: fix incorrent type in initializer
  staging: rtl8188eu: remove unused P2P_PRIVATE_IOCTL_SET_LEN
  staging: rtl8188eu: remove unused enum P2P_PROTO_WK_ID
  staging: rtl8723bs: Remove duplicated include from drv_types.h
  Staging: vt6655: Alignment should match open parenthesis
  staging: erofs: fix mis-acted TAIL merging behavior
  ...
2019-03-06 16:29:27 -08:00
Linus Torvalds e0f0ae838a iio: adc: fix warning in Qualcomm PM8xxx HK/XOADC driver
The pm8xxx_get_channel() implementation is unclear, and causes gcc to
suddenly generate odd warnings.  The trigger for the warning (at least
for me) was the entirely unrelated commit 79a4e91d1b ("device.h: Add
__cold to dev_<level> logging functions"), which apparently changes gcc
code generation in the caller function enough to cause this:

  drivers/iio/adc/qcom-pm8xxx-xoadc.c: In function ‘pm8xxx_xoadc_probe’:
  drivers/iio/adc/qcom-pm8xxx-xoadc.c:633:8: warning: ‘ch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    ret = pm8xxx_read_channel_rsv(adc, ch, AMUX_RSV4,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             &read_nomux_rsv4, true);
             ~~~~~~~~~~~~~~~~~~~~~~~
  drivers/iio/adc/qcom-pm8xxx-xoadc.c:426:27: note: ‘ch’ was declared here
    struct pm8xxx_chan_info *ch;
                             ^~

because gcc for some reason then isn't able to see that the termination
condition for the "for( )" loop in that function is also the condition
for returning NULL.

So it's not _actually_ uninitialized, but the function is admittedly
just unnecessarily oddly written.

Simplify and clarify the function, making gcc also see that it always
returns a valid initialized value.

Cc: Joe Perches <joe@perches.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andy Gross <andy.gross@linaro.org>
Cc: David Brown <david.brown@linaro.org>
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-03-06 15:41:29 -08:00
Greg Kroah-Hartman 277c8e8b81 Second set of new device support, features and cleanup for IIO in the 5.1 cycle.
There are a few late breaking fixes in here that weren't worth trying to
 rush into 5.0 as they have been with us for quite a while.
 
 New device support
 * ad7476
   - add support for TI ADS786X parts that are compatible with this Analog
     Devices driver. Good to see some simple devices are so similar.
 * Ingenic jz47xx SoC ADCs
   - new driver and bindings
 * Plantower PMS7003 partical sensor
   - new driver and bindings including vendor prefix.
 * TI DAC7612
   - new driver and bindings for this dual DAC.
 
 New features
 * ad7768-1
   - Sampling frequency control
 * bmi160
   - Data ready trigger support, including open-drain dt binding.
 
 Cleanup / minor fixes.
 * Analog Device DACs
   - Fix some inconsistent licenses.  These are only ones where there were
     two different license marked in the same file, and hence were previously
     unclear.
 * ads124s08
   - Spelling fix.
 * adxl345
   - Parameter alignement tidy up.
 * bmi160
   - SPDX
   - correct a note on the types of supported interrupts which was too strict.
   - use iio_pollfunc_store_time to grab an earlier timestamp.
   - use if (ret) instead of if (ret < 0) to be consistent whilst simplifying
     some handling where ret was effectively getting written to 0 even though
     it was always already 0.
 * exynos_adc
   - Fix a null pointer dereference on unbind.
   - Fix number of channels on Exynos4x12 devices to be 4 rather than 8.
 * lpc32xx-adc
   - Move DT bindings doc out of staging. Oops, I missed this one when
     moving the driver.
   - SPDX.
 * npcm-adc
   - drop documentation of reset node as going to be done differently.
     It's a new driver this cycle so no need to support the previous
     binding going forwards.
 * sps30
   - Fix an issue with a loop timeout test that meant it would never identify
     a timeout.
   - Mark deliberate switch fall throughs.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlxjNmgRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogooQ/9HDDuw4hrYJqH2cdUtKV29+a+kvMtrC1i
 X9+VstbMQNLo4DM3lYKi4VOeh6P5htRrD9ZJ4I2lh6PfnABjr3lb1AequlxwWNQZ
 9EHEY3BA0G33757LQEkqxl7h8Cqvo2y6Wl6OcUund0jP+h3F3EYkI4XWNcq5Yht4
 uWTkyTRYVZqFnlXGvfPz+53tEZ6p5RijbhOdYcL8R/0yWYzZzgzut7eYZn8Qn+mR
 LzSCBoEyAOUELYyRoczY2EkEO+u8H7lcU43i5TPPKji/c+w4OXu2ktuGVucXaHBs
 E1NLp0psLdqR2ef8fNYTs3FO2kxI7jV5qMlR91Sa2lDRyPhYeMF+JYBQlpqm5H2U
 xp8WwFrfT4KZ1yvioNeW+aNlPOd6ljDMg1z/iLWpAcUqx65QArmogL64m/Fc5GQD
 jrYzw68FO6fqKh3ik7VdPKIUS0p3Dz8BdWOqvI68+C/Mr/TgML51frf1NVbdd36L
 qgzMN6N53bykwN2w51O0Af4U3ZednN7BDDFkUbucutoglU+K8yRjFj583wM8QYsG
 GOZ3sPVZm+ItWCGc7nTJowe6+EQNgo/md3IEmmZNPrfWPHoMEebqnNcOuqcYvIlj
 wXgsJBNlWyQp5bqE9LmgClwAaWkXIoUvjUHt0cK5043ueLrYaGJ698sg0N/UO0JC
 T0/PJEMjLPE=
 =Se+F
 -----END PGP SIGNATURE-----

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

Jonathan writes:

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

There are a few late breaking fixes in here that weren't worth trying to
rush into 5.0 as they have been with us for quite a while.

New device support
* ad7476
  - add support for TI ADS786X parts that are compatible with this Analog
    Devices driver. Good to see some simple devices are so similar.
* Ingenic jz47xx SoC ADCs
  - new driver and bindings
* Plantower PMS7003 partical sensor
  - new driver and bindings including vendor prefix.
* TI DAC7612
  - new driver and bindings for this dual DAC.

New features
* ad7768-1
  - Sampling frequency control
* bmi160
  - Data ready trigger support, including open-drain dt binding.

Cleanup / minor fixes.
* Analog Device DACs
  - Fix some inconsistent licenses.  These are only ones where there were
    two different license marked in the same file, and hence were previously
    unclear.
* ads124s08
  - Spelling fix.
* adxl345
  - Parameter alignement tidy up.
* bmi160
  - SPDX
  - correct a note on the types of supported interrupts which was too strict.
  - use iio_pollfunc_store_time to grab an earlier timestamp.
  - use if (ret) instead of if (ret < 0) to be consistent whilst simplifying
    some handling where ret was effectively getting written to 0 even though
    it was always already 0.
* exynos_adc
  - Fix a null pointer dereference on unbind.
  - Fix number of channels on Exynos4x12 devices to be 4 rather than 8.
* lpc32xx-adc
  - Move DT bindings doc out of staging. Oops, I missed this one when
    moving the driver.
  - SPDX.
* npcm-adc
  - drop documentation of reset node as going to be done differently.
    It's a new driver this cycle so no need to support the previous
    binding going forwards.
* sps30
  - Fix an issue with a loop timeout test that meant it would never identify
    a timeout.
  - Mark deliberate switch fall throughs.

* tag 'iio-for-5.1b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (26 commits)
  iio: adc: exynos-adc: Use proper number of channels for Exynos4x12
  dt-binding: iio: remove rst node from NPCM ADC document
  dt-bindings: iio: chemical: pms7003: add device tree support
  dt-bindings: add Plantower to the vendor prefixes
  iio: chemical: add support for Plantower PMS7003 sensor
  iio:chemical:sps30 Supress some switch fallthrough warnings.
  iio:adc:lpc32xx use SPDX-License-Identifier
  dt-bindings: iio: adc: move lpc32xx-adc out of staging
  iio: adc: ads124s08: fix spelling mistake "converions" -> "conversions"
  iio: adc: exynos-adc: Fix NULL pointer exception on unbind
  iio: chemical: sps30: fix a loop timeout test
  iio:accel:adxl345: Change alignment to match paranthesis
  iio:dac:dac7612: device tree bindings
  iio:dac:ti-dac7612: Add driver for Texas Instruments DAC7612
  iio: adc: ad7476: Add support for TI ADS786X ADCs
  iio: adc: ad7768-1: Add support for setting the sampling frequency
  drivers: iio: dac: Fix wrong license for ADI drivers
  IIO: add Ingenic JZ47xx ADC driver.
  dt-bindings: iio/adc: Add bindings for Ingenic JZ47xx SoCs ADC.
  dt-bindings: iio/adc: Add docs for Ingenic JZ47xx SoCs ADC.
  ...
2019-02-13 08:24:50 +01:00
Krzysztof Kozlowski 103cda6a3b iio: adc: exynos-adc: Use proper number of channels for Exynos4x12
Exynos4212 and Exynos4412 have only four ADC channels so using
"samsung,exynos-adc-v1" compatible (for eight channels ADCv1) on them is
wrong.  Add a new compatible for Exynos4x12.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-12 20:56:00 +00:00
Greg Kroah-Hartman 3b6effbc38 Merge 5.0-rc6 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-11 09:25:01 +01:00
Gregory CLEMENT 4305834936 iio:adc:lpc32xx use SPDX-License-Identifier
Convert the driver to SPDX license description which allow removing
several lines in the file.

Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:03 +00:00
Colin Ian King fc4e0c97d1 iio: adc: ads124s08: fix spelling mistake "converions" -> "conversions"
There is a spelling mistake in several dev_err messages. Fix these.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:03 +00:00
Krzysztof Kozlowski 2ea8bab4dd iio: adc: exynos-adc: Fix NULL pointer exception on unbind
Fix NULL pointer exception on device unbind when device tree does not
contain "has-touchscreen" property.  In such case the input device is
not registered so it should not be unregistered.

    $ echo "12d10000.adc" > /sys/bus/platform/drivers/exynos-adc/unbind

    Unable to handle kernel NULL pointer dereference at virtual address 00000474
    ...
    (input_unregister_device) from [<c0772060>] (exynos_adc_remove+0x20/0x80)
    (exynos_adc_remove) from [<c0587d5c>] (platform_drv_remove+0x20/0x40)
    (platform_drv_remove) from [<c05860f0>] (device_release_driver_internal+0xdc/0x1ac)
    (device_release_driver_internal) from [<c0583ecc>] (unbind_store+0x60/0xd4)
    (unbind_store) from [<c031b89c>] (kernfs_fop_write+0x100/0x1e0)
    (kernfs_fop_write) from [<c029709c>] (__vfs_write+0x2c/0x17c)
    (__vfs_write) from [<c0297374>] (vfs_write+0xa4/0x184)
    (vfs_write) from [<c0297594>] (ksys_write+0x4c/0xac)
    (ksys_write) from [<c0101000>] (ret_fast_syscall+0x0/0x28)

Fixes: 2bb8ad9b44 ("iio: exynos-adc: add experimental touchscreen support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:03 +00:00
Ricardo Ribalda Delgado 77c5a7f5c1 iio: adc: ad7476: Add support for TI ADS786X ADCs
Add support for Texas Instruments ADS7866, ADS7867 and ADS7868
8/10/12 bit Single channel ADC.

Datasheet: http://www.ti.com/lit/ds/symlink/ads7868.pdf

Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:02 +00:00
Stefan Popa e9517dffd1 iio: adc: ad7768-1: Add support for setting the sampling frequency
The AD7768-1 core ADC receives a master clock signal (MCLK). The MCLK
frequency combined with the MCLK division and the digital filter
decimation rates, determines the sampling frequency. Along with
MCLK_DIV, the power mode is also configured according to datasheet
recommendations.

From user space, available sampling frequencies can be read. However,
it is not required for an exact value to be entered, since the driver
will look for the closest available match.

When the device configuration changes (for example, if the filter
decimation rate changes), a SYNC_IN pulse is required.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:01 +00:00
Artur Rojek 1a78daea10 IIO: add Ingenic JZ47xx ADC driver.
Add an IIO driver for the ADC hardware present on Ingenic JZ47xx SoCs.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-09 18:46:01 +00:00
Greg Kroah-Hartman 1dcc3ed4a7 First set of new device support, features and cleanup for IIO in the 5.1 cycle
A number of interesting new devices supported plus a good set of staging
 cleanup including one graduation and one drop.
 
 New device support
 * ad56886
   - Add support for AD5674R/AD5679R with some minor driver changes to support
     more channels.
 * ad7768
   - New driver and dt bindings for this 24 bit ADC.
 * max44009
   - New driver and dt bindings for this ambient light sensor.
 * mpu6050
   - Support the ICM 20602 IMU. Minor tweaks due to slightly different
     register map.
 * NPCM adc
   - New driver and dt bindings for this BMC ADC.
 * Sensiron SGP30
   - Modifiers for ethanol and H2.
   - New driver and dt bindings.
   - Follow patch added self cleaning support.
 * Sensiron SPS30
   - New channel type for mass concentration.
   - New driver and bindings.
   - Minor tidy up patch followed (drop fmt specifier as unused)
 * st_pressure
   - lps22hh support. ID plus information structures and dt bindings.
 * ti-ads124s08
   - Add binding doc and driver.
 
 Staging graduations
 * ad7606 driver and bindings.
 
 Staging drops
 * ad7152 CDC driver dropped.  This part is near EoL and no one is known
   to be using it.  If anyone surfaces obviously we can bring the driver
   back.  If not, good to drop it to avoid wasting anyone's time cleaning
   it up.
 
 New features
 * bme680
   - DT support and bindings doc.
 * isl29018
   - Add regulator for VCC.
 * mag3110
   - Add regulators for supplies.
 * meson-saradc
   - Support the temperature sensors of more SoCs.
 * mma8452
   - Add regulators for power suplies and binding docs to reflect them.
 * st-accel
   - Support the undocumented but it seems fairly common _ONT ACPI method
     to specify orientation of the sensor.
 
 Cleanup, minor fixes and fixes for staging driver that have been broken a
 long time
 * ad5933
   - Drop platform data alternative to specifying the reference voltage
     using a regulator.
   - Use the clock framework to contorl the reference clock.
   - Add a DT binding doc to cover the defacto binding.
 * ad7280a
   - Split up some big functions to improve readability.
 * ad7606
   - Allow for timeout if interrupt never occurs.
   - Use devm functions to simplify probe and remove.
   - Use the find_closest macro to avoid need for precise values from
     userspace.
   - Add missing vendor prefixes for various DT properties. Note the
     driver is in staging still and there are no known devicetrees.
   - Add explict OF device ID table.
   - Simplify the Kconfig choices
   - Change to a threaded IRQ.
   - SPDX and simple stype fixes.
 * ad7816
   - Drop unnecessary variable init.
 * ad9523
   - Check a return value that was ignored.
 * ad9833
   - Drop platform data.  It was just setting most values to the hardware
     defaults.
   - Use the clock framework to provide the input clock.
 * adt7316 (lots of staging cleanup)
   - Fix some wrong register / bit definitions
   - Invert the logic of the check for an ldac pin so it actually makes sense.
   - Read the right register to get internal vref settings
   - Allow adt751x chips to use the internal vref for all DAC channels rather
     than a subset.
   - Remove dac vref bypass control from parts that don't have one.
   - Make the store DAC update mode function consistent with the show one.
   - Fix some spellings and other minor tidy up.
   - Avoid passing irq numbers around by putting all the irq logic in
     one place.
   - Fix an issue with the resolution of DAC control.
   - Fix support of the high resolution DAC mode (for temp proportional output)
     where supported.
   - Fix DAC read and write calculations.
 * st_lsm6dsx
   - Drop an unused variable (set but not read)
 * xilinx-xadc
   - Check an unhandled return value.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlxXWXwRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogtPhAAtGoXJl9gwBywQXjykFBiN5PxBxKypq58
 El7EQY7I0P/RkIVEBHgIc9p85lREVkIZQEcQZqsO5LI63cumCGtODyJg2CAF6+oz
 EIO0GCZFvb2zLiTyPg2NSuBhsYxiLtyHfu5MGPivbDyzVKZzf8LLjwQxkHYPaLzb
 Qa9D3wigoGHuvXpC9ULGQT36kMj6XPN9JGQsCRtbUQVgPu2XOPiuLv98vEpyaCPj
 1C7D72LAEq1Z5A3rA17KpT576Yy1JGv1LkSz48xEtHlDoB2IgCkoZfx6ThTr1ehX
 eWav1NsD1IpbWKiSY19rSmjSkkbYk1WHyV+tTeTguFb6nfIA/y22kl9td8Rqjk2P
 L/O1tRHdXO8G+gtCfBhUdVmT1SQq/vkow2UBH59CllN81bsWxFEudE4VHJCBlmjr
 sgMKdb3d0aYekRis/bNQJMvT0nY2x+g2k+ey+kEnrYOZVjCx+EeNNS249CnUnFId
 ZZNGqJ2j0xK9BULqffcupCoERLIhf/9nlx5JO3n5YA5X3pdns+yzVkS/9oXpN7EK
 9A41pU9zVWYN8B21MqfN0EPG41nkY36TOuTvL2/4/U2DfAD6VIf4vEYimrkTjsU0
 n7vKqQL8DRicWDsbxP8h6u/nG0u+ZgOgY4SVzth0aT3/plCAwhWmoQpnkjVFKMBD
 HBQB0HlEg2M=
 =M03w
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of new device support, features and cleanup for IIO in the 5.1 cycle

A number of interesting new devices supported plus a good set of staging
cleanup including one graduation and one drop.

New device support
* ad56886
  - Add support for AD5674R/AD5679R with some minor driver changes to support
    more channels.
* ad7768
  - New driver and dt bindings for this 24 bit ADC.
* max44009
  - New driver and dt bindings for this ambient light sensor.
* mpu6050
  - Support the ICM 20602 IMU. Minor tweaks due to slightly different
    register map.
* NPCM adc
  - New driver and dt bindings for this BMC ADC.
* Sensiron SGP30
  - Modifiers for ethanol and H2.
  - New driver and dt bindings.
  - Follow patch added self cleaning support.
* Sensiron SPS30
  - New channel type for mass concentration.
  - New driver and bindings.
  - Minor tidy up patch followed (drop fmt specifier as unused)
* st_pressure
  - lps22hh support. ID plus information structures and dt bindings.
* ti-ads124s08
  - Add binding doc and driver.

Staging graduations
* ad7606 driver and bindings.

Staging drops
* ad7152 CDC driver dropped.  This part is near EoL and no one is known
  to be using it.  If anyone surfaces obviously we can bring the driver
  back.  If not, good to drop it to avoid wasting anyone's time cleaning
  it up.

New features
* bme680
  - DT support and bindings doc.
* isl29018
  - Add regulator for VCC.
* mag3110
  - Add regulators for supplies.
* meson-saradc
  - Support the temperature sensors of more SoCs.
* mma8452
  - Add regulators for power suplies and binding docs to reflect them.
* st-accel
  - Support the undocumented but it seems fairly common _ONT ACPI method
    to specify orientation of the sensor.

Cleanup, minor fixes and fixes for staging driver that have been broken a
long time
* ad5933
  - Drop platform data alternative to specifying the reference voltage
    using a regulator.
  - Use the clock framework to contorl the reference clock.
  - Add a DT binding doc to cover the defacto binding.
* ad7280a
  - Split up some big functions to improve readability.
* ad7606
  - Allow for timeout if interrupt never occurs.
  - Use devm functions to simplify probe and remove.
  - Use the find_closest macro to avoid need for precise values from
    userspace.
  - Add missing vendor prefixes for various DT properties. Note the
    driver is in staging still and there are no known devicetrees.
  - Add explict OF device ID table.
  - Simplify the Kconfig choices
  - Change to a threaded IRQ.
  - SPDX and simple stype fixes.
* ad7816
  - Drop unnecessary variable init.
* ad9523
  - Check a return value that was ignored.
* ad9833
  - Drop platform data.  It was just setting most values to the hardware
    defaults.
  - Use the clock framework to provide the input clock.
* adt7316 (lots of staging cleanup)
  - Fix some wrong register / bit definitions
  - Invert the logic of the check for an ldac pin so it actually makes sense.
  - Read the right register to get internal vref settings
  - Allow adt751x chips to use the internal vref for all DAC channels rather
    than a subset.
  - Remove dac vref bypass control from parts that don't have one.
  - Make the store DAC update mode function consistent with the show one.
  - Fix some spellings and other minor tidy up.
  - Avoid passing irq numbers around by putting all the irq logic in
    one place.
  - Fix an issue with the resolution of DAC control.
  - Fix support of the high resolution DAC mode (for temp proportional output)
    where supported.
  - Fix DAC read and write calculations.
* st_lsm6dsx
  - Drop an unused variable (set but not read)
* xilinx-xadc
  - Check an unhandled return value.

* tag 'iio-for-5.1a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (67 commits)
  iio: chemical: sps30: remove printk format specifier
  staging: iio: frequency: ad9833: Load clock using clock framework
  staging: iio: frequency: ad9833: Get frequency value statically
  dt-bindings: iio: light: Add max44009
  iio: light: add driver for MAX44009
  dt-bindings: iio: adc: Add docs for AD7768-1
  iio: adc: Add AD7768-1 ADC basic support
  staging: iio: cdc: ad7152: remove driver completely
  iio: imu: mpu6050: Add support for the ICM 20602 IMU
  dt-bindings: iio: imu: add icm20602 bindings to mpu6050
  dt-bindings: iio: pressure: add LPS22HH bindings
  iio: st_accel: use ACPI orientation data
  iio: adc: add NPCM ADC driver
  dt-binding: iio: add NPCM ADC documentation
  iio: chemical: sps30: allow changing self cleaning period
  dt-bindings: iio: chemical: Add bindings for bme680
  iio: chemical: bme680: Add device-tree support
  iio:st_pressure:initial lps22hh sensor support
  iio: accell: mma8452: add vdd/vddio regulator operation support
  dt-bindings: iio: accel: mma8452: add power supplies property
  ...
2019-02-04 07:06:36 +01:00
Greg Kroah-Hartman 6d923f8fe8 First set of IIO fixes for the 5.0 cycle.
Been a busy month, so these are rather later than they should have been.
 
 * atlas-ph-sensor:
   - Temperature scale didn't correspond to the ABI.
 * axp288:
   - A few different fixes around the TS-pin handling.
 * ti-ads8688
   - Not enough space in the buffer used to build the scan to allow for
     the timestamp.
 * tools - iio_generic_buffer
   - Make num_loops signed so that we really are running for ever
     rather than just a long time when we specify -1.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlxV1XIRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogHVA/7BgI+H8bsVf3JpfmCvuptBiz5XREUC3Hr
 hN5jNwdMTkH8JkBLYMaC6wCph1x118Fc4UhGFx4NwSg3RfMw6tkDPd+PDI0QY0ii
 PUuTIDVMoo7+lKDvanm2yIjdkKwp18fceJRh1peLKBVJ3tQDLD9mJIzi5Ezc9/Y6
 Nq+xAv5v5ToE020Znm9oqhuY/lbKNjlcc+RKCy9Q5uFEPDfv2KZzymC/vpuTZ59J
 PoE9LRAJoag9/DgI/bskSR3aQbU+ESwKMzCLRvx73P2wZYjfwGFR2G4hCQ3tJbhJ
 m87qsnj8TxenLl9VTFvMrYp/c6XEpVp9lugYBlM1GMQV7SHV1DMXSFnnNFm3GHb4
 OtubvXD4S/279xlC7JhhH+b6r4TDL3P8rDW1tjmIzUmvczV9rzda+SWj4ea6Ry8d
 HtUY9RMrb+w1NEOEEMEYvykVxUS8SpzUVfEJKMKm9OspqjfCpELfVaBrHtomB6//
 F6z3oiNzDQPFcqIna/xri7PquFP6zmTmT/2ky+f11sBukukW5y0X/p4laVBHcVmw
 D6Au0BmtqB4NOdFcz1zsZNlbCKp3AGveZq5lMS7JQs3VWorJSYEQIQRKrVeSXgE2
 hbgLQkai+sVaYL8HSYEf83Mc0dm3/20+PW0oc9tRPysSFYwVIodPJb/1wV0qTKW6
 olFtou+Fg/U=
 =2R0k
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of IIO fixes for the 5.0 cycle.

Been a busy month, so these are rather later than they should have been.

* atlas-ph-sensor:
  - Temperature scale didn't correspond to the ABI.
* axp288:
  - A few different fixes around the TS-pin handling.
* ti-ads8688
  - Not enough space in the buffer used to build the scan to allow for
    the timestamp.
* tools - iio_generic_buffer
  - Make num_loops signed so that we really are running for ever
    rather than just a long time when we specify -1.

* tag 'iio-fixes-5.0a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: ti-ads8688: Update buffer allocation for timestamps
  tools: iio: iio_generic_buffer: make num_loops signed
  iio: adc: axp288: Fix TS-pin handling
  iio: chemical: atlas-ph-sensor: correct IIO_TEMP values to millicelsius
2019-02-03 13:10:41 +01:00
Stefan Popa a5f8c7da3d iio: adc: Add AD7768-1 ADC basic support
The ad7768-1 is a single channel, precision 24-bit analog to digital
converter (ADC).

This basic patch configures the device in fast mode, with 32 kSPS and
leaves the default sinc5 filter.

Two data conversion modes are made available. When data is retrieved by
using the read_raw attribute, one shot single conversion mode is set.
The continuous conversion mode is enabled when the triggered buffer
mechanism is used. To assure correct data retrieval, the driver waits
for the interrupt triggered by the low to high transition of the DRDY
pin.

Datasheets:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-1.pdf

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02 10:28:56 +00:00
Lee Jones fa56a62d01 Merge branches 'ib-mfd-iio-input-5.1', 'ib-mfd-input-watchdog-5.1' and 'ib-mfd-platform-5.1' into ibs-for-mfd-merged 2019-02-01 08:20:04 +00:00
Tomer Maimon 9bf85fbc9d iio: adc: add NPCM ADC driver
Add Nuvoton NPCM BMC Analog-to-Digital Converter(ADC) driver.

The NPCM ADC is a 10-bit converter for eight channel inputs.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-19 18:58:54 +00:00
Stefan Agner 9f3d084965 iio: adc: add STMPE ADC driver using IIO framework
This adds an ADC driver for the STMPE device using the industrial
input/output interface. The driver supports raw reading of values.
The driver depends on the MFD STMPE driver. If the touchscreen
block is enabled too, only four of the 8 ADC channels are available.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2019-01-16 12:37:04 +00:00
Linus Torvalds 9deb9e1637 - New Device Support
- Add support for Power Supply to AXP813
    - Add support for GPIO, ADC, AC and Battery Power Supply to AXP803
    - Add support for UART to Exynos LPASS
 
  - Fix-ups
    - Use supplied MACROS; ti_am335x_tscadc
    - Trivial spelling/whitespace/alignment; tmio, axp20x, rave-sp
    - Regmap changes; bd9571mwv, wm5110-tables
    - Kconfig dependencies; MFD_AT91_USART
    - Supply shared data for child-devices; madera-core
    - Use new of_node_name_eq() API call; max77620, stmpe
    - Use managed resources (devm_*); tps65218
    - Comment descriptions; ingenic-tcu
    - Coding style; madera-core
 
  - Bug Fixes
    - Fix section mismatches; twl-core, db8500-prcmu
    - Correct error path related issues; mt6397-core, ab8500-core, mc13xxx-core
    - IRQ related fixes; tps6586x
    - Ensure proper initialisation sequence; qcom_rpm
    - Repair potential memory leak; cros_ec_dev
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAlwt0eMACgkQUa+KL4f8
 d2EiXBAApGil4yvMMczlCThaq9scR2e3PrwhKCWszbo+QO1QzM/0Tyo88D5sXUj5
 UxBIIU8lBC8rP9vkNkAob+UwNZZfuDB/iCEQ3PezbuXFxH6tglRMXzodtevQj4Nf
 LAfOa5OFjHZo9CgG03wqzOEqeS84CvKtOhvKZzG1iaFUExbT5HHCt1G+F4GdMoLf
 lkYNnQCk8Hv90NCwHobT6tl/hiz0ztVN//Xd94saQmrJc2SXviflAv9RxncKA8b0
 ESVgaZf+x4A+KyXzE3bUfffpZL/0rwq72yG6W7SQ8aO5QGdVjt1qYu8yMm0GFQOv
 2f7kkChnS54rFaSUFFO6PExy0Pz32/yTIu7iJrhR4R76TVFIYke2tNDJHjpYSlBf
 MPmnz4kZg7SUl9W+MGfCcGCsw8+vTeDgoQiLf+Xy6n78LNOx9AV2seYeraxC9njP
 xn3vKTX83A5RC/thmcdBFG7LE0uER2y0+S3oodBveGRHWEizZ701iKjwlZiK/51v
 MBMgjuOiu8eIlJK7hKYyv0rAAgWFoiIarOin6mTfq/cQxR3jU+U3jCenAxwcZ2VD
 9o5wE7O7zA/4z1nc3uG0o2tGoE6FH7sGot1+d4lyqaHUhYQUIyvUAl9dUnH323rO
 Bl9cCFU7pI4PQTyGHVNfJH8AHar9AQGbEfEWekC9Nl36MEY0ThE=
 =BwG/
 -----END PGP SIGNATURE-----

Merge tag 'mfd-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Device Support
   - Add support for Power Supply to AXP813
   - Add support for GPIO, ADC, AC and Battery Power Supply to AXP803
   - Add support for UART to Exynos LPASS

  Fix-ups:
   - Use supplied MACROS; ti_am335x_tscadc
   - Trivial spelling/whitespace/alignment; tmio, axp20x, rave-sp
   - Regmap changes; bd9571mwv, wm5110-tables
   - Kconfig dependencies; MFD_AT91_USART
   - Supply shared data for child-devices; madera-core
   - Use new of_node_name_eq() API call; max77620, stmpe
   - Use managed resources (devm_*); tps65218
   - Comment descriptions; ingenic-tcu
   - Coding style; madera-core

  Bug Fixes:
   - Fix section mismatches; twl-core, db8500-prcmu
   - Correct error path related issues; mt6397-core, ab8500-core, mc13xxx-core
   - IRQ related fixes; tps6586x
   - Ensure proper initialisation sequence; qcom_rpm
   - Repair potential memory leak; cros_ec_dev"

* tag 'mfd-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (25 commits)
  mfd: exynos-lpass: Enable UART module support
  mfd: mc13xxx: Fix a missing check of a register-read failure
  mfd: cros_ec: Add commands to control codec
  mfd: madera: Remove spurious semicolon in while loop
  mfd: rave-sp: Fix typo in rave_sp_checksum comment
  mfd: ingenic-tcu: Fix bit field description in header
  mfd: tps65218: Use devm_regmap_add_irq_chip and clean up error path in probe()
  mfd: Use of_node_name_eq() for node name comparisons
  mfd: cros_ec_dev: Add missing mfd_remove_devices() call in remove
  mfd: axp20x: Add supported cells for AXP803
  mfd: axp20x: Re-align MFD cell entries
  mfd: axp20x: Add AC power supply cell for AXP813
  mfd: wm5110: Add missing ASRC rate register
  mfd: qcom_rpm: write fw_version to CTRL_REG
  mfd: tps6586x: Handle interrupts on suspend
  mfd: madera: Add shared data for accessory detection
  mfd: at91-usart: Add platform dependency
  mfd: bd9571mwv: Add volatile register to make DVFS work
  mfd: ab8500-core: Return zero in get_register_interruptible()
  mfd: tmio: Typo s/use use/use/
  ...
2019-01-15 06:24:36 +12:00
Dan Murphy e717f8c6df iio: adc: Add the TI ads124s08 ADC code
Introduce the TI ADS124S08 and the ADS124S06 ADC
devices from TI.  The ADS124S08 is the 12 channel ADC
and the ADS124S06 is the 6 channel ADC device

These devices share a common datasheet:
http://www.ti.com/lit/gpn/ads124s08

Signed-off-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-12 18:42:39 +00:00
Dan Murphy f214ff521f iio: ti-ads8688: Update buffer allocation for timestamps
Per Jonathan Cameron, the buffer needs to allocate room for a
64 bit timestamp as well as the channels.  Change the buffer
to allocate this additional space.

Fixes: 2a86487786 ("iio: adc: ti-ads8688: add trigger and buffer support")
Signed-off-by: Dan Murphy <dmurphy@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-12 18:32:28 +00:00
Hans de Goede 9bcf15f75c iio: adc: axp288: Fix TS-pin handling
Prior to this commit there were 3 issues with our handling of the TS-pin:

1) There are 2 ways how the firmware can disable monitoring of the TS-pin
for designs which do not have a temperature-sensor for the battery:
a) Clearing bit 0 of the AXP20X_ADC_EN1 register
b) Setting bit 2 of the AXP288_ADC_TS_PIN_CTRL monitoring

Prior to this commit we were unconditionally setting both bits to the
value used on devices with a TS. This causes the temperature protection to
kick in on devices without a TS, such as the Jumper ezbook v2, causing
them to not charge under Linux.

This commit fixes this by using regmap_update_bits when updating these 2
registers, leaving the 2 mentioned bits alone.

The next 2 problems are related to our handling of the current-source
for the TS-pin. The current-source used for the battery temp-sensor (TS)
is shared with the GPADC. For proper fuel-gauge and charger operation the
TS current-source needs to be permanently on. But to read the GPADC we
need to temporary switch the TS current-source to ondemand, so that the
GPADC can use it, otherwise we will always read an all 0 value.

2) Problem 2 is we were writing hardcoded values to the ADC TS pin-ctrl
register, overwriting various other unrelated bits. Specifically we were
overwriting the current-source setting for the TS and GPIO0 pins, forcing
it to 80ųA independent of its original setting. On a Chuwi Vi10 tablet
this was causing us to get a too high adc value (due to a too high
current-source) resulting in the following errors being logged:

ACPI Error: AE_ERROR, Returned by Handler for [UserDefinedRegion]
ACPI Error: Method parse/execution failed \_SB.SXP1._TMP, AE_ERROR

This commit fixes this by using regmap_update_bits to change only the
relevant bits.

3) After reading the GPADC channel we were unconditionally enabling the
TS current-source even on devices where the TS-pin is not used and the
current-source thus was off before axp288_adc_read_raw call.

This commit fixes this by making axp288_adc_set_ts a nop on devices where
the ADC is not enabled for the TS-pin.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1610545
Fixes: 3091141d78 ("iio: adc: axp288: Fix the GPADC pin ...")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-12 17:09:55 +00:00
Aditya Pakki 7fc93f3285 iio: adc: xilinx: check return value of xadc_write_adc_reg
In function xadc_probe, xadc_write_adc_reg can return an error value
when write fails. The fix checks for the return value consistent with
other invocations of the latter function.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:44:02 +00:00
Martin Blumenstingl b002bf5f8d iio: adc: meson-saradc: enable the temperature sensor two more SoCs
Meson8b and Meson8m2 use the same logic to convert the ADC register
value to celsius, which is different from Meson8:
- Meson8 has different multiplier and divider values
- Meson8 uses a 4-bit TSC (temperature sensor coefficient) which fits
  into the 4-bit field in the MESON_SAR_ADC_DELTA_10 register:
  MESON_SAR_ADC_DELTA_10_TS_C_MASK. Meson8b and Meson8m2 have a 5-bit
  TSC which requires writing the upper-most bit into the
  MESON_HHI_DPLL_TOP_0[9] register from the HHI register area.

This adds support for the temperature sensor on the Meson8b and Meson8m2
SoCs by implementing the logic to write the upper-most TSC bit into the
HHI register area. The SoC-specific values (temperature_trimming_bits,
temperature_multiplier, temperature_divider) are added - these simply
integrate into the existing infrastructure (which was implemented for
Meson8) and thus require no further changes to the existing temperature
calculation logic.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:42:05 +00:00
Stefan Popa 2985a5d884 staging: iio: adc: ad7606: Move out of staging
Move ad7606 ADC driver out of staging and into the mainline.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:59 +00:00
Evan Green db23d88756 iio: adc: qcom-spmi-adc5: Initialize prescale properly
adc5_get_dt_data uses a local, prop, feeds it to adc5_get_dt_channel_data,
and then puts the result into adc->chan_props. The problem is
adc5_get_dt_channel_data may not initialize that structure fully, so a
garbage value is used for prescale if the optional "qcom,pre-scaling" is
not defined in DT. adc5_read_raw then uses this as an array index,
generating a crash that looks like this:

[    6.683186] Unable to handle kernel paging request at virtual address ffffff90e78c7964
Call trace:
qcom_vadc_scale_code_voltage_factor+0x74/0x104
qcom_vadc_scale_hw_calib_die_temp+0x20/0x60
qcom_adc5_hw_scale+0x78/0xa4
adc5_read_raw+0x3d0/0x65c
iio_channel_read+0x240/0x30c
iio_read_channel_processed+0x10c/0x150
qpnp_tm_get_temp+0xc0/0x40c
of_thermal_get_temp+0x7c/0x98
thermal_zone_get_temp+0xac/0xd8
thermal_zone_device_update+0xc0/0x38c
qpnp_tm_probe+0x624/0x81c
platform_drv_probe+0xe4/0x11c
really_probe+0x188/0x3fc
driver_probe_device+0xb8/0x188
__device_attach_driver+0x114/0x180
bus_for_each_drv+0xd8/0x118
__device_attach+0x180/0x27c
device_initial_probe+0x20/0x2c
bus_probe_device+0x78/0x124
deferred_probe_work_func+0xfc/0x138
process_one_work+0x3d8/0x8b0
process_scheduled_works+0x48/0x6c
worker_thread+0x488/0x7cc
kthread+0x24c/0x264
ret_from_fork+0x10/0x18

Unfortunately, when I went to add the initializer for this and tried to
boot it, my machine shut down immediately, complaining that it was
hotter than the sun. It appears that adc5_chans_pmic and adc5_chans_rev2
were initializing prescale_index as if it were directly a divisor,
rather than the index into adc5_prescale_ratios that it is.

Fix the uninitialized value, and change the static initialization to use
indices into adc5_prescale_ratios.

Signed-off-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-12 17:45:30 +00:00
Jonathan Bakker d1655c7f48 iio: adc: Allow selection of Exynos ADC on S5PV210
Make it possible to use Exynos ADC driver on S5PV210 based devices.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-12 17:19:32 +00:00
Jonathan Bakker 882bf52fde iio: adc: exynos-adc: Add S5PV210 variant
S5PV210's ADC variant is almost the same as v1 except that it has 10
channels and doesn't require the pmu register

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-12 17:15:05 +00:00
Vignesh R 4b3ab9372f iio: adc: ti_am335x_tscadc: Improve accuracy of measurement
When performing single ended measurements with TSCADC, its recommended
to set negative input (SEL_INM_SWC_3_0) of ADC step to ADC's VREFN in the
corresponding STEP_CONFIGx register.

Also, the positive(SEL_RFP_SWC_2_0) and negative(SEL_RFM_SWC_1_0)
reference voltage for ADC step needs to be set to VREFP and VREFN
respectively in STEP_CONFIGx register.
Without these changes, there may be variation of as much as ~2% in the
ADC's digital output which is bad for precise measurement.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2018-12-03 11:33:20 +00:00
Fabrice Gasnier 49ad8d2892 iio: adc: stm32-adc: switch off running adc when going to low power
Switch off ADC when going to low power mode, in case it has been left
running in buffer mode. Then re-enable it when resuming.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-25 13:16:38 +00:00
Fabrice Gasnier 9bdbb1139c iio: adc: stm32-adc: add power management support
Add support for runtime PM & sleep. Move all regulator and clock management
to dedicated HW start/stop routines. Then rely on (runtime) PM OPS to
call them.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-25 13:15:24 +00:00
Fabrice Gasnier 0da98c7b28 iio: adc: stm32-adc: move self-calibration to prepare routine
Move self-calibration routine to prepare routine.
- This is precursor patch to ease power management handling.
- This also allow to factorize few error cases (error handling).

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-25 13:13:40 +00:00