Lines Matching refs:fepriv

136 	struct dvb_frontend_private *fepriv = fe->frontend_priv;  in __dvb_frontend_free()  local
138 if (fepriv) in __dvb_frontend_free()
139 dvb_device_put(fepriv->dvbdev); in __dvb_frontend_free()
143 kfree(fepriv); in __dvb_frontend_free()
240 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_add_event() local
242 struct dvb_fe_events *events = &fepriv->events; in dvb_frontend_add_event()
249 dtv_get_frontend(fe, c, &fepriv->parameters_out); in dvb_frontend_add_event()
261 e->parameters = fepriv->parameters_out; in dvb_frontend_add_event()
270 static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv, in dvb_frontend_test_event() argument
275 up(&fepriv->sem); in dvb_frontend_test_event()
277 down(&fepriv->sem); in dvb_frontend_test_event()
285 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_get_event() local
286 struct dvb_fe_events *events = &fepriv->events; in dvb_frontend_get_event()
304 while (!dvb_frontend_test_event(fepriv, events)) { in dvb_frontend_get_event()
326 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_clear_events() local
327 struct dvb_fe_events *events = &fepriv->events; in dvb_frontend_clear_events()
353 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_reinitialise() local
355 fepriv->reinitialise = 1; in dvb_frontend_reinitialise()
360 static void dvb_frontend_swzigzag_update_delay(struct dvb_frontend_private *fepriv, int locked) in dvb_frontend_swzigzag_update_delay() argument
363 struct dvb_frontend *fe = fepriv->dvbdev->priv; in dvb_frontend_swzigzag_update_delay()
368 (fepriv->quality) = (fepriv->quality * 220 + 36 * 256) / 256; in dvb_frontend_swzigzag_update_delay()
370 (fepriv->quality) = (fepriv->quality * 220 + 0) / 256; in dvb_frontend_swzigzag_update_delay()
372 q2 = fepriv->quality - 128; in dvb_frontend_swzigzag_update_delay()
375 fepriv->delay = fepriv->min_delay + q2 * HZ / (128 * 128); in dvb_frontend_swzigzag_update_delay()
393 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag_autotune() local
405 fepriv->lnb_drift = fepriv->auto_step * fepriv->step_size; in dvb_frontend_swzigzag_autotune()
408 if (fepriv->lnb_drift > fepriv->max_drift) { in dvb_frontend_swzigzag_autotune()
409 fepriv->auto_step = 0; in dvb_frontend_swzigzag_autotune()
410 fepriv->auto_sub_step = 0; in dvb_frontend_swzigzag_autotune()
411 fepriv->lnb_drift = 0; in dvb_frontend_swzigzag_autotune()
415 switch (fepriv->auto_sub_step) { in dvb_frontend_swzigzag_autotune()
424 fepriv->inversion = (fepriv->inversion == INVERSION_OFF) ? INVERSION_ON : INVERSION_OFF; in dvb_frontend_swzigzag_autotune()
429 if (fepriv->lnb_drift == 0) break; in dvb_frontend_swzigzag_autotune()
431 fepriv->lnb_drift = -fepriv->lnb_drift; in dvb_frontend_swzigzag_autotune()
436 if (fepriv->lnb_drift == 0) break; in dvb_frontend_swzigzag_autotune()
439 fepriv->inversion = (fepriv->inversion == INVERSION_OFF) ? INVERSION_ON : INVERSION_OFF; in dvb_frontend_swzigzag_autotune()
440 fepriv->lnb_drift = -fepriv->lnb_drift; in dvb_frontend_swzigzag_autotune()
445 fepriv->auto_step++; in dvb_frontend_swzigzag_autotune()
446 fepriv->auto_sub_step = 0; in dvb_frontend_swzigzag_autotune()
450 if (!ready) fepriv->auto_sub_step++; in dvb_frontend_swzigzag_autotune()
455 if ((fepriv->auto_step == fepriv->started_auto_step) && in dvb_frontend_swzigzag_autotune()
456 (fepriv->auto_sub_step == 0) && check_wrapped) { in dvb_frontend_swzigzag_autotune()
462 __func__, fepriv->lnb_drift, fepriv->inversion, in dvb_frontend_swzigzag_autotune()
463 fepriv->auto_step, fepriv->auto_sub_step, in dvb_frontend_swzigzag_autotune()
464 fepriv->started_auto_step); in dvb_frontend_swzigzag_autotune()
467 c->frequency += fepriv->lnb_drift; in dvb_frontend_swzigzag_autotune()
469 c->inversion = fepriv->inversion; in dvb_frontend_swzigzag_autotune()
475 fepriv->state = FESTATE_ERROR; in dvb_frontend_swzigzag_autotune()
482 fepriv->auto_sub_step++; in dvb_frontend_swzigzag_autotune()
490 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_swzigzag() local
493 if (fepriv->max_drift) in dvb_frontend_swzigzag()
498 if (fepriv->state & FESTATE_IDLE) { in dvb_frontend_swzigzag()
499 fepriv->delay = 3 * HZ; in dvb_frontend_swzigzag()
500 fepriv->quality = 0; in dvb_frontend_swzigzag()
505 if (fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT) { in dvb_frontend_swzigzag()
506 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_swzigzag()
512 fepriv->state = FESTATE_ERROR; in dvb_frontend_swzigzag()
514 fepriv->state = FESTATE_TUNED; in dvb_frontend_swzigzag()
516 fepriv->delay = 3 * HZ; in dvb_frontend_swzigzag()
517 fepriv->quality = 0; in dvb_frontend_swzigzag()
522 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_swzigzag()
527 if (s != fepriv->status) { in dvb_frontend_swzigzag()
529 fepriv->status = s; in dvb_frontend_swzigzag()
534 if ((fepriv->state & FESTATE_WAITFORLOCK) && (s & FE_HAS_LOCK)) { in dvb_frontend_swzigzag()
535 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); in dvb_frontend_swzigzag()
536 fepriv->state = FESTATE_TUNED; in dvb_frontend_swzigzag()
541 c->inversion = fepriv->inversion; in dvb_frontend_swzigzag()
547 if (fepriv->state & FESTATE_TUNED) { in dvb_frontend_swzigzag()
548 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); in dvb_frontend_swzigzag()
554 fepriv->state = FESTATE_ZIGZAG_FAST; in dvb_frontend_swzigzag()
555 fepriv->started_auto_step = fepriv->auto_step; in dvb_frontend_swzigzag()
556 fepriv->check_wrapped = 0; in dvb_frontend_swzigzag()
562 if ((fepriv->state & FESTATE_LOSTLOCK) && in dvb_frontend_swzigzag()
563 (fe->ops.info.caps & FE_CAN_RECOVER) && (fepriv->max_drift == 0)) { in dvb_frontend_swzigzag()
564 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); in dvb_frontend_swzigzag()
571 if (fepriv->state & FESTATE_DISEQC) { in dvb_frontend_swzigzag()
572 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); in dvb_frontend_swzigzag()
579 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_swzigzag()
580 fepriv->lnb_drift = 0; in dvb_frontend_swzigzag()
581 fepriv->auto_step = 0; in dvb_frontend_swzigzag()
582 fepriv->auto_sub_step = 0; in dvb_frontend_swzigzag()
583 fepriv->started_auto_step = 0; in dvb_frontend_swzigzag()
584 fepriv->check_wrapped = 0; in dvb_frontend_swzigzag()
588 if ((fepriv->state & FESTATE_SEARCHING_FAST) || (fepriv->state & FESTATE_RETUNE)) { in dvb_frontend_swzigzag()
589 fepriv->delay = fepriv->min_delay; in dvb_frontend_swzigzag()
593 fepriv->check_wrapped); in dvb_frontend_swzigzag()
599 fepriv->state = FESTATE_SEARCHING_SLOW; in dvb_frontend_swzigzag()
600 fepriv->started_auto_step = fepriv->auto_step; in dvb_frontend_swzigzag()
603 fepriv->check_wrapped = 1; in dvb_frontend_swzigzag()
609 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_swzigzag()
610 fepriv->state = FESTATE_TUNING_FAST; in dvb_frontend_swzigzag()
615 if (fepriv->state & FESTATE_SEARCHING_SLOW) { in dvb_frontend_swzigzag()
616 dvb_frontend_swzigzag_update_delay(fepriv, s & FE_HAS_LOCK); in dvb_frontend_swzigzag()
626 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_is_exiting() local
631 if (fepriv->dvbdev->writers == 1) in dvb_frontend_is_exiting()
632 if (time_after_eq(jiffies, fepriv->release_jiffies + in dvb_frontend_is_exiting()
641 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_should_wakeup() local
643 if (fepriv->wakeup) { in dvb_frontend_should_wakeup()
644 fepriv->wakeup = 0; in dvb_frontend_should_wakeup()
652 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_wakeup() local
654 fepriv->wakeup = 1; in dvb_frontend_wakeup()
655 wake_up_interruptible(&fepriv->wait_queue); in dvb_frontend_wakeup()
662 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_thread() local
670 fepriv->check_wrapped = 0; in dvb_frontend_thread()
671 fepriv->quality = 0; in dvb_frontend_thread()
672 fepriv->delay = 3 * HZ; in dvb_frontend_thread()
673 fepriv->status = 0; in dvb_frontend_thread()
674 fepriv->wakeup = 0; in dvb_frontend_thread()
675 fepriv->reinitialise = 0; in dvb_frontend_thread()
681 up(&fepriv->sem); /* is locked when we enter the thread... */ in dvb_frontend_thread()
682 wait_event_freezable_timeout(fepriv->wait_queue, in dvb_frontend_thread()
685 fepriv->delay); in dvb_frontend_thread()
689 if (!down_interruptible(&fepriv->sem)) in dvb_frontend_thread()
695 if (down_interruptible(&fepriv->sem)) in dvb_frontend_thread()
698 if (fepriv->reinitialise) { 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()
704 fepriv->reinitialise = 0; in dvb_frontend_thread()
714 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_thread()
717 fepriv->state = FESTATE_TUNED; in dvb_frontend_thread()
723 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
725 if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) { in dvb_frontend_thread()
728 fepriv->status = s; 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()
737 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_thread()
739 fepriv->state = FESTATE_TUNED; in dvb_frontend_thread()
745 if (fepriv->algo_status & DVBFE_ALGO_SEARCH_AGAIN) { in dvb_frontend_thread()
747 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
752 fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
756 if (fepriv->algo_status != DVBFE_ALGO_SEARCH_SUCCESS) { in dvb_frontend_thread()
757 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
758 fepriv->delay = HZ / 2; in dvb_frontend_thread()
760 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
762 if (s != fepriv->status) { in dvb_frontend_thread()
764 fepriv->status = s; in dvb_frontend_thread()
766 fepriv->delay = HZ / 10; in dvb_frontend_thread()
767 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
769 fepriv->delay = 60 * HZ; in dvb_frontend_thread()
796 fepriv->thread = NULL; in dvb_frontend_thread()
804 up(&fepriv->sem); in dvb_frontend_thread()
811 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop() local
819 if (!fepriv->thread) in dvb_frontend_stop()
822 kthread_stop(fepriv->thread); in dvb_frontend_stop()
824 sema_init(&fepriv->sem, 1); in dvb_frontend_stop()
825 fepriv->state = FESTATE_IDLE; in dvb_frontend_stop()
828 if (fepriv->thread) in dvb_frontend_stop()
831 fepriv->thread); in dvb_frontend_stop()
859 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start() local
864 if (fepriv->thread) { in dvb_frontend_start()
873 if (down_interruptible(&fepriv->sem)) in dvb_frontend_start()
876 fepriv->state = FESTATE_IDLE; in dvb_frontend_start()
878 fepriv->thread = NULL; in dvb_frontend_start()
888 up(&fepriv->sem); in dvb_frontend_start()
891 fepriv->thread = fe_thread; in dvb_frontend_start()
1823 struct dvb_frontend_private *fepriv = fe->frontend_priv; in prepare_tuning_algo_parameters() local
1828 fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000; in prepare_tuning_algo_parameters()
1829 fepriv->max_drift = fetunesettings.max_drift; in prepare_tuning_algo_parameters()
1830 fepriv->step_size = fetunesettings.step_size; in prepare_tuning_algo_parameters()
1841 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1842 fepriv->step_size = c->symbol_rate / 16000; in prepare_tuning_algo_parameters()
1843 fepriv->max_drift = c->symbol_rate / 2000; in prepare_tuning_algo_parameters()
1849 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1850 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in prepare_tuning_algo_parameters()
1851 fepriv->max_drift = fepriv->step_size + 1; in prepare_tuning_algo_parameters()
1858 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1859 fepriv->step_size = 0; /* no zigzag */ in prepare_tuning_algo_parameters()
1860 fepriv->max_drift = 0; in prepare_tuning_algo_parameters()
1865 fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000; in prepare_tuning_algo_parameters()
2067 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl() local
2071 if (down_interruptible(&fepriv->sem)) in dvb_frontend_do_ioctl()
2075 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2096 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2102 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2147 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl() local
2209 if (fepriv->state != FESTATE_IDLE) { in dvb_frontend_handle_compat_ioctl()
2241 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl() local
2245 if (down_interruptible(&fepriv->sem)) in dvb_frontend_compat_ioctl()
2250 up(&fepriv->sem); in dvb_frontend_compat_ioctl()
2260 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend() local
2272 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2344 fepriv->state = FESTATE_RETUNE; in dtv_set_frontend()
2347 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dtv_set_frontend()
2352 fepriv->status = 0; in dtv_set_frontend()
2360 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_get_property() local
2390 if (fepriv->state != FESTATE_IDLE) { in dvb_get_property()
2435 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl() local
2528 if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) in dvb_frontend_handle_ioctl()
2539 if (fepriv->state == FESTATE_RETUNE || in dvb_frontend_handle_ioctl()
2540 fepriv->state == FESTATE_ERROR) { in dvb_frontend_handle_ioctl()
2554 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2555 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2568 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2569 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2576 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2577 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2583 fepriv->tone = (long)parg; in dvb_frontend_handle_ioctl()
2584 err = fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_handle_ioctl()
2585 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2586 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2592 fepriv->voltage = (long)parg; in dvb_frontend_handle_ioctl()
2593 err = fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_handle_ioctl()
2594 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2595 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2610 fepriv->tune_mode_flags = (unsigned long)parg; in dvb_frontend_handle_ioctl()
2619 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2620 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2676 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2677 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2685 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2694 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2703 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2712 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2751 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll() local
2755 poll_wait(file, &fepriv->events.wait_queue, wait); in dvb_frontend_poll()
2757 if (fepriv->events.eventw != fepriv->events.eventr) in dvb_frontend_poll()
2767 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open() local
2834 fepriv->reinitialise = 1; in dvb_frontend_open()
2842 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; in dvb_frontend_open()
2843 fepriv->tone = -1; in dvb_frontend_open()
2844 fepriv->voltage = -1; in dvb_frontend_open()
2853 &fepriv->pipe); in dvb_frontend_open()
2869 fepriv->events.eventr = fepriv->events.eventw = 0; in dvb_frontend_open()
2904 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release() local
2910 fepriv->release_jiffies = jiffies; in dvb_frontend_release()
2917 wake_up(&fepriv->wait_queue); in dvb_frontend_release()
2974 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume() local
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()
2997 fepriv->state = FESTATE_RETUNE; in dvb_frontend_resume()
3007 struct dvb_frontend_private *fepriv; in dvb_register_frontend() local
3029 fepriv = fe->frontend_priv; in dvb_register_frontend()
3040 sema_init(&fepriv->sem, 1); in dvb_register_frontend()
3041 init_waitqueue_head(&fepriv->wait_queue); in dvb_register_frontend()
3042 init_waitqueue_head(&fepriv->events.wait_queue); in dvb_register_frontend()
3043 mutex_init(&fepriv->events.mtx); in dvb_register_frontend()
3045 fepriv->inversion = INVERSION_OFF; in dvb_register_frontend()
3051 ret = dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
3074 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend() local
3080 dvb_remove_device(fepriv->dvbdev); in dvb_unregister_frontend()