diff options
Diffstat (limited to 'drivers/media/pci/saa7134/saa7134.h')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134.h | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h index d8c612aa65e0..5f8307f7cc9a 100644 --- a/drivers/media/pci/saa7134/saa7134.h +++ b/drivers/media/pci/saa7134/saa7134.h | |||
@@ -41,11 +41,11 @@ | |||
41 | #include <media/tuner.h> | 41 | #include <media/tuner.h> |
42 | #include <media/rc-core.h> | 42 | #include <media/rc-core.h> |
43 | #include <media/ir-kbd-i2c.h> | 43 | #include <media/ir-kbd-i2c.h> |
44 | #include <media/videobuf-dma-sg.h> | 44 | #include <media/videobuf2-dma-sg.h> |
45 | #include <sound/core.h> | 45 | #include <sound/core.h> |
46 | #include <sound/pcm.h> | 46 | #include <sound/pcm.h> |
47 | #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) | 47 | #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) |
48 | #include <media/videobuf-dvb.h> | 48 | #include <media/videobuf2-dvb.h> |
49 | #endif | 49 | #endif |
50 | #include "tda8290.h" | 50 | #include "tda8290.h" |
51 | 51 | ||
@@ -453,13 +453,15 @@ struct saa7134_thread { | |||
453 | /* buffer for one video/vbi/ts frame */ | 453 | /* buffer for one video/vbi/ts frame */ |
454 | struct saa7134_buf { | 454 | struct saa7134_buf { |
455 | /* common v4l buffer stuff -- must be first */ | 455 | /* common v4l buffer stuff -- must be first */ |
456 | struct videobuf_buffer vb; | 456 | struct vb2_buffer vb2; |
457 | 457 | ||
458 | /* saa7134 specific */ | 458 | /* saa7134 specific */ |
459 | unsigned int top_seen; | 459 | unsigned int top_seen; |
460 | int (*activate)(struct saa7134_dev *dev, | 460 | int (*activate)(struct saa7134_dev *dev, |
461 | struct saa7134_buf *buf, | 461 | struct saa7134_buf *buf, |
462 | struct saa7134_buf *next); | 462 | struct saa7134_buf *next); |
463 | |||
464 | struct list_head entry; | ||
463 | }; | 465 | }; |
464 | 466 | ||
465 | struct saa7134_dmaqueue { | 467 | struct saa7134_dmaqueue { |
@@ -468,16 +470,10 @@ struct saa7134_dmaqueue { | |||
468 | struct list_head queue; | 470 | struct list_head queue; |
469 | struct timer_list timeout; | 471 | struct timer_list timeout; |
470 | unsigned int need_two; | 472 | unsigned int need_two; |
473 | unsigned int seq_nr; | ||
471 | struct saa7134_pgtable pt; | 474 | struct saa7134_pgtable pt; |
472 | }; | 475 | }; |
473 | 476 | ||
474 | /* video filehandle status */ | ||
475 | struct saa7134_fh { | ||
476 | struct v4l2_fh fh; | ||
477 | bool is_empress; | ||
478 | unsigned int resources; | ||
479 | }; | ||
480 | |||
481 | /* dmasound dsp status */ | 477 | /* dmasound dsp status */ |
482 | struct saa7134_dmasound { | 478 | struct saa7134_dmasound { |
483 | struct mutex lock; | 479 | struct mutex lock; |
@@ -583,20 +579,35 @@ struct saa7134_dev { | |||
583 | struct v4l2_window win; | 579 | struct v4l2_window win; |
584 | struct v4l2_clip clips[8]; | 580 | struct v4l2_clip clips[8]; |
585 | unsigned int nclips; | 581 | unsigned int nclips; |
582 | struct v4l2_fh *overlay_owner; | ||
586 | 583 | ||
587 | 584 | ||
588 | /* video+ts+vbi capture */ | 585 | /* video+ts+vbi capture */ |
589 | struct saa7134_dmaqueue video_q; | 586 | struct saa7134_dmaqueue video_q; |
590 | struct videobuf_queue video_vbq; | 587 | struct vb2_queue video_vbq; |
591 | struct saa7134_dmaqueue vbi_q; | 588 | struct saa7134_dmaqueue vbi_q; |
592 | struct videobuf_queue vbi_vbq; | 589 | struct vb2_queue vbi_vbq; |
593 | unsigned int video_fieldcount; | 590 | enum v4l2_field field; |
594 | unsigned int vbi_fieldcount; | ||
595 | struct saa7134_format *fmt; | 591 | struct saa7134_format *fmt; |
596 | unsigned int width, height; | 592 | unsigned int width, height; |
597 | unsigned int vbi_hlen, vbi_vlen; | 593 | unsigned int vbi_hlen, vbi_vlen; |
598 | struct pm_qos_request qos_request; | 594 | struct pm_qos_request qos_request; |
599 | 595 | ||
596 | /* SAA7134_MPEG_* */ | ||
597 | struct saa7134_ts ts; | ||
598 | struct saa7134_dmaqueue ts_q; | ||
599 | enum v4l2_field ts_field; | ||
600 | int ts_started; | ||
601 | struct saa7134_mpeg_ops *mops; | ||
602 | |||
603 | /* SAA7134_MPEG_EMPRESS only */ | ||
604 | struct video_device *empress_dev; | ||
605 | struct v4l2_subdev *empress_sd; | ||
606 | struct vb2_queue empress_vbq; | ||
607 | struct work_struct empress_workqueue; | ||
608 | int empress_started; | ||
609 | struct v4l2_ctrl_handler empress_ctrl_handler; | ||
610 | |||
600 | /* various v4l controls */ | 611 | /* various v4l controls */ |
601 | struct saa7134_tvnorm *tvnorm; /* video */ | 612 | struct saa7134_tvnorm *tvnorm; /* video */ |
602 | struct saa7134_tvaudio *tvaudio; | 613 | struct saa7134_tvaudio *tvaudio; |
@@ -633,23 +644,9 @@ struct saa7134_dev { | |||
633 | /* I2C keyboard data */ | 644 | /* I2C keyboard data */ |
634 | struct IR_i2c_init_data init_data; | 645 | struct IR_i2c_init_data init_data; |
635 | 646 | ||
636 | /* SAA7134_MPEG_* */ | ||
637 | struct saa7134_ts ts; | ||
638 | struct saa7134_dmaqueue ts_q; | ||
639 | int ts_started; | ||
640 | struct saa7134_mpeg_ops *mops; | ||
641 | |||
642 | /* SAA7134_MPEG_EMPRESS only */ | ||
643 | struct video_device *empress_dev; | ||
644 | struct v4l2_subdev *empress_sd; | ||
645 | struct videobuf_queue empress_vbq; | ||
646 | struct work_struct empress_workqueue; | ||
647 | int empress_started; | ||
648 | struct v4l2_ctrl_handler empress_ctrl_handler; | ||
649 | |||
650 | #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) | 647 | #if IS_ENABLED(CONFIG_VIDEO_SAA7134_DVB) |
651 | /* SAA7134_MPEG_DVB only */ | 648 | /* SAA7134_MPEG_DVB only */ |
652 | struct videobuf_dvb_frontends frontends; | 649 | struct vb2_dvb_frontends frontends; |
653 | int (*original_demod_sleep)(struct dvb_frontend *fe); | 650 | int (*original_demod_sleep)(struct dvb_frontend *fe); |
654 | int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); | 651 | int (*original_set_voltage)(struct dvb_frontend *fe, fe_sec_voltage_t voltage); |
655 | int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); | 652 | int (*original_set_high_voltage)(struct dvb_frontend *fe, long arg); |
@@ -703,14 +700,12 @@ struct saa7134_dev { | |||
703 | _rc; \ | 700 | _rc; \ |
704 | }) | 701 | }) |
705 | 702 | ||
706 | static inline int res_check(struct saa7134_fh *fh, unsigned int bit) | 703 | static inline bool is_empress(struct file *file) |
707 | { | 704 | { |
708 | return fh->resources & bit; | 705 | struct video_device *vdev = video_devdata(file); |
709 | } | 706 | struct saa7134_dev *dev = video_get_drvdata(vdev); |
710 | 707 | ||
711 | static inline int res_locked(struct saa7134_dev *dev, unsigned int bit) | 708 | return vdev->queue == &dev->empress_vbq; |
712 | { | ||
713 | return dev->resources & bit; | ||
714 | } | 709 | } |
715 | 710 | ||
716 | /* ----------------------------------------------------------- */ | 711 | /* ----------------------------------------------------------- */ |
@@ -741,7 +736,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, | |||
741 | unsigned int state); | 736 | unsigned int state); |
742 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); | 737 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); |
743 | void saa7134_buffer_timeout(unsigned long data); | 738 | void saa7134_buffer_timeout(unsigned long data); |
744 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); | 739 | void saa7134_stop_streaming(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); |
745 | 740 | ||
746 | int saa7134_set_dmabits(struct saa7134_dev *dev); | 741 | int saa7134_set_dmabits(struct saa7134_dev *dev); |
747 | 742 | ||
@@ -775,6 +770,10 @@ extern unsigned int video_debug; | |||
775 | extern struct video_device saa7134_video_template; | 770 | extern struct video_device saa7134_video_template; |
776 | extern struct video_device saa7134_radio_template; | 771 | extern struct video_device saa7134_radio_template; |
777 | 772 | ||
773 | void saa7134_vb2_buffer_queue(struct vb2_buffer *vb); | ||
774 | int saa7134_vb2_start_streaming(struct vb2_queue *vq, unsigned int count); | ||
775 | void saa7134_vb2_stop_streaming(struct vb2_queue *vq); | ||
776 | |||
778 | int saa7134_s_std(struct file *file, void *priv, v4l2_std_id id); | 777 | int saa7134_s_std(struct file *file, void *priv, v4l2_std_id id); |
779 | int saa7134_g_std(struct file *file, void *priv, v4l2_std_id *id); | 778 | int saa7134_g_std(struct file *file, void *priv, v4l2_std_id *id); |
780 | int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std); | 779 | int saa7134_querystd(struct file *file, void *priv, v4l2_std_id *std); |
@@ -791,16 +790,6 @@ int saa7134_g_frequency(struct file *file, void *priv, | |||
791 | struct v4l2_frequency *f); | 790 | struct v4l2_frequency *f); |
792 | int saa7134_s_frequency(struct file *file, void *priv, | 791 | int saa7134_s_frequency(struct file *file, void *priv, |
793 | const struct v4l2_frequency *f); | 792 | const struct v4l2_frequency *f); |
794 | int saa7134_reqbufs(struct file *file, void *priv, | ||
795 | struct v4l2_requestbuffers *p); | ||
796 | int saa7134_querybuf(struct file *file, void *priv, | ||
797 | struct v4l2_buffer *b); | ||
798 | int saa7134_qbuf(struct file *file, void *priv, struct v4l2_buffer *b); | ||
799 | int saa7134_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b); | ||
800 | int saa7134_streamon(struct file *file, void *priv, | ||
801 | enum v4l2_buf_type type); | ||
802 | int saa7134_streamoff(struct file *file, void *priv, | ||
803 | enum v4l2_buf_type type); | ||
804 | 793 | ||
805 | int saa7134_videoport_init(struct saa7134_dev *dev); | 794 | int saa7134_videoport_init(struct saa7134_dev *dev); |
806 | void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); | 795 | void saa7134_set_tvnorm_hw(struct saa7134_dev *dev); |
@@ -817,7 +806,16 @@ void saa7134_video_fini(struct saa7134_dev *dev); | |||
817 | 806 | ||
818 | #define TS_PACKET_SIZE 188 /* TS packets 188 bytes */ | 807 | #define TS_PACKET_SIZE 188 /* TS packets 188 bytes */ |
819 | 808 | ||
820 | extern struct videobuf_queue_ops saa7134_ts_qops; | 809 | int saa7134_ts_buffer_init(struct vb2_buffer *vb2); |
810 | int saa7134_ts_buffer_prepare(struct vb2_buffer *vb2); | ||
811 | void saa7134_ts_buffer_finish(struct vb2_buffer *vb2); | ||
812 | int saa7134_ts_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt, | ||
813 | unsigned int *nbuffers, unsigned int *nplanes, | ||
814 | unsigned int sizes[], void *alloc_ctxs[]); | ||
815 | int saa7134_ts_start_streaming(struct vb2_queue *vq, unsigned int count); | ||
816 | void saa7134_ts_stop_streaming(struct vb2_queue *vq); | ||
817 | |||
818 | extern struct vb2_ops saa7134_ts_qops; | ||
821 | 819 | ||
822 | int saa7134_ts_init1(struct saa7134_dev *dev); | 820 | int saa7134_ts_init1(struct saa7134_dev *dev); |
823 | int saa7134_ts_fini(struct saa7134_dev *dev); | 821 | int saa7134_ts_fini(struct saa7134_dev *dev); |
@@ -834,7 +832,7 @@ int saa7134_ts_stop(struct saa7134_dev *dev); | |||
834 | /* ----------------------------------------------------------- */ | 832 | /* ----------------------------------------------------------- */ |
835 | /* saa7134-vbi.c */ | 833 | /* saa7134-vbi.c */ |
836 | 834 | ||
837 | extern struct videobuf_queue_ops saa7134_vbi_qops; | 835 | extern struct vb2_ops saa7134_vbi_qops; |
838 | extern struct video_device saa7134_vbi_template; | 836 | extern struct video_device saa7134_vbi_template; |
839 | 837 | ||
840 | int saa7134_vbi_init1(struct saa7134_dev *dev); | 838 | int saa7134_vbi_init1(struct saa7134_dev *dev); |