Lines Matching refs:adev
86 struct audio_device *adev; /* hardware information - only using this for the lock */
117 struct audio_device *adev; /* hardware information - only using this for the lock */
167 static void device_lock(struct audio_device *adev) {
168 pthread_mutex_lock(&adev->lock);
171 static int device_try_lock(struct audio_device *adev) {
172 return pthread_mutex_trylock(&adev->lock);
175 static void device_unlock(struct audio_device *adev) {
176 pthread_mutex_unlock(&adev->lock);
183 struct audio_device* adev, struct listnode* list, struct listnode* stream_node) {
184 device_lock(adev);
188 device_unlock(adev);
192 struct audio_device* adev, struct listnode* stream_node) {
193 device_lock(adev);
197 device_unlock(adev);
337 device_lock(out->adev);
339 device_unlock(out->adev);
378 device_lock(out->adev);
397 device_unlock(out->adev);
407 device_lock(out->adev);
411 device_unlock(out->adev);
442 device_lock(out->adev);
444 device_unlock(out->adev);
566 out->adev = (struct audio_device *)hw_dev;
567 device_lock(out->adev);
568 out->profile = &out->adev->out_profile;
591 out->adev->device_sample_rate = config->sample_rate;
592 device_unlock(out->adev);
653 adev_add_stream_to_list(out->adev, &out->adev->output_stream_list, &out->list_node);
671 adev_remove_stream_from_list(out->adev, &out->list_node);
681 device_lock(out->adev);
682 out->adev->device_sample_rate = 0;
683 device_unlock(out->adev);
743 device_lock(in->adev);
745 device_unlock(in->adev);
787 device_lock(in->adev);
806 device_unlock(in->adev);
817 device_lock(in->adev);
821 device_unlock(in->adev);
862 device_lock(in->adev);
864 device_unlock(in->adev);
914 /* no need to acquire in->adev->lock to read mic_muted here as we don't change its state */
915 if (num_read_buff_bytes > 0 && in->adev->mic_muted)
970 in->adev = (struct audio_device *)hw_dev;
971 device_lock(in->adev);
973 in->profile = &in->adev->in_profile;
988 if (in->adev->device_sample_rate != 0 && /* we are playing, so lock the rate */
989 in->adev->device_sample_rate >= RATELOCK_THRESHOLD) {/* but only for high sample rates */
990 ret = config->sample_rate != in->adev->device_sample_rate ? -EINVAL : 0;
991 adev->device_sample_rate;
998 device_unlock(in->adev);
1067 adev_add_stream_to_list(in->adev, &in->adev->input_stream_list, &in->list_node);
1095 adev_remove_stream_from_list(in->adev, &in->list_node);
1106 * ADEV Functions
1140 struct audio_device * adev = (struct audio_device *)hw_dev;
1141 device_lock(adev);
1142 adev->mic_muted = state;
1143 device_unlock(adev);
1156 struct audio_device* adev = (struct audio_device*)device;
1162 while (retry > 0 && device_try_lock(adev) != 0) {
1168 if (list_empty(&adev->output_stream_list)) {
1172 list_for_each(node, &adev->output_stream_list) {
1179 if (list_empty(&adev->input_stream_list)) {
1183 list_for_each(node, &adev->input_stream_list) {
1190 device_unlock(adev);
1201 struct audio_device *adev = (struct audio_device *)device;
1212 struct audio_device *adev = calloc(1, sizeof(struct audio_device));
1213 if (!adev)
1216 profile_init(&adev->out_profile, PCM_OUT);
1217 profile_init(&adev->in_profile, PCM_IN);
1219 list_init(&adev->output_stream_list);
1220 list_init(&adev->input_stream_list);
1222 adev->hw_device.common.tag = HARDWARE_DEVICE_TAG;
1223 adev->hw_device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
1224 adev->hw_device.common.module = (struct hw_module_t *)module;
1225 adev->hw_device.common.close = adev_close;
1227 adev->hw_device.init_check = adev_init_check;
1228 adev->hw_device.set_voice_volume = adev_set_voice_volume;
1229 adev->hw_device.set_master_volume = adev_set_master_volume;
1230 adev->hw_device.set_mode = adev_set_mode;
1231 adev->hw_device.set_mic_mute = adev_set_mic_mute;
1232 adev->hw_device.get_mic_mute = adev_get_mic_mute;
1233 adev->hw_device.set_parameters = adev_set_parameters;
1234 adev->hw_device.get_parameters = adev_get_parameters;
1235 adev->hw_device.get_input_buffer_size = adev_get_input_buffer_size;
1236 adev->hw_device.open_output_stream = adev_open_output_stream;
1237 adev->hw_device.close_output_stream = adev_close_output_stream;
1238 adev->hw_device.open_input_stream = adev_open_input_stream;
1239 adev->hw_device.close_input_stream = adev_close_input_stream;
1240 adev->hw_device.dump = adev_dump;
1242 *device = &adev->hw_device.common;