diff options
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134.h')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134.h | 108 |
1 files changed, 53 insertions, 55 deletions
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index 2474e848f2c0..e47edd4b57ce 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h @@ -41,11 +41,11 @@ #include <media/tuner.h> #include <media/rc-core.h> #include <media/ir-kbd-i2c.h> -#include <media/videobuf-dma-sg.h> +#include <media/videobuf2-dma-sg.h> #include <sound/core.h> #include <sound/pcm.h> #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) -#include <media/videobuf-dvb.h> +#include <media/videobuf2-dvb.h> #endif #include "tda8290.h" @@ -453,17 +453,15 @@ struct saa7134_thread { /* buffer for one video/vbi/ts frame */ struct saa7134_buf { /* common v4l buffer stuff -- must be first */ - struct videobuf_buffer vb; + struct vb2_buffer vb2; /* saa7134 specific */ - struct saa7134_format *fmt; unsigned int top_seen; int (*activate)(struct saa7134_dev *dev, struct saa7134_buf *buf, struct saa7134_buf *next); - /* page tables */ - struct saa7134_pgtable *pt; + struct list_head entry; }; struct saa7134_dmaqueue { @@ -472,13 +470,8 @@ struct saa7134_dmaqueue { struct list_head queue; struct timer_list timeout; unsigned int need_two; -}; - -/* video filehandle status */ -struct saa7134_fh { - struct v4l2_fh fh; - bool is_empress; - unsigned int resources; + unsigned int seq_nr; + struct saa7134_pgtable pt; }; /* dmasound dsp status */ @@ -504,7 +497,10 @@ struct saa7134_dmasound { unsigned int blksize; unsigned int bufsize; struct saa7134_pgtable pt; - struct videobuf_dmabuf dma; + void *vaddr; + struct scatterlist *sglist; + int sglen; + int nr_pages; unsigned int dma_blk; unsigned int read_offset; unsigned int read_count; @@ -515,7 +511,6 @@ struct saa7134_dmasound { /* ts/mpeg status */ struct saa7134_ts { /* TS capture */ - struct saa7134_pgtable pt_ts; int nr_packets; int nr_bufs; }; @@ -584,21 +579,35 @@ struct saa7134_dev { struct v4l2_window win; struct v4l2_clip clips[8]; unsigned int nclips; + struct v4l2_fh *overlay_owner; /* video+ts+vbi capture */ struct saa7134_dmaqueue video_q; - struct videobuf_queue cap; - struct saa7134_pgtable pt_cap; + struct vb2_queue video_vbq; struct saa7134_dmaqueue vbi_q; - struct videobuf_queue vbi; - struct saa7134_pgtable pt_vbi; - unsigned int video_fieldcount; - unsigned int vbi_fieldcount; + struct vb2_queue vbi_vbq; + enum v4l2_field field; struct saa7134_format *fmt; unsigned int width, height; + unsigned int vbi_hlen, vbi_vlen; struct pm_qos_request qos_request; + /* SAA7134_MPEG_* */ + struct saa7134_ts ts; + struct saa7134_dmaqueue ts_q; + enum v4l2_field ts_field; + int ts_started; + struct saa7134_mpeg_ops *mops; + + /* SAA7134_MPEG_EMPRESS only */ + struct video_device *empress_dev; + struct v4l2_subdev *empress_sd; + struct vb2_queue empress_vbq; + struct work_struct empress_workqueue; + int empress_started; + struct v4l2_ctrl_handler empress_ctrl_handler; + /* various v4l controls */ struct saa7134_tvnorm *tvnorm; /* video */ struct saa7134_tvaudio *tvaudio; @@ -635,23 +644,9 @@ struct saa7134_dev { /* I2C keyboard data */ struct IR_i2c_init_data init_data; - /* SAA7134_MPEG_* */ - struct saa7134_ts ts; - struct saa7134_dmaqueue ts_q; - int ts_started; - struct saa7134_mpeg_ops *mops; - - /* SAA7134_MPEG_EMPRESS only */ - struct video_device *empress_dev; - struct v4l2_subdev *empress_sd; - struct videobuf_queue empress_tsq; - struct work_struct empress_workqueue; - int empress_started; - struct v4l2_ctrl_handler empress_ctrl_handler; - #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) /* SAA7134_MPEG_DVB only */ - struct videobuf_dvb_frontends frontends; + struct vb2_dvb_frontends frontends; int (*original_demod_sleep)(struct dvb_frontend *fe); int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); @@ -705,14 +700,12 @@ struct saa7134_dev { _rc; \ }) -static inline int res_check(struct saa7134_fh *fh, unsigned int bit) +static inline bool is_empress(struct file *file) { - return fh->resources & bit; -} + struct video_device *vdev = video_devdata(file); + struct saa7134_dev *dev = video_get_drvdata(vdev); -static inline int res_locked(struct saa7134_dev *dev, unsigned int bit) -{ - return dev->resources & bit; + return vdev->queue == &dev->empress_vbq; } /* ----------------------------------------------------------- */ @@ -721,6 +714,7 @@ static inline int res_locked(struct saa7134_dev *dev, unsigned int bit) extern struct list_head saa7134_devlist; extern struct mutex saa7134_devlist_lock; extern int saa7134_no_overlay; +extern bool saa7134_userptr; void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value); @@ -743,7 +737,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, unsigned int state); void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_buffer_timeout(unsigned long data); -void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); +void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); int saa7134_set_dmabits(struct saa7134_dev *dev); @@ -777,8 +771,13 @@ extern unsigned int video_debug; extern struct video_device saa7134_video_template; extern struct video_device saa7134_radio_template; +void saa7134_vb2_buffer_queue(struct vb2_buffer *vb); +int saa7134_vb2_start_streaming(struct vb2_queue *vq, unsigned int count); +void saa7134_vb2_stop_streaming(struct vb2_queue *vq); + int saa7134_s_std(struct file *file, void *priv, v4l2_std_id id); int saa7134_g_std(struct file *file, void *priv, v4l2_std_id *id); +int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std); int saa7134_enum_input(struct file *file, void *priv, struct v4l2_input *i); int saa7134_g_input(struct file *file, void *priv, unsigned int *i); int saa7134_s_input(struct file *file, void *priv, unsigned int i); @@ -792,16 +791,6 @@ int saa7134_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f); int saa7134_s_frequency(struct file *file, void *priv, const struct v4l2_frequency *f); -int saa7134_reqbufs(struct file *file, void *priv, - struct v4l2_requestbuffers *p); -int saa7134_querybuf(struct file *file, void *priv, - struct v4l2_buffer *b); -int saa7134_qbuf(struct file *file, void *priv, struct v4l2_buffer *b); -int saa7134_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b); -int saa7134_streamon(struct file *file, void *priv, - enum v4l2_buf_type type); -int saa7134_streamoff(struct file *file, void *priv, - enum v4l2_buf_type type); int saa7134_videoport_init(struct saa7134_dev *dev); void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); @@ -818,7 +807,16 @@ void saa7134_video_fini(struct saa7134_dev *dev); #define TS_PACKET_SIZE 188 /* TS packets 188 bytes */ -extern struct videobuf_queue_ops saa7134_ts_qops; +int saa7134_ts_buffer_init(struct vb2_buffer *vb2); +int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2); +void saa7134_ts_buffer_finish(struct vb2_buffer *vb2); +int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, + unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], void *alloc_ctxs[]); +int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count); +void saa7134_ts_stop_streaming(struct vb2_queue *vq); + +extern struct vb2_ops saa7134_ts_qops; int saa7134_ts_init1(struct saa7134_dev *dev); int saa7134_ts_fini(struct saa7134_dev *dev); @@ -835,7 +833,7 @@ int saa7134_ts_stop(struct saa7134_dev *dev); /* ----------------------------------------------------------- */ /* saa7134-vbi.c */ -extern struct videobuf_queue_ops saa7134_vbi_qops; +extern struct vb2_ops saa7134_vbi_qops; extern struct video_device saa7134_vbi_template; int saa7134_vbi_init1(struct saa7134_dev *dev); |