All dmaqueue's use saa7134_pgtable, so move it into struct saa7134_dmaqueue.
The videobuf_queue priv_data field now points to the dmaqueue struct.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_ALTERNATE,
sizeof(struct saa7134_buf),
- dev, NULL);
+ &dev->ts_q, NULL);
switch (dev->board) {
case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_ALTERNATE,
sizeof(struct saa7134_buf),
- dev, NULL);
+ &dev->ts_q, NULL);
empress_signal_update(&dev->empress_workqueue);
return 0;
static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
enum v4l2_field field)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb);
unsigned int lines, llength, size;
int err;
buf->vb.width = llength;
buf->vb.height = lines;
buf->vb.size = size;
- buf->pt = &dev->ts.pt_ts;
err = videobuf_iolock(q,&buf->vb,NULL);
if (err)
goto oops;
- err = saa7134_pgtable_build(dev->pci,buf->pt,
+ err = saa7134_pgtable_build(dev->pci, &dmaq->pt,
dma->sglist,
dma->sglen,
saa7134_buffer_startpage(buf));
static int
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
*size = TS_PACKET_SIZE * dev->ts.nr_packets;
if (0 == *count)
static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
saa7134_buffer_queue(dev,&dev->ts_q,buf);
static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
if (dev->ts_started)
saa7134_ts_stop(dev);
dev->ts_q.dev = dev;
dev->ts_q.need_two = 1;
dev->ts_started = 0;
- saa7134_pgtable_alloc(dev->pci, &dev->ts.pt_ts);
+ saa7134_pgtable_alloc(dev->pci, &dev->ts_q.pt);
/* init TS hw */
saa7134_ts_init_hw(dev);
saa_writel(SAA7134_RS_PITCH(5), TS_PACKET_SIZE);
saa_writel(SAA7134_RS_CONTROL(5), SAA7134_RS_CONTROL_BURST_16 |
SAA7134_RS_CONTROL_ME |
- (dev->ts.pt_ts.dma >> 12));
+ (dev->ts_q.pt.dma >> 12));
/* reset hardware TS buffers */
saa_writeb(SAA7134_TS_SERIAL1, 0x00);
int saa7134_ts_fini(struct saa7134_dev *dev)
{
- saa7134_pgtable_free(dev->pci, &dev->ts.pt_ts);
+ saa7134_pgtable_free(dev->pci, &dev->ts_q.pt);
return 0;
}
base = saa7134_buffer_base(buf);
control = SAA7134_RS_CONTROL_BURST_16 |
SAA7134_RS_CONTROL_ME |
- (buf->pt->dma >> 12);
+ (dev->vbi_q.pt.dma >> 12);
saa_writel(SAA7134_RS_BA1(2), base);
saa_writel(SAA7134_RS_BA2(2), base + dev->vbi_hlen * dev->vbi_vlen);
saa_writel(SAA7134_RS_PITCH(2), dev->vbi_hlen);
struct videobuf_buffer *vb,
enum v4l2_field field)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
unsigned int size;
int err;
buf->vb.width = dev->vbi_hlen;
buf->vb.height = dev->vbi_vlen;
buf->vb.size = size;
- buf->pt = &dev->pt_vbi;
err = videobuf_iolock(q,&buf->vb,NULL);
if (err)
goto oops;
- err = saa7134_pgtable_build(dev->pci,buf->pt,
+ err = saa7134_pgtable_build(dev->pci, &dmaq->pt,
dma->sglist,
dma->sglen,
saa7134_buffer_startpage(buf));
static int
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
dev->vbi_vlen = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 + 1;
if (dev->vbi_vlen > VBI_LINE_COUNT)
static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb);
saa7134_buffer_queue(dev,&dev->vbi_q,buf);
bpl = (buf->vb.width * dev->fmt->depth) / 8;
control = SAA7134_RS_CONTROL_BURST_16 |
SAA7134_RS_CONTROL_ME |
- (buf->pt->dma >> 12);
+ (dev->video_q.pt.dma >> 12);
if (dev->fmt->bswap)
control |= SAA7134_RS_CONTROL_BSWAP;
if (dev->fmt->wswap)
struct videobuf_buffer *vb,
enum v4l2_field field)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb);
unsigned int size;
int err;
buf->vb.height = dev->height;
buf->vb.size = size;
buf->vb.field = field;
- buf->pt = &dev->pt_cap;
dev->video_q.curr = NULL;
err = videobuf_iolock(q,&buf->vb,&dev->ovbuf);
if (err)
goto oops;
- err = saa7134_pgtable_build(dev->pci,buf->pt,
+ err = saa7134_pgtable_build(dev->pci, &dmaq->pt,
dma->sglist,
dma->sglen,
saa7134_buffer_startpage(buf));
static int
buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
*size = dev->fmt->depth * dev->width * dev->height >> 3;
if (0 == *count)
static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
{
- struct saa7134_dev *dev = q->priv_data;
+ struct saa7134_dmaqueue *dmaq = q->priv_data;
+ struct saa7134_dev *dev = dmaq->dev;
struct saa7134_buf *buf = container_of(vb, struct saa7134_buf, vb);
saa7134_buffer_queue(dev, &dev->video_q, buf);
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED,
sizeof(struct saa7134_buf),
- dev, NULL);
+ &dev->video_q, NULL);
videobuf_queue_sg_init(&dev->vbi_vbq, &saa7134_vbi_qops,
&dev->pci->dev, &dev->slock,
V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_FIELD_SEQ_TB,
sizeof(struct saa7134_buf),
- dev, NULL);
- saa7134_pgtable_alloc(dev->pci, &dev->pt_cap);
- saa7134_pgtable_alloc(dev->pci, &dev->pt_vbi);
+ &dev->vbi_q, NULL);
+ saa7134_pgtable_alloc(dev->pci, &dev->video_q.pt);
+ saa7134_pgtable_alloc(dev->pci, &dev->vbi_q.pt);
return 0;
}
void saa7134_video_fini(struct saa7134_dev *dev)
{
/* free stuff */
- saa7134_pgtable_free(dev->pci, &dev->pt_cap);
- saa7134_pgtable_free(dev->pci, &dev->pt_vbi);
+ saa7134_pgtable_free(dev->pci, &dev->video_q.pt);
+ saa7134_pgtable_free(dev->pci, &dev->vbi_q.pt);
v4l2_ctrl_handler_free(&dev->ctrl_handler);
if (card_has_radio(dev))
v4l2_ctrl_handler_free(&dev->radio_ctrl_handler);
int (*activate)(struct saa7134_dev *dev,
struct saa7134_buf *buf,
struct saa7134_buf *next);
-
- /* page tables */
- struct saa7134_pgtable *pt;
};
struct saa7134_dmaqueue {
struct list_head queue;
struct timer_list timeout;
unsigned int need_two;
+ struct saa7134_pgtable pt;
};
/* video filehandle status */
/* ts/mpeg status */
struct saa7134_ts {
/* TS capture */
- struct saa7134_pgtable pt_ts;
int nr_packets;
int nr_bufs;
};
/* video+ts+vbi capture */
struct saa7134_dmaqueue video_q;
- struct saa7134_pgtable pt_cap;
struct videobuf_queue video_vbq;
struct saa7134_dmaqueue vbi_q;
- struct saa7134_pgtable pt_vbi;
struct videobuf_queue vbi_vbq;
unsigned int video_fieldcount;
unsigned int vbi_fieldcount;