• Home
  • Raw
  • Download

Lines Matching refs:odev

72 static int default_no_stream_playback(struct cras_iodev *odev)  in default_no_stream_playback()  argument
76 unsigned int target_hw_level = odev->min_cb_level * 2; in default_no_stream_playback()
80 rc = cras_iodev_frames_queued(odev, &hw_tstamp); in default_no_stream_playback()
87 rc = cras_iodev_output_underrun(odev, hw_level, 0); in default_no_stream_playback()
91 rc = cras_iodev_frames_queued(odev, &hw_tstamp); in default_no_stream_playback()
97 ATLOG(atlog, AUDIO_THREAD_ODEV_DEFAULT_NO_STREAMS, odev->info.idx, in default_no_stream_playback()
100 fr_to_write = cras_iodev_buffer_avail(odev, hw_level); in default_no_stream_playback()
103 return cras_iodev_fill_odev_zeros(odev, fr_to_write); in default_no_stream_playback()
129 static unsigned int dev_playback_frames(struct cras_iodev *odev) in dev_playback_frames() argument
134 DL_FOREACH (odev->streams, curr) { in dev_playback_frames()
172 static int cras_iodev_no_stream_playback_transition(struct cras_iodev *odev, in cras_iodev_no_stream_playback_transition() argument
177 if (odev->direction != CRAS_STREAM_OUTPUT) in cras_iodev_no_stream_playback_transition()
183 if ((odev->state != CRAS_IODEV_STATE_NORMAL_RUN) && in cras_iodev_no_stream_playback_transition()
184 (odev->state != CRAS_IODEV_STATE_NO_STREAM_RUN)) in cras_iodev_no_stream_playback_transition()
188 ATLOG(atlog, AUDIO_THREAD_ODEV_NO_STREAMS, odev->info.idx, 0, in cras_iodev_no_stream_playback_transition()
191 ATLOG(atlog, AUDIO_THREAD_ODEV_LEAVE_NO_STREAMS, odev->info.idx, in cras_iodev_no_stream_playback_transition()
195 rc = odev->no_stream(odev, enable); in cras_iodev_no_stream_playback_transition()
199 odev->state = CRAS_IODEV_STATE_NO_STREAM_RUN; in cras_iodev_no_stream_playback_transition()
201 odev->state = CRAS_IODEV_STATE_NORMAL_RUN; in cras_iodev_no_stream_playback_transition()
207 static int output_should_mute(struct cras_iodev *odev) in output_should_mute() argument
214 return cras_iodev_is_zero_volume(odev); in output_should_mute()
217 int cras_iodev_is_zero_volume(const struct cras_iodev *odev) in cras_iodev_is_zero_volume() argument
223 if (odev->active_node) { in cras_iodev_is_zero_volume()
225 odev->active_node, system_volume); in cras_iodev_is_zero_volume()
260 static int cras_iodev_output_event_sample_ready(struct cras_iodev *odev) in cras_iodev_output_event_sample_ready() argument
262 if (odev->state == CRAS_IODEV_STATE_OPEN || in cras_iodev_output_event_sample_ready()
263 odev->state == CRAS_IODEV_STATE_NO_STREAM_RUN) { in cras_iodev_output_event_sample_ready()
267 if (odev->ramp && !output_should_mute(odev)) { in cras_iodev_output_event_sample_ready()
268 cras_iodev_start_ramp(odev, odev->initial_ramp_request); in cras_iodev_output_event_sample_ready()
272 if (odev->state == CRAS_IODEV_STATE_OPEN) { in cras_iodev_output_event_sample_ready()
278 cras_iodev_fill_odev_zeros(odev, odev->min_cb_level); in cras_iodev_output_event_sample_ready()
279 ATLOG(atlog, AUDIO_THREAD_ODEV_START, odev->info.idx, in cras_iodev_output_event_sample_ready()
280 odev->min_cb_level, 0); in cras_iodev_output_event_sample_ready()
281 return cras_iodev_start(odev); in cras_iodev_output_event_sample_ready()
282 } else if (odev->state == CRAS_IODEV_STATE_NO_STREAM_RUN) { in cras_iodev_output_event_sample_ready()
286 return cras_iodev_no_stream_playback_transition(odev, 0); in cras_iodev_output_event_sample_ready()
290 odev->info.name, odev->state); in cras_iodev_output_event_sample_ready()
766 int cras_iodev_get_valid_frames(struct cras_iodev *odev, in cras_iodev_get_valid_frames() argument
771 if (odev->direction != CRAS_STREAM_OUTPUT) in cras_iodev_get_valid_frames()
774 if (odev->get_valid_frames) { in cras_iodev_get_valid_frames()
775 rc = odev->get_valid_frames(odev, hw_tstamp); in cras_iodev_get_valid_frames()
779 if (rc < odev->min_buffer_level) in cras_iodev_get_valid_frames()
782 return rc - odev->min_buffer_level; in cras_iodev_get_valid_frames()
784 return cras_iodev_frames_queued(odev, hw_tstamp); in cras_iodev_get_valid_frames()
1326 int cras_iodev_fill_odev_zeros(struct cras_iodev *odev, unsigned int frames) in cras_iodev_fill_odev_zeros() argument
1333 if (odev->direction != CRAS_STREAM_OUTPUT) in cras_iodev_fill_odev_zeros()
1336 ATLOG(atlog, AUDIO_THREAD_FILL_ODEV_ZEROS, odev->info.idx, frames, 0); in cras_iodev_fill_odev_zeros()
1338 frame_bytes = cras_get_format_bytes(odev->format); in cras_iodev_fill_odev_zeros()
1341 rc = cras_iodev_get_output_buffer(odev, &area, &frames_written); in cras_iodev_fill_odev_zeros()
1350 cras_iodev_put_output_buffer(odev, buf, frames_written, NULL, in cras_iodev_fill_odev_zeros()
1358 int cras_iodev_output_underrun(struct cras_iodev *odev, unsigned int hw_level, in cras_iodev_output_underrun() argument
1361 ATLOG(atlog, AUDIO_THREAD_UNDERRUN, odev->info.idx, hw_level, in cras_iodev_output_underrun()
1363 odev->num_underruns++; in cras_iodev_output_underrun()
1365 if (odev->output_underrun) in cras_iodev_output_underrun()
1366 return odev->output_underrun(odev); in cras_iodev_output_underrun()
1368 return cras_iodev_fill_odev_zeros(odev, odev->min_cb_level); in cras_iodev_output_underrun()
1371 int cras_iodev_odev_should_wake(const struct cras_iodev *odev) in cras_iodev_odev_should_wake() argument
1373 if (odev->direction != CRAS_STREAM_OUTPUT) in cras_iodev_odev_should_wake()
1376 if (odev->is_free_running && odev->is_free_running(odev)) in cras_iodev_odev_should_wake()
1380 return (odev->state == CRAS_IODEV_STATE_NORMAL_RUN || in cras_iodev_odev_should_wake()
1381 odev->state == CRAS_IODEV_STATE_NO_STREAM_RUN); in cras_iodev_odev_should_wake()
1385 cras_iodev_default_frames_to_play_in_sleep(struct cras_iodev *odev, in cras_iodev_default_frames_to_play_in_sleep() argument
1389 int rc = cras_iodev_frames_queued(odev, hw_tstamp); in cras_iodev_default_frames_to_play_in_sleep()
1394 if (odev->streams) { in cras_iodev_default_frames_to_play_in_sleep()
1405 if (*hw_level > odev->min_cb_level && dev_playback_frames(odev)) in cras_iodev_default_frames_to_play_in_sleep()
1406 return *hw_level - odev->min_cb_level; in cras_iodev_default_frames_to_play_in_sleep()
1409 &dev_normal_run_wake_up_time, odev->format->frame_rate); in cras_iodev_default_frames_to_play_in_sleep()
1423 odev->format->frame_rate); in cras_iodev_default_frames_to_play_in_sleep()
1424 if (level > MIN(odev->min_cb_level, wakeup_frames)) in cras_iodev_default_frames_to_play_in_sleep()
1425 return level - MIN(odev->min_cb_level, wakeup_frames); in cras_iodev_default_frames_to_play_in_sleep()
1430 unsigned int cras_iodev_frames_to_play_in_sleep(struct cras_iodev *odev, in cras_iodev_frames_to_play_in_sleep() argument
1436 if (odev->frames_to_play_in_sleep) in cras_iodev_frames_to_play_in_sleep()
1437 return odev->frames_to_play_in_sleep(odev, hw_level, hw_tstamp); in cras_iodev_frames_to_play_in_sleep()
1440 odev, hw_level, hw_tstamp); in cras_iodev_frames_to_play_in_sleep()
1443 int cras_iodev_default_no_stream_playback(struct cras_iodev *odev, int enable) in cras_iodev_default_no_stream_playback() argument
1446 return default_no_stream_playback(odev); in cras_iodev_default_no_stream_playback()
1450 int cras_iodev_prepare_output_before_write_samples(struct cras_iodev *odev) in cras_iodev_prepare_output_before_write_samples() argument
1455 if (odev->direction != CRAS_STREAM_OUTPUT) in cras_iodev_prepare_output_before_write_samples()
1458 state = cras_iodev_state(odev); in cras_iodev_prepare_output_before_write_samples()
1463 if (may_enter_normal_run && dev_playback_frames(odev)) in cras_iodev_prepare_output_before_write_samples()
1464 return cras_iodev_output_event_sample_ready(odev); in cras_iodev_prepare_output_before_write_samples()
1468 return odev->no_stream(odev, 1); in cras_iodev_prepare_output_before_write_samples()
1505 struct cras_iodev *odev = (struct cras_iodev *)data; in ramp_down_mute_callback() local
1506 cras_device_monitor_set_device_mute_state(odev->info.idx); in ramp_down_mute_callback()
1510 int cras_iodev_start_ramp(struct cras_iodev *odev, in cras_iodev_start_ramp() argument
1519 if (!cras_iodev_is_open(odev)) in cras_iodev_start_ramp()
1540 cb_data = (void *)odev; in cras_iodev_start_ramp()
1546 odev->initial_ramp_request = in cras_iodev_start_ramp()
1553 odev->initial_ramp_request = in cras_iodev_start_ramp()
1561 rc = cras_mute_ramp_start(odev->ramp, from, to, in cras_iodev_start_ramp()
1562 duration_secs * odev->format->frame_rate, cb, in cras_iodev_start_ramp()
1571 cras_device_monitor_set_device_mute_state(odev->info.idx); in cras_iodev_start_ramp()
1576 int cras_iodev_start_volume_ramp(struct cras_iodev *odev, in cras_iodev_start_volume_ramp() argument
1585 if (!cras_iodev_is_open(odev)) in cras_iodev_start_volume_ramp()
1587 if (!odev->format) in cras_iodev_start_volume_ramp()
1589 if (odev->active_node && odev->active_node->softvol_scalers) { in cras_iodev_start_volume_ramp()
1590 old_scaler = odev->active_node->softvol_scalers[old_volume]; in cras_iodev_start_volume_ramp()
1591 new_scaler = odev->active_node->softvol_scalers[new_volume]; in cras_iodev_start_volume_ramp()
1606 return cras_volume_ramp_start(odev->ramp, from, to, in cras_iodev_start_volume_ramp()
1608 odev->format->frame_rate, in cras_iodev_start_volume_ramp()