hal: audio: Add support to pick 32KHz and 144KHz sampling rate
Add support to pick 32kHz and 144KHz samplig rates for backend configuration of passthrough usecases. Do not update the bit width for passthrough usecases as output will always operate at 16bit for passthrough usecases. CRs-fixed: 1071692 Change-Id: I326cb9e906268566ecc4a7639804f06585b4004b
This commit is contained in:
parent
374940220a
commit
a395a9e050
|
@ -3987,6 +3987,10 @@ int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
out->compr_config.codec->ch_in =
|
||||
audio_channel_count_from_out_mask(out->channel_mask);
|
||||
out->compr_config.codec->ch_out = out->compr_config.codec->ch_in;
|
||||
/* Update bit width only for non passthrough usecases.
|
||||
* For passthrough usecases, the output will always be opened @16 bit
|
||||
*/
|
||||
if (!audio_extn_passthru_is_passthrough_stream(out))
|
||||
out->bit_width = AUDIO_OUTPUT_BIT_WIDTH;
|
||||
/*TODO: Do we need to change it for passthrough */
|
||||
out->compr_config.codec->format = SND_AUDIOSTREAMFORMAT_RAW;
|
||||
|
|
|
@ -4689,11 +4689,11 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
|
|||
*/
|
||||
// TODO: This has to be more dynamic based on policy file
|
||||
|
||||
if ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
|
||||
if (passthrough_enabled || ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
|
||||
(sample_rate != my_data->current_backend_cfg[(int)backend_idx].sample_rate) &&
|
||||
(my_data->hifi_audio ||
|
||||
backend_idx == USB_AUDIO_RX_BACKEND ||
|
||||
backend_idx == USB_AUDIO_TX_BACKEND)) {
|
||||
backend_idx == USB_AUDIO_TX_BACKEND))) {
|
||||
/*
|
||||
* sample rate update is needed only for hifi audio enabled platforms
|
||||
*/
|
||||
|
@ -4701,11 +4701,15 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
|
|||
struct mixer_ctl *ctl = NULL;
|
||||
|
||||
switch (sample_rate) {
|
||||
case 32000:
|
||||
if (passthrough_enabled) {
|
||||
rate_str = "KHZ_32";
|
||||
break;
|
||||
}
|
||||
case 8000:
|
||||
case 11025:
|
||||
case 16000:
|
||||
case 22050:
|
||||
case 32000:
|
||||
case 48000:
|
||||
rate_str = "KHZ_48";
|
||||
break;
|
||||
|
@ -4731,6 +4735,11 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
|
|||
case 384000:
|
||||
rate_str = "KHZ_384";
|
||||
break;
|
||||
case 144000:
|
||||
if (passthrough_enabled) {
|
||||
rate_str = "KHZ_144";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rate_str = "KHZ_48";
|
||||
break;
|
||||
|
@ -5646,6 +5655,7 @@ unsigned char platform_map_to_edid_format(int audio_format)
|
|||
format = AAC;
|
||||
break;
|
||||
case AUDIO_FORMAT_E_AC3:
|
||||
case AUDIO_FORMAT_E_AC3_JOC:
|
||||
ALOGV("%s:E_AC3", __func__);
|
||||
format = DOLBY_DIGITAL_PLUS;
|
||||
break;
|
||||
|
|
|
@ -4591,17 +4591,21 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
|
|||
ret = 0;
|
||||
}
|
||||
|
||||
if ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
|
||||
(sample_rate != my_data->current_backend_cfg[backend_idx].sample_rate)) {
|
||||
if (passthrough_enabled || ((my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl) &&
|
||||
(sample_rate != my_data->current_backend_cfg[backend_idx].sample_rate))) {
|
||||
char *rate_str = NULL;
|
||||
struct mixer_ctl *ctl = NULL;
|
||||
|
||||
switch (sample_rate) {
|
||||
case 32000:
|
||||
if (passthrough_enabled) {
|
||||
rate_str = "KHZ_32";
|
||||
break;
|
||||
}
|
||||
case 8000:
|
||||
case 11025:
|
||||
case 16000:
|
||||
case 22050:
|
||||
case 32000:
|
||||
case 48000:
|
||||
rate_str = "KHZ_48";
|
||||
break;
|
||||
|
@ -4627,6 +4631,11 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
|
|||
case 384000:
|
||||
rate_str = "KHZ_384";
|
||||
break;
|
||||
case 144000:
|
||||
if (passthrough_enabled) {
|
||||
rate_str = "KHZ_144";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rate_str = "KHZ_48";
|
||||
break;
|
||||
|
@ -5493,6 +5502,7 @@ unsigned char platform_map_to_edid_format(int audio_format)
|
|||
format = AAC;
|
||||
break;
|
||||
case AUDIO_FORMAT_E_AC3:
|
||||
case AUDIO_FORMAT_E_AC3_JOC:
|
||||
ALOGV("%s:E_AC3", __func__);
|
||||
format = DOLBY_DIGITAL_PLUS;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue