iio: at91_adc: Add missing CONFIG_OF macro

The data structure is required only when DT is enabled.
Hence compile it conditionally.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
iio: at91: fix adc_clk overflow

The adc_clk variable is currently defined using a 32-bits unsigned integer,
which will overflow under some very valid range of operations.

Such overflow will occur if, for example, the parent clock is set to a
20MHz frequency and the ADC startup time is larger than 215ns.

To fix this, introduce an intermediate variable holding the clock rate
in kHz.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
iio: at91: introduce the multiple compatible string for different IPs.

As use the multiple compatible string, we can remove hardware register in dt.

CC: devicetree@vger.kernel.org
Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91/dt: use correct compatible string for different soc

This patch also remove the hardware register parameters in dt

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: Use different prescal, startup mask in MR for different IP

For at91 boards, there are different IPs for adc. Different IPs has different
STARTUP & PRESCAL mask in ADC_MR.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: add hardware mr mask for prescal and startup

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: ADC start-up time calculation changed since at91sam9x5

Since in at91sam9x5, sama5d3x chip. the start up time calucation is changed.
This patch can choose different start up time calculation formula for different
chips.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: move the num_channels from DT to driver itself

CC: devicetree@vger.kernel.org
Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91/dt: remove adc-num-channels in dts file

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: introduce touch screen support in iio adc driver

AT91 ADC hardware integrate touch screen support. So this patch add touch
screen support for at91 adc iio driver.
To enable touch screen support in adc, you need to add the dt parameters:
  1. which type of touch are used? (4 or 5 wires), sample period time.
  2. correct pressure detect threshold value.

In the meantime, since touch screen will use a interal period trigger of adc,
so it is conflict to other hardware triggers. Driver will disable the hardware
trigger support if touch screen is enabled.

This driver has been tested in AT91SAM9X5-EK and SAMA5D3x-EK.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91: add an optional dt property for for adc clock hz (DON'T send to upstream)

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: sama5d3/dt: enable touchscreen in iio driver

Signed-off-by: Josh Wu <josh.wu@atmel.com>
iio: at91sam9x5/dt: enable iio touchscreen for 9x5ek

Signed-off-by: Josh Wu <josh.wu@atmel.com>
sama5d3: dt: remove tsadcc dts node as we use iio adc touch

Signed-off-by: Josh Wu <josh.wu@atmel.com>
at91sam9: update the dt_defconfig to enable at91 adc iio driver

Signed-off-by: Josh Wu <josh.wu@atmel.com>
Merge branch 'at91-3.10-trunk/v3.10_iio+touch' into linux-3.10-at91

Conflicts:
	arch/arm/boot/dts/sama5d3xdm.dtsi