linux/drivers/iio
Maarten ter Huurne 5a304e1a4e IIO: Ingenic JZ47xx: Set clock divider on probe
The SADC component can run at up to 8 MHz on JZ4725B, but is fed
a 12 MHz input clock (EXT). Divide it by two to get 6 MHz, then
set up another divider to match, to produce a 10us clock.

If the clock dividers are left on their power-on defaults (a divider
of 1), the SADC mostly works, but will occasionally produce erroneous
readings. This led to button presses being detected out of nowhere on
the RS90 every few minutes. With this change, no ghost button presses
were logged in almost a day worth of testing.

The ADCLK register for configuring clock dividers doesn't exist on
JZ4740, so avoid writing it there.

A function has been introduced rather than a flag because there is a lot
of variation between the ADCLK registers on JZ47xx SoCs, both in
the internal layout of the register and in the frequency range
supported by the SADC. So this solution should make it easier
to add support for other JZ47xx SoCs later.

Fixes: 1a78daea10 ("iio: adc: probe should set clock divider")
Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-07-14 16:02:08 +01:00
..
accel Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
adc IIO: Ingenic JZ47xx: Set clock divider on probe 2019-07-14 16:02:08 +01:00
afe treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
amplifiers Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
buffer treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
chemical treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
common chrome platform changes for v5.3 2019-07-11 18:45:29 -07:00
dac Merge 5.2-rc6 into staging-next 2019-06-23 13:29:03 +02:00
dummy treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
frequency Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
gyro treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
health treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
humidity Staging / IIO driver update for 5.3-rc1 2019-07-11 15:36:02 -07:00
imu Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
light Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
magnetometer treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
multiplexer treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
orientation treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 309 2019-06-05 17:37:04 +02:00
potentiometer treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
potentiostat treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pressure Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
proximity treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
resolver treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
temperature Merge 5.2-rc6 into staging-next 2019-06-23 13:29:03 +02:00
trigger treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_core_trigger.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-buffer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-configfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-core.c Staging / IIO driver update for 5.3-rc1 2019-07-11 15:36:02 -07:00
industrialio-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-device.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-triggered-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
inkern.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Kconfig Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
Makefile counter: stm32-lptimer: add counter device 2019-04-25 21:33:41 +02:00