162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * The Virtual DTV test driver serves as a reference DVB driver and helps 462306a36Sopenharmony_ci * validate the existing APIs in the media subsystem. It can also aid 562306a36Sopenharmony_ci * developers working on userspace applications. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * When this module is loaded, it will attempt to modprobe 'dvb_vidtv_tuner' and 'dvb_vidtv_demod'. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * Copyright (C) 2020 Daniel W. S. Almeida 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#ifndef VIDTV_BRIDGE_H 1362306a36Sopenharmony_ci#define VIDTV_BRIDGE_H 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* 1662306a36Sopenharmony_ci * For now, only one frontend is supported. See vidtv_start_streaming() 1762306a36Sopenharmony_ci */ 1862306a36Sopenharmony_ci#define NUM_FE 1 1962306a36Sopenharmony_ci#define VIDTV_PDEV_NAME "vidtv" 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#include <linux/i2c.h> 2262306a36Sopenharmony_ci#include <linux/platform_device.h> 2362306a36Sopenharmony_ci#include <linux/types.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#include <media/dmxdev.h> 2662306a36Sopenharmony_ci#include <media/dvb_demux.h> 2762306a36Sopenharmony_ci#include <media/dvb_frontend.h> 2862306a36Sopenharmony_ci#include <media/media-device.h> 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci#include "vidtv_mux.h" 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/** 3362306a36Sopenharmony_ci * struct vidtv_dvb - Vidtv bridge state 3462306a36Sopenharmony_ci * @pdev: The platform device. Obtained when the bridge is probed. 3562306a36Sopenharmony_ci * @fe: The frontends. Obtained when probing the demodulator modules. 3662306a36Sopenharmony_ci * @adapter: Represents a DTV adapter. See 'dvb_register_adapter'. 3762306a36Sopenharmony_ci * @demux: The demux used by the dvb_dmx_swfilter_packets() call. 3862306a36Sopenharmony_ci * @dmx_dev: Represents a demux device. 3962306a36Sopenharmony_ci * @dmx_fe: The frontends associated with the demux. 4062306a36Sopenharmony_ci * @i2c_adapter: The i2c_adapter associated with the bridge driver. 4162306a36Sopenharmony_ci * @i2c_client_demod: The i2c_clients associated with the demodulator modules. 4262306a36Sopenharmony_ci * @i2c_client_tuner: The i2c_clients associated with the tuner modules. 4362306a36Sopenharmony_ci * @nfeeds: The number of feeds active. 4462306a36Sopenharmony_ci * @feed_lock: Protects access to the start/stop stream logic/data. 4562306a36Sopenharmony_ci * @streaming: Whether we are streaming now. 4662306a36Sopenharmony_ci * @mux: The abstraction responsible for delivering MPEG TS packets to the bridge. 4762306a36Sopenharmony_ci * @mdev: The media_device struct for media controller support. 4862306a36Sopenharmony_ci */ 4962306a36Sopenharmony_cistruct vidtv_dvb { 5062306a36Sopenharmony_ci struct platform_device *pdev; 5162306a36Sopenharmony_ci struct dvb_frontend *fe[NUM_FE]; 5262306a36Sopenharmony_ci struct dvb_adapter adapter; 5362306a36Sopenharmony_ci struct dvb_demux demux; 5462306a36Sopenharmony_ci struct dmxdev dmx_dev; 5562306a36Sopenharmony_ci struct dmx_frontend dmx_fe[NUM_FE]; 5662306a36Sopenharmony_ci struct i2c_adapter i2c_adapter; 5762306a36Sopenharmony_ci struct i2c_client *i2c_client_demod[NUM_FE]; 5862306a36Sopenharmony_ci struct i2c_client *i2c_client_tuner[NUM_FE]; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci u32 nfeeds; 6162306a36Sopenharmony_ci struct mutex feed_lock; /* Protects access to the start/stop stream logic/data. */ 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci bool streaming; 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci struct vidtv_mux *mux; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci#ifdef CONFIG_MEDIA_CONTROLLER_DVB 6862306a36Sopenharmony_ci struct media_device mdev; 6962306a36Sopenharmony_ci#endif /* CONFIG_MEDIA_CONTROLLER_DVB */ 7062306a36Sopenharmony_ci}; 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#endif // VIDTV_BRIDG_H 73