1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _VIDEOBUF2_DVB_H_ 3*4882a593Smuzhiyun #define _VIDEOBUF2_DVB_H_ 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <media/dvbdev.h> 6*4882a593Smuzhiyun #include <media/dmxdev.h> 7*4882a593Smuzhiyun #include <media/dvb_demux.h> 8*4882a593Smuzhiyun #include <media/dvb_net.h> 9*4882a593Smuzhiyun #include <media/dvb_frontend.h> 10*4882a593Smuzhiyun #include <media/videobuf2-v4l2.h> 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun /* We don't actually need to include media-device.h here */ 13*4882a593Smuzhiyun struct media_device; 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun /* 16*4882a593Smuzhiyun * TODO: This header file should be replaced with videobuf2-core.h 17*4882a593Smuzhiyun * Currently, vb2_thread is not a stuff of videobuf2-core, 18*4882a593Smuzhiyun * since vb2_thread has many dependencies on videobuf2-v4l2. 19*4882a593Smuzhiyun */ 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun struct vb2_dvb { 22*4882a593Smuzhiyun /* filling that the job of the driver */ 23*4882a593Smuzhiyun char *name; 24*4882a593Smuzhiyun struct dvb_frontend *frontend; 25*4882a593Smuzhiyun struct vb2_queue dvbq; 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun /* video-buf-dvb state info */ 28*4882a593Smuzhiyun struct mutex lock; 29*4882a593Smuzhiyun int nfeeds; 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun /* vb2_dvb_(un)register manages this */ 32*4882a593Smuzhiyun struct dvb_demux demux; 33*4882a593Smuzhiyun struct dmxdev dmxdev; 34*4882a593Smuzhiyun struct dmx_frontend fe_hw; 35*4882a593Smuzhiyun struct dmx_frontend fe_mem; 36*4882a593Smuzhiyun struct dvb_net net; 37*4882a593Smuzhiyun }; 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun struct vb2_dvb_frontend { 40*4882a593Smuzhiyun struct list_head felist; 41*4882a593Smuzhiyun int id; 42*4882a593Smuzhiyun struct vb2_dvb dvb; 43*4882a593Smuzhiyun }; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun struct vb2_dvb_frontends { 46*4882a593Smuzhiyun struct list_head felist; 47*4882a593Smuzhiyun struct mutex lock; 48*4882a593Smuzhiyun struct dvb_adapter adapter; 49*4882a593Smuzhiyun int active_fe_id; /* Indicates which frontend in the felist is in use */ 50*4882a593Smuzhiyun int gate; /* Frontend with gate control 0=!MFE,1=fe0,2=fe1 etc */ 51*4882a593Smuzhiyun }; 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun int vb2_dvb_register_bus(struct vb2_dvb_frontends *f, 54*4882a593Smuzhiyun struct module *module, 55*4882a593Smuzhiyun void *adapter_priv, 56*4882a593Smuzhiyun struct device *device, 57*4882a593Smuzhiyun struct media_device *mdev, 58*4882a593Smuzhiyun short *adapter_nr, 59*4882a593Smuzhiyun int mfe_shared); 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun void vb2_dvb_unregister_bus(struct vb2_dvb_frontends *f); 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun struct vb2_dvb_frontend *vb2_dvb_alloc_frontend(struct vb2_dvb_frontends *f, int id); 64*4882a593Smuzhiyun void vb2_dvb_dealloc_frontends(struct vb2_dvb_frontends *f); 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun struct vb2_dvb_frontend *vb2_dvb_get_frontend(struct vb2_dvb_frontends *f, int id); 67*4882a593Smuzhiyun int vb2_dvb_find_frontend(struct vb2_dvb_frontends *f, struct dvb_frontend *p); 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun #endif /* _VIDEOBUF2_DVB_H_ */ 70