diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2014-10-24 22:51:37 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2014-10-24 22:51:36 -0700 |
commit | 9d1bcfbc5d3b28e356071726132b591d6585498a (patch) | |
tree | 90f2fa3ab1072e946a76fc350169c653e244f190 | |
parent | df80f867a3a8092e94a97225388e3360e06cb31b (diff) | |
parent | 1d89604def495119003b8e10a97721d47b6f682d (diff) | |
download | android_hardware_qcom_audio-9d1bcfbc5d3b28e356071726132b591d6585498a.tar.gz android_hardware_qcom_audio-9d1bcfbc5d3b28e356071726132b591d6585498a.tar.bz2 android_hardware_qcom_audio-9d1bcfbc5d3b28e356071726132b591d6585498a.zip |
Merge "hal: Fix combo device configuration for 24 bit playback on speaker"
-rw-r--r-- | hal/audio_extn/audio_extn.h | 1 | ||||
-rw-r--r-- | hal/audio_extn/utils.c | 12 | ||||
-rw-r--r-- | hal/audio_hw.c | 33 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 6 |
4 files changed, 22 insertions, 30 deletions
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h index 4c1416d9..dd6063fa 100644 --- a/hal/audio_extn/audio_extn.h +++ b/hal/audio_extn/audio_extn.h @@ -309,6 +309,7 @@ void audio_extn_utils_release_streams_output_cfg_list( struct listnode *streams_output_cfg_list); void audio_extn_utils_update_stream_app_type_cfg(void *platform, struct listnode *streams_output_cfg_list, + audio_devices_t devices, audio_output_flags_t flags, audio_format_t format, uint32_t sample_rate, diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c index 5287ae8c..68181615 100644 --- a/hal/audio_extn/utils.c +++ b/hal/audio_extn/utils.c @@ -422,6 +422,7 @@ static bool set_output_cfg(struct streams_output_cfg *so_info, void audio_extn_utils_update_stream_app_type_cfg(void *platform, struct listnode *streams_output_cfg_list, + audio_devices_t devices, audio_output_flags_t flags, audio_format_t format, uint32_t sample_rate, @@ -433,7 +434,14 @@ void audio_extn_utils_update_stream_app_type_cfg(void *platform, struct stream_format *sf_info; struct stream_sample_rate *ss_info; - ALOGV("%s: flags: %x, format: %x", __func__, flags, format); + if ((24 == bit_width) && + (devices & AUDIO_DEVICE_OUT_SPEAKER)) { + sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; + ALOGI("%s Allowing 24-bit playback on speaker ONLY at default sampling rate", __func__); + } + + ALOGV("%s: flags: %x, format: %x sample_rate %d", + __func__, flags, format, sample_rate); list_for_each(node_i, streams_output_cfg_list) { so_info = node_to_item(node_i, struct streams_output_cfg, list); if (so_info->flags == flags) { @@ -516,7 +524,7 @@ int audio_extn_utils_send_app_type_cfg(struct audio_usecase *usecase) } if ((24 == usecase->stream.out->bit_width) && - (AUDIO_DEVICE_OUT_SPEAKER == snd_device)) { + (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) { sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; } else { sample_rate = out->app_type_cfg.sample_rate; diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 9de620fd..390fb46c 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -874,26 +874,17 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) usecase->out_snd_device = out_snd_device; if (usecase->type == PCM_PLAYBACK) { - if ((24 == usecase->stream.out->bit_width) && - (AUDIO_DEVICE_OUT_SPEAKER == usecase->stream.out->devices)) { - audio_extn_utils_update_stream_app_type_cfg(adev->platform, - &adev->streams_output_cfg_list, - usecase->stream.out->flags, - usecase->stream.out->format, - DEFAULT_OUTPUT_SAMPLING_RATE, - usecase->stream.out->bit_width, - &usecase->stream.out->app_type_cfg); - } else { - audio_extn_utils_update_stream_app_type_cfg(adev->platform, + audio_extn_utils_update_stream_app_type_cfg(adev->platform, &adev->streams_output_cfg_list, + usecase->stream.out->devices, usecase->stream.out->flags, usecase->stream.out->format, usecase->stream.out->sample_rate, usecase->stream.out->bit_width, &usecase->stream.out->app_type_cfg); - } - ALOGI("%s Selected apptype: %d", __func__, usecase->stream.out->app_type_cfg.app_type); + ALOGI("%s Selected apptype: %d", __func__, usecase->stream.out->app_type_cfg.app_type); } + enable_audio_route(adev, usecase); /* Applicable only on the targets that has external modem. @@ -2527,7 +2518,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev, struct stream_out *out; int i, ret = 0; audio_format_t format; - int32_t sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; *stream_out = NULL; @@ -2730,20 +2720,11 @@ static int adev_open_output_stream(struct audio_hw_device *dev, out->sample_rate = out->config.rate; } - if ((24 == out->bit_width) && - (devices == AUDIO_DEVICE_OUT_SPEAKER)) { - sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE; - ALOGI("%s 24-bit playback on Speaker is allowed ONLY at 48khz. Hence changing sample rate to: %d", - __func__, sample_rate); - } else { - sample_rate = out->sample_rate; - } - - ALOGV("%s flags %x, format %x, sample_rate %d, out->bit_width %d", - __func__, flags, format, sample_rate, out->bit_width); + ALOGV("%s devices %d,flags %x, format %x, out->sample_rate %d, out->bit_width %d", + __func__, devices, flags, format, out->sample_rate, out->bit_width); audio_extn_utils_update_stream_app_type_cfg(adev->platform, &adev->streams_output_cfg_list, - flags, format, sample_rate, + devices, flags, format, out->sample_rate, out->bit_width, &out->app_type_cfg); if ((out->usecase == USECASE_AUDIO_PLAYBACK_PRIMARY) || (flags & AUDIO_OUTPUT_FLAG_PRIMARY)) { diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index a0a9321d..f034ee17 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -2666,9 +2666,11 @@ bool platform_check_codec_backend_cfg(struct audio_device* adev, } } - // 16 bit playbacks is allowed through 16 bit/48 khz backend only + // 24 bit playback on speakers and all 16 bit playbacks is allowed through + // 16 bit/48 khz backend only if ((16 == bit_width) || - ((24 == bit_width) && (SND_DEVICE_OUT_SPEAKER == usecase->devices))) { + ((24 == bit_width) && + (usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER))) { sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE; } // Force routing if the expected bitwdith or samplerate |