Commit graph

1520 commits

Author SHA1 Message Date
Alexandru Tachici
1a913270e5 iio: adc: ad7793: Fix IRQ flag
In Sigma-Delta devices the SDO line is also used as an interrupt.
Leaving IRQ on level instead of falling might trigger a sample read
when the IRQ is enabled, as the SDO line is already low. Not sure
if SDO line will always immediately go high in ad_sd_buffer_postenable
before the IRQ is enabled.

Also the datasheet seem to explicitly say the falling edge of the SDO
should be used as an interrupt:
>From the AD7793 datasheet: " The DOUT/RDY falling edge can be
used as an interrupt to a processor"

Fixes: da4d3d6bb9 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags")
Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210906065630.16325-4-alexandru.tachici@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:12 +01:00
Alexandru Tachici
e081102f30 iio: adc: ad7780: Fix IRQ flag
Correct IRQ flag here is falling.

In Sigma-Delta devices the SDO line is also used as an interrupt.
Leaving IRQ on level instead of falling might trigger a sample read
when the IRQ is enabled, as the SDO line is already low. Not sure
if SDO line will always immediately go high in ad_sd_buffer_postenable
before the IRQ is enabled.

Also the datasheet seem to explicitly say the falling edge of the SDO
should be used as an interrupt:
>From the AD7780 datasheet: " The DOUT/Figure 22 RDY falling edge
can be used as an interrupt to a processor"

Fixes: da4d3d6bb9 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags")
Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210906065630.16325-3-alexandru.tachici@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:12 +01:00
Alexandru Tachici
89a86da5cb iio: adc: ad7192: Add IRQ flag
IRQ type in ad_sigma_delta_info struct was missing.

In Sigma-Delta devices the SDO line is also used as an interrupt.
Leaving IRQ on level instead of falling might trigger a sample read
when the IRQ is enabled, as the SDO line is already low. Not sure
if SDO line will always immediately go high in ad_sd_buffer_postenable
before the IRQ is enabled.

Also the datasheet seem to explicitly say the falling edge of the SDO
should be used as an interrupt:
>From the AD7192 datasheet: "The DOUT/RDY falling edge can be used
as an interrupt to a processor,"

Fixes: da4d3d6bb9 ("iio: adc: ad-sigma-delta: Allow custom IRQ flags")
Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210906065630.16325-2-alexandru.tachici@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:11 +01:00
Billy Tsai
eb795cd973 iio: adc: aspeed: set driver data when adc probe.
Fix the issue when adc remove will get the null driver data.

Fixed: commit 573803234e ("iio: Aspeed ADC")
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20210831071458.2334-2-billy_tsai@aspeedtech.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:11 +01:00
Yang Yingliang
fa002b3649 iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
Add clk_disable_unprepare() on error path in rzg2l_adc_pm_runtime_resume().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210819132416.175644-1-yangyingliang@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:11 +01:00
Miquel Raynal
f0cb5fed37 iio: adc: max1027: Fix the number of max1X31 channels
The macro MAX1X29_CHANNELS() already calls MAX1X27_CHANNELS().
Calling MAX1X27_CHANNELS() before MAX1X29_CHANNELS() in the definition
of MAX1X31_CHANNELS() declares the first 8 channels twice. So drop this
extra call from the MAX1X31 channels list definition.

Fixes: 7af5257d84 ("iio: adc: max1027: Prepare the introduction of different resolutions")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210818111139.330636-3-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:10 +01:00
Miquel Raynal
732ae19ee8 iio: adc: max1027: Fix wrong shift with 12-bit devices
10-bit devices must shift the value twice.
This is not needed anymore on 12-bit devices.

Fixes: ae47d009b5 ("iio: adc: max1027: Introduce 12-bit devices support")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210818111139.330636-2-miquel.raynal@bootlin.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:10 +01:00
Christophe JAILLET
bbcf40816b iio: adc128s052: Fix the error handling path of 'adc128_probe()'
A successful 'regulator_enable()' call should be balanced by a
corresponding 'regulator_disable()' call in the error handling path of the
probe, as already done in the remove function.

Update the error handling path accordingly.

Fixes: 913b864686 ("iio: adc: Add TI ADC128S052")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/85189f1cfcf6f5f7b42d8730966f2a074b07b5f5.1629542160.git.christophe.jaillet@wanadoo.fr
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:10 +01:00
Colin Ian King
9909a395e9 iio: adc: rzg2l_adc: Fix -EBUSY timeout error return
Currently when a timeout occurs in rzg2l_adc_hw_init the error -EBUSY is
assigned to ret but the error code is used as the function is hard-coded
to return 0.  The variable ret is 0 before entering the while-loop hence
the fix is just to return ret at the end of the function to return the
success 0 or -EBUSY return code.

Addresses-Coverity: ("Unused value")
Fixes: d484c21bac ("iio: adc: Add driver for Renesas RZ/G2L A/D converter")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20210817172111.495897-1-colin.king@canonical.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-09-14 12:02:09 +01:00
Linus Torvalds
ebf435d3b5 IIO / Staging driver update for 5.15-rc1
Here is the big set of staging and IIO driver updates for 5.15-rc1.
 Also included in here are the counter driver subsystem updates as the
 IIO drivers needed them.
 
 Lots of churn in some staging drivers, we dropped the "old" rtl8188eu
 driver and replaced it with a newer version of the driver that had been
 maintained out-of-tree by Larry with the end goal of actually being able
 to get this driver out of staging eventually.  Despite that driver being
 "newer" the line count of this pull request is going up.
 
 Some drivers moved out of staging as well, which is always nice to see,
 that is why there are additions to the mfc and misc driver subsystems.
 All of these were acked by the various subsystem maintainers involved.
 
 But by far, as normal, it's coding style cleanups all over the
 drivers/staging/ tree in here.
 
 Full details of these changes are in the shortlog.
 
 All of these have been in linux-next for a while with no reported
 problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYS+BKg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yku5gCgyMykJ2mwtEiQxfAWu13e2iZX29AAnjk38ANp
 Un2sQXYnL9RVlcnjLg+X
 =jMWL
 -----END PGP SIGNATURE-----

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

