• Home
  • Raw
  • Download

Lines Matching refs:adev

48 static void update_estimated_rate(struct open_dev *adev)  in update_estimated_rate()  argument
51 struct cras_iodev *dev = adev->dev; in update_estimated_rate()
65 adev->coarse_rate_adjust); in update_estimated_rate()
75 struct open_dev *adev; in count_non_empty_dev() local
76 DL_FOREACH(adevs, adev) { in count_non_empty_dev()
77 if (!adev->empty_pi || !pic_interval_elapsed(adev->empty_pi)) in count_non_empty_dev()
102 static int fetch_streams(struct open_dev *adev) in fetch_streams() argument
105 struct cras_iodev *odev = adev->dev; in fetch_streams()
113 DL_FOREACH(adev->dev->streams, dev_stream) { in fetch_streams()
171 struct open_dev *adev; in input_delay_frames() local
175 DL_FOREACH(adevs, adev) { in input_delay_frames()
176 if (!cras_iodev_is_open(adev->dev)) in input_delay_frames()
178 delay = cras_iodev_delay_frames(adev->dev); in input_delay_frames()
191 static unsigned int set_stream_delay(struct open_dev *adev) in set_stream_delay() argument
197 delay = input_delay_frames(adev); in set_stream_delay()
199 DL_FOREACH(adev->dev->streams, stream) { in set_stream_delay()
219 struct open_dev *adev, in get_stream_limit() argument
230 DL_FOREACH(adev->dev->streams, stream) { in get_stream_limit()
238 adev->dev->info.idx, rstream->stream_id, in get_stream_limit()
268 struct open_dev *adev, in get_input_dev_max_wake_ts() argument
275 if(!adev || !adev->dev || !adev->dev->format || in get_input_dev_max_wake_ts()
276 !adev->dev->format->frame_rate || !adev->dev->buffer_size) in get_input_dev_max_wake_ts()
281 dev_rate = adev->dev->format->frame_rate; in get_input_dev_max_wake_ts()
282 half_buffer_size = adev->dev->buffer_size / 2; in get_input_dev_max_wake_ts()
303 static int set_input_dev_wake_ts(struct open_dev *adev) in set_input_dev_wake_ts() argument
317 rc = cras_iodev_frames_queued(adev->dev, &level_tstamp); in set_input_dev_wake_ts()
325 cap_limit = get_stream_limit(adev, UINT_MAX, &cap_limit_stream); in set_input_dev_wake_ts()
331 DL_FOREACH(adev->dev->streams, stream) { in set_input_dev_wake_ts()
356 if(adev->dev->active_node && in set_input_dev_wake_ts()
357 adev->dev->active_node->type != CRAS_NODE_TYPE_HOTWORD) { in set_input_dev_wake_ts()
358 rc = get_input_dev_max_wake_ts(adev, curr_level, &dev_wake_ts); in set_input_dev_wake_ts()
368 adev->wake_ts = min_ts; in set_input_dev_wake_ts()
377 static int capture_to_streams(struct open_dev *adev) in capture_to_streams() argument
379 struct cras_iodev *idev = adev->dev; in capture_to_streams()
386 DL_FOREACH(adev->dev->streams, stream) in capture_to_streams()
400 adev->coarse_rate_adjust = 1; in capture_to_streams()
402 adev->coarse_rate_adjust = -1; in capture_to_streams()
404 adev->coarse_rate_adjust = 0; in capture_to_streams()
406 update_estimated_rate(adev); in capture_to_streams()
409 cap_limit = get_stream_limit(adev, hw_level, &cap_limit_stream); in capture_to_streams()
410 set_stream_delay(adev); in capture_to_streams()
430 DL_FOREACH(adev->dev->streams, stream) { in capture_to_streams()
489 struct open_dev *adev, in write_streams() argument
493 struct cras_iodev *odev = adev->dev; in write_streams()
504 DL_FOREACH(adev->dev->streams, curr) { in write_streams()
544 DL_FOREACH(adev->dev->streams, curr) { in write_streams()
575 void update_dev_wakeup_time(struct open_dev *adev, unsigned int *hw_level) in update_dev_wakeup_time() argument
585 adev->dev, hw_level, &adev->wake_ts); in update_dev_wakeup_time()
586 if (!timespec_is_nonzero(&adev->wake_ts)) in update_dev_wakeup_time()
587 adev->wake_ts = now; in update_dev_wakeup_time()
589 if (cras_iodev_state(adev->dev) == CRAS_IODEV_STATE_NORMAL_RUN) in update_dev_wakeup_time()
590 cras_iodev_update_highest_hw_level(adev->dev, *hw_level); in update_dev_wakeup_time()
592 est_rate = adev->dev->ext_format->frame_rate * in update_dev_wakeup_time()
593 cras_iodev_get_est_rate_ratio(adev->dev); in update_dev_wakeup_time()
595 ATLOG(atlog, AUDIO_THREAD_SET_DEV_WAKE, adev->dev->info.idx, in update_dev_wakeup_time()
603 add_timespecs(&adev->wake_ts, &sleep_time); in update_dev_wakeup_time()
605 ATLOG(atlog, AUDIO_THREAD_DEV_SLEEP_TIME, adev->dev->info.idx, in update_dev_wakeup_time()
606 adev->wake_ts.tv_sec, adev->wake_ts.tv_nsec); in update_dev_wakeup_time()
611 struct open_dev *adev, in write_output_samples() argument
614 struct cras_iodev *odev = adev->dev; in write_output_samples()
642 ATLOG(atlog, AUDIO_THREAD_FILL_AUDIO_TSTAMP, adev->dev->info.idx, in write_output_samples()
646 adev->coarse_rate_adjust = 1; in write_output_samples()
648 adev->coarse_rate_adjust = -1; in write_output_samples()
650 adev->coarse_rate_adjust = 0; in write_output_samples()
653 update_estimated_rate(adev); in write_output_samples()
655 ATLOG(atlog, AUDIO_THREAD_FILL_AUDIO, adev->dev->info.idx, hw_level, 0); in write_output_samples()
673 written = write_streams(odevs, adev, dst, frames); in write_output_samples()
685 if (!adev->non_empty_check_pi) { in write_output_samples()
686 adev->non_empty_check_pi = pic_polled_interval_create( in write_output_samples()
692 if (adev->empty_pi || in write_output_samples()
693 pic_interval_elapsed(adev->non_empty_check_pi)) { in write_output_samples()
695 pic_interval_reset(adev->non_empty_check_pi); in write_output_samples()
706 if (non_empty && adev->empty_pi) { in write_output_samples()
709 pic_polled_interval_destroy(&adev->empty_pi); in write_output_samples()
712 if (non_empty_ptr && !non_empty && !adev->empty_pi) in write_output_samples()
715 adev->empty_pi = pic_polled_interval_create( in write_output_samples()
731 struct open_dev *adev; in dev_io_send_captured_samples() local
735 DL_FOREACH(idev_list, adev) { in dev_io_send_captured_samples()
738 if (!cras_iodev_is_open(adev->dev)) in dev_io_send_captured_samples()
742 DL_FOREACH(adev->dev->streams, stream) { in dev_io_send_captured_samples()
747 rc = set_input_dev_wake_ts(adev); in dev_io_send_captured_samples()
758 struct open_dev *adev) in handle_dev_err() argument
763 adev->dev->info.idx, 0, 0); in handle_dev_err()
764 cras_iodev_reset_request(adev->dev); in handle_dev_err()
767 dev_io_rm_open_dev(odevs, adev); in handle_dev_err()
774 struct open_dev *adev; in dev_io_capture() local
777 DL_FOREACH(idev_list, adev) { in dev_io_capture()
778 if (!cras_iodev_is_open(adev->dev)) in dev_io_capture()
780 rc = capture_to_streams(adev); in dev_io_capture()
782 handle_dev_err(rc, list, adev); in dev_io_capture()
790 struct open_dev *adev; in dev_io_playback_fetch() local
792 DL_FOREACH(odev_list, adev) { in dev_io_playback_fetch()
793 if (!cras_iodev_is_open(adev->dev)) in dev_io_playback_fetch()
795 fetch_streams(adev); in dev_io_playback_fetch()
802 struct open_dev *adev; in dev_io_playback_write() local
809 adev = *odevs; in dev_io_playback_write()
810 if (adev && adev->next) { in dev_io_playback_write()
811 DL_FOREACH(*odevs, adev) { in dev_io_playback_write()
812 DL_FOREACH(adev->dev->streams, curr) in dev_io_playback_write()
817 DL_FOREACH(*odevs, adev) { in dev_io_playback_write()
818 if (!cras_iodev_is_open(adev->dev)) in dev_io_playback_write()
821 rc = write_output_samples(odevs, adev, output_converter); in dev_io_playback_write()
823 handle_dev_err(rc, odevs, adev); in dev_io_playback_write()
831 if (!cras_iodev_odev_should_wake(adev->dev)) in dev_io_playback_write()
838 update_dev_wakeup_time(adev, &hw_level); in dev_io_playback_write()
852 adev->dev->info.idx, in dev_io_playback_write()
854 rc = cras_iodev_output_underrun(adev->dev); in dev_io_playback_write()
856 handle_dev_err(rc, odevs, adev); in dev_io_playback_write()
858 update_dev_wakeup_time(adev, &hw_level); in dev_io_playback_write()
865 DL_FOREACH(*odevs, adev) { in dev_io_playback_write()
867 if (!cras_iodev_is_open(adev->dev)) in dev_io_playback_write()
869 DL_FOREACH(adev->dev->streams, stream) { in dev_io_playback_write()
890 static int input_adev_ignore_wake(const struct open_dev *adev) in input_adev_ignore_wake() argument
892 if (!cras_iodev_is_open(adev->dev)) in input_adev_ignore_wake()
895 if (!adev->dev->active_node) in input_adev_ignore_wake()
898 if (adev->dev->active_node->type == CRAS_NODE_TYPE_HOTWORD && in input_adev_ignore_wake()
899 !cras_iodev_input_streaming(adev->dev)) in input_adev_ignore_wake()
907 struct open_dev *adev; in dev_io_next_input_wake() local
910 DL_FOREACH(*idevs, adev) { in dev_io_next_input_wake()
911 if (input_adev_ignore_wake(adev)) in dev_io_next_input_wake()
914 ATLOG(atlog, AUDIO_THREAD_DEV_SLEEP_TIME, adev->dev->info.idx, in dev_io_next_input_wake()
915 adev->wake_ts.tv_sec, adev->wake_ts.tv_nsec); in dev_io_next_input_wake()
916 if (timespec_after(min_ts, &adev->wake_ts)) in dev_io_next_input_wake()
917 *min_ts = adev->wake_ts; in dev_io_next_input_wake()