diff options
author | Trent Piepho <trent.piepho@synapse.com> | 2020-09-25 16:43:13 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-09-29 09:04:34 +0200 |
commit | 874b18607c5181530a64a0e02cf699efa5afcae4 (patch) | |
tree | f1b46052f2458ae2df1fb724f9410cec7a8e8796 /drivers/aiodev/Makefile | |
parent | 66195d63e85e56f9fc20b61c72f8f8cef57e18d8 (diff) | |
download | barebox-874b18607c5181530a64a0e02cf699efa5afcae4.tar.gz barebox-874b18607c5181530a64a0e02cf699efa5afcae4.tar.xz |
aiodev: am335x_adc: Driver for ADC on TI AM335x SoCs
This is a simple driver for the ADC. It's designed to get single
readings. Possible uses would be temperature sensing a thermistor,
measuring a power rail, or a detecting multi-level board ID pin
strapping.
It's not designed to co-exist with a touch screen controller driver,
which uses the same hardware on the AM335x, as there is no barebox
touchscreen driver.
The device tree binding is compatible with the Linux IIO driver.
This is from the Linux driver:
The ADC clock is expected to run at target of 3MHz, and expected to
capture 12-bit data at a rate of 200 KSPS. The TSC_ADC_SS
controller design assumes the OCP clock is at least 6x faster than
the ADC clock.
The OCP clock is 100 MHz, from CORE_CLKOUTM4/2. The AM335x Reference
Manual §12.2.2 gives a max ADC clock of 24 MHz. There's nothing about
the factor of 6x OCP to ADC, a 3 MHz ADC target, nor 200 kSPS. In
§12.3.7 a limit of at least 15 ADC clock cycles per sample is given.
The AM335x Datasheet §5.10 provides more parameters for the ADC: An ADC
clock max of 3 MHz, a nominal conversion time of 13 cycles, min and max
acquisition time of 2 to 257 cycles, and a max sample rate (@ 3 MHz) of
200 kSPS.
A 3 MHz ADC clock at 15 cycles per sample provides for a 200 kSPS
sampling rate. The minimum open, sampling, and conversion times are 0,
1, and 13 clocks, respectively. This would seem to indicate the
sampling at 14 cyles per sample is possible. Perhaps the "Sample Delay"
in the reference manual is called "Acquisition Time" in the datasheet,
and the reference manual minimum of 1 cycle is incorrect and the minimum
is actually 2 cycles. Which would then produce a minimum of 15 cycles
per sample.
This driver assumes the external references will be used (as does the
Linux IIO driver). This would have been good to put into the device
tree bindings, but the Linux driver's bindings did not do that.
The Barebox driver will convert the ADC reading to mV, and assumes the
external refs are GND and 1.8V. This also would have been nice to put
into the device tree binding. It also doesn't allow for automatically
adjusting for an external divider, commonly to measure power rails above
1.8V, e.g. the BeagleBone Black ain7 measures the 3.3V rail divided by
2.
Signed-off-by: Trent Piepho <trent.piepho@synapse.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/aiodev/Makefile')
-rw-r--r-- | drivers/aiodev/Makefile | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/aiodev/Makefile b/drivers/aiodev/Makefile index d5318deeb0..5f48b2022a 100644 --- a/drivers/aiodev/Makefile +++ b/drivers/aiodev/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o obj-$(CONFIG_LM75) += lm75.o obj-$(CONFIG_MC13XXX_ADC) += mc13xxx_adc.o obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o +obj-$(CONFIG_AM335X_ADC) += am335x_adc.o |