Lines Matching refs:dma_st
408 struct at91_adc_dma dma_st; member
761 if (!st->dma_st.dma_chan) { in at91_adc_configure_trigger()
767 if (!st->dma_st.dma_chan) { in at91_adc_configure_trigger()
785 if (st->dma_st.dma_chan) in at91_adc_reenable_trigger()
807 status = dmaengine_tx_status(st->dma_st.dma_chan, in at91_adc_dma_size_done()
808 st->dma_st.dma_chan->cookie, in at91_adc_dma_size_done()
814 i = st->dma_st.rx_buf_sz - state.residue; in at91_adc_dma_size_done()
817 if (i >= st->dma_st.buf_idx) in at91_adc_dma_size_done()
818 size = i - st->dma_st.buf_idx; in at91_adc_dma_size_done()
820 size = st->dma_st.rx_buf_sz + i - st->dma_st.buf_idx; in at91_adc_dma_size_done()
839 if (!st->dma_st.dma_chan) in at91_adc_dma_start()
843 st->dma_st.buf_idx = 0; in at91_adc_dma_start()
849 st->dma_st.rx_buf_sz = 0; in at91_adc_dma_start()
859 st->dma_st.rx_buf_sz += chan->scan_type.storagebits / 8; in at91_adc_dma_start()
861 st->dma_st.rx_buf_sz *= st->dma_st.watermark; in at91_adc_dma_start()
864 desc = dmaengine_prep_dma_cyclic(st->dma_st.dma_chan, in at91_adc_dma_start()
865 st->dma_st.rx_dma_buf, in at91_adc_dma_start()
866 st->dma_st.rx_buf_sz, in at91_adc_dma_start()
867 st->dma_st.rx_buf_sz / 2, in at91_adc_dma_start()
882 dmaengine_terminate_async(st->dma_st.dma_chan); in at91_adc_dma_start()
889 dma_async_issue_pending(st->dma_st.dma_chan); in at91_adc_dma_start()
892 st->dma_st.dma_ts = iio_get_time_ns(indio_dev); in at91_adc_dma_start()
947 if (!st->dma_st.dma_chan) in at91_adc_buffer_predisable()
951 dmaengine_terminate_sync(st->dma_st.dma_chan); in at91_adc_buffer_predisable()
969 if (st->dma_st.dma_chan) in at91_adc_buffer_predisable()
1072 sample_size = div_s64(st->dma_st.rx_buf_sz, st->dma_st.watermark); in at91_adc_trigger_handler_dma()
1080 interval = div_s64((ns - st->dma_st.dma_ts), sample_count); in at91_adc_trigger_handler_dma()
1088 &st->dma_st.rx_buf[st->dma_st.buf_idx], in at91_adc_trigger_handler_dma()
1092 (st->dma_st.rx_buf + st->dma_st.buf_idx), in at91_adc_trigger_handler_dma()
1093 (st->dma_st.dma_ts + interval * sample_index)); in at91_adc_trigger_handler_dma()
1097 st->dma_st.buf_idx += sample_size; in at91_adc_trigger_handler_dma()
1099 if (st->dma_st.buf_idx >= st->dma_st.rx_buf_sz) in at91_adc_trigger_handler_dma()
1100 st->dma_st.buf_idx = 0; in at91_adc_trigger_handler_dma()
1104 st->dma_st.dma_ts = iio_get_time_ns(indio_dev); in at91_adc_trigger_handler_dma()
1113 if (st->dma_st.dma_chan) in at91_adc_trigger_handler()
1292 } else if (iio_buffer_enabled(indio) && !st->dma_st.dma_chan) { in at91_adc_interrupt()
1296 } else if (iio_buffer_enabled(indio) && st->dma_st.dma_chan) { in at91_adc_interrupt()
1472 if (st->dma_st.dma_chan) in at91_adc_dma_init()
1475 st->dma_st.dma_chan = dma_request_slave_channel(&pdev->dev, "rx"); in at91_adc_dma_init()
1477 if (!st->dma_st.dma_chan) { in at91_adc_dma_init()
1482 st->dma_st.rx_buf = dma_alloc_coherent(st->dma_st.dma_chan->device->dev, in at91_adc_dma_init()
1484 &st->dma_st.rx_dma_buf, in at91_adc_dma_init()
1486 if (!st->dma_st.rx_buf) { in at91_adc_dma_init()
1493 config.src_addr = (phys_addr_t)(st->dma_st.phys_addr in at91_adc_dma_init()
1499 if (dmaengine_slave_config(st->dma_st.dma_chan, &config)) { in at91_adc_dma_init()
1505 dma_chan_name(st->dma_st.dma_chan)); in at91_adc_dma_init()
1510 dma_free_coherent(st->dma_st.dma_chan->device->dev, pages * PAGE_SIZE, in at91_adc_dma_init()
1511 st->dma_st.rx_buf, st->dma_st.rx_dma_buf); in at91_adc_dma_init()
1513 dma_release_channel(st->dma_st.dma_chan); in at91_adc_dma_init()
1514 st->dma_st.dma_chan = 0; in at91_adc_dma_init()
1528 if (!st->dma_st.dma_chan) in at91_adc_dma_disable()
1532 dmaengine_terminate_sync(st->dma_st.dma_chan); in at91_adc_dma_disable()
1534 dma_free_coherent(st->dma_st.dma_chan->device->dev, pages * PAGE_SIZE, in at91_adc_dma_disable()
1535 st->dma_st.rx_buf, st->dma_st.rx_dma_buf); in at91_adc_dma_disable()
1536 dma_release_channel(st->dma_st.dma_chan); in at91_adc_dma_disable()
1537 st->dma_st.dma_chan = 0; in at91_adc_dma_disable()
1555 st->dma_st.watermark = val; in at91_adc_set_watermark()
1613 return scnprintf(buf, PAGE_SIZE, "%d\n", !!st->dma_st.dma_chan); in at91_adc_get_fifo_state()
1623 return scnprintf(buf, PAGE_SIZE, "%d\n", st->dma_st.watermark); in at91_adc_get_watermark()
1751 st->dma_st.phys_addr = res->start; in at91_adc_probe()
1820 st->dma_st.watermark = 1; in at91_adc_probe()