]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: vf610: use ADC clock within specification
authorStefan Agner <stefan@agner.ch>
Tue, 24 Mar 2015 12:47:47 +0000 (13:47 +0100)
committerJonathan Cameron <jic23@kernel.org>
Sat, 28 Mar 2015 12:00:02 +0000 (12:00 +0000)
commit624bcf0604f4fb1cc41fd76f57a7ebd62c6e2c9d
treebac655359a11f9319f62a84d4879cab0e1624128
parent54e3d08162869b4f2433bc139c04a88df0a2b6af
iio: adc: vf610: use ADC clock within specification

Depending on conversion mode used, the ADC clock (ADCK) needs
to be below a maximum frequency. According to Vybrid's data
sheet this is 20MHz for the low power conversion mode.

The ADC clock is depending on input clock, which is the bus
clock by default. Vybrid SoC are typically clocked at at 400MHz
or 500MHz, which leads to 66MHz or 83MHz bus clock respectively.
Hence, a divider of 8 is required to stay below the specified
maximum clock of 20MHz.

Due to the different bus clock speeds, the resulting sampling
frequency is not static. Hence use the ADC clock and calculate
the actual available sampling frequency dynamically.

This fixes bogous values observed on some 500MHz clocked Vybrid
SoC. The resulting value usually showed Bit 9 being stuck at 1,
or 0, which lead to a value of +/-512.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Acked-by: Fugang Duan <B38611@freescale.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/vf610_adc.c