All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lo <dm81xx@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Subject: Re: continuous  mode driver for spi device with interrupt
Date: Wed, 31 Jul 2013 13:22:14 +0200	[thread overview]
Message-ID: <51F8F366.1090009@gmail.com> (raw)
In-Reply-To: <51F83DFE.6010107@kernel.org>

Hello Jonathan,
On 07/31/2013 12:28 AM, Jonathan Cameron wrote:
> On 07/30/13 20:55, Lo wrote:
[snip]
>>
>> Where my access funcs are:
>>      .preenable = &my_buffer_preenable,
>>      .postenable = &iio_triggered_buffer_postenable,
>>      .predisable = &iio_triggered_buffer_predisable,
>>      .postdisable = &my_buffer_postdisable
>> where:
>> preenable just sets iio->buffer->access->set_bytes_per_datum(iio->buffer, 19);
>
> The kfifo always contains aligned data. Hence it will be padded to the largest
> sized element.  The only way it would correctly be 19 would be to have 19 8 bit
> or lower channels.  Seems unlikely.  Also why doesn't the generic
> function work for your case?
>
I took a look at the dummy driver, I switched to the generic function.

>> and enables the irq
>> postenable disables the irq
>>
>> My irq handler does basically this:
>>      disable_irq_nosync(irq);
> Don't think you should need this if using the ONESHOT flag as it should be
> masked until handled. It's late here though so I might be completly wrong :)
>
Then I assume my irq handler should not return IRQ_HANDLED, but 
IRQ_WAKE_THREAD instead, right?

>>      iio_trigger_poll(adc->trig, iio_get_time_ns());
>>      return IRQ_HANDLED;
>>
>> My poll handler does this:
>>      ring->access->store_to(ring, (u8 *)data, pf->timestamp);
>>      iio_trigger_notify_done(iio->trig);
>>      enable_irq(adc->spi->irq);
>>      return IRQ_HANDLED;
> Looks fine.
> Take a look at the dummy driver (still in drivers/staging/iio) as that can be tested
> without any hardware. (iio_simple_dummy)
Thanks! that's what I need, but I kept looking in the adc related stuff.
I've compiled the dummy driver, but apparently my assumed way of using 
the buffer mode is wrong. My buffer length is 0, bytes per datum also.
I compiled the generic_buffer.c but don't know how to use that on the 
dummy device either. I can run it and by reading the source I saw I must 
pass the iiodevice name (./buftest -n iio_dummy_part_no ), but I've got 
no idea what I should pass as trigger argument. Btw: which arguments are 
required/optional?

--Lo



      reply	other threads:[~2013-07-31 11:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 19:55 continuous mode driver for spi device with interrupt Lo
2013-07-30 22:28 ` Jonathan Cameron
2013-07-31 11:22   ` Lo [this message]

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=51F8F366.1090009@gmail.com \
    --to=dm81xx@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    /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.