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