HAL: Add new device for voice headset

3-pole headphones not working for voice
usecase due to different backend added
for headset.

add new device for headset to differentiate
from headphones and update mixer path
accordingly.

Change-Id: I29d58e29637534e7d2b6098c5cb89ca6f3b987db
This commit is contained in:
Samyak Jain 2019-04-30 11:58:43 +05:30 committed by Gerrit - the friendly Code Review server
parent c96d28ea85
commit fd24f1e1a0
4 changed files with 16 additions and 5 deletions

View File

@ -142,6 +142,7 @@ static audio_devices_t get_audio_device(snd_device_t snd_device)
{SND_DEVICE_OUT_VOICE_HEADPHONES, AUDIO_DEVICE_OUT_WIRED_HEADPHONE},
{SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADPHONE}
{SND_DEVICE_OUT_VOICE_HEADSET, AUDIO_DEVICE_OUT_WIRED_HEADSET},
};
audio_devices_t aud_device = AUDIO_DEVICE_NONE;

View File

@ -499,6 +499,7 @@ static const char * const device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA] = "wsa-voice-speaker-2",
[SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = "voice-speaker-2-vbat",
[SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones",
[SND_DEVICE_OUT_VOICE_HEADSET] = "voice-headset",
[SND_DEVICE_OUT_VOICE_LINE] = "voice-line",
[SND_DEVICE_OUT_HDMI] = "hdmi",
[SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi",
@ -758,6 +759,7 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = 14,
[SND_DEVICE_OUT_VOICE_HAC_HANDSET] = 53,
[SND_DEVICE_OUT_VOICE_HEADPHONES] = 10,
[SND_DEVICE_OUT_VOICE_HEADSET] = 10,
[SND_DEVICE_OUT_VOICE_LINE] = 10,
[SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_HEADPHONES] = 10,
[SND_DEVICE_OUT_VOICE_SPEAKER_AND_VOICE_ANC_HEADSET] = 10,
@ -978,6 +980,7 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_HEADPHONES)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_HEADSET)},
{TO_NAME_INDEX(SND_DEVICE_OUT_VOICE_LINE)},
{TO_NAME_INDEX(SND_DEVICE_OUT_HDMI)},
{TO_NAME_INDEX(SND_DEVICE_OUT_SPEAKER_AND_HDMI)},
@ -2084,6 +2087,7 @@ static void set_platform_defaults(struct platform_data * my_data)
hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT] = strdup("SLIMBUS_0_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_HEADPHONES] = strdup("SLIMBUS_6_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_HEADSET] = strdup("SLIMBUS_6_RX");
hw_interface_table[SND_DEVICE_OUT_VOICE_MUSIC_TX] = strdup("VOICE_PLAYBACK_TX");
hw_interface_table[SND_DEVICE_OUT_VOICE_LINE] = strdup("SLIMBUS_6_RX");
hw_interface_table[SND_DEVICE_OUT_HDMI] = strdup("HDMI");
@ -3462,14 +3466,14 @@ acdb_init_fail:
strdup("SLIM_6_RX SampleRate");
}
//TODO: enable CONCURRENT_CAPTURE_ENABLED flag only if separate backend is defined
//NOTE: enable CONCURRENT_CAPTURE_ENABLED flag only if separate backend is defined
//for headset-mic. This is to capture separate data from headset-mic and handset-mic.
if(audio_extn_is_concurrent_capture_enabled())
if(audio_extn_is_concurrent_capture_enabled()) {
my_data->current_backend_cfg[HEADSET_TX_BACKEND].bitwidth_mixer_ctl =
strdup("SLIM_1_TX Format");
else
strdup("SLIM_1_TX Format");
my_data->current_backend_cfg[HEADSET_TX_BACKEND].samplerate_mixer_ctl =
strdup("SLIM_1_TX SampleRate");
strdup("SLIM_1_TX SampleRate");
}
}
my_data->current_backend_cfg[USB_AUDIO_TX_BACKEND].bitwidth_mixer_ctl =
@ -5390,6 +5394,10 @@ snd_device_t platform_get_output_snd_device(void *platform, struct stream_out *o
snd_device = SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET;
else
snd_device = SND_DEVICE_OUT_VOICE_ANC_HEADSET;
} else if (audio_extn_is_concurrent_capture_enabled() &&
(devices & AUDIO_DEVICE_OUT_WIRED_HEADSET)) {
//Separate backend is added for headset-mic as part of concurrent capture
snd_device = SND_DEVICE_OUT_VOICE_HEADSET;
} else {
snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES;
}

View File

@ -106,6 +106,7 @@ enum {
SND_DEVICE_OUT_VOICE_SPEAKER_2,
SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT,
SND_DEVICE_OUT_VOICE_HEADPHONES,
SND_DEVICE_OUT_VOICE_HEADSET,
SND_DEVICE_OUT_VOICE_LINE,
SND_DEVICE_OUT_HDMI,
SND_DEVICE_OUT_SPEAKER_AND_HDMI,

View File

@ -73,6 +73,7 @@ static bool voice_is_sidetone_device(snd_device_t out_device,
strlcpy(mixer_path, "sidetone-handset", MIXER_PATH_MAX_LENGTH);
break;
case SND_DEVICE_OUT_VOICE_HEADPHONES:
case SND_DEVICE_OUT_VOICE_HEADSET:
case SND_DEVICE_OUT_VOICE_ANC_HEADSET:
case SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET:
is_sidetone_dev = true;