Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * The Virtual DTV test driver serves as a reference DVB driver and helps
0004  * validate the existing APIs in the media subsystem. It can also aid
0005  * developers working on userspace applications.
0006  *
0007  * When this module is loaded, it will attempt to modprobe 'dvb_vidtv_tuner' and 'dvb_vidtv_demod'.
0008  *
0009  * Copyright (C) 2020 Daniel W. S. Almeida
0010  */
0011 
0012 #ifndef VIDTV_BRIDGE_H
0013 #define VIDTV_BRIDGE_H
0014 
0015 /*
0016  * For now, only one frontend is supported. See vidtv_start_streaming()
0017  */
0018 #define NUM_FE 1
0019 #define VIDTV_PDEV_NAME "vidtv"
0020 
0021 #include <linux/i2c.h>
0022 #include <linux/platform_device.h>
0023 #include <linux/types.h>
0024 
0025 #include <media/dmxdev.h>
0026 #include <media/dvb_demux.h>
0027 #include <media/dvb_frontend.h>
0028 #include <media/media-device.h>
0029 
0030 #include "vidtv_mux.h"
0031 
0032 /**
0033  * struct vidtv_dvb - Vidtv bridge state
0034  * @pdev: The platform device. Obtained when the bridge is probed.
0035  * @fe: The frontends. Obtained when probing the demodulator modules.
0036  * @adapter: Represents a DTV adapter. See 'dvb_register_adapter'.
0037  * @demux: The demux used by the dvb_dmx_swfilter_packets() call.
0038  * @dmx_dev: Represents a demux device.
0039  * @dmx_fe: The frontends associated with the demux.
0040  * @i2c_adapter: The i2c_adapter associated with the bridge driver.
0041  * @i2c_client_demod: The i2c_clients associated with the demodulator modules.
0042  * @i2c_client_tuner: The i2c_clients associated with the tuner modules.
0043  * @nfeeds: The number of feeds active.
0044  * @feed_lock: Protects access to the start/stop stream logic/data.
0045  * @streaming: Whether we are streaming now.
0046  * @mux: The abstraction responsible for delivering MPEG TS packets to the bridge.
0047  * @mdev: The media_device struct for media controller support.
0048  */
0049 struct vidtv_dvb {
0050     struct platform_device *pdev;
0051     struct dvb_frontend *fe[NUM_FE];
0052     struct dvb_adapter adapter;
0053     struct dvb_demux demux;
0054     struct dmxdev dmx_dev;
0055     struct dmx_frontend dmx_fe[NUM_FE];
0056     struct i2c_adapter i2c_adapter;
0057     struct i2c_client *i2c_client_demod[NUM_FE];
0058     struct i2c_client *i2c_client_tuner[NUM_FE];
0059 
0060     u32 nfeeds;
0061     struct mutex feed_lock; /* Protects access to the start/stop stream logic/data. */
0062 
0063     bool streaming;
0064 
0065     struct vidtv_mux *mux;
0066 
0067 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
0068     struct media_device mdev;
0069 #endif /* CONFIG_MEDIA_CONTROLLER_DVB */
0070 };
0071 
0072 #endif // VIDTV_BRIDG_H