Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
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  * Copyright (C) 2020 Daniel W. S. Almeida
0008  * Based on the example driver written by Emard <emard@softhome.net>
0009  */
0010 
0011 #ifndef VIDTV_DEMOD_H
0012 #define VIDTV_DEMOD_H
0013 
0014 #include <linux/dvb/frontend.h>
0015 
0016 #include <media/dvb_frontend.h>
0017 
0018 /**
0019  * struct vidtv_demod_cnr_to_qual_s - Map CNR values to a given combination of
0020  * modulation and fec_inner
0021  * @modulation: see enum fe_modulation
0022  * @fec: see enum fe_fec_rate
0023  * @cnr_ok: S/N threshold to consider the signal as OK. Below that, there's
0024  *          a chance of losing sync.
0025  * @cnr_good: S/N threshold to consider the signal strong.
0026  *
0027  * This struct matches values for 'good' and 'ok' CNRs given the combination
0028  * of modulation and fec_inner in use. We might simulate some noise if the
0029  * signal quality is not too good.
0030  *
0031  * The values were taken from libdvbv5.
0032  */
0033 struct vidtv_demod_cnr_to_qual_s {
0034     u32 modulation;
0035     u32 fec;
0036     u32 cnr_ok;
0037     u32 cnr_good;
0038 };
0039 
0040 /**
0041  * struct vidtv_demod_config - Configuration used to init the demod
0042  * @drop_tslock_prob_on_low_snr: probability of losing the lock due to low snr
0043  * @recover_tslock_prob_on_good_snr: probability of recovering when the signal
0044  * improves
0045  *
0046  * The configuration used to init the demodulator module, usually filled
0047  * by a bridge driver. For vidtv, this is filled by vidtv_bridge before the
0048  * demodulator module is probed.
0049  */
0050 struct vidtv_demod_config {
0051     u8 drop_tslock_prob_on_low_snr;
0052     u8 recover_tslock_prob_on_good_snr;
0053 };
0054 
0055 /**
0056  * struct vidtv_demod_state - The demodulator state
0057  * @frontend: The frontend structure allocated by the demod.
0058  * @config: The config used to init the demod.
0059  * @status: the demod status.
0060  * @tuner_cnr: current S/N ratio for the signal carrier
0061  */
0062 struct vidtv_demod_state {
0063     struct dvb_frontend frontend;
0064     struct vidtv_demod_config config;
0065     enum fe_status status;
0066     u16 tuner_cnr;
0067 };
0068 #endif // VIDTV_DEMOD_H