]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: dts: da850-lego-ev3: slow down A/DC as much as possible
authorDavid Lechner <david@lechnology.com>
Mon, 24 Sep 2018 01:31:46 +0000 (20:31 -0500)
committerSekhar Nori <nsekhar@ti.com>
Thu, 4 Oct 2018 14:38:40 +0000 (20:08 +0530)
commit17a8dad86546943a5ae92d4e7d10474e55bcfb54
tree40dee925044589dd0600b12ade66d4236e7f419b
parent350cf8ba338888cd74bb1982962ede8dfc38dc9b
ARM: dts: da850-lego-ev3: slow down A/DC as much as possible

Due to the electrical design of the A/DC circuits on LEGO MINDSTORMS EV3,
if we are reading analog values as fast as possible (i.e. using DMA to
service the SPI) the A/DC chip will read incorrect values - as much as
0.1V off when the SPI is running at 10MHz. (This has to do with the
capacitor charge time when channels are muxed in the A/DC.)

This patch slows down the SPI as much as possible (if CPU is at 456MHz,
SPI runs at 1/2 of that, so 228MHz and has a max prescalar of 256, so
we could get ~891kHz, but we're just rounding it to 1MHz). We also use
the max allowable value for WDELAY to slow things down even more.

These changes reduce the error of the analog values to about 5mV, which
is tolerable.

Commits f0db5439757c ("spi: spi-davinci: Add support for SPI_CS_WORD")
and 91d8d6ab9f60 ("iio: adc: ti-ads7950: use SPI_CS_WORD to reduce
CPU usage") introduce changes that allow DMA transfers to be used, so
this slow down is needed now.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
arch/arm/boot/dts/da850-lego-ev3.dts