Lines Matching +full:signal +full:- +full:to +full:- +full:noise
1 .. SPDX-License-Identifier: GPL-2.0
4 ------------------------
9 The Digital TV Frontend kABI defines a driver-internal interface for
10 registering low-level, hardware specific driver to a hardware independent
20 tells what type of digital TV standards are supported, and points to a
21 series of functions that allow the DVB core to command the hardware via
29 .name = "foo DVB-T/T2/C driver",
64 A typical example of such struct in a driver ``bar`` meant to be used on
70 .name = "Bar DVB-S/S2 demodulator",
91 /* Satellite-specific */
100 #) For satellite digital TV standards (DVB-S, DVB-S2, ISDB-S), the
102 standards, they're specified in Hz. Due to that, if the same frontend
103 supports both types, you'll need to have two separate
107 in order to remove the tuner from the I2C bus after a channel is
111 Yet, there are a number of callbacks meant to get statistics for
112 signal strength, S/N and UCB. Those are there to provide backward
117 #) Other callbacks are required for satellite TV standards, in order to
124 responsible for tuning the device. It supports multiple algorithms to
127 The algorithm to be used is obtained via ``.get_frontend_algo``. If the driver
128 doesn't fill its field at struct dvb_frontend_ops, it will default to
129 ``DVBFE_ALGO_SW``, meaning that the dvb-core will do a zigzag when tuning,
130 e. g. it will try first to use the specified center frequency ``f``,
131 then, it will do ``f`` + |delta|, ``f`` - |delta|, ``f`` + 2 x |delta|,
132 ``f`` - 2 x |delta| and so on.
140 a third type (``DVBFE_ALGO_CUSTOM``), in order to allow the driver to
141 define its own hardware-assisted algorithm. Very few hardware need to
142 use it nowadays. Using ``DVBFE_ALGO_CUSTOM`` require to provide other
145 Attaching frontend driver to the bridge driver
151 in order to register the new frontend at the subsystem. At device
153 :c:func:`dvb_unregister_frontend()` to
155 to free the memory allocated by the frontend drivers.
162 A few other optional functions are provided to handle some special cases.
173 :ref:`statistics <frontend-stat-properties>` meant to help tuning the device
182 scale at its init code. For example, if the frontend provides signal
185 struct dtv_frontend_properties *c = &state->fe.dtv_property_cache;
187 c->strength.len = 1;
188 c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
192 c->strength.stat[0].scale = FE_SCALE_DECIBEL;
193 c->strength.stat[0].uvalue = strength;
195 .. [#f2] For ISDB-T, it may provide both a global statistics and a per-layer
196 set of statistics. On such cases, len should be equal to 4. The first
197 value corresponds to the global stat; the other ones to each layer, e. g.:
199 - c->cnr.stat[0] for global S/N carrier ratio,
200 - c->cnr.stat[1] for Layer A S/N carrier ratio,
201 - c->cnr.stat[2] for layer B S/N carrier ratio,
202 - c->cnr.stat[3] for layer C S/N carrier ratio.
204 .. note:: Please prefer to use ``FE_SCALE_DECIBEL`` instead of
205 ``FE_SCALE_RELATIVE`` for signal strength and CNR measurements.
212 Signal strength (:ref:`DTV-STAT-SIGNAL-STRENGTH`)
213 - Measures the signal strength level at the analog part of the tuner or
216 - Typically obtained from the gain applied to the tuner and/or frontend
217 in order to detect the carrier. When no carrier is detected, the gain is
220 - As the gain is visible through the set of registers that adjust the gain,
223 - Drivers should try to make it available all the times, as these statistics
224 can be used when adjusting an antenna position and to check for troubles
232 Carrier Signal to Noise ratio (:ref:`DTV-STAT-CNR`)
233 - Signal to Noise ratio for the main carrier.
235 - Signal to Noise measurement depends on the device. On some hardware, it is
246 Bit counts post-FEC (:ref:`DTV-STAT-POST-ERROR-BIT-COUNT` and :ref:`DTV-STAT-POST-TOTAL-BIT-COUNT`)
247 - Those counters measure the number of bits and bit errors after
251 - Due to its nature, those statistics depend on full coding lock
255 Bit counts pre-FEC (:ref:`DTV-STAT-PRE-ERROR-BIT-COUNT` and :ref:`DTV-STAT-PRE-TOTAL-BIT-COUNT`)
256 - Those counters measure the number of bits and bit errors before
260 - Not all frontends provide this kind of statistics.
262 - Due to its nature, those statistics depend on inner coding lock (e. g.
265 Block counts (:ref:`DTV-STAT-ERROR-BLOCK-COUNT` and :ref:`DTV-STAT-TOTAL-BLOCK-COUNT`)
266 - Those counters measure the number of blocks and block errors after
270 - Due to its nature, those statistics depend on full coding lock
281 struct foo_state *state = fe->demodulator_priv;
282 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
297 if (!(fe->status & FE_HAS_CARRIER))
304 /* Check if pre-BER stats are available */
305 if (!(fe->status & FE_HAS_VITERBI))
312 /* Check if post-BER stats are available */
313 if (!(fe->status & FE_HAS_SYNC))
335 value as in the previous reading, causing the monotonic value to be
338 Drivers should take the responsibility to avoid too often reads. That
351 struct foo_state *state = fe->demodulator_priv;
352 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
373 c->pre_bit_error.stat[0].scale = FE_SCALE_COUNTER;
374 c->pre_bit_error.stat[0].uvalue += bit_error;
375 c->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER;
376 c->pre_bit_count.stat[0].uvalue += rc;
384 A few devices, however, may not provide a way to check if the stats are
385 available (or the way to check it is unknown). They may not even provide
386 a way to directly read the total number of bits or blocks.
388 On those devices, the driver need to ensure that it won't be reading from
391 On such drivers, a typical routine to get statistics would be like
402 struct foo_state *state = fe->demodulator_priv;
403 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
408 if (!time_after(jiffies, state->per_jiffies_stats))
412 state->per_jiffies_stats = jiffies + msecs_to_jiffies(1000);
426 c->pre_bit_error.stat[0].scale = FE_SCALE_COUNTER;
427 c->pre_bit_error.stat[0].uvalue += bit_error;
428 c->pre_bit_count.stat[0].scale = FE_SCALE_COUNTER;
429 c->pre_bit_count.stat[0].uvalue += bits;
439 That warrants that we won't miss to collect a counter and increment the
445 .. kernel-doc:: include/media/dvb_frontend.h