1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * The Virtual DTV test driver serves as a reference DVB driver and helps 4*4882a593Smuzhiyun * validate the existing APIs in the media subsystem. It can also aid 5*4882a593Smuzhiyun * developers working on userspace applications. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * When this module is loaded, it will attempt to modprobe 'dvb_vidtv_tuner' and 'dvb_vidtv_demod'. 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * Copyright (C) 2020 Daniel W. S. Almeida 10*4882a593Smuzhiyun */ 11*4882a593Smuzhiyun 12*4882a593Smuzhiyun #ifndef VIDTV_BRIDGE_H 13*4882a593Smuzhiyun #define VIDTV_BRIDGE_H 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun /* 16*4882a593Smuzhiyun * For now, only one frontend is supported. See vidtv_start_streaming() 17*4882a593Smuzhiyun */ 18*4882a593Smuzhiyun #define NUM_FE 1 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun #include <linux/i2c.h> 21*4882a593Smuzhiyun #include <linux/platform_device.h> 22*4882a593Smuzhiyun #include <linux/types.h> 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #include <media/dmxdev.h> 25*4882a593Smuzhiyun #include <media/dvb_demux.h> 26*4882a593Smuzhiyun #include <media/dvb_frontend.h> 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun #include "vidtv_mux.h" 29*4882a593Smuzhiyun 30*4882a593Smuzhiyun /** 31*4882a593Smuzhiyun * struct vidtv_dvb - Vidtv bridge state 32*4882a593Smuzhiyun * @pdev: The platform device. Obtained when the bridge is probed. 33*4882a593Smuzhiyun * @fe: The frontends. Obtained when probing the demodulator modules. 34*4882a593Smuzhiyun * @adapter: Represents a DTV adapter. See 'dvb_register_adapter'. 35*4882a593Smuzhiyun * @demux: The demux used by the dvb_dmx_swfilter_packets() call. 36*4882a593Smuzhiyun * @dmx_dev: Represents a demux device. 37*4882a593Smuzhiyun * @dmx_fe: The frontends associated with the demux. 38*4882a593Smuzhiyun * @i2c_adapter: The i2c_adapter associated with the bridge driver. 39*4882a593Smuzhiyun * @i2c_client_demod: The i2c_clients associated with the demodulator modules. 40*4882a593Smuzhiyun * @i2c_client_tuner: The i2c_clients associated with the tuner modules. 41*4882a593Smuzhiyun * @nfeeds: The number of feeds active. 42*4882a593Smuzhiyun * @feed_lock: Protects access to the start/stop stream logic/data. 43*4882a593Smuzhiyun * @streaming: Whether we are streaming now. 44*4882a593Smuzhiyun * @mux: The abstraction responsible for delivering MPEG TS packets to the bridge. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun struct vidtv_dvb { 47*4882a593Smuzhiyun struct platform_device *pdev; 48*4882a593Smuzhiyun struct dvb_frontend *fe[NUM_FE]; 49*4882a593Smuzhiyun struct dvb_adapter adapter; 50*4882a593Smuzhiyun struct dvb_demux demux; 51*4882a593Smuzhiyun struct dmxdev dmx_dev; 52*4882a593Smuzhiyun struct dmx_frontend dmx_fe[NUM_FE]; 53*4882a593Smuzhiyun struct i2c_adapter i2c_adapter; 54*4882a593Smuzhiyun struct i2c_client *i2c_client_demod[NUM_FE]; 55*4882a593Smuzhiyun struct i2c_client *i2c_client_tuner[NUM_FE]; 56*4882a593Smuzhiyun 57*4882a593Smuzhiyun u32 nfeeds; 58*4882a593Smuzhiyun struct mutex feed_lock; /* Protects access to the start/stop stream logic/data. */ 59*4882a593Smuzhiyun 60*4882a593Smuzhiyun bool streaming; 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun struct vidtv_mux *mux; 63*4882a593Smuzhiyun }; 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun #endif // VIDTV_BRIDG_H 66