• Home
  • Raw
  • Download

Lines Matching refs:tuner

103     struct stub_radio_tuner *tuner;  member
141 static int send_command_l(struct stub_radio_tuner *tuner, in send_command_l() argument
172 list_add_tail(&tuner->command_list, &cmd->node); in send_command_l()
173 pthread_cond_signal(&tuner->cond); in send_command_l()
211 static int prepare_metadata(struct stub_radio_tuner *tuner, in prepare_metadata() argument
226 ret = radio_metadata_allocate(metadata, tuner->program.channel, 0); in prepare_metadata()
271 struct stub_radio_tuner *tuner = (struct stub_radio_tuner *)context; in callback_thread_loop() local
278 pthread_mutex_lock(&tuner->lock); in callback_thread_loop()
292 if (list_empty(&tuner->command_list) || ts.tv_sec != 0) { in callback_thread_loop()
296 pthread_cond_timedwait(&tuner->cond, &tuner->lock, &ts); in callback_thread_loop()
299 pthread_cond_wait(&tuner->cond, &tuner->lock); in callback_thread_loop()
307 list_for_each_safe(item, tmp, &tuner->command_list) { in callback_thread_loop()
336 tuner->config = cmd->config; in callback_thread_loop()
337 tuner->config.antenna_connected = true; in callback_thread_loop()
339 event.config = tuner->config; in callback_thread_loop()
341 __func__, tuner->config.type, in callback_thread_loop()
342 tuner->config.lower_limit, tuner->config.upper_limit); in callback_thread_loop()
343 if (tuner->config.type == RADIO_BAND_FM) { in callback_thread_loop()
346 tuner->config.fm.stereo, tuner->config.fm.rds, in callback_thread_loop()
347 tuner->config.fm.ta, tuner->config.fm.af, in callback_thread_loop()
348 tuner->config.fm.ea); in callback_thread_loop()
350 ALOGV(" - stereo %d", tuner->config.am.stereo); in callback_thread_loop()
356 frequency = tuner->program.channel; in callback_thread_loop()
358 frequency += tuner->config.spacings[0]; in callback_thread_loop()
360 frequency -= tuner->config.spacings[0]; in callback_thread_loop()
362 if (frequency > (int)tuner->config.upper_limit) { in callback_thread_loop()
363 frequency = tuner->config.lower_limit; in callback_thread_loop()
365 if (frequency < (int)tuner->config.lower_limit) { in callback_thread_loop()
366 frequency = tuner->config.upper_limit; in callback_thread_loop()
368 tuner->program.channel = frequency; in callback_thread_loop()
369 tuner->program.tuned = (frequency / (tuner->config.spacings[0] * 5)) % 2; in callback_thread_loop()
370 tuner->program.signal_strength = 20; in callback_thread_loop()
371 if (tuner->config.type == RADIO_BAND_FM) in callback_thread_loop()
372 tuner->program.stereo = false; in callback_thread_loop()
374 tuner->program.stereo = false; in callback_thread_loop()
375 prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned); in callback_thread_loop()
378 event.info = tuner->program; in callback_thread_loop()
383 frequency = tuner->program.channel; in callback_thread_loop()
385 frequency += tuner->config.spacings[0] * 25; in callback_thread_loop()
387 frequency -= tuner->config.spacings[0] * 25; in callback_thread_loop()
389 if (frequency > (int)tuner->config.upper_limit) { in callback_thread_loop()
390 frequency = tuner->config.lower_limit; in callback_thread_loop()
392 if (frequency < (int)tuner->config.lower_limit) { in callback_thread_loop()
393 frequency = tuner->config.upper_limit; in callback_thread_loop()
395 tuner->program.channel = (unsigned int)frequency; in callback_thread_loop()
396 tuner->program.tuned = true; in callback_thread_loop()
397 if (tuner->config.type == RADIO_BAND_FM) in callback_thread_loop()
398 tuner->program.stereo = tuner->config.fm.stereo; in callback_thread_loop()
400 tuner->program.stereo = tuner->config.am.stereo; in callback_thread_loop()
401 tuner->program.signal_strength = 50; in callback_thread_loop()
402 prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned); in callback_thread_loop()
405 event.info = tuner->program; in callback_thread_loop()
410 tuner->program.channel = cmd->param; in callback_thread_loop()
411 tuner->program.tuned = (tuner->program.channel / in callback_thread_loop()
412 (tuner->config.spacings[0] * 5)) % 2; in callback_thread_loop()
414 if (tuner->program.tuned) { in callback_thread_loop()
415 … send_command_l(tuner, CMD_ANNOUNCEMENTS, thread_cmd_delay_ms[CMD_ANNOUNCEMENTS], NULL); in callback_thread_loop()
417 tuner->program.signal_strength = 100; in callback_thread_loop()
418 if (tuner->config.type == RADIO_BAND_FM) in callback_thread_loop()
419 tuner->program.stereo = in callback_thread_loop()
420 tuner->program.tuned ? tuner->config.fm.stereo : false; in callback_thread_loop()
422 tuner->program.stereo = in callback_thread_loop()
423 tuner->program.tuned ? tuner->config.am.stereo : false; in callback_thread_loop()
424 prepare_metadata(tuner, &tuner->program.metadata, tuner->program.tuned); in callback_thread_loop()
427 event.info = tuner->program; in callback_thread_loop()
432 int ret = prepare_metadata(tuner, &metadata, false); in callback_thread_loop()
448 ea_state, tuner->config.type, tuner->config.fm.ea); in callback_thread_loop()
449 if (tuner->config.type == RADIO_BAND_FM || in callback_thread_loop()
450 tuner->config.type == RADIO_BAND_FM_HD) { in callback_thread_loop()
454 } else if (tuner->config.fm.ea) { in callback_thread_loop()
460 if (tuner->config.fm.ea) { in callback_thread_loop()
461 send_command_l(tuner, CMD_ANNOUNCEMENTS, 5000, NULL); in callback_thread_loop()
466 if (event.type != RADIO_EVENT_HW_FAILURE && tuner->callback != NULL) { in callback_thread_loop()
467 pthread_mutex_unlock(&tuner->lock); in callback_thread_loop()
468 tuner->callback(&event, tuner->cookie); in callback_thread_loop()
469 pthread_mutex_lock(&tuner->lock); in callback_thread_loop()
488 list_for_each_safe(item, tmp, &tuner->command_list) { in callback_thread_loop()
495 send_command_l(tuner, CMD_METADATA, thread_cmd_delay_ms[CMD_METADATA], NULL); in callback_thread_loop()
500 pthread_mutex_unlock(&tuner->lock); in callback_thread_loop()
508 static int tuner_set_configuration(const struct radio_tuner *tuner, in tuner_set_configuration() argument
511 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_set_configuration()
532 static int tuner_get_configuration(const struct radio_tuner *tuner, in tuner_get_configuration() argument
535 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_get_configuration()
561 static int tuner_step(const struct radio_tuner *tuner, in tuner_step() argument
564 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_step()
575 static int tuner_scan(const struct radio_tuner *tuner, in tuner_scan() argument
578 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_scan()
589 static int tuner_tune(const struct radio_tuner *tuner, in tuner_tune() argument
592 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_tune()
608 static int tuner_cancel(const struct radio_tuner *tuner) in tuner_cancel() argument
610 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_cancel()
620 static int tuner_get_program_information(const struct radio_tuner *tuner, in tuner_get_program_information() argument
623 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in tuner_get_program_information()
664 const struct radio_tuner **tuner) in rdev_open_tuner() argument
672 if (rdev->tuner != NULL) { in rdev_open_tuner()
678 if (config == NULL || callback == NULL || tuner == NULL) { in rdev_open_tuner()
683 rdev->tuner = (struct stub_radio_tuner *)calloc(1, sizeof(struct stub_radio_tuner)); in rdev_open_tuner()
684 if (rdev->tuner == NULL) { in rdev_open_tuner()
689 rdev->tuner->interface.set_configuration = tuner_set_configuration; in rdev_open_tuner()
690 rdev->tuner->interface.get_configuration = tuner_get_configuration; in rdev_open_tuner()
691 rdev->tuner->interface.scan = tuner_scan; in rdev_open_tuner()
692 rdev->tuner->interface.step = tuner_step; in rdev_open_tuner()
693 rdev->tuner->interface.tune = tuner_tune; in rdev_open_tuner()
694 rdev->tuner->interface.cancel = tuner_cancel; in rdev_open_tuner()
695 rdev->tuner->interface.get_program_information = tuner_get_program_information; in rdev_open_tuner()
697 rdev->tuner->audio = audio; in rdev_open_tuner()
698 rdev->tuner->callback = callback; in rdev_open_tuner()
699 rdev->tuner->cookie = cookie; in rdev_open_tuner()
701 rdev->tuner->dev = rdev; in rdev_open_tuner()
703 pthread_mutex_init(&rdev->tuner->lock, (const pthread_mutexattr_t *) NULL); in rdev_open_tuner()
704 pthread_cond_init(&rdev->tuner->cond, (const pthread_condattr_t *) NULL); in rdev_open_tuner()
705 pthread_create(&rdev->tuner->callback_thread, (const pthread_attr_t *) NULL, in rdev_open_tuner()
706 callback_thread_loop, rdev->tuner); in rdev_open_tuner()
707 list_init(&rdev->tuner->command_list); in rdev_open_tuner()
709 pthread_mutex_lock(&rdev->tuner->lock); in rdev_open_tuner()
710 send_command_l(rdev->tuner, CMD_CONFIG, thread_cmd_delay_ms[CMD_CONFIG], (void *)config); in rdev_open_tuner()
711 pthread_mutex_unlock(&rdev->tuner->lock); in rdev_open_tuner()
713 *tuner = &rdev->tuner->interface; in rdev_open_tuner()
722 const struct radio_tuner *tuner) in rdev_close_tuner() argument
725 struct stub_radio_tuner *stub_tuner = (struct stub_radio_tuner *)tuner; in rdev_close_tuner()
728 ALOGI("%s tuner %p", __func__, tuner); in rdev_close_tuner()
731 if (tuner == NULL) { in rdev_close_tuner()
746 rdev->tuner = NULL; in rdev_close_tuner()
757 free(rdev->tuner); in rdev_close()