ad788x: re-organize code (and fix memory leakage)

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
ad788x: split tx building in a new function

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
ad788x: bug fix of buffer overflow

BUG: when user read a single channel but all the other channel are
enable, then it occurs a buffer overflow on all the other chennels.
When the buffer is full ZIO does not assign chan->active_block. So, the
index in the local buffer are wrong.

If there is no active_block, the driver must not acquire data from the
correspondent channel.

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
ad788x: improve buf size calculation and comment

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
ad788x: add support to AD7476 1-chan ADC

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
zio: remove all pr_debug() from zio module

These prints are still present in drivers, triggers and buffer

Signed-off-by: Federico Vaga <federico.vaga@gmail.com>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
cset: provide a "BUSY" flag, set by hardware

There are some hardware operations that cannot be stopped, like
ongoing DMA, and we must prevent abort from freeing stuff while
in use.  This commit only adds the flag.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
zio_trigger_abort_disable(): wait for hardware operations

The hardware may be in uninterruptible operations, like writing in DMA
to the buffers. So we can't release stuff until the hardware is done.
We are in atomic context for sure, and the hardare is mandated to be
fast, so busy-wait for it.

The CSET_BUSY flag is set and cleared by the hardware driver,
with the cset lock taken.

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>
trivial: remove unused variable

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
Acked-by: Federico Vaga <federico.vaga@gmail.com>