devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: ti_am335x_adc: Add optional DT properties for tscadc
@ 2015-03-31 11:12 Vignesh R
  2015-03-31 11:12 ` [PATCH 1/2] iio: adc: ti_am335x_adc: refactor DT parsing into a function Vignesh R
  2015-03-31 11:12 ` [PATCH 2/2] iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters Vignesh R
  0 siblings, 2 replies; 14+ messages in thread
From: Vignesh R @ 2015-03-31 11:12 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald,
	Dmitry Torokhov, Karol Wrona, Jan Kardell,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-iio-u79uwXL29TY76Z2rM5mHXA, fcooper-l0cyMroinI0, Vignesh R


Hi,

This patch adds optional DT properties for tscadc to set open delay,
sample delay and number of averages per sample for each adc channel.
Open delay, sample delay and averaging are some of the parameters that
affect the sampling rate and accuracy of the tscadc. Decreasing delays
and averaging helps to achieve higher sampling rates, while increasing
this parameters provides greater accuracy. Hence, this patch provides DT
properties to set the initial values for delays and number of averages
per sample. User space control via sysfs can be added later.


Vignesh R (2):
  iio: adc: ti_am335x_adc: refactor DT parsing into a function
  iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT
    parameters

 .../bindings/input/touchscreen/ti-tsc-adc.txt      | 24 +++++++
 drivers/iio/adc/ti_am335x_adc.c                    | 83 +++++++++++++++++-----
 2 files changed, 91 insertions(+), 16 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH 1/2] iio: adc: ti_am335x_adc: refactor DT parsing into a function
@ 2014-08-27 12:19 Vignesh R
  2014-08-27 12:19 ` [PATCH 2/2] iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters Vignesh R
  0 siblings, 1 reply; 14+ messages in thread
From: Vignesh R @ 2014-08-27 12:19 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Jonathan Cameron
  Cc: Randy Dunlap, Samuel Ortiz, Lee Jones, Felipe Balbi,
	Sebastian Andrzej Siewior, devicetree, linux-doc, linux-iio,
	Vignesh R

Refactor DT parsing into a seperate function from probe() to
help addition of more DT parameters later.

No functional changes.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/iio/adc/ti_am335x_adc.c |   29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
index 63b2bb6..dfb0db0 100644
--- a/drivers/iio/adc/ti_am335x_adc.c
+++ b/drivers/iio/adc/ti_am335x_adc.c
@@ -407,16 +407,30 @@ static const struct iio_info tiadc_info = {
 	.driver_module = THIS_MODULE,
 };
 
+static int tiadc_parse_dt(struct platform_device *pdev,
+				struct tiadc_device *adc_dev)
+{
+	struct device_node *node = pdev->dev.of_node;
+	struct property *prop;
+	const __be32 *cur;
+	int channels = 0;
+	u32 val;
+
+	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
+		adc_dev->channel_line[channels] = val;
+		channels++;
+	}
+
+	adc_dev->channels = channels;
+	return 0;
+}
+
 static int tiadc_probe(struct platform_device *pdev)
 {
 	struct iio_dev		*indio_dev;
 	struct tiadc_device	*adc_dev;
 	struct device_node	*node = pdev->dev.of_node;
-	struct property		*prop;
-	const __be32		*cur;
 	int			err;
-	u32			val;
-	int			channels = 0;
 
 	if (!node) {
 		dev_err(&pdev->dev, "Could not find valid DT data.\n");
@@ -432,12 +446,7 @@ static int tiadc_probe(struct platform_device *pdev)
 	adc_dev = iio_priv(indio_dev);
 
 	adc_dev->mfd_tscadc = ti_tscadc_dev_get(pdev);
-
-	of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) {
-		adc_dev->channel_line[channels] = val;
-		channels++;
-	}
-	adc_dev->channels = channels;
+	tiadc_parse_dt(pdev, adc_dev);
 
 	indio_dev->dev.parent = &pdev->dev;
 	indio_dev->name = dev_name(&pdev->dev);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-05-13 17:38 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 11:12 [PATCH 0/2] iio: ti_am335x_adc: Add optional DT properties for tscadc Vignesh R
2015-03-31 11:12 ` [PATCH 1/2] iio: adc: ti_am335x_adc: refactor DT parsing into a function Vignesh R
     [not found]   ` <1427800357-21680-2-git-send-email-vigneshr-l0cyMroinI0@public.gmane.org>
2015-04-09 14:13     ` Jonathan Cameron
2015-03-31 11:12 ` [PATCH 2/2] iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters Vignesh R
     [not found]   ` <1427800357-21680-3-git-send-email-vigneshr-l0cyMroinI0@public.gmane.org>
2015-04-09 14:19     ` Jonathan Cameron
2015-05-13  7:42       ` Vignesh R
     [not found]         ` <5553006B.1050306-l0cyMroinI0@public.gmane.org>
2015-05-13 17:38           ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2014-08-27 12:19 [PATCH 1/2] iio: adc: ti_am335x_adc: refactor DT parsing into a function Vignesh R
2014-08-27 12:19 ` [PATCH 2/2] iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters Vignesh R
     [not found]   ` <1409141990-29627-2-git-send-email-vigneshr-l0cyMroinI0@public.gmane.org>
2014-08-27 13:56     ` Lee Jones
2014-08-28  5:12       ` Vignesh R
2014-08-28  7:11         ` Lee Jones
2014-08-30  9:34           ` Jonathan Cameron
2014-08-30  9:43   ` Jonathan Cameron
2014-09-01  6:40     ` Vignesh R

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).