hal: Add change to fix speaker and headphone concurrency.
After the device switch from headset to the speaker, lag in playback was observed. The issue was seen because both the speaker and headphone was configured using the native clock. Add change to configure headphone to 48Khz sample rate before enabling the use case on speaker. Change-Id: I8ad1f2690e94a960f61fb7f36f49e8f6e5cace60
This commit is contained in:
parent
a334969383
commit
c14116653c
|
@ -133,6 +133,10 @@
|
|||
<param key="true_32_bit" value="true"/>
|
||||
<!-- In the below value string, the value indicates sidetone gain in dB -->
|
||||
<param key="usb_sidetone_gain" value="35"/>
|
||||
<!-- In the below value string, the value indicates whether the -->
|
||||
<!-- target does not supports speaker and headphone working on -->
|
||||
<!-- different fractional and integer sampling rate -->
|
||||
<param key="spkr_hph_single_be_native_concurrency" value="true"/>
|
||||
</config_params>
|
||||
<gain_db_to_level_mapping>
|
||||
<gain_level_map db="-59" level="5"/>
|
||||
|
|
|
@ -110,6 +110,10 @@
|
|||
<param key="native_audio_mode" value="multiple_mix_dsp"/>
|
||||
<param key="hfp_pcm_dev_id" value="39"/>
|
||||
<param key="input_mic_max_count" value="4"/>
|
||||
<!-- In the below value string, the value indicates whether the -->
|
||||
<!-- target does not supports speaker and headphone working on -->
|
||||
<!-- different fractional and integer sampling rate -->
|
||||
<param key="spkr_hph_single_be_native_concurrency" value="true"/>
|
||||
</config_params>
|
||||
<gain_db_to_level_mapping>
|
||||
<gain_level_map db="-59" level="5"/>
|
||||
|
|
|
@ -110,6 +110,10 @@
|
|||
<param key="native_audio_mode" value="multiple_mix_dsp"/>
|
||||
<param key="hfp_pcm_dev_id" value="39"/>
|
||||
<param key="input_mic_max_count" value="2"/>
|
||||
<!-- In the below value string, the value indicates whether the -->
|
||||
<!-- target does not supports speaker and headphone working on -->
|
||||
<!-- different fractional and integer sampling rate -->
|
||||
<param key="spkr_hph_single_be_native_concurrency" value="true"/>
|
||||
</config_params>
|
||||
<gain_db_to_level_mapping>
|
||||
<gain_level_map db="-59" level="5"/>
|
||||
|
|
|
@ -935,6 +935,36 @@ static void disable_asrc_mode(struct audio_device *adev)
|
|||
adev->asrc_mode_enabled = false;
|
||||
}
|
||||
|
||||
static void check_and_configure_headphone(struct audio_device *adev,
|
||||
struct audio_usecase *uc_info,
|
||||
snd_device_t snd_device)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct audio_usecase *usecase;
|
||||
int new_backend_idx, usecase_backend_idx;
|
||||
bool spkr_hph_single_be_native_concurrency;
|
||||
|
||||
new_backend_idx = platform_get_backend_index(snd_device);
|
||||
spkr_hph_single_be_native_concurrency = platform_get_spkr_hph_single_be_native_concurrency_flag();
|
||||
if ( spkr_hph_single_be_native_concurrency && (new_backend_idx == DEFAULT_CODEC_BACKEND)) {
|
||||
list_for_each(node, &adev->usecase_list) {
|
||||
usecase = node_to_item(node, struct audio_usecase, list);
|
||||
if ((usecase->type != PCM_CAPTURE) && (usecase != uc_info)) {
|
||||
usecase_backend_idx = platform_get_backend_index(usecase->out_snd_device);
|
||||
if (((usecase_backend_idx == HEADPHONE_BACKEND) ||
|
||||
(usecase_backend_idx == HEADPHONE_44_1_BACKEND)) &&
|
||||
((usecase->stream.out->sample_rate % OUTPUT_SAMPLING_RATE_44100) == 0)) {
|
||||
disable_audio_route(adev, usecase);
|
||||
disable_snd_device(adev, usecase->out_snd_device);
|
||||
usecase->stream.out->sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
|
||||
enable_audio_route(adev, usecase);
|
||||
enable_snd_device(adev, usecase->out_snd_device);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* - Enable ASRC mode for incoming mix path use case(Headphone backend)if Headphone
|
||||
* 44.1 or Native DSD backends are enabled for any of current use case.
|
||||
|
@ -2968,6 +2998,7 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id)
|
|||
/* Enable new sound devices */
|
||||
if (out_snd_device != SND_DEVICE_NONE) {
|
||||
check_usecases_codec_backend(adev, usecase, out_snd_device);
|
||||
check_and_configure_headphone(adev, usecase, out_snd_device);
|
||||
if (platform_check_codec_asrc_support(adev->platform))
|
||||
check_and_set_asrc_mode(adev, usecase, out_snd_device);
|
||||
enable_snd_device(adev, out_snd_device);
|
||||
|
|
|
@ -282,6 +282,7 @@ typedef struct codec_backend_cfg {
|
|||
|
||||
static native_audio_prop na_props = {0, 0, NATIVE_AUDIO_MODE_INVALID};
|
||||
static bool supports_true_32_bit = false;
|
||||
static bool spkr_hph_single_be_native_concurrency = false;
|
||||
|
||||
static int max_be_dai_names = 0;
|
||||
static const struct be_dai_name_struct *be_dai_name_table;
|
||||
|
@ -5159,6 +5160,27 @@ int platform_get_native_support()
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool platform_get_spkr_hph_single_be_native_concurrency_flag()
|
||||
{
|
||||
return spkr_hph_single_be_native_concurrency;
|
||||
}
|
||||
|
||||
void spkr_hph_single_be_native_concurrency_params(struct str_parms *parms,
|
||||
char *value, int len)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = str_parms_get_str(parms, AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY,
|
||||
value, len);
|
||||
if (ret >= 0) {
|
||||
if (value && !strncmp(value, "true", sizeof("true")))
|
||||
spkr_hph_single_be_native_concurrency = true;
|
||||
else
|
||||
spkr_hph_single_be_native_concurrency = false;
|
||||
str_parms_del(parms, AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY);
|
||||
}
|
||||
}
|
||||
|
||||
void native_audio_get_params(struct str_parms *query,
|
||||
struct str_parms *reply,
|
||||
char *value, int len)
|
||||
|
@ -8427,6 +8449,7 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
|
|||
|
||||
/* handle audio calibration parameters */
|
||||
set_audiocal(platform, parms, value, len);
|
||||
spkr_hph_single_be_native_concurrency_params(parms, value, len);
|
||||
native_audio_set_params(platform, parms, value, len);
|
||||
audio_extn_spkr_prot_set_parameters(parms, value, len);
|
||||
audio_extn_usb_set_sidetone_gain(parms, value, len);
|
||||
|
|
|
@ -370,6 +370,8 @@ enum {
|
|||
|
||||
#define AUDIO_PARAMETER_KEY_TRUE_32_BIT "true_32_bit"
|
||||
|
||||
#define AUDIO_PARAMETER_SPKR_HPH_SINGLE_BE_NATIVE_CONCURRENCY "spkr_hph_single_be_native_concurrency"
|
||||
|
||||
#define AUDIO_MAX_DSP_CHANNELS 32
|
||||
|
||||
#define ALL_SESSION_VSID 0xFFFFFFFF
|
||||
|
|
|
@ -334,6 +334,7 @@ int platform_get_backend_index(snd_device_t snd_device);
|
|||
int platform_get_ext_disp_type(void *platform);
|
||||
void platform_invalidate_hdmi_config(void *platform);
|
||||
void platform_invalidate_backend_config(void * platform,snd_device_t snd_device);
|
||||
bool platform_get_spkr_hph_single_be_native_concurrency_flag();
|
||||
|
||||
#ifdef INSTANCE_ID_ENABLED
|
||||
void platform_make_cal_cfg(acdb_audio_cal_cfg_t* cal, int acdb_dev_id,
|
||||
|
|
Loading…
Reference in New Issue