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 = -1; /* it'll be incremented to 0 in a moment */ 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()
683 wait_event_interruptible_timeout(fepriv->wait_queue, in dvb_frontend_thread()
687 fepriv->delay); in dvb_frontend_thread()
691 if (!down_interruptible(&fepriv->sem)) in dvb_frontend_thread()
700 if (down_interruptible(&fepriv->sem)) in dvb_frontend_thread()
703 if (fepriv->reinitialise) { in dvb_frontend_thread()
705 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_thread()
706 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_thread()
707 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_thread()
708 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_thread()
709 fepriv->reinitialise = 0; in dvb_frontend_thread()
719 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_thread()
722 fepriv->state = FESTATE_TUNED; in dvb_frontend_thread()
728 fe->ops.tune(fe, re_tune, fepriv->tune_mode_flags, &fepriv->delay, &s); in dvb_frontend_thread()
730 if (s != fepriv->status && !(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) { in dvb_frontend_thread()
733 fepriv->status = s; in dvb_frontend_thread()
741 …dev_dbg(fe->dvb->device, "%s: Frontend ALGO = DVBFE_ALGO_CUSTOM, state=%d\n", __func__, fepriv->st… in dvb_frontend_thread()
742 if (fepriv->state & FESTATE_RETUNE) { in dvb_frontend_thread()
744 fepriv->state = FESTATE_TUNED; in dvb_frontend_thread()
750 if (fepriv->algo_status & DVBFE_ALGO_SEARCH_AGAIN) { in dvb_frontend_thread()
752 fepriv->algo_status = fe->ops.search(fe); in dvb_frontend_thread()
757 fepriv->algo_status &= ~DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
761 if (fepriv->algo_status != DVBFE_ALGO_SEARCH_SUCCESS) { in dvb_frontend_thread()
762 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
763 fepriv->delay = HZ / 2; in dvb_frontend_thread()
765 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dvb_frontend_thread()
767 if (s != fepriv->status) { in dvb_frontend_thread()
769 fepriv->status = s; in dvb_frontend_thread()
771 fepriv->delay = HZ / 10; in dvb_frontend_thread()
772 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dvb_frontend_thread()
774 fepriv->delay = 60 * HZ; in dvb_frontend_thread()
801 fepriv->thread = NULL; in dvb_frontend_thread()
809 up(&fepriv->sem); in dvb_frontend_thread()
816 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_stop() local
824 if (!fepriv->thread) in dvb_frontend_stop()
827 kthread_stop(fepriv->thread); in dvb_frontend_stop()
829 sema_init(&fepriv->sem, 1); in dvb_frontend_stop()
830 fepriv->state = FESTATE_IDLE; in dvb_frontend_stop()
833 if (fepriv->thread) in dvb_frontend_stop()
836 fepriv->thread); in dvb_frontend_stop()
864 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_start() local
869 if (fepriv->thread) { in dvb_frontend_start()
878 if (down_interruptible(&fepriv->sem)) in dvb_frontend_start()
881 fepriv->state = FESTATE_IDLE; in dvb_frontend_start()
883 fepriv->thread = NULL; in dvb_frontend_start()
893 up(&fepriv->sem); in dvb_frontend_start()
896 fepriv->thread = fe_thread; in dvb_frontend_start()
1828 struct dvb_frontend_private *fepriv = fe->frontend_priv; in prepare_tuning_algo_parameters() local
1833 fepriv->min_delay = (fetunesettings.min_delay_ms * HZ) / 1000; in prepare_tuning_algo_parameters()
1834 fepriv->max_drift = fetunesettings.max_drift; in prepare_tuning_algo_parameters()
1835 fepriv->step_size = fetunesettings.step_size; in prepare_tuning_algo_parameters()
1846 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1847 fepriv->step_size = c->symbol_rate / 16000; in prepare_tuning_algo_parameters()
1848 fepriv->max_drift = c->symbol_rate / 2000; in prepare_tuning_algo_parameters()
1854 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1855 fepriv->step_size = dvb_frontend_get_stepsize(fe) * 2; in prepare_tuning_algo_parameters()
1856 fepriv->max_drift = fepriv->step_size + 1; in prepare_tuning_algo_parameters()
1863 fepriv->min_delay = HZ / 20; in prepare_tuning_algo_parameters()
1864 fepriv->step_size = 0; /* no zigzag */ in prepare_tuning_algo_parameters()
1865 fepriv->max_drift = 0; in prepare_tuning_algo_parameters()
1870 fepriv->min_delay = (dvb_override_tune_delay * HZ) / 1000; in prepare_tuning_algo_parameters()
2072 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_do_ioctl() local
2076 if (down_interruptible(&fepriv->sem)) in dvb_frontend_do_ioctl()
2080 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2101 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2107 up(&fepriv->sem); in dvb_frontend_do_ioctl()
2152 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_compat_ioctl() local
2214 if (fepriv->state != FESTATE_IDLE) { in dvb_frontend_handle_compat_ioctl()
2246 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_compat_ioctl() local
2250 if (down_interruptible(&fepriv->sem)) in dvb_frontend_compat_ioctl()
2255 up(&fepriv->sem); in dvb_frontend_compat_ioctl()
2265 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dtv_set_frontend() local
2277 dtv_property_legacy_params_sync(fe, c, &fepriv->parameters_out); in dtv_set_frontend()
2349 fepriv->state = FESTATE_RETUNE; in dtv_set_frontend()
2352 fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; in dtv_set_frontend()
2357 fepriv->status = 0; in dtv_set_frontend()
2365 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_get_property() local
2395 if (fepriv->state != FESTATE_IDLE) { in dvb_get_property()
2440 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_handle_ioctl() local
2533 if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT)) in dvb_frontend_handle_ioctl()
2544 if (fepriv->state == FESTATE_RETUNE || in dvb_frontend_handle_ioctl()
2545 fepriv->state == FESTATE_ERROR) { in dvb_frontend_handle_ioctl()
2559 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2560 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2573 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2574 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2581 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2582 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2588 fepriv->tone = (long)parg; in dvb_frontend_handle_ioctl()
2589 err = fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_handle_ioctl()
2590 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2591 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2597 fepriv->voltage = (long)parg; in dvb_frontend_handle_ioctl()
2598 err = fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_handle_ioctl()
2599 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2600 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2615 fepriv->tune_mode_flags = (unsigned long)parg; in dvb_frontend_handle_ioctl()
2624 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2625 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2681 fepriv->state = FESTATE_DISEQC; in dvb_frontend_handle_ioctl()
2682 fepriv->status = 0; in dvb_frontend_handle_ioctl()
2690 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2699 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2708 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2717 if (fepriv->thread) in dvb_frontend_handle_ioctl()
2756 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_poll() local
2760 poll_wait(file, &fepriv->events.wait_queue, wait); in dvb_frontend_poll()
2762 if (fepriv->events.eventw != fepriv->events.eventr) in dvb_frontend_poll()
2772 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_open() local
2839 fepriv->reinitialise = 1; in dvb_frontend_open()
2847 fepriv->tune_mode_flags &= ~FE_TUNE_MODE_ONESHOT; in dvb_frontend_open()
2848 fepriv->tone = -1; in dvb_frontend_open()
2849 fepriv->voltage = -1; in dvb_frontend_open()
2858 &fepriv->pipe); in dvb_frontend_open()
2874 fepriv->events.eventr = fepriv->events.eventw = 0; in dvb_frontend_open()
2909 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_release() local
2915 fepriv->release_jiffies = jiffies; in dvb_frontend_release()
2922 wake_up(&fepriv->wait_queue); in dvb_frontend_release()
2979 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_frontend_resume() local
2996 if (fe->ops.set_tone && fepriv->tone != -1) in dvb_frontend_resume()
2997 fe->ops.set_tone(fe, fepriv->tone); in dvb_frontend_resume()
2998 if (fe->ops.set_voltage && fepriv->voltage != -1) in dvb_frontend_resume()
2999 fe->ops.set_voltage(fe, fepriv->voltage); in dvb_frontend_resume()
3002 fepriv->state = FESTATE_RETUNE; in dvb_frontend_resume()
3012 struct dvb_frontend_private *fepriv; in dvb_register_frontend() local
3034 fepriv = fe->frontend_priv; in dvb_register_frontend()
3045 sema_init(&fepriv->sem, 1); in dvb_register_frontend()
3046 init_waitqueue_head(&fepriv->wait_queue); in dvb_register_frontend()
3047 init_waitqueue_head(&fepriv->events.wait_queue); in dvb_register_frontend()
3048 mutex_init(&fepriv->events.mtx); in dvb_register_frontend()
3050 fepriv->inversion = INVERSION_OFF; in dvb_register_frontend()
3056 ret = dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template, in dvb_register_frontend()
3079 struct dvb_frontend_private *fepriv = fe->frontend_priv; in dvb_unregister_frontend() local
3085 dvb_remove_device(fepriv->dvbdev); in dvb_unregister_frontend()