69 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * The Virtual DTV test driver serves as a reference DVB driver and helps4 * validate the existing APIs in the media subsystem. It can also aid5 * developers working on userspace applications.6 *7 * Copyright (C) 2020 Daniel W. S. Almeida8 * Based on the example driver written by Emard <emard@softhome.net>9 */10 11#ifndef VIDTV_DEMOD_H12#define VIDTV_DEMOD_H13 14#include <linux/dvb/frontend.h>15 16#include <media/dvb_frontend.h>17 18/**19 * struct vidtv_demod_cnr_to_qual_s - Map CNR values to a given combination of20 * modulation and fec_inner21 * @modulation: see enum fe_modulation22 * @fec: see enum fe_fec_rate23 * @cnr_ok: S/N threshold to consider the signal as OK. Below that, there's24 * a chance of losing sync.25 * @cnr_good: S/N threshold to consider the signal strong.26 *27 * This struct matches values for 'good' and 'ok' CNRs given the combination28 * of modulation and fec_inner in use. We might simulate some noise if the29 * signal quality is not too good.30 *31 * The values were taken from libdvbv5.32 */33struct vidtv_demod_cnr_to_qual_s {34 u32 modulation;35 u32 fec;36 u32 cnr_ok;37 u32 cnr_good;38};39 40/**41 * struct vidtv_demod_config - Configuration used to init the demod42 * @drop_tslock_prob_on_low_snr: probability of losing the lock due to low snr43 * @recover_tslock_prob_on_good_snr: probability of recovering when the signal44 * improves45 *46 * The configuration used to init the demodulator module, usually filled47 * by a bridge driver. For vidtv, this is filled by vidtv_bridge before the48 * demodulator module is probed.49 */50struct vidtv_demod_config {51 u8 drop_tslock_prob_on_low_snr;52 u8 recover_tslock_prob_on_good_snr;53};54 55/**56 * struct vidtv_demod_state - The demodulator state57 * @frontend: The frontend structure allocated by the demod.58 * @config: The config used to init the demod.59 * @status: the demod status.60 * @tuner_cnr: current S/N ratio for the signal carrier61 */62struct vidtv_demod_state {63 struct dvb_frontend frontend;64 struct vidtv_demod_config config;65 enum fe_status status;66 u16 tuner_cnr;67};68#endif // VIDTV_DEMOD_H69