Lines Matching refs:fe

142 static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
143 void (*release)(struct dvb_frontend *fe));
145 static void __dvb_frontend_free(struct dvb_frontend *fe) in __dvb_frontend_free() argument
147 struct dvb_frontend_private *fepriv = fe->frontend_priv; in __dvb_frontend_free()
152 dvb_frontend_invoke_release(fe, fe->ops.release); in __dvb_frontend_free()
159 struct dvb_frontend *fe = in dvb_frontend_free() local
162 __dvb_frontend_free(fe); in dvb_frontend_free()
165 static void dvb_frontend_put(struct dvb_frontend *fe) in dvb_frontend_put() argument
171 if (fe->frontend_priv) in dvb_frontend_put()
172 kref_put(&fe->refcount, dvb_frontend_free); in dvb_frontend_put()
174 __dvb_frontend_free(fe); in dvb_frontend_put()
177 static void dvb_frontend_get(struct dvb_frontend *fe) in dvb_frontend_get() argument
179 kref_get(&fe->refcount); in dvb_frontend_get()
182 static void dvb_frontend_wakeup(struct dvb_frontend *fe);
183 static int dtv_get_frontend(struct dvb_frontend *fe,
187 dtv_property_legacy_params_sync(struct dvb_frontend *fe,
191 static bool has_get_frontend(struct dvb_frontend *fe) in has_get_frontend() argument
193 return fe->ops.get_frontend; in has_get_frontend()
245 static void dvb_frontend_add_event(struct dvb_frontend *fe, in dvb_frontend_add_event() argument
248 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_add_event()
249 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_add_event()
254 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_add_event()
256 if ((status & FE_HAS_LOCK) && has_get_frontend(fe)) in dvb_frontend_add_event()
257 dtv_get_frontend(fe, c, &fepriv->parameters_out); in dvb_frontend_add_event()
290 static int dvb_frontend_get_event(struct dvb_frontend *fe, in dvb_frontend_get_event() argument
293 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_get_event()
296 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_get_event()
324 static void dvb_frontend_clear_events(struct dvb_frontend *fe) in dvb_frontend_clear_events() argument
326 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_clear_events()
334 static void dvb_frontend_init(struct dvb_frontend *fe) in dvb_frontend_init() argument
336 dev_dbg(fe->dvb->device, in dvb_frontend_init()
338 __func__, fe->dvb->num, fe->id, fe->ops.info.name); in dvb_frontend_init()
340 if (fe->ops.init) in dvb_frontend_init()
341 fe->ops.init(fe); in dvb_frontend_init()
342 if (fe->ops.tuner_ops.init) { in dvb_frontend_init()
343 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
344 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_init()
345 fe->ops.tuner_ops.init(fe); in dvb_frontend_init()
346 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
347 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_init()
351 void dvb_frontend_reinitialise(struct dvb_frontend *fe) in dvb_frontend_reinitialise() argument
353 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_reinitialise()
356 dvb_frontend_wakeup(fe); in dvb_frontend_reinitialise()
363 struct dvb_frontend *fe = fepriv->dvbdev->priv; in dvb_frontend_swzigzag_update_delay() local
365 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_swzigzag_update_delay()
388 static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wrapped) in dvb_frontend_swzigzag_autotune() argument
393 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag_autotune()
394 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag_autotune()
399 autoinversion = ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag_autotune()
460 dev_dbg(fe->dvb->device, in dvb_frontend_swzigzag_autotune()
471 if (fe->ops.set_frontend) in dvb_frontend_swzigzag_autotune()
472 fe_set_err = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag_autotune()
486 static void dvb_frontend_swzigzag(struct dvb_frontend *fe) in dvb_frontend_swzigzag() argument
490 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag()
491 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag()
504 if (fe->ops.set_frontend) in dvb_frontend_swzigzag()
505 retval = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag()
521 if (fe->ops.read_status) in dvb_frontend_swzigzag()
522 fe->ops.read_status(fe, &s); in dvb_frontend_swzigzag()
524 dvb_frontend_add_event(fe, s); in dvb_frontend_swzigzag()
535 if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag()
559 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { in dvb_frontend_swzigzag()
588 retval = dvb_frontend_swzigzag_autotune(fe, in dvb_frontend_swzigzag()
616 dvb_frontend_swzigzag_autotune(fe, 0); in dvb_frontend_swzigzag()
620 static int dvb_frontend_is_exiting(struct dvb_frontend *fe) in dvb_frontend_is_exiting() argument
622 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_is_exiting()
624 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_is_exiting()
635 static int dvb_frontend_should_wakeup(struct dvb_frontend *fe) in dvb_frontend_should_wakeup() argument
637 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_should_wakeup()
643 return dvb_frontend_is_exiting(fe); in dvb_frontend_should_wakeup()
646 static void dvb_frontend_wakeup(struct dvb_frontend *fe) in dvb_frontend_wakeup() argument
648 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_wakeup()
656 struct dvb_frontend *fe = data; in dvb_frontend_thread() local
657 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_thread()
658 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_thread()
664 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_thread()
673 dvb_frontend_init(fe); in dvb_frontend_thread()
680 dvb_frontend_should_wakeup(fe) || in dvb_frontend_thread()
685 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { in dvb_frontend_thread()
689 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_thread()
700 dvb_frontend_init(fe); in dvb_frontend_thread()
701 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_thread()
702 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_thread()
703 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_thread()
704 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_thread()
709 if (fe->ops.get_frontend_algo) { in dvb_frontend_thread()
710 algo = fe->ops.get_frontend_algo(fe); in dvb_frontend_thread()
713 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); in dvb_frontend_thread()
716 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__); in dvb_frontend_thread()
723 if (fe->ops.tune) in dvb_frontend_thread()
724 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
727 dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__); in dvb_frontend_thread()
728 dvb_frontend_add_event(fe, s); in dvb_frontend_thread()
733 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__); in dvb_frontend_thread()
734 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
737 …dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->st… in dvb_frontend_thread()
739 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTAT_RETUNE\n", __func__); in dvb_frontend_thread()
747 if (fe->ops.search) { in dvb_frontend_thread()
748 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
761 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
762 fe->ops.read_status(fe, &s); in dvb_frontend_thread()
764 dvb_frontend_add_event(fe, s); /* update event list */ in dvb_frontend_thread()
775 dev_dbg(fe->dvb->device, "%s: UNDEFINED ALGO !\n", __func__); in dvb_frontend_thread()
779 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
784 if (fe->ops.set_voltage) in dvb_frontend_thread()
785 fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); in dvb_frontend_thread()
786 if (fe->ops.tuner_ops.sleep) { in dvb_frontend_thread()
787 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
788 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_thread()
789 fe->ops.tuner_ops.sleep(fe); in dvb_frontend_thread()
790 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
791 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_thread()
793 if (fe->ops.sleep) in dvb_frontend_thread()
794 fe->ops.sleep(fe); in dvb_frontend_thread()
799 fe->exit = DVB_FE_DEVICE_REMOVED; in dvb_frontend_thread()
801 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_thread()
806 dvb_frontend_wakeup(fe); in dvb_frontend_thread()
810 static void dvb_frontend_stop(struct dvb_frontend *fe) in dvb_frontend_stop() argument
812 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop()
814 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_stop()
816 if (fe->exit != DVB_FE_DEVICE_REMOVED) in dvb_frontend_stop()
817 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_stop()
830 dev_warn(fe->dvb->device, in dvb_frontend_stop()
857 static int dvb_frontend_start(struct dvb_frontend *fe) in dvb_frontend_start() argument
860 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start()
863 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_start()
866 if (fe->exit == DVB_FE_NO_EXIT) in dvb_frontend_start()
869 dvb_frontend_stop(fe); in dvb_frontend_start()
878 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_start()
882 fe_thread = kthread_run(dvb_frontend_thread, fe, in dvb_frontend_start()
883 "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id); in dvb_frontend_start()
886 dev_warn(fe->dvb->device, in dvb_frontend_start()
896 static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, in dvb_frontend_get_frequency_limits() argument
900 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_frequency_limits()
901 u32 tuner_min = fe->ops.tuner_ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
902 u32 tuner_max = fe->ops.tuner_ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
903 u32 frontend_min = fe->ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
904 u32 frontend_max = fe->ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
916 dev_warn(fe->dvb->device, in dvb_frontend_get_frequency_limits()
918 fe->dvb->num, fe->id); in dvb_frontend_get_frequency_limits()
929 *tolerance = fe->ops.info.frequency_tolerance_hz / kHz; in dvb_frontend_get_frequency_limits()
934 *tolerance = fe->ops.info.frequency_tolerance_hz; in dvb_frontend_get_frequency_limits()
939 static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe) in dvb_frontend_get_stepsize() argument
941 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_stepsize()
942 u32 fe_step = fe->ops.info.frequency_stepsize_hz; in dvb_frontend_get_stepsize()
943 u32 tuner_step = fe->ops.tuner_ops.info.frequency_step_hz; in dvb_frontend_get_stepsize()
960 static int dvb_frontend_check_parameters(struct dvb_frontend *fe) in dvb_frontend_check_parameters() argument
962 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_check_parameters()
967 dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max, NULL); in dvb_frontend_check_parameters()
970 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
971 fe->dvb->num, fe->id, c->frequency, in dvb_frontend_check_parameters()
983 if ((fe->ops.info.symbol_rate_min && in dvb_frontend_check_parameters()
984 c->symbol_rate < fe->ops.info.symbol_rate_min) || in dvb_frontend_check_parameters()
985 (fe->ops.info.symbol_rate_max && in dvb_frontend_check_parameters()
986 c->symbol_rate > fe->ops.info.symbol_rate_max)) { in dvb_frontend_check_parameters()
987 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
988 fe->dvb->num, fe->id, c->symbol_rate, in dvb_frontend_check_parameters()
989 fe->ops.info.symbol_rate_min, in dvb_frontend_check_parameters()
990 fe->ops.info.symbol_rate_max); in dvb_frontend_check_parameters()
1000 static int dvb_frontend_clear_cache(struct dvb_frontend *fe) in dvb_frontend_clear_cache() argument
1002 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_clear_cache()
1010 dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n", in dvb_frontend_clear_cache()
1172 static int dtv_property_cache_sync(struct dvb_frontend *fe, in dtv_property_cache_sync() argument
1181 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_cache_sync()
1186 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_cache_sync()
1192 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_cache_sync()
1225 dev_dbg(fe->dvb->device, "%s: Preparing ATSC req\n", __func__); in dtv_property_cache_sync()
1235 dev_err(fe->dvb->device, in dtv_property_cache_sync()
1248 dtv_property_legacy_params_sync(struct dvb_frontend *fe, in dtv_property_legacy_params_sync() argument
1257 dev_err(fe->dvb->device, in dtv_property_legacy_params_sync()
1262 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_legacy_params_sync()
1267 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_legacy_params_sync()
1273 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_legacy_params_sync()
1305 dev_dbg(fe->dvb->device, "%s: Preparing VSB req\n", __func__); in dtv_property_legacy_params_sync()
1322 static int dtv_get_frontend(struct dvb_frontend *fe, in dtv_get_frontend() argument
1328 if (fe->ops.get_frontend) { in dtv_get_frontend()
1329 r = fe->ops.get_frontend(fe, c); in dtv_get_frontend()
1333 dtv_property_legacy_params_sync(fe, c, p_out); in dtv_get_frontend()
1344 static int dtv_property_process_get(struct dvb_frontend *fe, in dtv_property_process_get() argument
1354 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dtv_property_process_get()
1355 tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps]; in dtv_property_process_get()
1484 tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver; in dtv_property_process_get()
1487 tvp->u.data = fe->dtv_property_cache.atscmh_parade_id; in dtv_property_process_get()
1490 tvp->u.data = fe->dtv_property_cache.atscmh_nog; in dtv_property_process_get()
1493 tvp->u.data = fe->dtv_property_cache.atscmh_tnog; in dtv_property_process_get()
1496 tvp->u.data = fe->dtv_property_cache.atscmh_sgn; in dtv_property_process_get()
1499 tvp->u.data = fe->dtv_property_cache.atscmh_prc; in dtv_property_process_get()
1502 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_mode; in dtv_property_process_get()
1505 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_ensemble; in dtv_property_process_get()
1508 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_pri; in dtv_property_process_get()
1511 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_sec; in dtv_property_process_get()
1514 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_block_mode; in dtv_property_process_get()
1517 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_a; in dtv_property_process_get()
1520 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_b; in dtv_property_process_get()
1523 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_c; in dtv_property_process_get()
1526 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_d; in dtv_property_process_get()
1559 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1566 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1571 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1581 static int dtv_set_frontend(struct dvb_frontend *fe);
1599 static int emulate_delivery_system(struct dvb_frontend *fe, u32 delsys) in emulate_delivery_system() argument
1602 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in emulate_delivery_system()
1610 dev_dbg(fe->dvb->device, in emulate_delivery_system()
1630 dev_dbg(fe->dvb->device, "%s: change delivery system on cache to %d\n", in emulate_delivery_system()
1653 static int dvbv5_set_delivery_system(struct dvb_frontend *fe, in dvbv5_set_delivery_system() argument
1658 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv5_set_delivery_system()
1668 desired_system = fe->ops.delsys[0]; in dvbv5_set_delivery_system()
1676 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1677 if (fe->ops.delsys[ncaps] == desired_system) { in dvbv5_set_delivery_system()
1679 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1695 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1708 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1709 if (dvbv3_type(fe->ops.delsys[ncaps]) == type) in dvbv5_set_delivery_system()
1710 delsys = fe->ops.delsys[ncaps]; in dvbv5_set_delivery_system()
1716 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1722 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1726 return emulate_delivery_system(fe, desired_system); in dvbv5_set_delivery_system()
1757 static int dvbv3_set_delivery_system(struct dvb_frontend *fe) in dvbv3_set_delivery_system() argument
1761 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv3_set_delivery_system()
1765 c->delivery_system = fe->ops.delsys[0]; in dvbv3_set_delivery_system()
1772 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1783 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv3_set_delivery_system()
1784 if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) { in dvbv3_set_delivery_system()
1785 delsys = fe->ops.delsys[ncaps]; in dvbv3_set_delivery_system()
1791 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1796 return emulate_delivery_system(fe, delsys); in dvbv3_set_delivery_system()
1813 static int dtv_property_process_set(struct dvb_frontend *fe, in dtv_property_process_set() argument
1818 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_property_process_set()
1822 dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", in dtv_property_process_set()
1825 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1834 dvb_frontend_clear_cache(fe); in dtv_property_process_set()
1841 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1845 r = dtv_set_frontend(fe); in dtv_property_process_set()
1872 r = dvbv5_set_delivery_system(fe, data); in dtv_property_process_set()
1972 fe->dtv_property_cache.atscmh_parade_id = data; in dtv_property_process_set()
1975 fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; in dtv_property_process_set()
1980 if (fe->ops.set_lna) in dtv_property_process_set()
1981 r = fe->ops.set_lna(fe); in dtv_property_process_set()
1997 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_do_ioctl() local
1998 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl()
2001 dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); in dvb_frontend_do_ioctl()
2005 if (fe->exit != DVB_FE_NO_EXIT) { in dvb_frontend_do_ioctl()
2077 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_compat_ioctl() local
2078 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl()
2102 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_compat_ioctl()
2114 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_compat_ioctl()
2139 err = dtv_get_frontend(fe, &getp, NULL); in dvb_frontend_handle_compat_ioctl()
2147 fe, &getp, (struct dtv_property *)(tvp + i), file); in dvb_frontend_handle_compat_ioctl()
2169 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_compat_ioctl() local
2170 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl()
2187 static int dtv_set_frontend(struct dvb_frontend *fe) in dtv_set_frontend() argument
2189 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend()
2190 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_set_frontend()
2194 if (dvb_frontend_check_parameters(fe) < 0) in dtv_set_frontend()
2202 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2271 if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) { in dtv_set_frontend()
2293 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in dtv_set_frontend()
2294 fepriv->max_drift = (dvb_frontend_get_stepsize(fe) * 2) + 1; in dtv_set_frontend()
2315 dvb_frontend_clear_events(fe); in dtv_set_frontend()
2316 dvb_frontend_add_event(fe, 0); in dtv_set_frontend()
2317 dvb_frontend_wakeup(fe); in dtv_set_frontend()
2327 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_ioctl() local
2328 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl()
2329 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2332 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_handle_ioctl()
2339 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_frontend_handle_ioctl()
2341 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_frontend_handle_ioctl()
2356 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_ioctl()
2371 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2373 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_frontend_handle_ioctl()
2375 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_frontend_handle_ioctl()
2396 err = dtv_get_frontend(fe, &getp, NULL); in dvb_frontend_handle_ioctl()
2403 err = dtv_property_process_get(fe, &getp, in dvb_frontend_handle_ioctl()
2425 strcpy(info->name, fe->ops.info.name); in dvb_frontend_handle_ioctl()
2426 info->symbol_rate_min = fe->ops.info.symbol_rate_min; in dvb_frontend_handle_ioctl()
2427 info->symbol_rate_max = fe->ops.info.symbol_rate_max; in dvb_frontend_handle_ioctl()
2428 info->symbol_rate_tolerance = fe->ops.info.symbol_rate_tolerance; in dvb_frontend_handle_ioctl()
2429 info->caps = fe->ops.info.caps; in dvb_frontend_handle_ioctl()
2430 info->frequency_stepsize = dvb_frontend_get_stepsize(fe); in dvb_frontend_handle_ioctl()
2431 dvb_frontend_get_frequency_limits(fe, &info->frequency_min, in dvb_frontend_handle_ioctl()
2460 dev_err(fe->dvb->device, in dvb_frontend_handle_ioctl()
2465 dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", in dvb_frontend_handle_ioctl()
2487 if (fe->ops.read_status) in dvb_frontend_handle_ioctl()
2488 err = fe->ops.read_status(fe, status); in dvb_frontend_handle_ioctl()
2493 if (fe->ops.diseqc_reset_overload) { in dvb_frontend_handle_ioctl()
2494 err = fe->ops.diseqc_reset_overload(fe); in dvb_frontend_handle_ioctl()
2501 if (fe->ops.diseqc_send_master_cmd) { in dvb_frontend_handle_ioctl()
2508 err = fe->ops.diseqc_send_master_cmd(fe, cmd); in dvb_frontend_handle_ioctl()
2515 if (fe->ops.diseqc_send_burst) { in dvb_frontend_handle_ioctl()
2516 err = fe->ops.diseqc_send_burst(fe, in dvb_frontend_handle_ioctl()
2524 if (fe->ops.set_tone) { in dvb_frontend_handle_ioctl()
2525 err = fe->ops.set_tone(fe, in dvb_frontend_handle_ioctl()
2534 if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2535 err = fe->ops.set_voltage(fe, in dvb_frontend_handle_ioctl()
2544 if (fe->ops.diseqc_recv_slave_reply) in dvb_frontend_handle_ioctl()
2545 err = fe->ops.diseqc_recv_slave_reply(fe, parg); in dvb_frontend_handle_ioctl()
2549 if (fe->ops.enable_high_lnb_voltage) in dvb_frontend_handle_ioctl()
2550 err = fe->ops.enable_high_lnb_voltage(fe, (long)parg); in dvb_frontend_handle_ioctl()
2561 if (fe->ops.dishnetwork_send_legacy_command) { in dvb_frontend_handle_ioctl()
2562 err = fe->ops.dishnetwork_send_legacy_command(fe, in dvb_frontend_handle_ioctl()
2566 } else if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2598 fe->ops.set_voltage(fe, SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2606 fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2615 __func__, fe->dvb->num); in dvb_frontend_handle_ioctl()
2629 if (fe->ops.read_ber) { in dvb_frontend_handle_ioctl()
2631 err = fe->ops.read_ber(fe, parg); in dvb_frontend_handle_ioctl()
2638 if (fe->ops.read_signal_strength) { in dvb_frontend_handle_ioctl()
2640 err = fe->ops.read_signal_strength(fe, parg); in dvb_frontend_handle_ioctl()
2647 if (fe->ops.read_snr) { in dvb_frontend_handle_ioctl()
2649 err = fe->ops.read_snr(fe, parg); in dvb_frontend_handle_ioctl()
2656 if (fe->ops.read_ucblocks) { in dvb_frontend_handle_ioctl()
2658 err = fe->ops.read_ucblocks(fe, parg); in dvb_frontend_handle_ioctl()
2667 err = dvbv3_set_delivery_system(fe); in dvb_frontend_handle_ioctl()
2671 err = dtv_property_cache_sync(fe, c, parg); in dvb_frontend_handle_ioctl()
2674 err = dtv_set_frontend(fe); in dvb_frontend_handle_ioctl()
2677 err = dvb_frontend_get_event(fe, parg, file->f_flags); in dvb_frontend_handle_ioctl()
2681 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2689 err = dtv_get_frontend(fe, &getp, parg); in dvb_frontend_handle_ioctl()
2703 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_poll() local
2704 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll()
2706 dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_poll()
2719 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_open() local
2720 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open()
2721 struct dvb_adapter *adapter = fe->dvb; in dvb_frontend_open()
2724 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_open()
2725 if (fe->exit == DVB_FE_DEVICE_REMOVED) in dvb_frontend_open()
2767 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { in dvb_frontend_open()
2768 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) in dvb_frontend_open()
2790 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2791 if (fe->dvb->mdev) { in dvb_frontend_open()
2792 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2793 if (fe->dvb->mdev->enable_source) in dvb_frontend_open()
2794 ret = fe->dvb->mdev->enable_source( in dvb_frontend_open()
2797 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2799 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2800 dev_err(fe->dvb->device, in dvb_frontend_open()
2805 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2807 ret = dvb_frontend_start(fe); in dvb_frontend_open()
2815 dvb_frontend_get(fe); in dvb_frontend_open()
2823 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2824 if (fe->dvb->mdev) { in dvb_frontend_open()
2825 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2826 if (fe->dvb->mdev->disable_source) in dvb_frontend_open()
2827 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_open()
2828 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2830 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2835 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) in dvb_frontend_open()
2836 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_open()
2846 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_release() local
2847 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release()
2850 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_release()
2862 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2863 if (fe->dvb->mdev) { in dvb_frontend_release()
2864 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2865 if (fe->dvb->mdev->disable_source) in dvb_frontend_release()
2866 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_release()
2867 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2869 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2871 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_release()
2873 if (fe->ops.ts_bus_ctrl) in dvb_frontend_release()
2874 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_release()
2877 dvb_frontend_put(fe); in dvb_frontend_release()
2894 int dvb_frontend_suspend(struct dvb_frontend *fe) in dvb_frontend_suspend() argument
2898 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_suspend()
2899 fe->id); in dvb_frontend_suspend()
2901 if (fe->ops.tuner_ops.suspend) in dvb_frontend_suspend()
2902 ret = fe->ops.tuner_ops.suspend(fe); in dvb_frontend_suspend()
2903 else if (fe->ops.tuner_ops.sleep) in dvb_frontend_suspend()
2904 ret = fe->ops.tuner_ops.sleep(fe); in dvb_frontend_suspend()
2906 if (fe->ops.sleep) in dvb_frontend_suspend()
2907 ret = fe->ops.sleep(fe); in dvb_frontend_suspend()
2913 int dvb_frontend_resume(struct dvb_frontend *fe) in dvb_frontend_resume() argument
2915 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume()
2918 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_resume()
2919 fe->id); in dvb_frontend_resume()
2921 fe->exit = DVB_FE_DEVICE_RESUME; in dvb_frontend_resume()
2922 if (fe->ops.init) in dvb_frontend_resume()
2923 ret = fe->ops.init(fe); in dvb_frontend_resume()
2925 if (fe->ops.tuner_ops.resume) in dvb_frontend_resume()
2926 ret = fe->ops.tuner_ops.resume(fe); in dvb_frontend_resume()
2927 else if (fe->ops.tuner_ops.init) in dvb_frontend_resume()
2928 ret = fe->ops.tuner_ops.init(fe); in dvb_frontend_resume()
2930 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_resume()
2931 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_resume()
2932 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_resume()
2933 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_resume()
2935 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_resume()
2937 dvb_frontend_wakeup(fe); in dvb_frontend_resume()
2944 struct dvb_frontend *fe) in dvb_register_frontend() argument
2953 .name = fe->ops.info.name, in dvb_register_frontend()
2962 fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); in dvb_register_frontend()
2963 if (!fe->frontend_priv) { in dvb_register_frontend()
2967 fepriv = fe->frontend_priv; in dvb_register_frontend()
2969 kref_init(&fe->refcount); in dvb_register_frontend()
2976 dvb_frontend_get(fe); in dvb_register_frontend()
2982 fe->dvb = dvb; in dvb_register_frontend()
2985 dev_info(fe->dvb->device, in dvb_register_frontend()
2987 fe->dvb->num, fe->id, fe->ops.info.name); in dvb_register_frontend()
2989 dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
2990 fe, DVB_DEVICE_FRONTEND, 0); in dvb_register_frontend()
2997 fe->dtv_property_cache.delivery_system = fe->ops.delsys[0]; in dvb_register_frontend()
2998 dvb_frontend_clear_cache(fe); in dvb_register_frontend()
3005 int dvb_unregister_frontend(struct dvb_frontend *fe) in dvb_unregister_frontend() argument
3007 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend()
3009 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_unregister_frontend()
3012 dvb_frontend_stop(fe); in dvb_unregister_frontend()
3017 dvb_frontend_put(fe); in dvb_unregister_frontend()
3022 static void dvb_frontend_invoke_release(struct dvb_frontend *fe, in dvb_frontend_invoke_release() argument
3023 void (*release)(struct dvb_frontend *fe)) in dvb_frontend_invoke_release() argument
3026 release(fe); in dvb_frontend_invoke_release()
3033 void dvb_frontend_detach(struct dvb_frontend *fe) in dvb_frontend_detach() argument
3035 dvb_frontend_invoke_release(fe, fe->ops.release_sec); in dvb_frontend_detach()
3036 dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release); in dvb_frontend_detach()
3037 dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release); in dvb_frontend_detach()
3038 dvb_frontend_invoke_release(fe, fe->ops.detach); in dvb_frontend_detach()
3039 dvb_frontend_put(fe); in dvb_frontend_detach()