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