--- zzzz-none-000/linux-3.10.107/drivers/media/usb/au0828/au0828.h 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/usb/au0828/au0828.h 2021-02-04 17:41:59.000000000 +0000 @@ -19,6 +19,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include #include #include #include @@ -26,7 +29,8 @@ /* Analog */ #include -#include +#include +#include #include #include #include @@ -42,7 +46,6 @@ #include "au0828-reg.h" #include "au0828-cards.h" -#define DRIVER_NAME "au0828" #define URB_COUNT 16 #define URB_BUFSIZE (0xe522) @@ -88,6 +91,8 @@ unsigned int tuner_type; unsigned char tuner_addr; unsigned char i2c_clk_divider; + unsigned char has_ir_i2c:1; + unsigned char has_analog:1; struct au0828_input input[AU0828_MAX_INPUT]; }; @@ -102,6 +107,10 @@ struct dmx_frontend fe_mem; struct dvb_net net; int feeding; + int start_count; + int stop_count; + + int (*set_frontend)(struct dvb_frontend *fe); }; enum au0828_stream_state { @@ -114,22 +123,12 @@ /* device state */ enum au0828_dev_state { - DEV_INITIALIZED = 0x01, - DEV_DISCONNECTED = 0x02, - DEV_MISCONFIGURED = 0x04 + DEV_INITIALIZED = 0, + DEV_DISCONNECTED = 1, + DEV_MISCONFIGURED = 2 }; -struct au0828_fh { - /* must be the first field of this struct! */ - struct v4l2_fh fh; - - struct au0828_dev *dev; - unsigned int resources; - - struct videobuf_queue vb_vidq; - struct videobuf_queue vb_vbiq; - enum v4l2_buf_type type; -}; +struct au0828_dev; struct au0828_usb_isoc_ctl { /* max packet size of isoc transaction */ @@ -170,21 +169,20 @@ /* buffer for one video frame */ struct au0828_buffer { /* common v4l buffer stuff -- must be first */ - struct videobuf_buffer vb; + struct vb2_v4l2_buffer vb; + struct list_head list; - struct list_head frame; + void *mem; + unsigned long length; int top_field; - int receiving; + /* pointer to vmalloc memory address in vb */ + char *vb_buf; }; struct au0828_dmaqueue { struct list_head active; - struct list_head queued; - - wait_queue_head_t wq; - /* Counters to control buffer fill */ - int pos; + int pos; }; struct au0828_dev { @@ -209,14 +207,30 @@ struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler v4l2_ctrl_hdl; #endif - int users; - unsigned int resources; /* resources in use */ - struct video_device *vdev; - struct video_device *vbi_dev; +#ifdef CONFIG_VIDEO_AU0828_RC + struct au0828_rc *ir; +#endif + + struct video_device vdev; + struct video_device vbi_dev; + + /* Videobuf2 */ + struct vb2_queue vb_vidq; + struct vb2_queue vb_vbiq; + struct mutex vb_queue_lock; + struct mutex vb_vbi_queue_lock; + + unsigned int frame_count; + unsigned int vbi_frame_count; + struct timer_list vid_timeout; int vid_timeout_running; struct timer_list vbi_timeout; int vbi_timeout_running; + + int users; + int streaming_users; + int width; int height; int vbi_width; @@ -231,12 +245,11 @@ __u8 isoc_in_endpointaddr; u8 isoc_init_ok; int greenscreen_detected; - unsigned int frame_count; int ctrl_freq; int input_type; int std_set_in_tuner_core; unsigned int ctrl_input; - enum au0828_dev_state dev_state; + long unsigned int dev_state; /* defined at enum au0828_dev_state */; enum au0828_stream_state stream_state; wait_queue_head_t open; @@ -257,11 +270,16 @@ char *transfer_buffer[AU0828_MAX_ISO_BUFS];/* transfer buffers for isoc transfer */ - /* USB / URB Related */ - int urb_streaming; + /* DVB USB / URB Related */ + bool urb_streaming, need_urb_start; struct urb *urbs[URB_COUNT]; + + /* Preallocated transfer digital transfer buffers */ + + char *dig_transfer_buffer[URB_COUNT]; }; + /* ----------------------------------------------------------- */ #define au0828_read(dev, reg) au0828_readreg(dev, reg) #define au0828_write(dev, reg, value) au0828_writereg(dev, reg, value) @@ -294,20 +312,44 @@ /* ----------------------------------------------------------- */ /* au0828-video.c */ -int au0828_analog_register(struct au0828_dev *dev, +extern int au0828_analog_register(struct au0828_dev *dev, struct usb_interface *interface); -int au0828_analog_stream_disable(struct au0828_dev *d); -void au0828_analog_unregister(struct au0828_dev *dev); +extern void au0828_analog_unregister(struct au0828_dev *dev); +extern int au0828_start_analog_streaming(struct vb2_queue *vq, + unsigned int count); +extern void au0828_stop_vbi_streaming(struct vb2_queue *vq); +#ifdef CONFIG_VIDEO_AU0828_V4L2 +extern void au0828_v4l2_suspend(struct au0828_dev *dev); +extern void au0828_v4l2_resume(struct au0828_dev *dev); +#else +static inline void au0828_v4l2_suspend(struct au0828_dev *dev) { }; +static inline void au0828_v4l2_resume(struct au0828_dev *dev) { }; +#endif /* ----------------------------------------------------------- */ /* au0828-dvb.c */ extern int au0828_dvb_register(struct au0828_dev *dev); extern void au0828_dvb_unregister(struct au0828_dev *dev); +void au0828_dvb_suspend(struct au0828_dev *dev); +void au0828_dvb_resume(struct au0828_dev *dev); /* au0828-vbi.c */ -extern struct videobuf_queue_ops au0828_vbi_qops; +extern struct vb2_ops au0828_vbi_qops; #define dprintk(level, fmt, arg...)\ do { if (au0828_debug & level)\ - printk(KERN_DEBUG DRIVER_NAME "/0: " fmt, ## arg);\ + printk(KERN_DEBUG pr_fmt(fmt), ## arg);\ } while (0) + +/* au0828-input.c */ +#ifdef CONFIG_VIDEO_AU0828_RC +extern int au0828_rc_register(struct au0828_dev *dev); +extern void au0828_rc_unregister(struct au0828_dev *dev); +extern int au0828_rc_suspend(struct au0828_dev *dev); +extern int au0828_rc_resume(struct au0828_dev *dev); +#else +static inline int au0828_rc_register(struct au0828_dev *dev) { return 0; } +static inline void au0828_rc_unregister(struct au0828_dev *dev) { } +static inline int au0828_rc_suspend(struct au0828_dev *dev) { return 0; } +static inline int au0828_rc_resume(struct au0828_dev *dev) { return 0; } +#endif