Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-12 Thread Jonathan Cameron
On 11/11/16 11:37, Peter Rosin wrote: > On 2016-11-09 16:06, Thomas Gleixner wrote: >> On Wed, 9 Nov 2016, Peter Rosin wrote: >>> On 2016-11-08 22:47, Thomas Gleixner wrote: I don't think you need extra race handling with that, but I might be wrong as usual. >>> >>> There's obviously no

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-12 Thread Jonathan Cameron
On 11/11/16 11:37, Peter Rosin wrote: > On 2016-11-09 16:06, Thomas Gleixner wrote: >> On Wed, 9 Nov 2016, Peter Rosin wrote: >>> On 2016-11-08 22:47, Thomas Gleixner wrote: I don't think you need extra race handling with that, but I might be wrong as usual. >>> >>> There's obviously no

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-12 Thread Jonathan Cameron
On 08/11/16 17:03, Peter Rosin wrote: > On 2016-11-08 16:59, Thomas Gleixner wrote: >> On Tue, 8 Nov 2016, Peter Rosin wrote: >>> +/* >>> + * The envelope_detector_comp_latch function works together with the >>> compare >>> + * interrupt service routine below (envelope_detector_comp_isr) as a

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-12 Thread Jonathan Cameron
On 08/11/16 17:03, Peter Rosin wrote: > On 2016-11-08 16:59, Thomas Gleixner wrote: >> On Tue, 8 Nov 2016, Peter Rosin wrote: >>> +/* >>> + * The envelope_detector_comp_latch function works together with the >>> compare >>> + * interrupt service routine below (envelope_detector_comp_isr) as a

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-11 Thread Peter Rosin
On 2016-11-09 16:06, Thomas Gleixner wrote: > On Wed, 9 Nov 2016, Peter Rosin wrote: >> On 2016-11-08 22:47, Thomas Gleixner wrote: >>> I don't think you need extra race handling with that, but I might be wrong >>> as usual. >> >> There's obviously no way to determine which of the timeout or the

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-11 Thread Peter Rosin
On 2016-11-09 16:06, Thomas Gleixner wrote: > On Wed, 9 Nov 2016, Peter Rosin wrote: >> On 2016-11-08 22:47, Thomas Gleixner wrote: >>> I don't think you need extra race handling with that, but I might be wrong >>> as usual. >> >> There's obviously no way to determine which of the timeout or the

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-09 Thread Thomas Gleixner
On Wed, 9 Nov 2016, Peter Rosin wrote: > On 2016-11-08 22:47, Thomas Gleixner wrote: > > I don't think you need extra race handling with that, but I might be wrong > > as usual. > > There's obviously no way to determine which of the timeout or the > interrupt that happens first without some race

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-09 Thread Thomas Gleixner
On Wed, 9 Nov 2016, Peter Rosin wrote: > On 2016-11-08 22:47, Thomas Gleixner wrote: > > I don't think you need extra race handling with that, but I might be wrong > > as usual. > > There's obviously no way to determine which of the timeout or the > interrupt that happens first without some race

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-09 Thread Peter Rosin
On 2016-11-08 22:47, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> So, to sum up, in order for this to work with threaded oneshot >> interrupts, I still need to either keep the enable/sync/enable-dance >> or tweak the irq core to handle my case better. The only gain would >>

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-09 Thread Peter Rosin
On 2016-11-08 22:47, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> So, to sum up, in order for this to work with threaded oneshot >> interrupts, I still need to either keep the enable/sync/enable-dance >> or tweak the irq core to handle my case better. The only gain would >>

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
On 2016-11-08 19:38, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> On 2016-11-08 16:59, Thomas Gleixner wrote: > >>> So you need that whole dance including the delayed work because you cannot >>> call iio_write_channel_raw() from hard interrupt context, right? >> >> It's not

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
On 2016-11-08 19:38, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> On 2016-11-08 16:59, Thomas Gleixner wrote: > >>> So you need that whole dance including the delayed work because you cannot >>> call iio_write_channel_raw() from hard interrupt context, right? >> >> It's not

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > So, to sum up, in order for this to work with threaded oneshot > interrupts, I still need to either keep the enable/sync/enable-dance > or tweak the irq core to handle my case better. The only gain would > be that I could fire the next step of the search

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > So, to sum up, in order for this to work with threaded oneshot > interrupts, I still need to either keep the enable/sync/enable-dance > or tweak the irq core to handle my case better. The only gain would > be that I could fire the next step of the search

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
On 2016-11-08 16:59, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> +/* >> + * The envelope_detector_comp_latch function works together with the compare >> + * interrupt service routine below (envelope_detector_comp_isr) as a latch >> + * (one-bit memory) for if the interrupt

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
On 2016-11-08 16:59, Thomas Gleixner wrote: > On Tue, 8 Nov 2016, Peter Rosin wrote: >> +/* >> + * The envelope_detector_comp_latch function works together with the compare >> + * interrupt service routine below (envelope_detector_comp_isr) as a latch >> + * (one-bit memory) for if the interrupt

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > On 2016-11-08 16:59, Thomas Gleixner wrote: > > So you need that whole dance including the delayed work because you cannot > > call iio_write_channel_raw() from hard interrupt context, right? > > It's not the "cannot call from hard irq context" that made

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > On 2016-11-08 16:59, Thomas Gleixner wrote: > > So you need that whole dance including the delayed work because you cannot > > call iio_write_channel_raw() from hard interrupt context, right? > > It's not the "cannot call from hard irq context" that made

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > +/* > + * The envelope_detector_comp_latch function works together with the compare > + * interrupt service routine below (envelope_detector_comp_isr) as a latch > + * (one-bit memory) for if the interrupt has triggered since last calling > + * this

Re: [PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Thomas Gleixner
On Tue, 8 Nov 2016, Peter Rosin wrote: > +/* > + * The envelope_detector_comp_latch function works together with the compare > + * interrupt service routine below (envelope_detector_comp_isr) as a latch > + * (one-bit memory) for if the interrupt has triggered since last calling > + * this

[PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
The DAC is used to find the peak level of an alternating voltage input signal by a binary search using the output of a comparator wired to an interrupt pin. Like so: _ | \ input +-->---|+ \ | \

[PATCH v4 8/8] iio: envelope-detector: ADC driver based on a DAC and a comparator

2016-11-08 Thread Peter Rosin
The DAC is used to find the peak level of an alternating voltage input signal by a binary search using the output of a comparator wired to an interrupt pin. Like so: _ | \ input +-->---|+ \ | \