Lines Matching +full:full +full:- +full:scale

1 // SPDX-License-Identifier: GPL-2.0-or-later
80 struct device *dev = fe->dvb->device; in vidtv_match_cnr_s()
85 c = &fe->dtv_property_cache; in vidtv_match_cnr_s()
87 switch (c->delivery_system) { in vidtv_match_cnr_s()
113 c->delivery_system); in vidtv_match_cnr_s()
118 if (cnr2qual[i].modulation == c->modulation && in vidtv_match_cnr_s()
119 cnr2qual[i].fec == c->fec_inner) in vidtv_match_cnr_s()
127 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in vidtv_clean_stats()
132 c->strength.len = 1; in vidtv_clean_stats()
133 c->strength.stat[0].scale = FE_SCALE_DECIBEL; in vidtv_clean_stats()
134 c->strength.stat[0].svalue = 0; in vidtv_clean_stats()
137 c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
138 c->cnr.stat[0].svalue = 0; in vidtv_clean_stats()
139 c->cnr.len = 1; in vidtv_clean_stats()
141 /* Those depends on full lock */ in vidtv_clean_stats()
142 c->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
143 c->pre_bit_error.stat[0].uvalue = 0; in vidtv_clean_stats()
144 c->pre_bit_error.len = 1; in vidtv_clean_stats()
145 c->pre_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
146 c->pre_bit_count.stat[0].uvalue = 0; in vidtv_clean_stats()
147 c->pre_bit_count.len = 1; in vidtv_clean_stats()
148 c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
149 c->post_bit_error.stat[0].uvalue = 0; in vidtv_clean_stats()
150 c->post_bit_error.len = 1; in vidtv_clean_stats()
151 c->post_bit_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
152 c->post_bit_count.stat[0].uvalue = 0; in vidtv_clean_stats()
153 c->post_bit_count.len = 1; in vidtv_clean_stats()
154 c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
155 c->block_error.stat[0].uvalue = 0; in vidtv_clean_stats()
156 c->block_error.len = 1; in vidtv_clean_stats()
157 c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in vidtv_clean_stats()
158 c->block_count.stat[0].uvalue = 0; in vidtv_clean_stats()
159 c->block_count.len = 1; in vidtv_clean_stats()
164 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in vidtv_demod_update_stats()
165 struct vidtv_demod_state *state = fe->demodulator_priv; in vidtv_demod_update_stats()
166 u32 scale; in vidtv_demod_update_stats() local
168 if (state->status & FE_HAS_LOCK) { in vidtv_demod_update_stats()
169 scale = FE_SCALE_COUNTER; in vidtv_demod_update_stats()
170 c->cnr.stat[0].scale = FE_SCALE_DECIBEL; in vidtv_demod_update_stats()
172 scale = FE_SCALE_NOT_AVAILABLE; in vidtv_demod_update_stats()
173 c->cnr.stat[0].scale = scale; in vidtv_demod_update_stats()
176 c->pre_bit_error.stat[0].scale = scale; in vidtv_demod_update_stats()
177 c->pre_bit_count.stat[0].scale = scale; in vidtv_demod_update_stats()
178 c->post_bit_error.stat[0].scale = scale; in vidtv_demod_update_stats()
179 c->post_bit_count.stat[0].scale = scale; in vidtv_demod_update_stats()
180 c->block_error.stat[0].scale = scale; in vidtv_demod_update_stats()
181 c->block_count.stat[0].scale = scale; in vidtv_demod_update_stats()
190 c->strength.stat[0].svalue = state->tuner_cnr; in vidtv_demod_update_stats()
191 c->strength.stat[0].svalue -= get_random_u32_below(state->tuner_cnr / 50); in vidtv_demod_update_stats()
192 c->strength.stat[0].svalue -= 68000; /* Adjust to a better range */ in vidtv_demod_update_stats()
194 c->cnr.stat[0].svalue = state->tuner_cnr; in vidtv_demod_update_stats()
195 c->cnr.stat[0].svalue -= get_random_u32_below(state->tuner_cnr / 50); in vidtv_demod_update_stats()
201 struct vidtv_demod_state *state = fe->demodulator_priv; in vidtv_demod_read_status()
203 struct vidtv_demod_config *config = &state->config; in vidtv_demod_read_status()
206 /* Simulate random lost of signal due to a bad-tuned channel */ in vidtv_demod_read_status()
207 cnr2qual = vidtv_match_cnr_s(&state->frontend); in vidtv_demod_read_status()
209 if (cnr2qual && state->tuner_cnr < cnr2qual->cnr_good && in vidtv_demod_read_status()
210 state->frontend.ops.tuner_ops.get_rf_strength) { in vidtv_demod_read_status()
211 state->frontend.ops.tuner_ops.get_rf_strength(&state->frontend, in vidtv_demod_read_status()
214 if (snr < cnr2qual->cnr_ok) { in vidtv_demod_read_status()
216 if (get_random_u32_below(100) < config->drop_tslock_prob_on_low_snr) in vidtv_demod_read_status()
217 state->status = 0; in vidtv_demod_read_status()
221 config->recover_tslock_prob_on_good_snr) in vidtv_demod_read_status()
222 state->status = FE_HAS_SIGNAL | in vidtv_demod_read_status()
230 vidtv_demod_update_stats(&state->frontend); in vidtv_demod_read_status()
232 *status = state->status; in vidtv_demod_read_status()
240 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in vidtv_demod_read_signal_strength()
242 *strength = c->strength.stat[0].uvalue; in vidtv_demod_read_signal_strength()
264 struct vidtv_demod_state *state = fe->demodulator_priv; in vidtv_demod_set_frontend()
268 if (!fe->ops.tuner_ops.set_params) in vidtv_demod_set_frontend()
271 fe->ops.tuner_ops.set_params(fe); in vidtv_demod_set_frontend()
274 ret = fe->ops.tuner_ops.get_rf_strength(fe, &state->tuner_cnr); in vidtv_demod_set_frontend()
278 fe->ops.tuner_ops.get_status(fe, &tuner_status); in vidtv_demod_set_frontend()
279 state->status = (state->tuner_cnr > 0) ? FE_HAS_SIGNAL | in vidtv_demod_set_frontend()
288 if (fe->ops.i2c_gate_ctrl) in vidtv_demod_set_frontend()
289 fe->ops.i2c_gate_ctrl(fe, 0); in vidtv_demod_set_frontend()
299 * Should only be implemented if the demod has support for DVB-S or DVB-S2
312 * Should only be implemented if the demod has support for DVB-S or DVB-S2
325 * Should only be implemented if the demod has support for DVB-S or DVB-S2
338 * Should only be implemented if the demod has support for DVB-S or DVB-S2
348 struct vidtv_demod_state *state = fe->demodulator_priv; in vidtv_demod_release()
363 .name = "Dummy demod for DVB-T/T2/C/S/S2",
401 /* For DVB-S/S2 */
417 struct vidtv_tuner_config *config = client->dev.platform_data; in vidtv_demod_i2c_probe()
423 return -ENOMEM; in vidtv_demod_i2c_probe()
426 memcpy(&state->frontend.ops, in vidtv_demod_i2c_probe()
430 memcpy(&state->config, config, sizeof(state->config)); in vidtv_demod_i2c_probe()
432 state->frontend.demodulator_priv = state; in vidtv_demod_i2c_probe()
435 vidtv_clean_stats(&state->frontend); in vidtv_demod_i2c_probe()