Lines Matching refs:fe

130 static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
131 void (*release)(struct dvb_frontend *fe));
133 static void __dvb_frontend_free(struct dvb_frontend *fe) in __dvb_frontend_free() argument
135 struct dvb_frontend_private *fepriv = fe->frontend_priv; in __dvb_frontend_free()
140 dvb_frontend_invoke_release(fe, fe->ops.release); in __dvb_frontend_free()
147 struct dvb_frontend *fe = in dvb_frontend_free() local
150 __dvb_frontend_free(fe); in dvb_frontend_free()
153 static void dvb_frontend_put(struct dvb_frontend *fe) in dvb_frontend_put() argument
156 if (fe->ops.detach) in dvb_frontend_put()
157 fe->ops.detach(fe); in dvb_frontend_put()
162 if (fe->frontend_priv) in dvb_frontend_put()
163 kref_put(&fe->refcount, dvb_frontend_free); in dvb_frontend_put()
165 __dvb_frontend_free(fe); in dvb_frontend_put()
168 static void dvb_frontend_get(struct dvb_frontend *fe) in dvb_frontend_get() argument
170 kref_get(&fe->refcount); in dvb_frontend_get()
173 static void dvb_frontend_wakeup(struct dvb_frontend *fe);
174 static int dtv_get_frontend(struct dvb_frontend *fe,
178 dtv_property_legacy_params_sync(struct dvb_frontend *fe,
182 static bool has_get_frontend(struct dvb_frontend *fe) in has_get_frontend() argument
184 return fe->ops.get_frontend; in has_get_frontend()
236 static void dvb_frontend_add_event(struct dvb_frontend *fe, in dvb_frontend_add_event() argument
239 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_add_event()
240 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_add_event()
245 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_add_event()
247 if ((status & FE_HAS_LOCK) && has_get_frontend(fe)) in dvb_frontend_add_event()
248 dtv_get_frontend(fe, c, &fepriv->parameters_out); in dvb_frontend_add_event()
281 static int dvb_frontend_get_event(struct dvb_frontend *fe, in dvb_frontend_get_event() argument
284 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_get_event()
287 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_get_event()
315 static void dvb_frontend_clear_events(struct dvb_frontend *fe) in dvb_frontend_clear_events() argument
317 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_clear_events()
325 static void dvb_frontend_init(struct dvb_frontend *fe) in dvb_frontend_init() argument
327 dev_dbg(fe->dvb->device, in dvb_frontend_init()
329 __func__, fe->dvb->num, fe->id, fe->ops.info.name); in dvb_frontend_init()
331 if (fe->ops.init) in dvb_frontend_init()
332 fe->ops.init(fe); in dvb_frontend_init()
333 if (fe->ops.tuner_ops.init) { in dvb_frontend_init()
334 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
335 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_init()
336 fe->ops.tuner_ops.init(fe); in dvb_frontend_init()
337 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
338 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_init()
342 void dvb_frontend_reinitialise(struct dvb_frontend *fe) in dvb_frontend_reinitialise() argument
344 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_reinitialise()
347 dvb_frontend_wakeup(fe); in dvb_frontend_reinitialise()
354 struct dvb_frontend *fe = fepriv->dvbdev->priv; in dvb_frontend_swzigzag_update_delay() local
356 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_swzigzag_update_delay()
379 static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wrapped) in dvb_frontend_swzigzag_autotune() argument
384 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag_autotune()
385 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag_autotune()
390 autoinversion = ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag_autotune()
451 dev_dbg(fe->dvb->device, in dvb_frontend_swzigzag_autotune()
462 if (fe->ops.set_frontend) in dvb_frontend_swzigzag_autotune()
463 fe_set_err = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag_autotune()
477 static void dvb_frontend_swzigzag(struct dvb_frontend *fe) in dvb_frontend_swzigzag() argument
481 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag()
482 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag()
495 if (fe->ops.set_frontend) in dvb_frontend_swzigzag()
496 retval = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag()
512 if (fe->ops.read_status) in dvb_frontend_swzigzag()
513 fe->ops.read_status(fe, &s); in dvb_frontend_swzigzag()
515 dvb_frontend_add_event(fe, s); in dvb_frontend_swzigzag()
526 if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag()
550 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { in dvb_frontend_swzigzag()
579 retval = dvb_frontend_swzigzag_autotune(fe, in dvb_frontend_swzigzag()
607 dvb_frontend_swzigzag_autotune(fe, 0); in dvb_frontend_swzigzag()
611 static int dvb_frontend_is_exiting(struct dvb_frontend *fe) in dvb_frontend_is_exiting() argument
613 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_is_exiting()
615 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_is_exiting()
626 static int dvb_frontend_should_wakeup(struct dvb_frontend *fe) in dvb_frontend_should_wakeup() argument
628 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_should_wakeup()
634 return dvb_frontend_is_exiting(fe); in dvb_frontend_should_wakeup()
637 static void dvb_frontend_wakeup(struct dvb_frontend *fe) in dvb_frontend_wakeup() argument
639 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_wakeup()
647 struct dvb_frontend *fe = data; in dvb_frontend_thread() local
648 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_thread()
649 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_thread()
655 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_thread()
664 dvb_frontend_init(fe); in dvb_frontend_thread()
671 dvb_frontend_should_wakeup(fe) || in dvb_frontend_thread()
676 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { in dvb_frontend_thread()
680 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_thread()
691 dvb_frontend_init(fe); in dvb_frontend_thread()
692 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_thread()
693 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_thread()
694 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_thread()
695 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_thread()
700 if (fe->ops.get_frontend_algo) { in dvb_frontend_thread()
701 algo = fe->ops.get_frontend_algo(fe); in dvb_frontend_thread()
704 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); in dvb_frontend_thread()
707 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__); in dvb_frontend_thread()
714 if (fe->ops.tune) in dvb_frontend_thread()
715 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
718 dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__); in dvb_frontend_thread()
719 dvb_frontend_add_event(fe, s); in dvb_frontend_thread()
724 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__); in dvb_frontend_thread()
725 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
728 …dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->st… in dvb_frontend_thread()
730 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTAT_RETUNE\n", __func__); in dvb_frontend_thread()
738 if (fe->ops.search) { in dvb_frontend_thread()
739 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
752 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
753 fe->ops.read_status(fe, &s); in dvb_frontend_thread()
755 dvb_frontend_add_event(fe, s); /* update event list */ in dvb_frontend_thread()
766 dev_dbg(fe->dvb->device, "%s: UNDEFINED ALGO !\n", __func__); in dvb_frontend_thread()
770 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
775 if (fe->ops.set_voltage) in dvb_frontend_thread()
776 fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); in dvb_frontend_thread()
777 if (fe->ops.tuner_ops.sleep) { in dvb_frontend_thread()
778 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
779 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_thread()
780 fe->ops.tuner_ops.sleep(fe); in dvb_frontend_thread()
781 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
782 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_thread()
784 if (fe->ops.sleep) in dvb_frontend_thread()
785 fe->ops.sleep(fe); in dvb_frontend_thread()
790 fe->exit = DVB_FE_DEVICE_REMOVED; in dvb_frontend_thread()
792 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_thread()
797 dvb_frontend_wakeup(fe); in dvb_frontend_thread()
801 static void dvb_frontend_stop(struct dvb_frontend *fe) in dvb_frontend_stop() argument
803 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop()
805 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_stop()
807 if (fe->exit != DVB_FE_DEVICE_REMOVED) in dvb_frontend_stop()
808 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_stop()
821 dev_warn(fe->dvb->device, in dvb_frontend_stop()
848 static int dvb_frontend_start(struct dvb_frontend *fe) in dvb_frontend_start() argument
851 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start()
854 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_start()
857 if (fe->exit == DVB_FE_NO_EXIT) in dvb_frontend_start()
860 dvb_frontend_stop(fe); in dvb_frontend_start()
869 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_start()
873 fe_thread = kthread_run(dvb_frontend_thread, fe, in dvb_frontend_start()
874 "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id); in dvb_frontend_start()
877 dev_warn(fe->dvb->device, in dvb_frontend_start()
887 static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, in dvb_frontend_get_frequency_limits() argument
891 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_frequency_limits()
892 u32 tuner_min = fe->ops.tuner_ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
893 u32 tuner_max = fe->ops.tuner_ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
894 u32 frontend_min = fe->ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
895 u32 frontend_max = fe->ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
907 dev_warn(fe->dvb->device, in dvb_frontend_get_frequency_limits()
909 fe->dvb->num, fe->id); in dvb_frontend_get_frequency_limits()
911 dev_dbg(fe->dvb->device, "frequency interval: tuner: %u...%u, frontend: %u...%u", in dvb_frontend_get_frequency_limits()
923 *tolerance = fe->ops.info.frequency_tolerance_hz / kHz; in dvb_frontend_get_frequency_limits()
928 *tolerance = fe->ops.info.frequency_tolerance_hz; in dvb_frontend_get_frequency_limits()
933 static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe) in dvb_frontend_get_stepsize() argument
935 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_stepsize()
936 u32 fe_step = fe->ops.info.frequency_stepsize_hz; in dvb_frontend_get_stepsize()
937 u32 tuner_step = fe->ops.tuner_ops.info.frequency_step_hz; in dvb_frontend_get_stepsize()
954 static int dvb_frontend_check_parameters(struct dvb_frontend *fe) in dvb_frontend_check_parameters() argument
956 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_check_parameters()
961 dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max, NULL); in dvb_frontend_check_parameters()
964 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
965 fe->dvb->num, fe->id, c->frequency, in dvb_frontend_check_parameters()
977 if ((fe->ops.info.symbol_rate_min && in dvb_frontend_check_parameters()
978 c->symbol_rate < fe->ops.info.symbol_rate_min) || in dvb_frontend_check_parameters()
979 (fe->ops.info.symbol_rate_max && in dvb_frontend_check_parameters()
980 c->symbol_rate > fe->ops.info.symbol_rate_max)) { in dvb_frontend_check_parameters()
981 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
982 fe->dvb->num, fe->id, c->symbol_rate, in dvb_frontend_check_parameters()
983 fe->ops.info.symbol_rate_min, in dvb_frontend_check_parameters()
984 fe->ops.info.symbol_rate_max); in dvb_frontend_check_parameters()
994 static int dvb_frontend_clear_cache(struct dvb_frontend *fe) in dvb_frontend_clear_cache() argument
996 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_clear_cache()
1004 dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n", in dvb_frontend_clear_cache()
1166 static int dtv_property_cache_sync(struct dvb_frontend *fe, in dtv_property_cache_sync() argument
1175 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_cache_sync()
1180 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_cache_sync()
1186 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_cache_sync()
1219 dev_dbg(fe->dvb->device, "%s: Preparing ATSC req\n", __func__); in dtv_property_cache_sync()
1229 dev_err(fe->dvb->device, in dtv_property_cache_sync()
1242 dtv_property_legacy_params_sync(struct dvb_frontend *fe, in dtv_property_legacy_params_sync() argument
1251 dev_err(fe->dvb->device, in dtv_property_legacy_params_sync()
1256 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_legacy_params_sync()
1261 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_legacy_params_sync()
1267 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_legacy_params_sync()
1299 dev_dbg(fe->dvb->device, "%s: Preparing VSB req\n", __func__); in dtv_property_legacy_params_sync()
1316 static int dtv_get_frontend(struct dvb_frontend *fe, in dtv_get_frontend() argument
1322 if (fe->ops.get_frontend) { in dtv_get_frontend()
1323 r = fe->ops.get_frontend(fe, c); in dtv_get_frontend()
1327 dtv_property_legacy_params_sync(fe, c, p_out); in dtv_get_frontend()
1338 static int dtv_property_process_get(struct dvb_frontend *fe, in dtv_property_process_get() argument
1348 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dtv_property_process_get()
1349 tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps]; in dtv_property_process_get()
1478 tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver; in dtv_property_process_get()
1481 tvp->u.data = fe->dtv_property_cache.atscmh_parade_id; in dtv_property_process_get()
1484 tvp->u.data = fe->dtv_property_cache.atscmh_nog; in dtv_property_process_get()
1487 tvp->u.data = fe->dtv_property_cache.atscmh_tnog; in dtv_property_process_get()
1490 tvp->u.data = fe->dtv_property_cache.atscmh_sgn; in dtv_property_process_get()
1493 tvp->u.data = fe->dtv_property_cache.atscmh_prc; in dtv_property_process_get()
1496 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_mode; in dtv_property_process_get()
1499 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_ensemble; in dtv_property_process_get()
1502 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_pri; in dtv_property_process_get()
1505 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_sec; in dtv_property_process_get()
1508 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_block_mode; in dtv_property_process_get()
1511 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_a; in dtv_property_process_get()
1514 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_b; in dtv_property_process_get()
1517 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_c; in dtv_property_process_get()
1520 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_d; in dtv_property_process_get()
1553 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1560 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1565 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1575 static int dtv_set_frontend(struct dvb_frontend *fe);
1593 static int emulate_delivery_system(struct dvb_frontend *fe, u32 delsys) in emulate_delivery_system() argument
1596 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in emulate_delivery_system()
1604 dev_dbg(fe->dvb->device, in emulate_delivery_system()
1624 dev_dbg(fe->dvb->device, "%s: change delivery system on cache to %d\n", in emulate_delivery_system()
1647 static int dvbv5_set_delivery_system(struct dvb_frontend *fe, in dvbv5_set_delivery_system() argument
1652 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv5_set_delivery_system()
1662 desired_system = fe->ops.delsys[0]; in dvbv5_set_delivery_system()
1670 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1671 if (fe->ops.delsys[ncaps] == desired_system) { in dvbv5_set_delivery_system()
1673 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1689 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1702 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1703 if (dvbv3_type(fe->ops.delsys[ncaps]) == type) in dvbv5_set_delivery_system()
1704 delsys = fe->ops.delsys[ncaps]; in dvbv5_set_delivery_system()
1710 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1716 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1720 return emulate_delivery_system(fe, desired_system); in dvbv5_set_delivery_system()
1751 static int dvbv3_set_delivery_system(struct dvb_frontend *fe) in dvbv3_set_delivery_system() argument
1755 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv3_set_delivery_system()
1759 c->delivery_system = fe->ops.delsys[0]; in dvbv3_set_delivery_system()
1766 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1777 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv3_set_delivery_system()
1778 if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) { in dvbv3_set_delivery_system()
1779 delsys = fe->ops.delsys[ncaps]; in dvbv3_set_delivery_system()
1785 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1790 return emulate_delivery_system(fe, delsys); in dvbv3_set_delivery_system()
1807 static int dtv_property_process_set(struct dvb_frontend *fe, in dtv_property_process_set() argument
1812 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_property_process_set()
1816 dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", in dtv_property_process_set()
1819 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1828 dvb_frontend_clear_cache(fe); in dtv_property_process_set()
1835 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1839 r = dtv_set_frontend(fe); in dtv_property_process_set()
1866 r = dvbv5_set_delivery_system(fe, data); in dtv_property_process_set()
1966 fe->dtv_property_cache.atscmh_parade_id = data; in dtv_property_process_set()
1969 fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; in dtv_property_process_set()
1974 if (fe->ops.set_lna) in dtv_property_process_set()
1975 r = fe->ops.set_lna(fe); in dtv_property_process_set()
1991 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_do_ioctl() local
1992 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl()
1995 dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); in dvb_frontend_do_ioctl()
1999 if (fe->exit != DVB_FE_NO_EXIT) { in dvb_frontend_do_ioctl()
2071 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_compat_ioctl() local
2072 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl()
2096 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_compat_ioctl()
2108 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_compat_ioctl()
2133 err = dtv_get_frontend(fe, &getp, NULL); in dvb_frontend_handle_compat_ioctl()
2141 fe, &getp, (struct dtv_property *)(tvp + i), file); in dvb_frontend_handle_compat_ioctl()
2163 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_compat_ioctl() local
2164 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl()
2181 static int dtv_set_frontend(struct dvb_frontend *fe) in dtv_set_frontend() argument
2183 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend()
2184 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_set_frontend()
2188 if (dvb_frontend_check_parameters(fe) < 0) in dtv_set_frontend()
2196 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2265 if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) { in dtv_set_frontend()
2287 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in dtv_set_frontend()
2288 fepriv->max_drift = (dvb_frontend_get_stepsize(fe) * 2) + 1; in dtv_set_frontend()
2309 dvb_frontend_clear_events(fe); in dtv_set_frontend()
2310 dvb_frontend_add_event(fe, 0); in dtv_set_frontend()
2311 dvb_frontend_wakeup(fe); in dtv_set_frontend()
2317 static int dvb_get_property(struct dvb_frontend *fe, struct file *file, in dvb_get_property() argument
2320 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_get_property()
2325 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_property()
2327 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_get_property()
2329 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_get_property()
2350 err = dtv_get_frontend(fe, &getp, NULL); in dvb_get_property()
2355 err = dtv_property_process_get(fe, &getp, in dvb_get_property()
2373 static int dvb_get_frontend(struct dvb_frontend *fe, in dvb_get_frontend() argument
2384 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_frontend()
2386 return dtv_get_frontend(fe, &getp, p_out); in dvb_get_frontend()
2393 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_ioctl() local
2394 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl()
2395 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2398 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_handle_ioctl()
2405 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_frontend_handle_ioctl()
2407 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_frontend_handle_ioctl()
2422 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_ioctl()
2435 err = dvb_get_property(fe, file, parg); in dvb_frontend_handle_ioctl()
2442 strscpy(info->name, fe->ops.info.name, sizeof(info->name)); in dvb_frontend_handle_ioctl()
2443 info->symbol_rate_min = fe->ops.info.symbol_rate_min; in dvb_frontend_handle_ioctl()
2444 info->symbol_rate_max = fe->ops.info.symbol_rate_max; in dvb_frontend_handle_ioctl()
2445 info->symbol_rate_tolerance = fe->ops.info.symbol_rate_tolerance; in dvb_frontend_handle_ioctl()
2446 info->caps = fe->ops.info.caps; in dvb_frontend_handle_ioctl()
2447 info->frequency_stepsize = dvb_frontend_get_stepsize(fe); in dvb_frontend_handle_ioctl()
2448 dvb_frontend_get_frequency_limits(fe, &info->frequency_min, in dvb_frontend_handle_ioctl()
2477 dev_err(fe->dvb->device, in dvb_frontend_handle_ioctl()
2482 dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", in dvb_frontend_handle_ioctl()
2504 if (fe->ops.read_status) in dvb_frontend_handle_ioctl()
2505 err = fe->ops.read_status(fe, status); in dvb_frontend_handle_ioctl()
2510 if (fe->ops.diseqc_reset_overload) { in dvb_frontend_handle_ioctl()
2511 err = fe->ops.diseqc_reset_overload(fe); in dvb_frontend_handle_ioctl()
2518 if (fe->ops.diseqc_send_master_cmd) { in dvb_frontend_handle_ioctl()
2525 err = fe->ops.diseqc_send_master_cmd(fe, cmd); in dvb_frontend_handle_ioctl()
2532 if (fe->ops.diseqc_send_burst) { in dvb_frontend_handle_ioctl()
2533 err = fe->ops.diseqc_send_burst(fe, in dvb_frontend_handle_ioctl()
2541 if (fe->ops.set_tone) { in dvb_frontend_handle_ioctl()
2542 err = fe->ops.set_tone(fe, in dvb_frontend_handle_ioctl()
2551 if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2552 err = fe->ops.set_voltage(fe, in dvb_frontend_handle_ioctl()
2561 if (fe->ops.diseqc_recv_slave_reply) in dvb_frontend_handle_ioctl()
2562 err = fe->ops.diseqc_recv_slave_reply(fe, parg); in dvb_frontend_handle_ioctl()
2566 if (fe->ops.enable_high_lnb_voltage) in dvb_frontend_handle_ioctl()
2567 err = fe->ops.enable_high_lnb_voltage(fe, (long)parg); in dvb_frontend_handle_ioctl()
2577 if (fe->ops.dishnetwork_send_legacy_command) { in dvb_frontend_handle_ioctl()
2578 err = fe->ops.dishnetwork_send_legacy_command(fe, in dvb_frontend_handle_ioctl()
2582 } else if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2614 fe->ops.set_voltage(fe, SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2622 fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2631 fe->dvb->num); in dvb_frontend_handle_ioctl()
2645 if (fe->ops.read_ber) { in dvb_frontend_handle_ioctl()
2647 err = fe->ops.read_ber(fe, parg); in dvb_frontend_handle_ioctl()
2654 if (fe->ops.read_signal_strength) { in dvb_frontend_handle_ioctl()
2656 err = fe->ops.read_signal_strength(fe, parg); in dvb_frontend_handle_ioctl()
2663 if (fe->ops.read_snr) { in dvb_frontend_handle_ioctl()
2665 err = fe->ops.read_snr(fe, parg); in dvb_frontend_handle_ioctl()
2672 if (fe->ops.read_ucblocks) { in dvb_frontend_handle_ioctl()
2674 err = fe->ops.read_ucblocks(fe, parg); in dvb_frontend_handle_ioctl()
2683 err = dvbv3_set_delivery_system(fe); in dvb_frontend_handle_ioctl()
2687 err = dtv_property_cache_sync(fe, c, parg); in dvb_frontend_handle_ioctl()
2690 err = dtv_set_frontend(fe); in dvb_frontend_handle_ioctl()
2694 err = dvb_frontend_get_event(fe, parg, file->f_flags); in dvb_frontend_handle_ioctl()
2698 err = dvb_get_frontend(fe, parg); in dvb_frontend_handle_ioctl()
2711 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_poll() local
2712 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll()
2714 dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_poll()
2727 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_open() local
2728 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open()
2729 struct dvb_adapter *adapter = fe->dvb; in dvb_frontend_open()
2732 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_open()
2733 if (fe->exit == DVB_FE_DEVICE_REMOVED) in dvb_frontend_open()
2775 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { in dvb_frontend_open()
2776 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) in dvb_frontend_open()
2798 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2799 if (fe->dvb->mdev) { in dvb_frontend_open()
2800 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2801 if (fe->dvb->mdev->enable_source) in dvb_frontend_open()
2802 ret = fe->dvb->mdev->enable_source( in dvb_frontend_open()
2805 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2807 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2808 dev_err(fe->dvb->device, in dvb_frontend_open()
2813 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2815 ret = dvb_frontend_start(fe); in dvb_frontend_open()
2823 dvb_frontend_get(fe); in dvb_frontend_open()
2831 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2832 if (fe->dvb->mdev) { in dvb_frontend_open()
2833 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2834 if (fe->dvb->mdev->disable_source) in dvb_frontend_open()
2835 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_open()
2836 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2838 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2843 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) in dvb_frontend_open()
2844 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_open()
2854 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_release() local
2855 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release()
2858 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_release()
2870 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2871 if (fe->dvb->mdev) { in dvb_frontend_release()
2872 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2873 if (fe->dvb->mdev->disable_source) in dvb_frontend_release()
2874 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_release()
2875 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2877 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2879 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_release()
2881 if (fe->ops.ts_bus_ctrl) in dvb_frontend_release()
2882 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_release()
2885 dvb_frontend_put(fe); in dvb_frontend_release()
2902 int dvb_frontend_suspend(struct dvb_frontend *fe) in dvb_frontend_suspend() argument
2906 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_suspend()
2907 fe->id); in dvb_frontend_suspend()
2909 if (fe->ops.tuner_ops.suspend) in dvb_frontend_suspend()
2910 ret = fe->ops.tuner_ops.suspend(fe); in dvb_frontend_suspend()
2911 else if (fe->ops.tuner_ops.sleep) in dvb_frontend_suspend()
2912 ret = fe->ops.tuner_ops.sleep(fe); in dvb_frontend_suspend()
2914 if (fe->ops.sleep) in dvb_frontend_suspend()
2915 ret = fe->ops.sleep(fe); in dvb_frontend_suspend()
2921 int dvb_frontend_resume(struct dvb_frontend *fe) in dvb_frontend_resume() argument
2923 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume()
2926 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_resume()
2927 fe->id); in dvb_frontend_resume()
2929 fe->exit = DVB_FE_DEVICE_RESUME; in dvb_frontend_resume()
2930 if (fe->ops.init) in dvb_frontend_resume()
2931 ret = fe->ops.init(fe); in dvb_frontend_resume()
2933 if (fe->ops.tuner_ops.resume) in dvb_frontend_resume()
2934 ret = fe->ops.tuner_ops.resume(fe); in dvb_frontend_resume()
2935 else if (fe->ops.tuner_ops.init) in dvb_frontend_resume()
2936 ret = fe->ops.tuner_ops.init(fe); in dvb_frontend_resume()
2938 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_resume()
2939 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_resume()
2940 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_resume()
2941 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_resume()
2943 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_resume()
2945 dvb_frontend_wakeup(fe); in dvb_frontend_resume()
2952 struct dvb_frontend *fe) in dvb_register_frontend() argument
2961 .name = fe->ops.info.name, in dvb_register_frontend()
2970 fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); in dvb_register_frontend()
2971 if (!fe->frontend_priv) { in dvb_register_frontend()
2975 fepriv = fe->frontend_priv; in dvb_register_frontend()
2977 kref_init(&fe->refcount); in dvb_register_frontend()
2984 dvb_frontend_get(fe); in dvb_register_frontend()
2990 fe->dvb = dvb; in dvb_register_frontend()
2993 dev_info(fe->dvb->device, in dvb_register_frontend()
2995 fe->dvb->num, fe->id, fe->ops.info.name); in dvb_register_frontend()
2997 dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
2998 fe, DVB_DEVICE_FRONTEND, 0); in dvb_register_frontend()
3005 fe->dtv_property_cache.delivery_system = fe->ops.delsys[0]; in dvb_register_frontend()
3006 dvb_frontend_clear_cache(fe); in dvb_register_frontend()
3013 int dvb_unregister_frontend(struct dvb_frontend *fe) in dvb_unregister_frontend() argument
3015 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend()
3017 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_unregister_frontend()
3020 dvb_frontend_stop(fe); in dvb_unregister_frontend()
3025 dvb_frontend_put(fe); in dvb_unregister_frontend()
3030 static void dvb_frontend_invoke_release(struct dvb_frontend *fe, in dvb_frontend_invoke_release() argument
3031 void (*release)(struct dvb_frontend *fe)) in dvb_frontend_invoke_release() argument
3034 release(fe); in dvb_frontend_invoke_release()
3041 void dvb_frontend_detach(struct dvb_frontend *fe) in dvb_frontend_detach() argument
3043 dvb_frontend_invoke_release(fe, fe->ops.release_sec); in dvb_frontend_detach()
3044 dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release); in dvb_frontend_detach()
3045 dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release); in dvb_frontend_detach()
3046 dvb_frontend_put(fe); in dvb_frontend_detach()