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