diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-queue.h')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-queue.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/media/video/ivtv/ivtv-queue.h b/drivers/media/video/ivtv/ivtv-queue.h index 903edd4b4381..2ed8d548255d 100644 --- a/drivers/media/video/ivtv/ivtv-queue.h +++ b/drivers/media/video/ivtv/ivtv-queue.h | |||
@@ -20,18 +20,43 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define IVTV_DMA_UNMAPPED ((u32) -1) | 22 | #define IVTV_DMA_UNMAPPED ((u32) -1) |
23 | #define SLICED_VBI_PIO 1 | ||
23 | 24 | ||
24 | /* ivtv_buffer utility functions */ | 25 | /* ivtv_buffer utility functions */ |
26 | |||
27 | static inline int ivtv_might_use_pio(struct ivtv_stream *s) | ||
28 | { | ||
29 | return s->dma == PCI_DMA_NONE || (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI); | ||
30 | } | ||
31 | |||
32 | static inline int ivtv_use_pio(struct ivtv_stream *s) | ||
33 | { | ||
34 | struct ivtv *itv = s->itv; | ||
35 | |||
36 | return s->dma == PCI_DMA_NONE || | ||
37 | (SLICED_VBI_PIO && s->type == IVTV_ENC_STREAM_TYPE_VBI && itv->vbi.sliced_in->service_set); | ||
38 | } | ||
39 | |||
40 | static inline int ivtv_might_use_dma(struct ivtv_stream *s) | ||
41 | { | ||
42 | return s->dma != PCI_DMA_NONE; | ||
43 | } | ||
44 | |||
45 | static inline int ivtv_use_dma(struct ivtv_stream *s) | ||
46 | { | ||
47 | return !ivtv_use_pio(s); | ||
48 | } | ||
49 | |||
25 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) | 50 | static inline void ivtv_buf_sync_for_cpu(struct ivtv_stream *s, struct ivtv_buffer *buf) |
26 | { | 51 | { |
27 | if (s->dma != PCI_DMA_NONE) | 52 | if (ivtv_use_dma(s)) |
28 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, | 53 | pci_dma_sync_single_for_cpu(s->itv->dev, buf->dma_handle, |
29 | s->buf_size + 256, s->dma); | 54 | s->buf_size + 256, s->dma); |
30 | } | 55 | } |
31 | 56 | ||
32 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) | 57 | static inline void ivtv_buf_sync_for_device(struct ivtv_stream *s, struct ivtv_buffer *buf) |
33 | { | 58 | { |
34 | if (s->dma != PCI_DMA_NONE) | 59 | if (ivtv_use_dma(s)) |
35 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, | 60 | pci_dma_sync_single_for_device(s->itv->dev, buf->dma_handle, |
36 | s->buf_size + 256, s->dma); | 61 | s->buf_size + 256, s->dma); |
37 | } | 62 | } |
@@ -53,12 +78,14 @@ void ivtv_stream_free(struct ivtv_stream *s); | |||
53 | 78 | ||
54 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) | 79 | static inline void ivtv_stream_sync_for_cpu(struct ivtv_stream *s) |
55 | { | 80 | { |
56 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, | 81 | if (ivtv_use_dma(s)) |
57 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 82 | pci_dma_sync_single_for_cpu(s->itv->dev, s->SG_handle, |
83 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
58 | } | 84 | } |
59 | 85 | ||
60 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) | 86 | static inline void ivtv_stream_sync_for_device(struct ivtv_stream *s) |
61 | { | 87 | { |
62 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, | 88 | if (ivtv_use_dma(s)) |
63 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | 89 | pci_dma_sync_single_for_device(s->itv->dev, s->SG_handle, |
90 | sizeof(struct ivtv_SG_element) * s->buffers, PCI_DMA_TODEVICE); | ||
64 | } | 91 | } |