Lines Matching +full:- +full:312

1 // SPDX-License-Identifier: GPL-2.0-or-later
11 #include "saa7134-reg.h"
19 /* ------------------------------------------------------------------ */
30 /* ------------------------------------------------------------------ */
37 buf->top_seen = 0; in buffer_activate()
39 if (!dev->ts_started) in buffer_activate()
40 dev->ts_field = V4L2_FIELD_TOP; in buffer_activate()
44 if (V4L2_FIELD_TOP == dev->ts_field) { in buffer_activate()
45 ts_dbg("- [top] buf=%p next=%p\n", buf, next); in buffer_activate()
48 dev->ts_field = V4L2_FIELD_BOTTOM; in buffer_activate()
50 ts_dbg("- [bottom] buf=%p next=%p\n", buf, next); in buffer_activate()
53 dev->ts_field = V4L2_FIELD_TOP; in buffer_activate()
59 mod_timer(&dev->ts_q.timeout, jiffies+TS_BUFFER_TIMEOUT); in buffer_activate()
61 if (!dev->ts_started) in buffer_activate()
70 struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv; in saa7134_ts_buffer_init()
73 dmaq->curr = NULL; in saa7134_ts_buffer_init()
74 buf->activate = buffer_activate; in saa7134_ts_buffer_init()
83 struct saa7134_dmaqueue *dmaq = vb2->vb2_queue->drv_priv; in saa7134_ts_buffer_prepare()
84 struct saa7134_dev *dev = dmaq->dev; in saa7134_ts_buffer_prepare()
92 lines = dev->ts.nr_packets; in saa7134_ts_buffer_prepare()
96 return -EINVAL; in saa7134_ts_buffer_prepare()
99 vbuf->field = dev->field; in saa7134_ts_buffer_prepare()
101 return saa7134_pgtable_build(dev->pci, &dmaq->pt, dma->sgl, dma->nents, in saa7134_ts_buffer_prepare()
110 struct saa7134_dmaqueue *dmaq = q->drv_priv; in saa7134_ts_queue_setup()
111 struct saa7134_dev *dev = dmaq->dev; in saa7134_ts_queue_setup()
112 int size = TS_PACKET_SIZE * dev->ts.nr_packets; in saa7134_ts_queue_setup()
115 *nbuffers = dev->ts.nr_bufs; in saa7134_ts_queue_setup()
127 struct saa7134_dmaqueue *dmaq = vq->drv_priv; in saa7134_ts_start_streaming()
128 struct saa7134_dev *dev = dmaq->dev; in saa7134_ts_start_streaming()
134 if (vb2_is_busy(&dev->video_vbq) && dev->fmt->planar) { in saa7134_ts_start_streaming()
137 list_for_each_entry_safe(buf, tmp, &dmaq->queue, entry) { in saa7134_ts_start_streaming()
138 list_del(&buf->entry); in saa7134_ts_start_streaming()
139 vb2_buffer_done(&buf->vb2.vb2_buf, in saa7134_ts_start_streaming()
142 if (dmaq->curr) { in saa7134_ts_start_streaming()
143 vb2_buffer_done(&dmaq->curr->vb2.vb2_buf, in saa7134_ts_start_streaming()
145 dmaq->curr = NULL; in saa7134_ts_start_streaming()
147 return -EBUSY; in saa7134_ts_start_streaming()
149 dmaq->seq_nr = 0; in saa7134_ts_start_streaming()
156 struct saa7134_dmaqueue *dmaq = vq->drv_priv; in saa7134_ts_stop_streaming()
157 struct saa7134_dev *dev = dmaq->dev; in saa7134_ts_stop_streaming()
175 /* ----------------------------------------------------------- */
180 MODULE_PARM_DESC(tsbufs, "number of ts buffers for read/write IO, range 2-32");
192 saa_writeb(SAA7134_TS_PARALLEL_SERIAL, (TS_PACKET_SIZE-1)); in saa7134_ts_init_hw()
193 saa_writeb(SAA7134_TS_DMA0, ((dev->ts.nr_packets-1)&0xff)); in saa7134_ts_init_hw()
194 saa_writeb(SAA7134_TS_DMA1, (((dev->ts.nr_packets-1)>>8)&0xff)); in saa7134_ts_init_hw()
197 ((((dev->ts.nr_packets-1)>>16)&0x3f) | 0x00)); in saa7134_ts_init_hw()
211 if (ts_nr_packets > 312) in saa7134_ts_init1()
212 ts_nr_packets = 312; in saa7134_ts_init1()
213 dev->ts.nr_bufs = tsbufs; in saa7134_ts_init1()
214 dev->ts.nr_packets = ts_nr_packets; in saa7134_ts_init1()
216 INIT_LIST_HEAD(&dev->ts_q.queue); in saa7134_ts_init1()
217 timer_setup(&dev->ts_q.timeout, saa7134_buffer_timeout, 0); in saa7134_ts_init1()
218 dev->ts_q.dev = dev; in saa7134_ts_init1()
219 dev->ts_q.need_two = 1; in saa7134_ts_init1()
220 dev->ts_started = 0; in saa7134_ts_init1()
221 saa7134_pgtable_alloc(dev->pci, &dev->ts_q.pt); in saa7134_ts_init1()
234 if (!dev->ts_started) in saa7134_ts_stop()
238 switch (saa7134_boards[dev->board].ts_type) { in saa7134_ts_stop()
241 dev->ts_started = 0; in saa7134_ts_stop()
245 dev->ts_started = 0; in saa7134_ts_stop()
256 if (WARN_ON(dev->ts_started)) in saa7134_ts_start()
260 saa_writeb(SAA7134_TS_DMA0, (dev->ts.nr_packets - 1) & 0xff); in saa7134_ts_start()
262 ((dev->ts.nr_packets - 1) >> 8) & 0xff); in saa7134_ts_start()
265 (((dev->ts.nr_packets - 1) >> 16) & 0x3f) | 0x00); in saa7134_ts_start()
269 (dev->ts_q.pt.dma >> 12)); in saa7134_ts_start()
277 /* TS clock non-inverted */ in saa7134_ts_start()
281 switch (saa7134_boards[dev->board].ts_type) { in saa7134_ts_start()
285 (saa7134_boards[dev->board].ts_force_val << 4)); in saa7134_ts_start()
290 (saa7134_boards[dev->board].ts_force_val << 4)); in saa7134_ts_start()
296 dev->ts_started = 1; in saa7134_ts_start()
303 del_timer_sync(&dev->ts_q.timeout); in saa7134_ts_fini()
304 saa7134_pgtable_free(dev->pci, &dev->ts_q.pt); in saa7134_ts_fini()
312 spin_lock(&dev->slock); in saa7134_irq_ts_done()
313 if (dev->ts_q.curr) { in saa7134_irq_ts_done()
314 field = dev->ts_field; in saa7134_irq_ts_done()
322 saa7134_buffer_finish(dev, &dev->ts_q, VB2_BUF_STATE_DONE); in saa7134_irq_ts_done()
324 saa7134_buffer_next(dev,&dev->ts_q); in saa7134_irq_ts_done()
327 spin_unlock(&dev->slock); in saa7134_irq_ts_done()