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()
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()
382 * @fe: The frontend concerned.
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()
494 dev_warn_once(fe->dvb->device, in dvb_frontend_swzigzag()
508 if (fe->ops.set_frontend) in dvb_frontend_swzigzag()
509 retval = fe->ops.set_frontend(fe); in dvb_frontend_swzigzag()
525 if (fe->ops.read_status) in dvb_frontend_swzigzag()
526 fe->ops.read_status(fe, &s); in dvb_frontend_swzigzag()
528 dvb_frontend_add_event(fe, s); in dvb_frontend_swzigzag()
539 if ((!(fe->ops.info.caps & FE_CAN_INVERSION_AUTO)) && in dvb_frontend_swzigzag()
563 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { in dvb_frontend_swzigzag()
592 retval = dvb_frontend_swzigzag_autotune(fe, in dvb_frontend_swzigzag()
620 dvb_frontend_swzigzag_autotune(fe, 0); in dvb_frontend_swzigzag()
624 static int dvb_frontend_is_exiting(struct dvb_frontend *fe) in dvb_frontend_is_exiting() argument
626 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_is_exiting()
628 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_is_exiting()
639 static int dvb_frontend_should_wakeup(struct dvb_frontend *fe) in dvb_frontend_should_wakeup() argument
641 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_should_wakeup()
647 return dvb_frontend_is_exiting(fe); in dvb_frontend_should_wakeup()
650 static void dvb_frontend_wakeup(struct dvb_frontend *fe) in dvb_frontend_wakeup() argument
652 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_wakeup()
660 struct dvb_frontend *fe = data; in dvb_frontend_thread() local
661 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_thread()
662 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_thread()
668 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_thread()
677 dvb_frontend_init(fe); in dvb_frontend_thread()
683 dvb_frontend_should_wakeup(fe) || in dvb_frontend_thread()
687 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) { in dvb_frontend_thread()
691 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_thread()
699 dvb_frontend_init(fe); in dvb_frontend_thread()
700 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_thread()
701 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_thread()
702 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_thread()
703 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_thread()
708 if (fe->ops.get_frontend_algo) { in dvb_frontend_thread()
709 algo = fe->ops.get_frontend_algo(fe); in dvb_frontend_thread()
712 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_HW\n", __func__); in dvb_frontend_thread()
715 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTATE_RETUNE\n", __func__); in dvb_frontend_thread()
722 if (fe->ops.tune) in dvb_frontend_thread()
723 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
726 dev_dbg(fe->dvb->device, "%s: state changed, adding current state\n", __func__); in dvb_frontend_thread()
727 dvb_frontend_add_event(fe, s); in dvb_frontend_thread()
732 dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_SW\n", __func__); in dvb_frontend_thread()
733 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
736 …dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->st… in dvb_frontend_thread()
738 dev_dbg(fe->dvb->device, "%s: Retune requested, FESTAT_RETUNE\n", __func__); in dvb_frontend_thread()
746 if (fe->ops.search) { in dvb_frontend_thread()
747 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
760 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
761 fe->ops.read_status(fe, &s); in dvb_frontend_thread()
763 dvb_frontend_add_event(fe, s); /* update event list */ in dvb_frontend_thread()
774 dev_dbg(fe->dvb->device, "%s: UNDEFINED ALGO !\n", __func__); in dvb_frontend_thread()
778 dvb_frontend_swzigzag(fe); in dvb_frontend_thread()
783 if (fe->ops.set_voltage) in dvb_frontend_thread()
784 fe->ops.set_voltage(fe, SEC_VOLTAGE_OFF); in dvb_frontend_thread()
785 if (fe->ops.tuner_ops.sleep) { in dvb_frontend_thread()
786 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
787 fe->ops.i2c_gate_ctrl(fe, 1); in dvb_frontend_thread()
788 fe->ops.tuner_ops.sleep(fe); in dvb_frontend_thread()
789 if (fe->ops.i2c_gate_ctrl) in dvb_frontend_thread()
790 fe->ops.i2c_gate_ctrl(fe, 0); in dvb_frontend_thread()
792 if (fe->ops.sleep) in dvb_frontend_thread()
793 fe->ops.sleep(fe); in dvb_frontend_thread()
798 fe->exit = DVB_FE_DEVICE_REMOVED; in dvb_frontend_thread()
800 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_thread()
805 dvb_frontend_wakeup(fe); in dvb_frontend_thread()
809 static void dvb_frontend_stop(struct dvb_frontend *fe) in dvb_frontend_stop() argument
811 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop()
813 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_stop()
815 if (fe->exit != DVB_FE_DEVICE_REMOVED) in dvb_frontend_stop()
816 fe->exit = DVB_FE_NORMAL_EXIT; in dvb_frontend_stop()
829 dev_warn(fe->dvb->device, in dvb_frontend_stop()
856 static int dvb_frontend_start(struct dvb_frontend *fe) in dvb_frontend_start() argument
859 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start()
862 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_start()
865 if (fe->exit == DVB_FE_NO_EXIT) in dvb_frontend_start()
868 dvb_frontend_stop(fe); in dvb_frontend_start()
877 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_start()
881 fe_thread = kthread_run(dvb_frontend_thread, fe, in dvb_frontend_start()
882 "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id); in dvb_frontend_start()
885 dev_warn(fe->dvb->device, in dvb_frontend_start()
895 static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, in dvb_frontend_get_frequency_limits() argument
899 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_frequency_limits()
900 u32 tuner_min = fe->ops.tuner_ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
901 u32 tuner_max = fe->ops.tuner_ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
902 u32 frontend_min = fe->ops.info.frequency_min_hz; in dvb_frontend_get_frequency_limits()
903 u32 frontend_max = fe->ops.info.frequency_max_hz; in dvb_frontend_get_frequency_limits()
915 dev_warn(fe->dvb->device, in dvb_frontend_get_frequency_limits()
917 fe->dvb->num, fe->id); in dvb_frontend_get_frequency_limits()
919 dev_dbg(fe->dvb->device, "frequency interval: tuner: %u...%u, frontend: %u...%u", in dvb_frontend_get_frequency_limits()
932 *tolerance = fe->ops.info.frequency_tolerance_hz / kHz; in dvb_frontend_get_frequency_limits()
937 *tolerance = fe->ops.info.frequency_tolerance_hz; in dvb_frontend_get_frequency_limits()
942 static u32 dvb_frontend_get_stepsize(struct dvb_frontend *fe) in dvb_frontend_get_stepsize() argument
944 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_get_stepsize()
945 u32 fe_step = fe->ops.info.frequency_stepsize_hz; in dvb_frontend_get_stepsize()
946 u32 tuner_step = fe->ops.tuner_ops.info.frequency_step_hz; in dvb_frontend_get_stepsize()
964 static int dvb_frontend_check_parameters(struct dvb_frontend *fe) in dvb_frontend_check_parameters() argument
966 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_check_parameters()
971 dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max, NULL); in dvb_frontend_check_parameters()
974 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
975 fe->dvb->num, fe->id, c->frequency, in dvb_frontend_check_parameters()
988 if ((fe->ops.info.symbol_rate_min && in dvb_frontend_check_parameters()
989 c->symbol_rate < fe->ops.info.symbol_rate_min) || in dvb_frontend_check_parameters()
990 (fe->ops.info.symbol_rate_max && in dvb_frontend_check_parameters()
991 c->symbol_rate > fe->ops.info.symbol_rate_max)) { in dvb_frontend_check_parameters()
992 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n", in dvb_frontend_check_parameters()
993 fe->dvb->num, fe->id, c->symbol_rate, in dvb_frontend_check_parameters()
994 fe->ops.info.symbol_rate_min, in dvb_frontend_check_parameters()
995 fe->ops.info.symbol_rate_max); in dvb_frontend_check_parameters()
1006 static int dvb_frontend_clear_cache(struct dvb_frontend *fe) in dvb_frontend_clear_cache() argument
1008 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_clear_cache()
1016 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()
1314 * @fe: struct dvb_frontend pointer
1316 * @p_out: struct dvb_frontend_parameters pointer (DVBv3 FE struct)
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
1355 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dtv_property_process_get()
1356 tvp->u.buffer.data[ncaps] = fe->ops.delsys[ncaps]; in dtv_property_process_get()
1486 tvp->u.data = fe->dtv_property_cache.atscmh_fic_ver; in dtv_property_process_get()
1489 tvp->u.data = fe->dtv_property_cache.atscmh_parade_id; in dtv_property_process_get()
1492 tvp->u.data = fe->dtv_property_cache.atscmh_nog; in dtv_property_process_get()
1495 tvp->u.data = fe->dtv_property_cache.atscmh_tnog; in dtv_property_process_get()
1498 tvp->u.data = fe->dtv_property_cache.atscmh_sgn; in dtv_property_process_get()
1501 tvp->u.data = fe->dtv_property_cache.atscmh_prc; in dtv_property_process_get()
1504 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_mode; in dtv_property_process_get()
1507 tvp->u.data = fe->dtv_property_cache.atscmh_rs_frame_ensemble; in dtv_property_process_get()
1510 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_pri; in dtv_property_process_get()
1513 tvp->u.data = fe->dtv_property_cache.atscmh_rs_code_mode_sec; in dtv_property_process_get()
1516 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_block_mode; in dtv_property_process_get()
1519 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_a; in dtv_property_process_get()
1522 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_b; in dtv_property_process_get()
1525 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_c; in dtv_property_process_get()
1528 tvp->u.data = fe->dtv_property_cache.atscmh_sccc_code_mode_d; in dtv_property_process_get()
1585 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1586 "%s: FE property %d doesn't exist\n", in dtv_property_process_get()
1594 dev_dbg(fe->dvb->device, in dtv_property_process_get()
1602 static int dtv_set_frontend(struct dvb_frontend *fe);
1612 * @fe: struct frontend;
1620 static int emulate_delivery_system(struct dvb_frontend *fe, u32 delsys) in emulate_delivery_system() argument
1623 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in emulate_delivery_system()
1631 dev_dbg(fe->dvb->device, in emulate_delivery_system()
1651 dev_dbg(fe->dvb->device, "%s: change delivery system on cache to %d\n", in emulate_delivery_system()
1659 * @fe: frontend struct
1674 static int dvbv5_set_delivery_system(struct dvb_frontend *fe, in dvbv5_set_delivery_system() argument
1679 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv5_set_delivery_system()
1689 desired_system = fe->ops.delsys[0]; in dvbv5_set_delivery_system()
1697 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1698 if (fe->ops.delsys[ncaps] == desired_system) { in dvbv5_set_delivery_system()
1700 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1716 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1729 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv5_set_delivery_system()
1730 if (dvbv3_type(fe->ops.delsys[ncaps]) == type) in dvbv5_set_delivery_system()
1731 delsys = fe->ops.delsys[ncaps]; in dvbv5_set_delivery_system()
1737 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1743 dev_dbg(fe->dvb->device, in dvbv5_set_delivery_system()
1747 return emulate_delivery_system(fe, desired_system); in dvbv5_set_delivery_system()
1752 * @fe: frontend struct
1778 static int dvbv3_set_delivery_system(struct dvb_frontend *fe) in dvbv3_set_delivery_system() argument
1782 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvbv3_set_delivery_system()
1786 c->delivery_system = fe->ops.delsys[0]; in dvbv3_set_delivery_system()
1793 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1804 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) { in dvbv3_set_delivery_system()
1805 if (dvbv3_type(fe->ops.delsys[ncaps]) != DVBV3_UNKNOWN) { in dvbv3_set_delivery_system()
1806 delsys = fe->ops.delsys[ncaps]; in dvbv3_set_delivery_system()
1812 dev_dbg(fe->dvb->device, in dvbv3_set_delivery_system()
1817 return emulate_delivery_system(fe, delsys); in dvbv3_set_delivery_system()
1820 static void prepare_tuning_algo_parameters(struct dvb_frontend *fe) in prepare_tuning_algo_parameters() argument
1822 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in prepare_tuning_algo_parameters()
1823 struct dvb_frontend_private *fepriv = fe->frontend_priv; in prepare_tuning_algo_parameters()
1827 if (fe->ops.get_tune_settings && (fe->ops.get_tune_settings(fe, &fetunesettings) == 0)) { in prepare_tuning_algo_parameters()
1850 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in prepare_tuning_algo_parameters()
1870 * @fe: Pointer to &struct dvb_frontend
1882 static int dtv_property_process_set(struct dvb_frontend *fe, in dtv_property_process_set() argument
1887 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_property_process_set()
1891 dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n", in dtv_property_process_set()
1894 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1903 dvb_frontend_clear_cache(fe); in dtv_property_process_set()
1910 dev_dbg(fe->dvb->device, in dtv_property_process_set()
1914 r = dtv_set_frontend(fe); in dtv_property_process_set()
1941 r = dvbv5_set_delivery_system(fe, data); in dtv_property_process_set()
2041 fe->dtv_property_cache.atscmh_parade_id = data; in dtv_property_process_set()
2044 fe->dtv_property_cache.atscmh_rs_frame_ensemble = data; in dtv_property_process_set()
2049 if (fe->ops.set_lna) in dtv_property_process_set()
2050 r = fe->ops.set_lna(fe); in dtv_property_process_set()
2066 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_do_ioctl() local
2067 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl()
2070 dev_dbg(fe->dvb->device, "%s: (%d)\n", __func__, _IOC_NR(cmd)); in dvb_frontend_do_ioctl()
2074 if (fe->exit != DVB_FE_NO_EXIT) { in dvb_frontend_do_ioctl()
2146 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_compat_ioctl() local
2147 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl()
2172 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_compat_ioctl()
2184 struct dtv_frontend_properties getp = fe->dtv_property_cache; in dvb_frontend_handle_compat_ioctl()
2210 err = dtv_get_frontend(fe, &getp, NULL); in dvb_frontend_handle_compat_ioctl()
2218 fe, &getp, (struct dtv_property *)(tvp + i), file); in dvb_frontend_handle_compat_ioctl()
2240 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_compat_ioctl() local
2241 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl()
2258 static int dtv_set_frontend(struct dvb_frontend *fe) in dtv_set_frontend() argument
2260 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend()
2261 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dtv_set_frontend()
2264 if (dvb_frontend_check_parameters(fe) < 0) in dtv_set_frontend()
2272 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2342 prepare_tuning_algo_parameters(fe); in dtv_set_frontend()
2349 dvb_frontend_clear_events(fe); in dtv_set_frontend()
2350 dvb_frontend_add_event(fe, 0); in dtv_set_frontend()
2351 dvb_frontend_wakeup(fe); in dtv_set_frontend()
2357 static int dvb_get_property(struct dvb_frontend *fe, struct file *file, in dvb_get_property() argument
2360 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_get_property()
2365 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_property()
2367 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_get_property()
2369 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_get_property()
2391 err = dtv_get_frontend(fe, &getp, NULL); in dvb_get_property()
2396 err = dtv_property_process_get(fe, &getp, in dvb_get_property()
2414 static int dvb_get_frontend(struct dvb_frontend *fe, in dvb_get_frontend() argument
2425 memcpy(&getp, &fe->dtv_property_cache, sizeof(getp)); in dvb_get_frontend()
2427 return dtv_get_frontend(fe, &getp, p_out); in dvb_get_frontend()
2434 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_handle_ioctl() local
2435 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl()
2436 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in dvb_frontend_handle_ioctl()
2439 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_handle_ioctl()
2446 dev_dbg(fe->dvb->device, "%s: properties.num = %d\n", in dvb_frontend_handle_ioctl()
2448 dev_dbg(fe->dvb->device, "%s: properties.props = %p\n", in dvb_frontend_handle_ioctl()
2464 err = dtv_property_process_set(fe, file, in dvb_frontend_handle_ioctl()
2477 err = dvb_get_property(fe, file, parg); in dvb_frontend_handle_ioctl()
2484 strscpy(info->name, fe->ops.info.name, sizeof(info->name)); in dvb_frontend_handle_ioctl()
2485 info->symbol_rate_min = fe->ops.info.symbol_rate_min; in dvb_frontend_handle_ioctl()
2486 info->symbol_rate_max = fe->ops.info.symbol_rate_max; in dvb_frontend_handle_ioctl()
2487 info->symbol_rate_tolerance = fe->ops.info.symbol_rate_tolerance; in dvb_frontend_handle_ioctl()
2488 info->caps = fe->ops.info.caps; in dvb_frontend_handle_ioctl()
2489 info->frequency_stepsize = dvb_frontend_get_stepsize(fe); in dvb_frontend_handle_ioctl()
2490 dvb_frontend_get_frequency_limits(fe, &info->frequency_min, in dvb_frontend_handle_ioctl()
2519 dev_err(fe->dvb->device, in dvb_frontend_handle_ioctl()
2524 dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n", in dvb_frontend_handle_ioctl()
2546 if (fe->ops.read_status) in dvb_frontend_handle_ioctl()
2547 err = fe->ops.read_status(fe, status); in dvb_frontend_handle_ioctl()
2552 if (fe->ops.diseqc_reset_overload) { in dvb_frontend_handle_ioctl()
2553 err = fe->ops.diseqc_reset_overload(fe); in dvb_frontend_handle_ioctl()
2560 if (fe->ops.diseqc_send_master_cmd) { in dvb_frontend_handle_ioctl()
2567 err = fe->ops.diseqc_send_master_cmd(fe, cmd); in dvb_frontend_handle_ioctl()
2574 if (fe->ops.diseqc_send_burst) { in dvb_frontend_handle_ioctl()
2575 err = fe->ops.diseqc_send_burst(fe, (long)parg); in dvb_frontend_handle_ioctl()
2582 if (fe->ops.set_tone) { in dvb_frontend_handle_ioctl()
2584 err = fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_handle_ioctl()
2591 if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2593 err = fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_handle_ioctl()
2600 if (fe->ops.diseqc_recv_slave_reply) in dvb_frontend_handle_ioctl()
2601 err = fe->ops.diseqc_recv_slave_reply(fe, parg); in dvb_frontend_handle_ioctl()
2605 if (fe->ops.enable_high_lnb_voltage) in dvb_frontend_handle_ioctl()
2606 err = fe->ops.enable_high_lnb_voltage(fe, (long)parg); in dvb_frontend_handle_ioctl()
2616 if (fe->ops.dishnetwork_send_legacy_command) { in dvb_frontend_handle_ioctl()
2617 err = fe->ops.dishnetwork_send_legacy_command(fe, in dvb_frontend_handle_ioctl()
2621 } else if (fe->ops.set_voltage) { in dvb_frontend_handle_ioctl()
2653 fe->ops.set_voltage(fe, SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2661 fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18); in dvb_frontend_handle_ioctl()
2670 fe->dvb->num); in dvb_frontend_handle_ioctl()
2684 if (fe->ops.read_ber) { in dvb_frontend_handle_ioctl()
2686 err = fe->ops.read_ber(fe, parg); in dvb_frontend_handle_ioctl()
2693 if (fe->ops.read_signal_strength) { in dvb_frontend_handle_ioctl()
2695 err = fe->ops.read_signal_strength(fe, parg); in dvb_frontend_handle_ioctl()
2702 if (fe->ops.read_snr) { in dvb_frontend_handle_ioctl()
2704 err = fe->ops.read_snr(fe, parg); in dvb_frontend_handle_ioctl()
2711 if (fe->ops.read_ucblocks) { in dvb_frontend_handle_ioctl()
2713 err = fe->ops.read_ucblocks(fe, parg); in dvb_frontend_handle_ioctl()
2722 err = dvbv3_set_delivery_system(fe); in dvb_frontend_handle_ioctl()
2726 err = dtv_property_cache_sync(fe, c, parg); in dvb_frontend_handle_ioctl()
2729 err = dtv_set_frontend(fe); in dvb_frontend_handle_ioctl()
2733 err = dvb_frontend_get_event(fe, parg, file->f_flags); in dvb_frontend_handle_ioctl()
2737 err = dvb_get_frontend(fe, parg); in dvb_frontend_handle_ioctl()
2750 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_poll() local
2751 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll()
2753 dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_poll()
2766 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_open() local
2767 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open()
2768 struct dvb_adapter *adapter = fe->dvb; in dvb_frontend_open()
2771 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_open()
2772 if (fe->exit == DVB_FE_DEVICE_REMOVED) in dvb_frontend_open()
2824 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) { in dvb_frontend_open()
2825 if ((ret = fe->ops.ts_bus_ctrl(fe, 1)) < 0) in dvb_frontend_open()
2847 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2848 if (fe->dvb->mdev) { in dvb_frontend_open()
2849 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2850 if (fe->dvb->mdev->enable_source) in dvb_frontend_open()
2851 ret = fe->dvb->mdev->enable_source( in dvb_frontend_open()
2854 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2856 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2857 dev_err(fe->dvb->device, in dvb_frontend_open()
2862 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2864 ret = dvb_frontend_start(fe); in dvb_frontend_open()
2872 dvb_frontend_get(fe); in dvb_frontend_open()
2880 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2881 if (fe->dvb->mdev) { in dvb_frontend_open()
2882 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2883 if (fe->dvb->mdev->disable_source) in dvb_frontend_open()
2884 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_open()
2885 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_open()
2887 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_open()
2892 if (dvbdev->users == -1 && fe->ops.ts_bus_ctrl) in dvb_frontend_open()
2893 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_open()
2903 struct dvb_frontend *fe = dvbdev->priv; in dvb_frontend_release() local
2904 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release()
2907 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_frontend_release()
2919 mutex_lock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2920 if (fe->dvb->mdev) { in dvb_frontend_release()
2921 mutex_lock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2922 if (fe->dvb->mdev->disable_source) in dvb_frontend_release()
2923 fe->dvb->mdev->disable_source(dvbdev->entity); in dvb_frontend_release()
2924 mutex_unlock(&fe->dvb->mdev->graph_mutex); in dvb_frontend_release()
2926 mutex_unlock(&fe->dvb->mdev_lock); in dvb_frontend_release()
2928 if (fe->exit != DVB_FE_NO_EXIT) in dvb_frontend_release()
2930 if (fe->ops.ts_bus_ctrl) in dvb_frontend_release()
2931 fe->ops.ts_bus_ctrl(fe, 0); in dvb_frontend_release()
2934 dvb_frontend_put(fe); in dvb_frontend_release()
2951 int dvb_frontend_suspend(struct dvb_frontend *fe) in dvb_frontend_suspend() argument
2955 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_suspend()
2956 fe->id); in dvb_frontend_suspend()
2958 if (fe->ops.tuner_ops.suspend) in dvb_frontend_suspend()
2959 ret = fe->ops.tuner_ops.suspend(fe); in dvb_frontend_suspend()
2960 else if (fe->ops.tuner_ops.sleep) in dvb_frontend_suspend()
2961 ret = fe->ops.tuner_ops.sleep(fe); in dvb_frontend_suspend()
2963 if (fe->ops.suspend) in dvb_frontend_suspend()
2964 ret = fe->ops.suspend(fe); in dvb_frontend_suspend()
2965 else if (fe->ops.sleep) in dvb_frontend_suspend()
2966 ret = fe->ops.sleep(fe); in dvb_frontend_suspend()
2972 int dvb_frontend_resume(struct dvb_frontend *fe) in dvb_frontend_resume() argument
2974 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume()
2977 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num, in dvb_frontend_resume()
2978 fe->id); in dvb_frontend_resume()
2980 fe->exit = DVB_FE_DEVICE_RESUME; in dvb_frontend_resume()
2981 if (fe->ops.resume) in dvb_frontend_resume()
2982 ret = fe->ops.resume(fe); in dvb_frontend_resume()
2983 else if (fe->ops.init) in dvb_frontend_resume()
2984 ret = fe->ops.init(fe); in dvb_frontend_resume()
2986 if (fe->ops.tuner_ops.resume) in dvb_frontend_resume()
2987 ret = fe->ops.tuner_ops.resume(fe); in dvb_frontend_resume()
2988 else if (fe->ops.tuner_ops.init) in dvb_frontend_resume()
2989 ret = fe->ops.tuner_ops.init(fe); in dvb_frontend_resume()
2991 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_resume()
2992 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_resume()
2993 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_resume()
2994 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_resume()
2996 fe->exit = DVB_FE_NO_EXIT; in dvb_frontend_resume()
2998 dvb_frontend_wakeup(fe); in dvb_frontend_resume()
3005 struct dvb_frontend *fe) in dvb_register_frontend() argument
3014 .name = fe->ops.info.name, in dvb_register_frontend()
3024 fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); in dvb_register_frontend()
3025 if (!fe->frontend_priv) { in dvb_register_frontend()
3029 fepriv = fe->frontend_priv; in dvb_register_frontend()
3031 kref_init(&fe->refcount); in dvb_register_frontend()
3038 dvb_frontend_get(fe); in dvb_register_frontend()
3044 fe->dvb = dvb; in dvb_register_frontend()
3047 dev_info(fe->dvb->device, in dvb_register_frontend()
3049 fe->dvb->num, fe->id, fe->ops.info.name); in dvb_register_frontend()
3051 ret = dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
3052 fe, DVB_DEVICE_FRONTEND, 0); in dvb_register_frontend()
3054 dvb_frontend_put(fe); in dvb_register_frontend()
3064 fe->dtv_property_cache.delivery_system = fe->ops.delsys[0]; in dvb_register_frontend()
3065 dvb_frontend_clear_cache(fe); in dvb_register_frontend()
3072 int dvb_unregister_frontend(struct dvb_frontend *fe) in dvb_unregister_frontend() argument
3074 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend()
3076 dev_dbg(fe->dvb->device, "%s:\n", __func__); in dvb_unregister_frontend()
3079 dvb_frontend_stop(fe); in dvb_unregister_frontend()
3082 /* fe is invalid now */ in dvb_unregister_frontend()
3084 dvb_frontend_put(fe); in dvb_unregister_frontend()
3089 static void dvb_frontend_invoke_release(struct dvb_frontend *fe, in dvb_frontend_invoke_release() argument
3090 void (*release)(struct dvb_frontend *fe)) in dvb_frontend_invoke_release() argument
3093 release(fe); in dvb_frontend_invoke_release()
3100 void dvb_frontend_detach(struct dvb_frontend *fe) in dvb_frontend_detach() argument
3102 dvb_frontend_invoke_release(fe, fe->ops.release_sec); in dvb_frontend_detach()
3103 dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release); in dvb_frontend_detach()
3104 dvb_frontend_invoke_release(fe, fe->ops.analog_ops.release); in dvb_frontend_detach()
3105 dvb_frontend_put(fe); in dvb_frontend_detach()