All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zubair Lutfullah :" <zubair.lutfullah@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Jan Kardell <jan.kardell@telliq.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-iio@vger.kernel.org, linux-omap@vger.kernel.org,
	Rachna Patil <rachna@ti.com>,
	Zubair Lutfullah: zubair.lutfullah@gmail.com
Subject: Re: [PATCH] iio: ti_am335x_adc: Use same step id at FIFOs both ends
Date: Sat, 21 Jun 2014 11:26:59 +0100	[thread overview]
Message-ID: <20140621102658.GA5177@gmail.com> (raw)
In-Reply-To: <53A555A7.7070800@kernel.org>

On Sat, Jun 21, 2014 at 10:51:35AM +0100, Jonathan Cameron wrote:
> On 11/06/14 22:18, Jan Kardell wrote:
> >Since AI lines could be selected at will (linux-3.11) the sending
> >and receiving ends of the FIFO does not agree about what step is used
> >for a line. It only works if the last lines are used, like 5,6,7,
> >and fails if ie 2,4,6 is selected in DT.
> >
> >Signed-off-by: Jan Kardell <jan.kardell@telliq.com>
> I'd like an ack / review from someone more familiar with this part than I
> am. I have cc'd a few people who might offer a view.

Been a while since I've seen this driver.
I'll try a bit..

> 
> Thanks,
> 
> Jonathan (IIO maintainer)
> >---
> >  drivers/iio/adc/ti_am335x_adc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
> >index a4db302..d5dc4c6 100644
> >--- a/drivers/iio/adc/ti_am335x_adc.c
> >+++ b/drivers/iio/adc/ti_am335x_adc.c
> >@@ -374,7 +374,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev,
> >  			return -EAGAIN;
> >  		}
> >  	}
> >-	map_val = chan->channel + TOTAL_CHANNELS;
> >+	map_val = adc_dev->channel_step[chan->scan_index];

Looking at the code again.
Could you tell me if using map_val = step_en will work?

Checking TRM, the channel ID is written with step id.
And if i am not mistaken, step id is already stored in step_en.
That is the step we enable for sampling.
Would make sense to check fifo for that step no?

something like

@@ -324,7 +324,7 @@
 		int *val, int *val2, long mask)
 {
 	struct tiadc_device *adc_dev = iio_priv(indio_dev);
-	int i, map_val;
+	int i;
 	unsigned int fifo1count, read, stepid;
 	bool found = false;
 	u32 step_en;
@@ -342,7 +342,6 @@
 		if (time_after(jiffies, timeout))
 			return -EAGAIN;
 		}
-	map_val = chan->channel + TOTAL_CHANNELS;
 
 	/*
 	 * When the sub-system is first enabled,
@@ -361,7 +360,7 @@
 		stepid = read & FIFOREAD_CHNLID_MASK;
 		stepid = stepid >> 0x10;
 
-		if (stepid == map_val) {
+		if (stepid == step_en) {
 			read = read & FIFOREAD_DATA_MASK;
 			found = true;
 			*val = (u16) read;


Cheers
ZubairLK



> >
> >  	/*
> >  	 * We check the complete FIFO. We programmed just one entry but in case
> >
> 

  parent reply	other threads:[~2014-06-21 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 21:18 [PATCH] iio: ti_am335x_adc: Use same step id at FIFOs both ends Jan Kardell
2014-06-11 21:18 ` Jan Kardell
     [not found] ` <53A555A7.7070800@kernel.org>
2014-06-21 10:26   ` Zubair Lutfullah : [this message]
2014-06-23 10:58     ` Jan Kardell
     [not found]       ` <53BAD468.8090908@kernel.org>
2014-07-08 18:53         ` Zubair Lutfullah :

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140621102658.GA5177@gmail.com \
    --to=zubair.lutfullah@gmail.com \
    --cc=bigeasy@linutronix.de \
    --cc=jan.kardell@telliq.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rachna@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.