Pull IIO and staging driver updates from Greg KH:
 "Here is the big set of staging and IIO driver updates for 5.15-rc1.
  Also included in here are the counter driver subsystem updates as the
  IIO drivers needed them.

  Lots of churn in some staging drivers, we dropped the "old" rtl8188eu
  driver and replaced it with a newer version of the driver that had
  been maintained out-of-tree by Larry with the end goal of actually
  being able to get this driver out of staging eventually. Despite that
  driver being "newer" the line count of this pull request is going up.

  Some drivers moved out of staging as well, which is always nice to
  see, that is why there are additions to the mfc and misc driver
  subsystems. All of these were acked by the various subsystem
  maintainers involved.

  But by far, as normal, it's coding style cleanups all over the
  drivers/staging/ tree in here.

  Full details of these changes are in the shortlog.

  All of these have been in linux-next for a while with no reported
  problems"

[ Note: the r8188eu merge clashed with commit 89939e8906 ("staging:
  rtlwifi: use siocdevprivate") from the networking tree. When resolving
  the issue, I noted that the whole r8188eu rtw_android code is dead
  since commit ae7471cae0 ("staging: r8188eu: remove rtw_ioctl
  function").

  End result: the merge resolution was to throw all of that away,
  rather than do the mindless fixup to code that isn't actually
  reachable                                               - Linus ]

* tag 'staging-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (551 commits)
  staging: vt6655: Remove filenames in files
  staging: r8188eu: add extra TODO entries
  staging: vt6656: Remove filenames in files
  staging: wlan-ng: fix invalid assignment warning
  staging: r8188eu: rename fields of struct rtl_ps
  staging: r8188eu: remove ODM_DynamicPrimaryCCA_DupRTS()
  staging: r8188eu: rename fields of struct dyn_primary_cca
  staging: r8188eu: rename struct field Wifi_Error_Status
  staging: r8188eu: Provide a TODO file for this driver
  staging: r8188eu: remove unneeded variable
  staging: r8188eu: remove unneeded conversions to bool
  staging: r8188eu: remove {read,write}_macreg
  staging: r8188eu: core: remove condition with no effect
  staging: r8188eu: remove ethernet.h header file
  staging: r8188eu: remove ip.h header file
  staging: r8188eu: remove if_ether.h header file
  staging: r8188eu: make rtw_deinit_intf_priv return void
  staging: r8188eu: use is_multicast_ether_addr in os_dep/recv_linux.c
  staging: r8188eu: use is_multicast_ether_addr in hal/rtl8188eu_xmit.c
  staging: r8188eu: use is_multicast_ether_addr in core/rtw_xmit.c
  ...
2021-09-01 09:45:57 -07:00
Linus Torvalds
4520dcbe0d power supply and reset changes for the v5.15 series
battery/charger related changes:
  - cros-peripheral-charger: new driver
  - mt6360-charger: new driver
  - simple-battery: support reading chemistry info
  - max17042-battery: add max77849 support
  - sbs-battery: add time_to_empty_now support
  - smb347-charger: prepare USB OTG support
  - rn5t618: add voltage_now support
  - axp288: cleanup & optimizations
  - max17042_battery: cleanups
  - ab8500: cleanups
  - misc minor cleanups and DT binding fixes
 
 reset related changes:
  - tps65086-restart: new driver
  - linkstation-poweroff: support NETGEAR ReadyNAS Duo v2
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmEmUVwACgkQ2O7X88g7
 +poFbA//XimqwjO0MR7xqmm2905l78L3L1cNn7vRPzfdPbcf/kKPg8Jrx8kTn1EK
 wKdbP4ZQJOIyCLIFcI6oURUaNHh485KXj4DFvT13AsbkPw+2xUv0Ha5p8J698QAG
 RPmkTNHk+0M/K+/Z7/GPb6t0B7uQi3cg7/aIZeFo26FYpIP5XekoxP1xoLfE9lO2
 aSrSbDh8oIjOLFPc4nuzm0x4Bcg/MpbUG1nhTBdP8OD8xjuMSmDUnbEvLgQYv4oP
 9PLbi4jxm0VSfFhdECCSZ+x7CO0+wqxLXWCoOGlzDQ1Y2OYp9nG+Xgsj46HGh38c
 11WER/16J7AfzUg1zqfu7NKDOKWad+TsTvQgXVK4GAxDOxpOS8Hz7GuP0/nnZBLx
 PoDAb7ZBtb6QXJDEvCDWoo+yMcZRaULbefQCgR/ys6bWoL+B6wdowxfV/daFGpmx
 fAMDGoSGrmYJhbPkcfAVJrN196zd5EQzbB6pyOfAPu3lJiDz+M/DyPNYwkljagAx
 JzSK80cwtXk07lgZZvC8Z3MJruN5pqqvWX/TA8l7dHpReoguCM3hAPUJ9pdVoIa7
 haavL0UzLwya9C2sK9hcys8EBim5thkXI6GsnpRxiztkXZh0LtsUP9Dydt2srGA6
 Hl4BD/g23W9+zmjkAIAvgMwbBoZ2/SHkD7l3ZqG2N2j6LrQxpwc=
 =UcdD
 -----END PGP SIGNATURE-----

Merge tag 'for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 "Battery/charger related:
   - cros-peripheral-charger: new driver
   - mt6360-charger: new driver
   - simple-battery: support reading chemistry info
   - max17042-battery: add max77849 support
   - sbs-battery: add time_to_empty_now support
   - smb347-charger: prepare USB OTG support
   - rn5t618: add voltage_now support
   - axp288: cleanup & optimizations
   - max17042_battery: cleanups
   - ab8500: cleanups
   - misc minor cleanups and DT binding fixes

  reset related:
   - tps65086-restart: new driver
   - linkstation-poweroff: support NETGEAR ReadyNAS Duo v2"

* tag 'for-v5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (51 commits)
  power: supply: core: Fix parsing of battery chemistry/technology
  power: supply: max17042_battery: log SOC threshold using debug log level
  power: supply: max17042_battery: more robust chip type checks
  power: supply: max17042_battery: fix typo in MAx17042_TOFF
  power: supply: max17042_battery: clean up MAX17055_V_empty
  power: supply: smb347-charger: Implement USB VBUS regulator
  power: supply: smb347-charger: Add missing pin control activation
  power: supply: smb347-charger: Utilize generic regmap caching
  power: supply: smb347-charger: Make smb347_set_writable() IRQ-safe
  dt-bindings: power: supply: smb347-charger: Document USB VBUS regulator
  power: reset: Add TPS65086 restart driver
  dt-bindings: power: supply: max17042: describe interrupt
  power: supply: max17042: remove duplicated STATUS bit defines
  power: supply: max17042: handle fails of reading status register
  power: supply: core: Parse battery chemistry/technology
  dt-bindings: power: Extend battery bindings with chemistry
  power: reset: linkstation-poweroff: add new device
  power: reset: linkstation-poweroff: prepare for new devices
  power: supply: bq24735: reorganize ChargeOption command macros
  power: supply: rn5t618: Add voltage_now property
  ...
2021-08-30 11:47:32 -07:00
Greg Kroah-Hartman
9d9d90a9af 2nd set of new IIO device support and cleanups for the 5.15 cycle.
A small pull request to pick up a few new drivers and some cleanup
 and fix patches.
 
 New device support
 * ad5110 non-volatile digital potentiometer
   - New driver
 * renesas rzl/gl2 12-bit / 8 channel ADC block
   - New driver and bindings
 
 Minor or late breaking fixes and cleanups
 * ltc2983
   - Fix a false assumption of initial interrupt during probe().
 * hp03
   - Use devm_* to simplify probe and allow the remove function to be dropped.
 * rockchip_saradc
   - Use a regulator notifier to reduce overheads of querying the scale.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmEbzu0RHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogK9RAAj+v3Y7AaHxjMltqZYSrOnkuzYkXnL8Sm
 1th0yh1m+U65iyZgZNKxMRg7ABW6+BW2WOBDr5qcfISiKI9VKzxvdSG3S1gsjkOj
 mpDX4HNdTToXapWbN9Iw8IwU35r+116YPqrSKcau1Xyani1dsMOp8MhRvzwzh47R
 ixlHTVDbu1aeCkIxEuN8HfCyAftbC8P8olenKRzbDvcQxApr68Sr0wvmBDkHk8lg
 VjFRvHh2GQZbptvCKt0HegmEEQ9qiMMJmua8o7g49uarIAqzhKCDAfSStszCMzHD
 gAe+RPIZaTlz2iY1YMi28rhJWj8VC2hCZl7PIO27AOw05ynVg9tVo4w74cQ0QYFQ
 N+2J+L2FRcMuwdPmpAgIwVDY+B6EvAbNkS88Pco45YmfTkzcnrctk2jv4+DSSRMb
 5p5ojhq7ONxVS/MPE0mkZRWO8jFyiqNB3YiktdsaA++gFcH7PPuIxsep9GBbjaik
 LxrZzbXvmE0hI24iz0oKdp9dO1N8Gws5BtZEtx1quJYxDPwa3cDDOrpCKvnsR86E
 JKRkCZ7jPT1Rahj6tOdtU84xbNTRrqFDXZpx8BN0MqV2QqvXSglWTvB7fMJqf78i
 r9lx/LJ9LaQ971gQ/dtPSB/7o6TlOxG55JP+GnZOH/0DGAicFCfllluEx1bVTz7T
 AgI7Ng6s7Mk=
 =d/Fm
 -----END PGP SIGNATURE-----

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

Jonathan writes:

2nd set of new IIO device support and cleanups for the 5.15 cycle.

A small pull request to pick up a few new drivers and some cleanup
and fix patches.

New device support
* ad5110 non-volatile digital potentiometer
  - New driver
* renesas rzl/gl2 12-bit / 8 channel ADC block
  - New driver and bindings

Minor or late breaking fixes and cleanups
* ltc2983
  - Fix a false assumption of initial interrupt during probe().
* hp03
  - Use devm_* to simplify probe and allow the remove function to be dropped.
* rockchip_saradc
  - Use a regulator notifier to reduce overheads of querying the scale.

* tag 'iio-for-5.15b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: adc: Add driver for Renesas RZ/G2L A/D converter
  dt-bindings: iio: adc: Add binding documentation for Renesas RZ/G2L A/D converter
  iio: pressure: hp03: update device probe to register with devm functions
  iio: adc: rockchip_saradc: add voltage notifier so get referenced voltage once at probe
  iio: ltc2983: fix device probe
  iio: potentiometer: Add driver support for AD5110
  dt-bindings: iio: potentiometer: Add AD5110 in trivial-devices
2021-08-17 19:48:42 +02:00
Greg Kroah-Hartman
a30514a076 Merge 5.14-rc6 into staging-next
We need the IIO fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-16 09:02:59 +02:00
Lad Prabhakar
d484c21bac iio: adc: Add driver for Renesas RZ/G2L A/D converter
Add ADC driver support for Renesas RZ/G2L A/D converter in SW
trigger mode.

A/D Converter block is a successive approximation analog-to-digital
converter with a 12-bit accuracy and supports a maximum of 8 input
channels.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20210804202118.25745-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15 17:03:13 +01:00
David Wu
cabd6e9cf2 iio: adc: rockchip_saradc: add voltage notifier so get referenced voltage once at probe
Add voltage notifier, no need to query regulator voltage for
every saradc read, just get regulator voltage once at probe.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Simon Xue <xxm@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20210810011007.54066-1-xxm@rock-chips.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-15 16:58:37 +01:00
Andreas Kemnade
1a844ddf06 iio: adc: rn5t618: Add iio map
Add iio map to allow power driver to read out values as a consumer.
This approach does not block later addition of devicetree support
which would be helpful if there is an in-kernel consumer for AIN0/1.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-08-13 18:38:17 +02:00
Alexander Sverdlin
6c3ce4049b iio: ep93xx: Prepare clock before using it
Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch
to Common Clock Framework, otherwise the following is visible:

WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:1011 clk_core_enable+0x9c/0xbc
Enabling unprepared ep93xx-adc
CPU: 0 PID: 1 Comm: swapper Not tainted 5.13.0-rc5-... #1
Hardware name: Cirrus Logic EDB9302 Evaluation Board
[<c000d5b0>] (unwind_backtrace) from [<c000c590>] (show_stack+0x10/0x18)
[<c000c590>] (show_stack) from [<c03a5f38>] (dump_stack+0x20/0x2c)
[<c03a5f38>] (dump_stack) from [<c03a2098>] (__warn+0x98/0xc0)
[<c03a2098>] (__warn) from [<c03a2150>] (warn_slowpath_fmt+0x90/0xc0)
[<c03a2150>] (warn_slowpath_fmt) from [<c01d8358>] (clk_core_enable+0x9c/0xbc)
[<c01d8358>] (clk_core_enable) from [<c01d8698>] (clk_core_enable_lock+0x18/0x30)
[<c01d8698>] (clk_core_enable_lock) from [<c0266560>] (ep93xx_adc_probe+0xe4/0x1a0)
[<c0266560>] (ep93xx_adc_probe) from [<c02126e0>] (platform_probe+0x34/0x80)
[<c02126e0>] (platform_probe) from [<c0210bf8>] (really_probe+0xe8/0x394)
[<c0210bf8>] (really_probe) from [<c0211464>] (device_driver_attach+0x5c/0x64)
[<c0211464>] (device_driver_attach) from [<c02114e8>] (__driver_attach+0x7c/0xec)
[<c02114e8>] (__driver_attach) from [<c020f1b4>] (bus_for_each_dev+0x78/0xc4)
[<c020f1b4>] (bus_for_each_dev) from [<c0211570>] (driver_attach+0x18/0x24)
[<c0211570>] (driver_attach) from [<c020fab4>] (bus_add_driver+0x140/0x1cc)
[<c020fab4>] (bus_add_driver) from [<c0211c44>] (driver_register+0x74/0x114)
[<c0211c44>] (driver_register) from [<c02134f8>] (__platform_driver_register+0x18/0x24)
[<c02134f8>] (__platform_driver_register) from [<c0470148>] (ep93xx_adc_driver_init+0x10/0x1c)
[<c0470148>] (ep93xx_adc_driver_init) from [<c045ce88>] (do_one_initcall+0x7c/0x1a4)
[<c045ce88>] (do_one_initcall) from [<c045d184>] (kernel_init_freeable+0x17c/0x1fc)
[<c045d184>] (kernel_init_freeable) from [<c03a64d0>] (kernel_init+0x8/0xf8)
[<c03a64d0>] (kernel_init) from [<c00082d8>] (ret_from_fork+0x14/0x3c)
...
ep93xx-adc ep93xx-adc: Cannot enable clock
ep93xx-adc: probe of ep93xx-adc failed with error -108

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20210613233041.128961-2-alexander.sverdlin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08 14:57:19 +01:00
Tang Bin
f27b1b2a04 iio: adc: fsl-imx25-gcq: adjust irq check to match docs and simplify code
For the function of platform_get_irq(), the example in platform.c is
 *	int irq = platform_get_irq(pdev, 0);
 *	if (irq < 0)
 *		return irq;
the return value of zero is unnecessary to check, so make the right
check and simplify code.

Note that platform_get_irq() is documented as never returning 0
so this is a minor optmization rather than a fix.

Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210802120929.33760-1-tangbin@cmss.chinamobile.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08 14:52:23 +01:00
Christophe Branchereau
bf1b2418c2 iio/adc: ingenic: add JZ4760B support to the sadc driver
The JZ4760B variant differs slightly from the JZ4760: it has a bit called VBAT_SEL in the CFG register.

In order to correctly sample the battery voltage on existing handhelds using this SOC, the bit must be cleared.

We leave the possibility to set the bit, by using the "ingenic,use-internal-divider" in the devicetree.

Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com>
Link: https://lore.kernel.org/r/20210726082033.351533-5-cbranchereau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31 18:14:53 +01:00
Christophe Branchereau
b9e9bdd425 iio/adc: ingenic: add JZ4760 support to the sadc driver
The jz4760 sadc is very similar to the jz4770 one, but has a VREF of 2.5V
and 3 aux channels.

modify ingenic_adc_read_chan_info_raw() needs a change to account for it.

Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com>

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210726082033.351533-4-cbranchereau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31 18:14:53 +01:00
Christophe Branchereau
9c5eb724f9 iio/adc: ingenic: rename has_aux2 to has_aux_md
The jz4760(b) socs have 3 aux channels.

The purpose of has_aux2 is to set the MD bits used to select
the AUX channel to be sampled, not to describe the hardware.

Rename it to a more appropriate name.

Signed-off-by: Christophe Branchereau <cbranchereau@gmail.com>

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210726082033.351533-2-cbranchereau@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31 18:14:53 +01:00
Colin Ian King
5afc1540f1 iio: adc: Fix incorrect exit of for-loop
Currently the for-loop that scans for the optimial adc_period iterates
through all the possible adc_period levels because the exit logic in
the loop is inverted. I believe the comparison should be swapped and
the continue replaced with a break to exit the loop at the correct
point.

Addresses-Coverity: ("Continue has no effect")
Fixes: e08e19c331 ("iio:adc: add iio driver for Palmas (twl6035/7) gpadc")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210730071651.17394-1-colin.king@canonical.com
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-31 14:46:05 +01:00
Martin Blumenstingl
9491b9177f iio: adc: meson-saradc: Fix indentation of arguments after a line-break
Align the function arguments after a line-break with the opening
parenthesis on the previous line. No functional changes intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20210717233718.332267-4-martin.blumenstingl@googlemail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25 15:57:31 +01:00
Martin Blumenstingl
0e1d2a5ec7 iio: adc: meson-saradc: Add missing space between if and parenthesis
Add a missing space between if and the opening parenthesis to make the
coding style consistent across the whole driver. No functional changes
intended.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20210717233718.332267-3-martin.blumenstingl@googlemail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25 15:57:31 +01:00
Martin Blumenstingl
48dc1abde0 iio: adc: meson-saradc: Disable BL30 integration on G12A and newer SoCs
G12A and newer don't use the SAR ADC to read the SoC temperature from
within the firmware. Instead there's now a dedicated thermal sensor.
Disable the BL30 integration for G12A and newer SoCs to save a few CPU
cycles when reading samples.
Adding a separate struct meson_sar_adc_data is a good idea anyways
because starting with G12A there's some extra registers to read the
samples in a simplified way.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20210717233718.332267-2-martin.blumenstingl@googlemail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-25 15:57:31 +01:00
Tang Bin
78a6af3346 iio: adc: fsl-imx25-gcq: Use the defined variable to clean code
Use the defined variable "dev" to make the code cleaner.

Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
Link: https://lore.kernel.org/r/20210720125945.11548-1-tangbin@cmss.chinamobile.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-24 16:27:21 +01:00
Uwe Kleine-König
9898cb24e4 iio: adc: ti-ads7950: Ensure CS is deasserted after reading channels
The ADS7950 requires that CS is deasserted after each SPI word. Before
commit e2540da86e ("iio: adc: ti-ads7950: use SPI_CS_WORD to reduce
CPU usage") the driver used a message with one spi transfer per channel
where each but the last one had .cs_change set to enforce a CS toggle.
This was wrongly translated into a message with a single transfer and
.cs_change set which results in a CS toggle after each word but the
last which corrupts the first adc conversion of all readouts after the
first readout.

Fixes: e2540da86e ("iio: adc: ti-ads7950: use SPI_CS_WORD to reduce CPU usage")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: David Lechner <david@lechnology.com>
Tested-by: David Lechner <david@lechnology.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210709101110.1814294-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-17 18:36:53 +01:00
Simon Xue
7786da3b5a iio: adc: rockchip_saradc: add support for rk3568 saradc
It is similar to other devices, but with 8 channels.

Signed-off-by: Simon Xue <xxm@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20210712014507.97477-1-xxm@rock-chips.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-07-17 18:03:39 +01:00
Jonathan Cameron
17181d4dc3 iio: adc: ads1015: Balance runtime pm + pm_runtime_resume_and_get()
The call to pm_runtime_put_noidle() in remove() is not balancing a
counter increment.  Note this doesn't matter as the runtime pm core
will not allow the counter to go negative.  However, it is confusing
to the reader so let's remove it.

The pm_runtime_resume_and_get() replacement was found using coccicheck
script under review at:
https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/

This is a prequel to taking a closer look at the runtime pm in IIO drivers
in general.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/20210516162103.1332291-3-jic23@kernel.org
2021-06-16 14:53:13 +01:00
Jonathan Cameron
61fa5dfa5f iio: adc: ti-ads8688: Fix alignment of buffer in iio_push_to_buffers_with_timestamp()
Add __aligned(8) to ensure the buffer passed to
iio_push_to_buffers_with_timestamp() is suitable for the naturally
aligned timestamp that will be inserted.

Fixes: f214ff521f ("iio: ti-ads8688: Update buffer allocation for timestamps")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-5-jic23@kernel.org
2021-06-14 11:42:41 +01:00
Jonathan Cameron
6a6be221b8 iio: adc: mxs-lradc: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.
Add a comment on why the buffer is the size it is as not immediately
obvious.

Found during an audit of all calls of this function.

Fixes: 6dd112b9f8 ("iio: adc: mxs-lradc: Add support for ADC driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-4-jic23@kernel.org
2021-06-14 11:42:41 +01:00
Jonathan Cameron
afe2a789fb iio: adc: hx711: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.

Found during an audit of all calls of this function.

Fixes: d3bf60450d ("iio: hx711: add triggered buffer support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-3-jic23@kernel.org
2021-06-14 11:42:41 +01:00
Jonathan Cameron
8f88475896 iio: adc: at91-sama5d2: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
To make code more readable, use a structure to express the channel
layout and ensure the timestamp is 8 byte aligned.

Found during an audit of all calls of this function.

Fixes: 5e1a1da0f8 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20210613152301.571002-2-jic23@kernel.org
2021-06-14 11:42:41 +01:00
Alexandru Ardelean
49bd77560f iio: adc: remove unused private data assigned with spi_set_drvdata()
These were usually used before the conversion to devm_ functions, so that
the remove hook would be able to retrieve the pointer and do cleanups on
remove.
When the conversion happened, they should have been removed, but were
omitted.

Some drivers were copied from drivers that fit the criteria described
above. In any case, in order to prevent more drivers from being used as
example (and have spi_set_drvdata() needlessly set), this change removes it
from the IIO ADC group.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513111035.77950-1-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:17 +01:00
Alexandru Ardelean
4b36151d74 iio: adc: ad_sigma_delta: remove ad_sd_{setup,cleanup}_buffer_and_trigger()
Since all AD Sigma-Delta drivers now use the
devm_ad_sd_setup_buffer_and_trigger() function, we can remove the old
ad_sd_{setup,cleanup}_buffer_and_trigger() functions.

This way we can discourage new drivers that use the ad_sigma_delta
lib-driver to use these (older functions).

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-13-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:17 +01:00
Jonathan Cameron
c066ca1464 iio: adc: ad7124: Use devm_ managed calls for all of probe() + drop remove()
As not many steps were not already devm_ managed, use
devm_add_action_or_reset() to handle the rest.

This also uses the new devm_ad_sd_setup_buffer_and_trigger() function.

Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-12-aardelean@deviqon.com
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
bd5dcdeb3f iio: adc: ad7192: convert to device-managed functions
With the devm_ad_sd_setup_buffer_and_trigger() helper, it's a bit easier
now to convert the probe of the AD7192 driver to use device-managed
functions.

The regulators and the mclk requires devm_add_action_or_reset() callbacks
though.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-11-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
c9ec2cb328 iio: adc: ad7192: use devm_clk_get_optional() for mclk
The devm_clk_get_optional() helper returns NULL when devm_clk_get() returns
-ENOENT.
This makes things slightly cleaner. The added benefit is mostly cosmetic.

Also, a minor detail with this call, is that the reference for the parent
device is taken as `spi->dev` instead of `&st->sd.spi->dev` (which looks a
little quirky).

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-10-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
e50aab18dd iio: adc: ad7780: convert to device-managed functions
With the devm_ad_sd_setup_buffer_and_trigger() helper, it's a bit easier
now to convert the probe of the AD7780 driver to use device-managed
functions.

Only the regulator disable requires a devm_add_action_or_reset() callback.

This change does that, cleaning up the driver a bit.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-9-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
bb560edc19 iio: adc: ad7791: convert to device-managed functions
With the devm_ad_sd_setup_buffer_and_trigger() helper, it's a bit easier
now to convert the probe of the AD7791 driver to use device-managed
functions.

Only the regulator disable requires a devm_add_action_or_reset() callback.

This change does that, cleaning up the driver a bit.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-8-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
801a80eff4 iio: adc: ad7793: convert to device-managed functions
With the devm_ad_sd_setup_buffer_and_trigger() helper, it's a bit easier
now to convert the probe of the AD7793 driver to use device-managed
functions.

Only the regulator disable requires a devm_add_action_or_reset() callback.

This change does that, cleaning up the driver a bit.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-7-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Alexandru Ardelean
718fb2bcf1 iio: adc: ad_sigma_delta: introduct devm_ad_sd_setup_buffer_and_trigger()
This is a version of ad_sd_setup_buffer_and_trigger() with all underlying
functions (that are used) being replaced with their device-managed
variants.

One thing to take care here is with {devm_}iio_trigger_alloc(), where both
functions take a parent-device object as the first parameter.

To make sure nothing quirky is happening, the devm_ad_sd_probe_trigger()
function is checking that the provided 'dev' reference is the same as the
one stored on the 'struct ad_sigma_delta' driver data.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210513120752.90074-6-aardelean@deviqon.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-13 17:00:16 +01:00
Greg Kroah-Hartman
6771fb0b94 1st set of new IIO/counter device support, features and cleanup for 5.14
There are a couple of large cleanup sets in here alongside a number of new
 drivers.
 
 Note an immutable branch merged to add a stub for i2c_verify_client()
 as needed to avoid a build issue in the fxls8962af driver as a result of a
 workaround for a device errata that only applies when i2c interface is used.
 
 Counters
 ========
 
 New device support
 * intel,quadrature encoder peripheral found on Elkhart Lake platforms.
   - New driver.
 
 IIO
 ===
 
 New device support
 * amstaos,tsl2591 ambient light sensor.
   - New driver + bindings
   - Follow up fix to ensure some local variables are suitable for error
     handling.
 * fsl,fxls8962af + fsl,fxls8964af accelerometers
   - New driver + bindings
   - Includes an errata work around that cause a build bot failure fixed
     by adding a stub to i2c.
 * kionix,kxcjk-1013
   - Add support for KX023-1025 device.  Mostly a different register map
     that needed to be supported.
 * murata,sca3300 accelerometer
   - New driver + bindings
 * st,lsm9ds0 IMU
   - Rework of st,sensors driver to cleanly support this new glue driver
     that enables the two parts of the LSM9DS0.
 * ti,tsc2046 touchscreen controller ADC.
   - New driver. Intent here is to use this with existing IIO consumer
     drivers such as resistive-adc-touch.
   - Follow up fix to avoid an issue with unsigned subtraction in error
     check.
 * ti,tmp117 digital temperature sensor
   - New driver + bindings
 
 Features
 * adi,ad5755
   - Add missing dt-binding doc
 * adi,ad7298
   - Add ACPI ID used on Intel Galileo Gen 1 boards.
   - Add missing dt-binding doc
 * adi,ad7476
   - Add missing dt-binding doc
 * adi,ad7746
   - Add missing dt-binding doc for this driver that will hopefully move out
     of staging shortly. Update staging driver to use the binding instead of
     platform data.
 * adi,adis16201 + adis16209
   - Add missing dt-binding doc
 * adi,adis16480
   - Support burst mode for adis16495 and adis16497 parts.
 * bosch,bma220
   - Add missing dt-binding doc
 * fsl,mma7455
   - Add missing dt-binding doc
 * iio-rescale
   - Support handling of processed channels from provider.  Some ADCs
     require (typically non linear) calibration functions to be applied,
     and so provide only IIO_CHAN_INFO_PROCESSED read back. They can be
     used as providers to the iio-rescale driver which needs to handle them
     somewhat differently from IIO_CHAN_INFO_RAW
 * sensiron,sps30
   - Support the serial interface.  Note this required significant
     refactoring of existing driver.
 * st,st-sensors
   - Add mount matrix support for normal dt-binding whilst continuing to
     support the odd ACPI approach for accelerometers.
 * ti,dac082s085 + similar
   - Add missing dt-binding doc
 * trivial-devices - add entries for
   - memsic,mx4005, memsic,mx6255 and memsic,mxc6655
   - sensortek,stk8312 and sensortek,stk8ba50
 
 Cleanup / minor fixes
 * core
   - Use devm_add_action_or_reset() to replace boilerplate in several
     driver and core IIO devm_* functions.
   - Fix an error path issue introduced by above, that could return an
     error pointer rather than the expected null from dev_iio_device_alloc()
   - Move more IIO internals related fields from struct iio_dev to
     struct iio_dev_opaque.
   - Drop unused final update of in_loc in demux setup.
 * Docs
   - Move some docs from driver specific to core dos to avoid replication
     of names which the documentation builder does not allow.
     Note this means adding a few device specific notes to the general docs
     to cover the more unusual uses of the ABI.
   - ABI: Move old buffer/* and scan_elements/* docs to obsolete as now we
     have the bufferX/* variant.  Not we are not getting rid of these
     interfaces, just encouraging new code to use the new interface.
 * IIO wide:
   - Tidy up new cases of dev.parent etc being set in drivers as the core
     now does it.
   - Fix more cases of possible miss-aligned buffers when passed to
     iio_push_to_buffers_with_timestamp().  Note we only have one known
     instance of anyone seeing this bug actually happening, so this has been
     a low priority cleanup effort for several cycles.
   - sysfs_emit() used in more drivers.
   - Runtime pm tidy up and use of pm_runtime_resume_and_get()
   - Buffer alignment fixes as iio_push_to_buffers_with_timestamp requires
     that the timestamp when inserted by naturally aligned + consumers can
     assume that all fields are naturally aligned. Part of a long running
     effort, with at least 2 more series to come tackling additional
     variants.
   - Stop specifying "mount-matrix" property name in every lookup of the
     mount matrix from firmware by hard coding it in the core.
 * adi,ad7476
   - Handle the variety of different regulators used by the parts supported
     by this driver (came up in dt-binding review)
 * adi,ad7746
   - Trivial drop of if (ret) return ret; return 0; pattern
   - Tidy up comments
   - Pull capdac setup out to own function.
 * adi,ad7766
   - Trivial drop of if (ret) return ret; return 0; pattern
 * adi,adis
   - Avoid returning error codes in interrupt handlers.
   - Handle a failure in spi_write in the trigger handler.
   - Rework to add updating of device page after changing it.
   - Don't push data to IIO buffers when read failed.
   - Add configuration of burst max speed to core avoid handling this in
     each driver.
   - Use the adis_dev_lock() helper in adis16260 and adis16136 drivers.
   - Excessive includes cleanup via include-what-you-use static checker
     after zero day highlighted that these needed updating.
 * afe
   - Amend binding to add #io-channel-cells, thus allowing this IIO
     consumer to also be an IIO provider.
 * aosong,am2315
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * bosch,bma180
   - Adding missing bandwidth settings (500, 1000 Hz)
 * bosch,bme680
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * ep93xx_adc,
   - Drop a redundant error print.
 * maxim,max118
   - Convert remainder of probe() to devm_ managed functions.
   - Avoid some repeated jumping back and forth between iio_dev and
     spi structures.
 * maxim,max11100
   - Use get_unaligned_be16() instead of open coding.
   - Convert remainder of probe() to devm_ managed functions.
 * samsung,exynos_adc
   - Unused error value dropped.
 * sensiron,sgp30
   - Drop use of %hx in favor of %x and letting the normal type conversion
     work.
 * sensortek,stk8312
   - Add lowercase device id and note uppercase version deprecated.
   - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
     ACPI naming.
 * sprx,sc72xx_adc
   - add MODULE_DEVICE_TABLE
 * st,lsm6dsx
   - Fix docs of valid ODRs
 * st,sensors
   - dt-binding rework.  Two efforts on this crossed in a previous cycle
     so this update cherry picks the best of the two yaml conversions.
   - Don't copy the channel spec array as now ext_info is no longer modified.
 * st,stm32-adc
   - tidy up some docs that were marked as kernel-doc but aren't.
 * ti,adc081c, ti,adc0832, ti,adc108s102 and ti,adc161s626
   - Convert remainder of probe() functions to devm_ managed functions
     to simplify error handing and remove paths.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmC/mCoRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoidAQ//SqpbBeEy8HATSHccooHwHI3eK+hnj0n9
 9zr6/7o52EQ0lFN6V7OLp0XNL3DNIV8oYAyvzYZ4Qh2NXLYQHDnqiiUyLxCfctqu
 Ii+9NmVmuk/PlPRRubQRZE+Czdtwgsp7dRQOYJiuxUeKVD/EUVjl1FmpsiPtGeaa
 iU6JaYtdF3ie0b1zQCwQTYYsM8lZ2/ovKW8F29K5ALnrDd9h6Ad0p5QDvyDxyajp
 VyLRJa7nwAfK5rP6efuNsDfzbMycTPtHkcC+Pgec/2RrXL5mDz4EXHI1nOUZAGdb
 UaN/uDpytAxJZk6Fs2f+RdgevlQgpBxAXGDHE2YHkcZi7X0ppWOjeIZFSDbDiaHO
 XlSQgOelUqKtHhRZ3MYHxbSOgO3Vif6ecCDMNCN78E0YE3kQHHSwY0JMGgUeHIGG
 hQPKGaD1AKzh7AsbPbazYW6VX4dDDWcr8pQ8D9wWLUKikcZLKqRH5uAwvjZ+NjuC
 Bfnjx/QhmIhbs0gFaw4Q5mvYQ3Zmfh7nzcW98jwcbR6pOqKvIeqzw9OARRHaimrd
 /GRCiccxKtU8J7f5l+MSzYQt4hT0Ef1vuq9Ak5SDCr3Fwnix5ipFVLkipWvgJ7JD
 OqubcwwW5EfgZPY/X7nsK/U6v8SlqF4XrvCVky4MUt0x1YXxc/tjYak8oLEqpMVC
 gQP3KUZIYeA=
 =Zved
 -----END PGP SIGNATURE-----

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

Jonathan writes:

1st set of new IIO/counter device support, features and cleanup for 5.14

There are a couple of large cleanup sets in here alongside a number of new
drivers.

Note an immutable branch merged to add a stub for i2c_verify_client()
as needed to avoid a build issue in the fxls8962af driver as a result of a
workaround for a device errata that only applies when i2c interface is used.

Counters
========

New device support
* intel,quadrature encoder peripheral found on Elkhart Lake platforms.
  - New driver.

IIO
===

New device support
* amstaos,tsl2591 ambient light sensor.
  - New driver + bindings
  - Follow up fix to ensure some local variables are suitable for error
    handling.
* fsl,fxls8962af + fsl,fxls8964af accelerometers
  - New driver + bindings
  - Includes an errata work around that cause a build bot failure fixed
    by adding a stub to i2c.
* kionix,kxcjk-1013
  - Add support for KX023-1025 device.  Mostly a different register map
    that needed to be supported.
* murata,sca3300 accelerometer
  - New driver + bindings
* st,lsm9ds0 IMU
  - Rework of st,sensors driver to cleanly support this new glue driver
    that enables the two parts of the LSM9DS0.
* ti,tsc2046 touchscreen controller ADC.
  - New driver. Intent here is to use this with existing IIO consumer
    drivers such as resistive-adc-touch.
  - Follow up fix to avoid an issue with unsigned subtraction in error
    check.
* ti,tmp117 digital temperature sensor
  - New driver + bindings

Features
* adi,ad5755
  - Add missing dt-binding doc
* adi,ad7298
  - Add ACPI ID used on Intel Galileo Gen 1 boards.
  - Add missing dt-binding doc
* adi,ad7476
  - Add missing dt-binding doc
* adi,ad7746
  - Add missing dt-binding doc for this driver that will hopefully move out
    of staging shortly. Update staging driver to use the binding instead of
    platform data.
* adi,adis16201 + adis16209
  - Add missing dt-binding doc
* adi,adis16480
  - Support burst mode for adis16495 and adis16497 parts.
* bosch,bma220
  - Add missing dt-binding doc
* fsl,mma7455
  - Add missing dt-binding doc
* iio-rescale
  - Support handling of processed channels from provider.  Some ADCs
    require (typically non linear) calibration functions to be applied,
    and so provide only IIO_CHAN_INFO_PROCESSED read back. They can be
    used as providers to the iio-rescale driver which needs to handle them
    somewhat differently from IIO_CHAN_INFO_RAW
* sensiron,sps30
  - Support the serial interface.  Note this required significant
    refactoring of existing driver.
* st,st-sensors
  - Add mount matrix support for normal dt-binding whilst continuing to
    support the odd ACPI approach for accelerometers.
* ti,dac082s085 + similar
  - Add missing dt-binding doc
* trivial-devices - add entries for
  - memsic,mx4005, memsic,mx6255 and memsic,mxc6655
  - sensortek,stk8312 and sensortek,stk8ba50

Cleanup / minor fixes
* core
  - Use devm_add_action_or_reset() to replace boilerplate in several
    driver and core IIO devm_* functions.
  - Fix an error path issue introduced by above, that could return an
    error pointer rather than the expected null from dev_iio_device_alloc()
  - Move more IIO internals related fields from struct iio_dev to
    struct iio_dev_opaque.
  - Drop unused final update of in_loc in demux setup.
* Docs
  - Move some docs from driver specific to core dos to avoid replication
    of names which the documentation builder does not allow.
    Note this means adding a few device specific notes to the general docs
    to cover the more unusual uses of the ABI.
  - ABI: Move old buffer/* and scan_elements/* docs to obsolete as now we
    have the bufferX/* variant.  Not we are not getting rid of these
    interfaces, just encouraging new code to use the new interface.
* IIO wide:
  - Tidy up new cases of dev.parent etc being set in drivers as the core
    now does it.
  - Fix more cases of possible miss-aligned buffers when passed to
    iio_push_to_buffers_with_timestamp().  Note we only have one known
    instance of anyone seeing this bug actually happening, so this has been
    a low priority cleanup effort for several cycles.
  - sysfs_emit() used in more drivers.
  - Runtime pm tidy up and use of pm_runtime_resume_and_get()
  - Buffer alignment fixes as iio_push_to_buffers_with_timestamp requires
    that the timestamp when inserted by naturally aligned + consumers can
    assume that all fields are naturally aligned. Part of a long running
    effort, with at least 2 more series to come tackling additional
    variants.
  - Stop specifying "mount-matrix" property name in every lookup of the
    mount matrix from firmware by hard coding it in the core.
* adi,ad7476
  - Handle the variety of different regulators used by the parts supported
    by this driver (came up in dt-binding review)
* adi,ad7746
  - Trivial drop of if (ret) return ret; return 0; pattern
  - Tidy up comments
  - Pull capdac setup out to own function.
* adi,ad7766
  - Trivial drop of if (ret) return ret; return 0; pattern
* adi,adis
  - Avoid returning error codes in interrupt handlers.
  - Handle a failure in spi_write in the trigger handler.
  - Rework to add updating of device page after changing it.
  - Don't push data to IIO buffers when read failed.
  - Add configuration of burst max speed to core avoid handling this in
    each driver.
  - Use the adis_dev_lock() helper in adis16260 and adis16136 drivers.
  - Excessive includes cleanup via include-what-you-use static checker
    after zero day highlighted that these needed updating.
* afe
  - Amend binding to add #io-channel-cells, thus allowing this IIO
    consumer to also be an IIO provider.
* aosong,am2315
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* bosch,bma180
  - Adding missing bandwidth settings (500, 1000 Hz)
* bosch,bme680
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* ep93xx_adc,
  - Drop a redundant error print.
* maxim,max118
  - Convert remainder of probe() to devm_ managed functions.
  - Avoid some repeated jumping back and forth between iio_dev and
    spi structures.
* maxim,max11100
  - Use get_unaligned_be16() instead of open coding.
  - Convert remainder of probe() to devm_ managed functions.
* samsung,exynos_adc
  - Unused error value dropped.
* sensiron,sgp30
  - Drop use of %hx in favor of %x and letting the normal type conversion
    work.
* sensortek,stk8312
  - Add lowercase device id and note uppercase version deprecated.
  - Drop ACPI id. Unlikely this one is in the wild and it isn't valid
    ACPI naming.
* sprx,sc72xx_adc
  - add MODULE_DEVICE_TABLE
* st,lsm6dsx
  - Fix docs of valid ODRs
* st,sensors
  - dt-binding rework.  Two efforts on this crossed in a previous cycle
    so this update cherry picks the best of the two yaml conversions.
  - Don't copy the channel spec array as now ext_info is no longer modified.
* st,stm32-adc
  - tidy up some docs that were marked as kernel-doc but aren't.
* ti,adc081c, ti,adc0832, ti,adc108s102 and ti,adc161s626
  - Convert remainder of probe() functions to devm_ managed functions
    to simplify error handing and remove paths.

* tag 'iio-for-5.14a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (171 commits)
  i2c: core: Add stub for i2c_verify_client() if !CONFIG_I2C
  iio: adis: Cleanout unused headers
  iio: accel: bma180: Add missing 500 Hz / 1000 Hz bandwidth
  counter: Add support for Intel Quadrature Encoder Peripheral
  staging: iio: cdc: ad7746: extract capac setup to own function
  staging: iio: cdc: ad7746: clean up probe return
  staging: iio: cdc: ad7746: remove ordinary comments
  iio: adc: ti-adc161s626: Use devm managed functions for all of probe.
  iio: adc: ti-adc108s102: Use devm managed functions for all of probe()
  iio: adc: ti-adc0832: Use devm managed functions for all of probe()
  iio: adc: ti-adc081c: Use devm managed functions for all of probe()
  iio: adc: max1118: Avoid jumping back and forth between spi and iio structures
  iio: adc: max1118: Use devm_ managed functions for all of probe
  iio: adc: max11100: Use devm_ functions for rest of probe()
  iio: adc: max11100: Use get_unaligned_be16() rather than opencoding.
  iio: chemical: sgp30: Drop use of %hx in format string.
  iio: gyro: st_gyro: Support mount matrix
  iio: magnetometer: st_magn: Support mount matrix
  iio: accel: st_sensors: Stop copying channels
  iio: accel: st_sensors: Support generic mounting matrix
  ...
2021-06-09 12:11:49 +02:00
Jonathan Cameron
09f75a2bab iio: adc: ti-adc161s626: Use devm managed functions for all of probe.
Simplifies error handling and allows us to drop remove entirely.

The regulator handling in this driver was unusual as it would try to
acquire the regulator, but if that failed with an error would continue.

We should get a stub regulator if one isn't provided in DT and an error
could indicate an actual problem preventing the device being powered
(perhaps a need to defer). So this handling is cleaned up (arguably
that might be a fix but given no one has run into it, I haven't broken
it out separately.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Acked-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-9-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
9ecc2ebbb6 iio: adc: ti-adc108s102: Use devm managed functions for all of probe()
Simplifies error handling and lets us drop remove() entirely.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Bogdan Pricop <bogdan.pricop@emutex.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-8-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
55364f73a6 iio: adc: ti-adc0832: Use devm managed functions for all of probe()
Simplifies error handling, plus allows us to drop the remove()
function entirely.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-7-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
6c100eb960 iio: adc: ti-adc081c: Use devm managed functions for all of probe()
Simplifies error handling and allows us to drop remove() entirely.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-6-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
3c43b6e108 iio: adc: max1118: Avoid jumping back and forth between spi and iio structures
Changing from passing the spi structure into various functions to
passing struct iio_dev avoids use of spi_get_drvdata and lets us
stop setting that at all.  Previous code was unnecessarily complex.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-5-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
30b527dd4f iio: adc: max1118: Use devm_ managed functions for all of probe
This simplifies error handling and allows us to drop the remove
function entirely.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-4-jic23@kernel.org
2021-06-03 18:24:14 +01:00
Jonathan Cameron
7169a78e39 iio: adc: max11100: Use devm_ functions for rest of probe()
By using devm_add_action_or_reset() to manage the regulator disable,
it becomes simple to use managed functions for all of remove.
This simplifies error handling and allows us to drop the remove()
function entirely.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Alexandru Ardelean <aardelean@deviqon.com>
Link: https://lore.kernel.org/r/20210516172520.1398835-3-jic23@kernel.org
2021-06-03 18:24:14 +01:00