linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: adc: rockchip_saradc: fix bitmasking and remove custom logic for getting reset
@ 2024-02-23 12:45 Quentin Schulz
  2024-02-23 12:45 ` [PATCH 1/3] iio: adc: rockchip_saradc: fix bitmask for channels on SARADCv2 Quentin Schulz
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Quentin Schulz @ 2024-02-23 12:45 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Heiko Stuebner,
	AngeloGioacchino Del Regno, Andy Shevchenko, Shreeya Patel,
	Simon Xue, Philipp Zabel
  Cc: Jonathan Cameron, linux-iio, linux-arm-kernel, linux-rockchip,
	linux-kernel, Quentin Schulz, Quentin Schulz

The mask for the channel selection is incorrect as it's specified to be
16b wide by is actually only 4.

Also, the 16 lower bits in the SARADC_CONV_CON register are write
protected. Whatever their value is can only be written to the hardware
block if their associated bit in the higher 16 bits is set. Considering
that the channel bitmask is 4b wide but that we can write e.g. 0 in
there, we shouldn't use the value shifted by 16 as a mask but rather the
bitmask for that value shifted by 16. This is currently NOT an issue
because the only SoC with SARADCv2 IP is the RK3588 which has a reset
defined in the SoC DTSI. When that is the case, the reset is asserted
before every channel conversion is started. This means the registers are
reset so effectively, we do not need to write zeros so the wrong mask
still works because where we should be writing zeroes, there are already
zeroes. However, let's fix this in case there comes a day there's an SoC
which doesn't require to reset the controller before every channel
conversion is started.

Lastly, let's use the appropriate function from the reset subsystem
for getting an optional exclusive reset instead of rolling out our own
logic.

Those three patches should not be changing any behavior.

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
Quentin Schulz (3):
      iio: adc: rockchip_saradc: fix bitmask for channels on SARADCv2
      iio: adc: rockchip_saradc: use mask for write_enable bitfield
      iio: adc: rockchip_saradc: replace custom logic with devm_reset_control_get_optional_exclusive

 drivers/iio/adc/rockchip_saradc.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
---
base-commit: 39133352cbed6626956d38ed72012f49b0421e7b
change-id: 20240222-saradcv2-chan-mask-593585865256

Best regards,
-- 
Quentin Schulz <quentin.schulz@theobroma-systems.com>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-02-27 14:55 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 12:45 [PATCH 0/3] iio: adc: rockchip_saradc: fix bitmasking and remove custom logic for getting reset Quentin Schulz
2024-02-23 12:45 ` [PATCH 1/3] iio: adc: rockchip_saradc: fix bitmask for channels on SARADCv2 Quentin Schulz
2024-02-23 13:40   ` Heiko Stübner
2024-02-23 12:45 ` [PATCH 2/3] iio: adc: rockchip_saradc: use mask for write_enable bitfield Quentin Schulz
2024-02-23 13:43   ` Heiko Stübner
2024-02-23 12:45 ` [PATCH 3/3] iio: adc: rockchip_saradc: replace custom logic with devm_reset_control_get_optional_exclusive Quentin Schulz
2024-02-23 13:00   ` Andy Shevchenko
2024-02-23 13:10     ` Quentin Schulz
2024-02-23 14:39       ` Andy Shevchenko
2024-02-26 20:31         ` Dragan Simic
2024-02-27 12:48           ` Andy Shevchenko
2024-02-27 14:55             ` Dragan Simic
2024-02-23 13:44   ` Heiko Stübner
2024-02-23 13:01 ` [PATCH 0/3] iio: adc: rockchip_saradc: fix bitmasking and remove custom logic for getting reset Andy Shevchenko
2024-02-24 19:25   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).