Re: [PATCH 2/2] iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 27 Aug 2014, Vignesh R wrote:

> Number of averaging, open delay, sample delay are made DT parameters.
> By decreasing averaging and delays more samples can be obtained per
> second increasing performance of ADC. Previously the number of
> averages per step was fixed to 16. Making these parameters
> configurable will help in balancing speed vs accuracy.
> For each ADC step provide DT based paramters to set open delay,
> sample delay and number of averaging. One configurable step is
> used per ADC channel. Since there can be atmost 8 ADC channels,
> steps 16 to 8 are used for ADC.
> 
> Signed-off-by: Vignesh R <vigneshr@xxxxxx>
> ---
>  .../bindings/input/touchscreen/ti-tsc-adc.txt      |   18 +++++++
>  drivers/iio/adc/ti_am335x_adc.c                    |   49 +++++++++++++++++---
>  include/linux/mfd/ti_am335x_tscadc.h               |    3 ++
>  3 files changed, 63 insertions(+), 7 deletions(-)

[...]

> diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
> index fb96c84..26d3e84 100644
> --- a/include/linux/mfd/ti_am335x_tscadc.h
> +++ b/include/linux/mfd/ti_am335x_tscadc.h
> @@ -82,14 +82,17 @@

There are so many different formats at play here, it's difficult to
see what's happening where!

>  #define STEPCONFIG_INP_AN4	STEPCONFIG_INP(4)
>  #define STEPCONFIG_INP_ADCREFM	STEPCONFIG_INP(8)
>  #define STEPCONFIG_FIFO1	BIT(26)
> +#define STEPCONFIG_AVG_MAX	16
>  
>  /* Delay register */
>  #define STEPDELAY_OPEN_MASK	(0x3FFFF << 0)
>  #define STEPDELAY_OPEN(val)	((val) << 0)

What's the point in shifting by zero?

>  #define STEPCONFIG_OPENDLY	STEPDELAY_OPEN(0x098)
> +#define STEPDELAY_OPEN_MAX	0x3FFFF

Put this up the top, then you can use it when defining
STEPDELAY_OPEN_MASK.

>  #define STEPDELAY_SAMPLE_MASK	(0xFF << 24)
>  #define STEPDELAY_SAMPLE(val)	((val) << 24)
>  #define STEPCONFIG_SAMPLEDLY	STEPDELAY_SAMPLE(0)
> +#define STEPDELAY_SAMPLE_MAX	0xFF

>  /* Charge Config */
>  #define STEPCHARGE_RFP_MASK	(7 << 12)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux