All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: getting started w/ iio driver
       [not found]         ` <38963561-8108-40CE-9B45-76672A860F0B@jic23.retrosnub.co.uk>
@ 2017-11-04 20:51           ` Enrico Weigelt, metux IT consult
  2017-11-10 23:50             ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Enrico Weigelt, metux IT consult @ 2017-11-04 20:51 UTC (permalink / raw)
  To: Jonathan Cameron, Jonathan Cameron; +Cc: linux-iio

On 04.11.2017 21:38, Jonathan Cameron wrote:

>> How should I implement the sampling rate setting w/ separate devices ?
>> Maybe some master-slave concept where settings on the master
>> automatically affect the slaves ?
> 
> Yes it will be a bit ugly. Probably do it as a set of peers where writing any will change them all.

Ok. By the way: how to set the sampling-rate via iio ?
Is there a callback or device field for that ?

where should i tell the adc to start capture w/ ?
in pre- or post-enable buffer ops ?


--mtx


-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@metux.net -- +49-151-27565287

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

* Re: getting started w/ iio driver
       [not found] <4d347c06-b53a-de3d-f8f1-8e05684a4ebd@metux.net>
       [not found] ` <20171103071702.00005355@huawei.com>
@ 2017-11-05  6:28 ` Phil Reid
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Reid @ 2017-11-05  6:28 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult, linux-iio

On 3/11/2017 11:12, Enrico Weigelt, metux IT consult wrote:
> Hi folks,
> 
> i'm currently developing an iio driver for a custom adc and looking for
> the optimal approach.
> 
> The device is made up of 3x 24bit-SD-ADCs and a fpga (as buffer+bridge)
> connected via EIM. All ADCs operate at the same (configurable, up to
> 500khz) sampling rate and each have their own hw buffer. For each buffer
> there's a separate interrupt line.
> 
> So, i'd need an irq handler, which fetches the data into a suitable
> buffer and push it into iio. is that what iio_triggered_buffer_setup()
> etc is for ? How does that relate to triggers ?
> 
I have something very similar. Multiple SD ADC's connected to an FPGA.

Multiple ADC channels clocked with common sample rate.

My approach was to have a master IIO device that controls common parameters
(sample rate etc) and an IIO device per channel.
I wanted the channel data to be separated into a separate stream and the
ability to start / stop channels independently.
The master device creates the child devices nd manages an interdependencies..

FGPA writes directly to memory buffers (FPGA is the DMA master)
The IIO system can provide a queue of memory buffers to fill.
And then in the hard IRQ it updates the target address.

I based the DMA stuff on Lars-Peter's dummy dma buffer example.
http://comments.gmane.org/gmane.linux.kernel.iio/20283

The dma buffer code is in mainline by I don't think the example driver is.




-- 
Regards
Phil Reid

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

* Re: getting started w/ iio driver
  2017-11-04 20:51           ` getting started w/ iio driver Enrico Weigelt, metux IT consult
@ 2017-11-10 23:50             ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2017-11-10 23:50 UTC (permalink / raw)
  To: Enrico Weigelt, metux IT consult; +Cc: Jonathan Cameron, linux-iio

On Sat, 4 Nov 2017 21:51:34 +0100
"Enrico Weigelt, metux IT consult" <info@metux.net> wrote:

> On 04.11.2017 21:38, Jonathan Cameron wrote:
> 
> >> How should I implement the sampling rate setting w/ separate devices ?
> >> Maybe some master-slave concept where settings on the master
> >> automatically affect the slaves ?  
> > 
> > Yes it will be a bit ugly. Probably do it as a set of peers where writing any will change them all.  

Sorry, been a busy week - now have beer and am on right side of airport security ;)
> 
> Ok. By the way: how to set the sampling-rate via iio ?
> Is there a callback or device field for that ?
Yes - the raw_write callback will do it but you will also need to
add the IIO_CHAN_SPEC_SAMP_FREQ bit to the appropriate 
infomask_shared_by*
> 

> where should i tell the adc to start capture w/ ?
> in pre- or post-enable buffer ops ?

Conceptually in the post-enable.  The pre / post divide is
rather vague now as it the original plan to do it nice and cleanly
was flawed by some race conditions.  Now they both occur in a very
similar state...
> 
> 
> --mtx
> 
> 


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

end of thread, other threads:[~2017-11-10 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4d347c06-b53a-de3d-f8f1-8e05684a4ebd@metux.net>
     [not found] ` <20171103071702.00005355@huawei.com>
     [not found]   ` <d470edd4-a67f-7e1f-91b6-41ae22aea762@metux.net>
     [not found]     ` <53418B0A3A5CEF439F1108674285B0A9014D15CC@lhreml523-mbs.china.huawei.com>
     [not found]       ` <be9b39c0-01c1-7c57-3103-b04727dff857@metux.net>
     [not found]         ` <38963561-8108-40CE-9B45-76672A860F0B@jic23.retrosnub.co.uk>
2017-11-04 20:51           ` getting started w/ iio driver Enrico Weigelt, metux IT consult
2017-11-10 23:50             ` Jonathan Cameron
2017-11-05  6:28 ` Phil Reid

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.