summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Shekhar <ashekhar@codeaurora.org>2014-10-03 13:16:09 -0700
committerAmit Shekhar <ashekhar@codeaurora.org>2014-10-13 09:51:29 -0700
commit1d89604def495119003b8e10a97721d47b6f682d (patch)
tree244080ef48202fcd41fa53fbbfb50e218aa6e2bf
parent987af8e86b2aeaddc4865428d5c5cedb05ea258c (diff)
downloadandroid_hardware_qcom_audio-1d89604def495119003b8e10a97721d47b6f682d.tar.gz
android_hardware_qcom_audio-1d89604def495119003b8e10a97721d47b6f682d.tar.bz2
android_hardware_qcom_audio-1d89604def495119003b8e10a97721d47b6f682d.zip
hal: Fix combo device configuration for 24 bit playback on speaker
-Fix combo device configuration for 24 bit playback on speaker -Move exception hadndling code to audio_extn Change-Id: Ia0985a284042a5ac5e3de64aaf5e4d57462ceb85
-rw-r--r--hal/audio_extn/audio_extn.h1
-rw-r--r--hal/audio_extn/utils.c12
-rw-r--r--hal/audio_hw.c33
-rw-r--r--hal/msm8974/platform.c6
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 627900bb..05bf1329 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -822,26 +822,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.
@@ -2433,7 +2424,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;
@@ -2619,20 +2609,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 ff9076e0..ff1f9b8e 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -2559,9 +2559,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