Lines Matching full:fe

131 static void dvb_frontend_invoke_release(struct dvb_frontend *fe,
132 void (*release)(struct dvb_frontend *fe));
134 static void __dvb_frontend_free(struct dvb_frontend *fe) in __dvb_frontend_free() argument
136 struct dvb_frontend_private *fepriv = fe->frontend_priv; in __dvb_frontend_free()
141 dvb_frontend_invoke_release(fe, fe->ops.release); in __dvb_frontend_free()
148 struct dvb_frontend *fe = in dvb_frontend_free() local
151 __dvb_frontend_free(fe); in dvb_frontend_free()
154 static void dvb_frontend_put(struct dvb_frontend *fe) in dvb_frontend_put() argument
157 if (fe->ops.detach) in dvb_frontend_put()
158 fe->ops.detach(fe); in dvb_frontend_put()
163 if (fe->frontend_priv) in dvb_frontend_put()
164 kref_put(&fe->refcount, dvb_frontend_free); in dvb_frontend_put()
166 __dvb_frontend_free(fe); in dvb_frontend_put()
169 static void dvb_frontend_get(struct dvb_frontend *fe) in dvb_frontend_get() argument
171 kref_get(&fe->refcount); in dvb_frontend_get()
174 static void dvb_frontend_wakeup(struct dvb_frontend *fe);
175 static int dtv_get_frontend(struct dvb_frontend *fe,
179 dtv_property_legacy_params_sync(struct dvb_frontend *fe,
183 static bool has_get_frontend(struct dvb_frontend *fe) in has_get_frontend() argument
185 return fe->ops.get_frontend; in has_get_frontend()
237 static void dvb_frontend_add_event(struct dvb_frontend *fe, in dvb_frontend_add_event() argument
240 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_add_event()
241 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_add_event()
246 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_add_event()
248 if ((status & FE_HAS_LOCK) && has_get_frontend(fe)) in dvb_frontend_add_event()
249 dtv_get_frontend(fe, c, &fepriv->parameters_out); in dvb_frontend_add_event()
282 static int dvb_frontend_get_event(struct dvb_frontend *fe, in dvb_frontend_get_event() argument
285 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_get_event()
288 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_get_event()
316 static void dvb_frontend_clear_events(struct dvb_frontend *fe) in dvb_frontend_clear_events() argument
318 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_clear_events()
326 static void dvb_frontend_init(struct dvb_frontend *fe) in dvb_frontend_init() argument
328 dev_dbg(fe->dvb->device, in dvb_frontend_init()
330 __func__, fe->dvb->num, fe->id, fe->ops.info.name); in dvb_frontend_init()
332 if (fe->ops.init) in dvb_frontend_init()
333 fe->ops.init(fe); in dvb_frontend_init()
334 if (fe->ops.tuner_ops.init) { in dvb_frontend_init()
335 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
336 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_init()
337 fe->ops.tuner_ops.init(fe); in dvb_frontend_init()
338 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_init()
339 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_init()
343 void dvb_frontend_reinitialise(struct dvb_frontend *fe) in dvb_frontend_reinitialise() argument
345 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_reinitialise()
348 dvb_frontend_wakeup(fe); in dvb_frontend_reinitialise()
355 struct dvb_frontend *fe = fepriv->dvbdev->priv; in dvb_frontend_swzigzag_update_delay() local
357 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_swzigzag_update_delay()
374 * @fe: The frontend concerned.
380 static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wrapped) in dvb_frontend_swzigzag_autotune() argument
385 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag_autotune()
386 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag_autotune()
391 autoinversion = ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag_autotune()
452 dev_dbg(fe->dvb->device, in dvb_frontend_swzigzag_autotune()
463 if (fe->ops.set_frontend) in dvb_frontend_swzigzag_autotune()
464 fe_set_err = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag_autotune()
478 static void dvb_frontend_swzigzag(struct dvb_frontend *fe) in dvb_frontend_swzigzag() argument
482 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag()
483 struct dtv_frontend_properties *c = &fe->dtv_property_cache, tmp; in dvb_frontend_swzigzag()
486 dev_warn_once(fe->dvb->device, in dvb_frontend_swzigzag()
500 if (fe->ops.set_frontend) in dvb_frontend_swzigzag()
501 retval = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag()
517 if (fe->ops.read_status) in dvb_frontend_swzigzag()
518 fe->ops.read_status(fe, &s); in dvb_frontend_swzigzag()
520 dvb_frontend_add_event(fe, s); in dvb_frontend_swzigzag()
531 if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag()
555 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { in dvb_frontend_swzigzag()
584 retval = dvb_frontend_swzigzag_autotune(fe, in dvb_frontend_swzigzag()
612 dvb_frontend_swzigzag_autotune(fe, 0); in dvb_frontend_swzigzag()
616 static int dvb_frontend_is_exiting(struct dvb_frontend *fe) in dvb_frontend_is_exiting() argument
618 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_is_exiting()
620 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_is_exiting()
631 static int dvb_frontend_should_wakeup(struct dvb_frontend *fe) in dvb_frontend_should_wakeup() argument
633 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_should_wakeup()
639 return dvb_frontend_is_exiting(fe); in dvb_frontend_should_wakeup()
642 static void dvb_frontend_wakeup(struct dvb_frontend *fe) in dvb_frontend_wakeup() argument
644 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_wakeup()
652 struct dvb_frontend *fe = data; in dvb_frontend_thread() local
653 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_thread()
654 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_thread()
660 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_thread()
669 dvb_frontend_init(fe); in dvb_frontend_thread()
676 dvb_frontend_should_wakeup(fe) || in dvb_frontend_thread()
681 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { in dvb_frontend_thread()
685 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_thread()
696 dvb_frontend_init(fe); in dvb_frontend_thread()
697 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_thread()
698 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_thread()
699 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_thread()
700 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_thread()
705 if (fe->ops.get_frontend_algo) { in dvb_frontend_thread()
706 algo = fe->ops.get_frontend_algo(fe); in dvb_frontend_thread()
709 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); in dvb_frontend_thread()
712 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__); in dvb_frontend_thread()
719 if (fe->ops.tune) in dvb_frontend_thread()
720 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
723 dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__); in dvb_frontend_thread()
724 dvb_frontend_add_event(fe, s); in dvb_frontend_thread()
729 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__); in dvb_frontend_thread()
730 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
733 …dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->st… in dvb_frontend_thread()
735 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTAT_RETUNE\n", __func__); in dvb_frontend_thread()
743 if (fe->ops.search) { in dvb_frontend_thread()
744 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
757 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
758 fe->ops.read_status(fe, &s); in dvb_frontend_thread()
760 dvb_frontend_add_event(fe, s); /* update event list */ in dvb_frontend_thread()
771 dev_dbg(fe->dvb->device, "%s: UNDEFINED ALGO !\n", __func__); in dvb_frontend_thread()
775 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
780 if (fe->ops.set_voltage) in dvb_frontend_thread()
781 fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); in dvb_frontend_thread()
782 if (fe->ops.tuner_ops.sleep) { in dvb_frontend_thread()
783 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
784 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_thread()
785 fe->ops.tuner_ops.sleep(fe); in dvb_frontend_thread()
786 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
787 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_thread()
789 if (fe->ops.sleep) in dvb_frontend_thread()
790 fe->ops.sleep(fe); in dvb_frontend_thread()
795 fe->exit = DVB_FE_DEVICE_REMOVED; in dvb_frontend_thread()
797 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_thread()
802 dvb_frontend_wakeup(fe); in dvb_frontend_thread()
806 static void dvb_frontend_stop(struct dvb_frontend *fe) in dvb_frontend_stop() argument
808 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop()
810 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_stop()
812 if (fe->exit != DVB_FE_DEVICE_REMOVED) in dvb_frontend_stop()
813 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_stop()
826 dev_warn(fe->dvb->device, in dvb_frontend_stop()
853 static int dvb_frontend_start(struct dvb_frontend *fe) in dvb_frontend_start() argument
856 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start()
859 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_start()
862 if (fe->exit == DVB_FE_NO_EXIT) in dvb_frontend_start()
865 dvb_frontend_stop(fe); in dvb_frontend_start()
874 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_start()
878 fe_thread = kthread_run(dvb_frontend_thread, fe, in dvb_frontend_start()
879 "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id); in dvb_frontend_start()
882 dev_warn(fe->dvb->device, in dvb_frontend_start()
892 static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, in dvb_frontend_get_frequency_limits() argument
896 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_frequency_limits()
897 u32 tuner_min = fe->ops.tuner_ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
898 u32 tuner_max = fe->ops.tuner_ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
899 u32 frontend_min = fe->ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
900 u32 frontend_max = fe->ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
912 dev_warn(fe->dvb->device, in dvb_frontend_get_frequency_limits()
914 fe->dvb->num, fe->id); in dvb_frontend_get_frequency_limits()
916 dev_dbg(fe->dvb->device, "frequency interval: tuner: %u...%u, frontend: %u...%u", in dvb_frontend_get_frequency_limits()
928 *tolerance = fe->ops.info.frequency_tolerance_hz / kHz; in dvb_frontend_get_frequency_limits()
933 *tolerance = fe->ops.info.frequency_tolerance_hz; in dvb_frontend_get_frequency_limits()
938 static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe) in dvb_frontend_get_stepsize() argument
940 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_stepsize()
941 u32 fe_step = fe->ops.info.frequency_stepsize_hz; in dvb_frontend_get_stepsize()
942 u32 tuner_step = fe->ops.tuner_ops.info.frequency_step_hz; in dvb_frontend_get_stepsize()
959 static int dvb_frontend_check_parameters(struct dvb_frontend *fe) in dvb_frontend_check_parameters() argument
961 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_check_parameters()
966 dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max, NULL); in dvb_frontend_check_parameters()
969 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
970 fe->dvb->num, fe->id, c->frequency, in dvb_frontend_check_parameters()
982 if ((fe->ops.info.symbol_rate_min && in dvb_frontend_check_parameters()
983 c->symbol_rate < fe->ops.info.symbol_rate_min) || in dvb_frontend_check_parameters()
984 (fe->ops.info.symbol_rate_max && in dvb_frontend_check_parameters()
985 c->symbol_rate > fe->ops.info.symbol_rate_max)) { in dvb_frontend_check_parameters()
986 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
987 fe->dvb->num, fe->id, c->symbol_rate, in dvb_frontend_check_parameters()
988 fe->ops.info.symbol_rate_min, in dvb_frontend_check_parameters()
989 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()
1162 static int dtv_property_cache_sync(struct dvb_frontend *fe, in dtv_property_cache_sync() argument
1171 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_cache_sync()
1176 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_cache_sync()
1182 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_cache_sync()
1215 dev_dbg(fe->dvb->device, "%s: Preparing ATSC req\n", __func__); in dtv_property_cache_sync()
1225 dev_err(fe->dvb->device, in dtv_property_cache_sync()
1238 dtv_property_legacy_params_sync(struct dvb_frontend *fe, in dtv_property_legacy_params_sync() argument
1247 dev_err(fe->dvb->device, in dtv_property_legacy_params_sync()
1252 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__); in dtv_property_legacy_params_sync()
1257 dev_dbg(fe->dvb->device, "%s: Preparing QAM req\n", __func__); in dtv_property_legacy_params_sync()
1263 dev_dbg(fe->dvb->device, "%s: Preparing OFDM req\n", __func__); in dtv_property_legacy_params_sync()
1295 dev_dbg(fe->dvb->device, "%s: Preparing VSB req\n", __func__); in dtv_property_legacy_params_sync()
1304 * @fe: struct dvb_frontend pointer
1306 * @p_out: struct dvb_frontend_parameters pointer (DVBv3 FE struct)
1312 static int dtv_get_frontend(struct dvb_frontend *fe, in dtv_get_frontend() argument
1318 if (fe->ops.get_frontend) { in dtv_get_frontend()
1319 r = fe->ops.get_frontend(fe, c); in dtv_get_frontend()
1323 dtv_property_legacy_params_sync(fe, c, p_out); in dtv_get_frontend()
1334 static int dtv_property_process_get(struct dvb_frontend *fe, in dtv_property_process_get() argument
1345 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dtv_property_process_get()
1346 tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps]; in dtv_property_process_get()
1476 tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver; in dtv_property_process_get()
1479 tvp->u.data = fe->dtv_property_cache.atscmh_parade_id; in dtv_property_process_get()
1482 tvp->u.data = fe->dtv_property_cache.atscmh_nog; in dtv_property_process_get()
1485 tvp->u.data = fe->dtv_property_cache.atscmh_tnog; in dtv_property_process_get()
1488 tvp->u.data = fe->dtv_property_cache.atscmh_sgn; in dtv_property_process_get()
1491 tvp->u.data = fe->dtv_property_cache.atscmh_prc; in dtv_property_process_get()
1494 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_mode; in dtv_property_process_get()
1497 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_ensemble; in dtv_property_process_get()
1500 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_pri; in dtv_property_process_get()
1503 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_sec; in dtv_property_process_get()
1506 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_block_mode; in dtv_property_process_get()
1509 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_a; in dtv_property_process_get()
1512 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_b; in dtv_property_process_get()
1515 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_c; in dtv_property_process_get()
1518 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_d; in dtv_property_process_get()
1575 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1576 "%s: FE property %d doesn't exist\n", in dtv_property_process_get()
1584 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1592 static int dtv_set_frontend(struct dvb_frontend *fe);
1602 * @fe: struct frontend;
1610 static int emulate_delivery_system(struct dvb_frontend *fe, u32 delsys) in emulate_delivery_system() argument
1613 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in emulate_delivery_system()
1621 dev_dbg(fe->dvb->device, in emulate_delivery_system()
1641 dev_dbg(fe->dvb->device, "%s: change delivery system on cache to %d\n", in emulate_delivery_system()
1649 * @fe: frontend struct
1664 static int dvbv5_set_delivery_system(struct dvb_frontend *fe, in dvbv5_set_delivery_system() argument
1669 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv5_set_delivery_system()
1679 desired_system = fe->ops.delsys[0]; in dvbv5_set_delivery_system()
1687 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1688 if (fe->ops.delsys[ncaps] == desired_system) { in dvbv5_set_delivery_system()
1690 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1706 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1719 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1720 if (dvbv3_type(fe->ops.delsys[ncaps]) == type) in dvbv5_set_delivery_system()
1721 delsys = fe->ops.delsys[ncaps]; in dvbv5_set_delivery_system()
1727 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1733 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1737 return emulate_delivery_system(fe, desired_system); in dvbv5_set_delivery_system()
1742 * @fe: frontend struct
1768 static int dvbv3_set_delivery_system(struct dvb_frontend *fe) in dvbv3_set_delivery_system() argument
1772 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv3_set_delivery_system()
1776 c->delivery_system = fe->ops.delsys[0]; in dvbv3_set_delivery_system()
1783 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1794 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv3_set_delivery_system()
1795 if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) { in dvbv3_set_delivery_system()
1796 delsys = fe->ops.delsys[ncaps]; in dvbv3_set_delivery_system()
1802 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1807 return emulate_delivery_system(fe, delsys); in dvbv3_set_delivery_system()
1810 static void prepare_tuning_algo_parameters(struct dvb_frontend *fe) in prepare_tuning_algo_parameters() argument
1812 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in prepare_tuning_algo_parameters()
1813 struct dvb_frontend_private *fepriv = fe->frontend_priv; in prepare_tuning_algo_parameters()
1817 if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) { in prepare_tuning_algo_parameters()
1839 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in prepare_tuning_algo_parameters()
1859 * @fe: Pointer to &struct dvb_frontend
1871 static int dtv_property_process_set(struct dvb_frontend *fe, in dtv_property_process_set() argument
1876 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_property_process_set()
1880 dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", in dtv_property_process_set()
1883 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1892 dvb_frontend_clear_cache(fe); in dtv_property_process_set()
1899 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1903 r = dtv_set_frontend(fe); in dtv_property_process_set()
1930 r = dvbv5_set_delivery_system(fe, data); in dtv_property_process_set()
2030 fe->dtv_property_cache.atscmh_parade_id = data; in dtv_property_process_set()
2033 fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; in dtv_property_process_set()
2038 if (fe->ops.set_lna) in dtv_property_process_set()
2039 r = fe->ops.set_lna(fe); in dtv_property_process_set()
2055 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_do_ioctl() local
2056 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl()
2059 dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); in dvb_frontend_do_ioctl()
2063 if (fe->exit != DVB_FE_NO_EXIT) { in dvb_frontend_do_ioctl()
2135 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_compat_ioctl() local
2136 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl()
2160 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_compat_ioctl()
2172 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_compat_ioctl()
2197 err = dtv_get_frontend(fe, &getp, NULL); in dvb_frontend_handle_compat_ioctl()
2205 fe, &getp, (struct dtv_property *)(tvp + i), file); in dvb_frontend_handle_compat_ioctl()
2227 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_compat_ioctl() local
2228 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl()
2245 static int dtv_set_frontend(struct dvb_frontend *fe) in dtv_set_frontend() argument
2247 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend()
2248 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_set_frontend()
2251 if (dvb_frontend_check_parameters(fe) < 0) in dtv_set_frontend()
2259 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2326 prepare_tuning_algo_parameters(fe); in dtv_set_frontend()
2333 dvb_frontend_clear_events(fe); in dtv_set_frontend()
2334 dvb_frontend_add_event(fe, 0); in dtv_set_frontend()
2335 dvb_frontend_wakeup(fe); in dtv_set_frontend()
2341 static int dvb_get_property(struct dvb_frontend *fe, struct file *file, in dvb_get_property() argument
2344 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_get_property()
2349 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_property()
2351 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_get_property()
2353 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_get_property()
2374 err = dtv_get_frontend(fe, &getp, NULL); in dvb_get_property()
2379 err = dtv_property_process_get(fe, &getp, in dvb_get_property()
2397 static int dvb_get_frontend(struct dvb_frontend *fe, in dvb_get_frontend() argument
2408 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_frontend()
2410 return dtv_get_frontend(fe, &getp, p_out); in dvb_get_frontend()
2417 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_ioctl() local
2418 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl()
2419 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2422 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_handle_ioctl()
2429 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_frontend_handle_ioctl()
2431 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_frontend_handle_ioctl()
2446 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_ioctl()
2459 err = dvb_get_property(fe, file, parg); in dvb_frontend_handle_ioctl()
2466 strscpy(info->name, fe->ops.info.name, sizeof(info->name)); in dvb_frontend_handle_ioctl()
2467 info->symbol_rate_min = fe->ops.info.symbol_rate_min; in dvb_frontend_handle_ioctl()
2468 info->symbol_rate_max = fe->ops.info.symbol_rate_max; in dvb_frontend_handle_ioctl()
2469 info->symbol_rate_tolerance = fe->ops.info.symbol_rate_tolerance; in dvb_frontend_handle_ioctl()
2470 info->caps = fe->ops.info.caps; in dvb_frontend_handle_ioctl()
2471 info->frequency_stepsize = dvb_frontend_get_stepsize(fe); in dvb_frontend_handle_ioctl()
2472 dvb_frontend_get_frequency_limits(fe, &info->frequency_min, in dvb_frontend_handle_ioctl()
2501 dev_err(fe->dvb->device, in dvb_frontend_handle_ioctl()
2506 dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", in dvb_frontend_handle_ioctl()
2528 if (fe->ops.read_status) in dvb_frontend_handle_ioctl()
2529 err = fe->ops.read_status(fe, status); in dvb_frontend_handle_ioctl()
2534 if (fe->ops.diseqc_reset_overload) { in dvb_frontend_handle_ioctl()
2535 err = fe->ops.diseqc_reset_overload(fe); in dvb_frontend_handle_ioctl()
2542 if (fe->ops.diseqc_send_master_cmd) { in dvb_frontend_handle_ioctl()
2549 err = fe->ops.diseqc_send_master_cmd(fe, cmd); in dvb_frontend_handle_ioctl()
2556 if (fe->ops.diseqc_send_burst) { in dvb_frontend_handle_ioctl()
2557 err = fe->ops.diseqc_send_burst(fe, (long)parg); in dvb_frontend_handle_ioctl()
2564 if (fe->ops.set_tone) { in dvb_frontend_handle_ioctl()
2566 err = fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_handle_ioctl()
2573 if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2575 err = fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_handle_ioctl()
2582 if (fe->ops.diseqc_recv_slave_reply) in dvb_frontend_handle_ioctl()
2583 err = fe->ops.diseqc_recv_slave_reply(fe, parg); in dvb_frontend_handle_ioctl()
2587 if (fe->ops.enable_high_lnb_voltage) in dvb_frontend_handle_ioctl()
2588 err = fe->ops.enable_high_lnb_voltage(fe, (long)parg); in dvb_frontend_handle_ioctl()
2598 if (fe->ops.dishnetwork_send_legacy_command) { in dvb_frontend_handle_ioctl()
2599 err = fe->ops.dishnetwork_send_legacy_command(fe, in dvb_frontend_handle_ioctl()
2603 } else if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2635 fe->ops.set_voltage(fe, SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2643 fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2652 fe->dvb->num); in dvb_frontend_handle_ioctl()
2666 if (fe->ops.read_ber) { in dvb_frontend_handle_ioctl()
2668 err = fe->ops.read_ber(fe, parg); in dvb_frontend_handle_ioctl()
2675 if (fe->ops.read_signal_strength) { in dvb_frontend_handle_ioctl()
2677 err = fe->ops.read_signal_strength(fe, parg); in dvb_frontend_handle_ioctl()
2684 if (fe->ops.read_snr) { in dvb_frontend_handle_ioctl()
2686 err = fe->ops.read_snr(fe, parg); in dvb_frontend_handle_ioctl()
2693 if (fe->ops.read_ucblocks) { in dvb_frontend_handle_ioctl()
2695 err = fe->ops.read_ucblocks(fe, parg); in dvb_frontend_handle_ioctl()
2704 err = dvbv3_set_delivery_system(fe); in dvb_frontend_handle_ioctl()
2708 err = dtv_property_cache_sync(fe, c, parg); in dvb_frontend_handle_ioctl()
2711 err = dtv_set_frontend(fe); in dvb_frontend_handle_ioctl()
2715 err = dvb_frontend_get_event(fe, parg, file->f_flags); in dvb_frontend_handle_ioctl()
2719 err = dvb_get_frontend(fe, parg); in dvb_frontend_handle_ioctl()
2732 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_poll() local
2733 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll()
2735 dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_poll()
2748 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_open() local
2749 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open()
2750 struct dvb_adapter *adapter = fe->dvb; in dvb_frontend_open()
2753 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_open()
2754 if (fe->exit == DVB_FE_DEVICE_REMOVED) in dvb_frontend_open()
2796 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { in dvb_frontend_open()
2797 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) in dvb_frontend_open()
2819 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2820 if (fe->dvb->mdev) { in dvb_frontend_open()
2821 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2822 if (fe->dvb->mdev->enable_source) in dvb_frontend_open()
2823 ret = fe->dvb->mdev->enable_source( in dvb_frontend_open()
2826 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2828 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2829 dev_err(fe->dvb->device, in dvb_frontend_open()
2834 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2836 ret = dvb_frontend_start(fe); in dvb_frontend_open()
2844 dvb_frontend_get(fe); in dvb_frontend_open()
2852 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2853 if (fe->dvb->mdev) { in dvb_frontend_open()
2854 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2855 if (fe->dvb->mdev->disable_source) in dvb_frontend_open()
2856 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_open()
2857 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2859 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2864 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) in dvb_frontend_open()
2865 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_open()
2875 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_release() local
2876 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release()
2879 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_release()
2891 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2892 if (fe->dvb->mdev) { in dvb_frontend_release()
2893 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2894 if (fe->dvb->mdev->disable_source) in dvb_frontend_release()
2895 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_release()
2896 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2898 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2900 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_release()
2902 if (fe->ops.ts_bus_ctrl) in dvb_frontend_release()
2903 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_release()
2906 dvb_frontend_put(fe); in dvb_frontend_release()
2923 int dvb_frontend_suspend(struct dvb_frontend *fe) in dvb_frontend_suspend() argument
2927 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_suspend()
2928 fe->id); in dvb_frontend_suspend()
2930 if (fe->ops.tuner_ops.suspend) in dvb_frontend_suspend()
2931 ret = fe->ops.tuner_ops.suspend(fe); in dvb_frontend_suspend()
2932 else if (fe->ops.tuner_ops.sleep) in dvb_frontend_suspend()
2933 ret = fe->ops.tuner_ops.sleep(fe); in dvb_frontend_suspend()
2935 if (fe->ops.suspend) in dvb_frontend_suspend()
2936 ret = fe->ops.suspend(fe); in dvb_frontend_suspend()
2937 else if (fe->ops.sleep) in dvb_frontend_suspend()
2938 ret = fe->ops.sleep(fe); in dvb_frontend_suspend()
2944 int dvb_frontend_resume(struct dvb_frontend *fe) in dvb_frontend_resume() argument
2946 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume()
2949 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_resume()
2950 fe->id); in dvb_frontend_resume()
2952 fe->exit = DVB_FE_DEVICE_RESUME; in dvb_frontend_resume()
2953 if (fe->ops.resume) in dvb_frontend_resume()
2954 ret = fe->ops.resume(fe); in dvb_frontend_resume()
2955 else if (fe->ops.init) in dvb_frontend_resume()
2956 ret = fe->ops.init(fe); in dvb_frontend_resume()
2958 if (fe->ops.tuner_ops.resume) in dvb_frontend_resume()
2959 ret = fe->ops.tuner_ops.resume(fe); in dvb_frontend_resume()
2960 else if (fe->ops.tuner_ops.init) in dvb_frontend_resume()
2961 ret = fe->ops.tuner_ops.init(fe); in dvb_frontend_resume()
2963 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_resume()
2964 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_resume()
2965 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_resume()
2966 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_resume()
2968 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_resume()
2970 dvb_frontend_wakeup(fe); in dvb_frontend_resume()
2977 struct dvb_frontend *fe) in dvb_register_frontend() argument
2986 .name = fe->ops.info.name, in dvb_register_frontend()
2995 fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); in dvb_register_frontend()
2996 if (!fe->frontend_priv) { in dvb_register_frontend()
3000 fepriv = fe->frontend_priv; in dvb_register_frontend()
3002 kref_init(&fe->refcount); in dvb_register_frontend()
3009 dvb_frontend_get(fe); in dvb_register_frontend()
3015 fe->dvb = dvb; in dvb_register_frontend()
3018 dev_info(fe->dvb->device, in dvb_register_frontend()
3020 fe->dvb->num, fe->id, fe->ops.info.name); in dvb_register_frontend()
3022 dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
3023 fe, DVB_DEVICE_FRONTEND, 0); in dvb_register_frontend()
3030 fe->dtv_property_cache.delivery_system = fe->ops.delsys[0]; in dvb_register_frontend()
3031 dvb_frontend_clear_cache(fe); in dvb_register_frontend()
3038 int dvb_unregister_frontend(struct dvb_frontend *fe) in dvb_unregister_frontend() argument
3040 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend()
3042 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_unregister_frontend()
3045 dvb_frontend_stop(fe); in dvb_unregister_frontend()
3048 /* fe is invalid now */ in dvb_unregister_frontend()
3050 dvb_frontend_put(fe); in dvb_unregister_frontend()
3055 static void dvb_frontend_invoke_release(struct dvb_frontend *fe, in dvb_frontend_invoke_release() argument
3056 void (*release)(struct dvb_frontend *fe)) in dvb_frontend_invoke_release() argument
3059 release(fe); in dvb_frontend_invoke_release()
3066 void dvb_frontend_detach(struct dvb_frontend *fe) in dvb_frontend_detach() argument
3068 dvb_frontend_invoke_release(fe, fe->ops.release_sec); in dvb_frontend_detach()
3069 dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release); in dvb_frontend_detach()
3070 dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release); in dvb_frontend_detach()
3071 dvb_frontend_put(fe); in dvb_frontend_detach()