From 8c59f59776e24dc04f8b9cfc03646682b778291e Mon Sep 17 00:00:00 2001 From: Deepa G K Date: Wed, 3 Apr 2024 09:59:27 +0000 Subject: [PATCH] Fallback to Dummy when no onboard PCH card When the PCH card is not card 0 and device 0, fallback to dummy card to avoid sink not ready error at the framework. This ensures that the dummy card is available and helps in --- primary/audio_hw.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/primary/audio_hw.c b/primary/audio_hw.c index b5ae1ad..d8a38d2 100755 --- a/primary/audio_hw.c +++ b/primary/audio_hw.c @@ -1082,11 +1082,14 @@ static int adev_open_output_stream(struct audio_hw_device *dev, } } - ALOGI("PCM playback card selected = %d, \n", adev->card); - - if (!params) - return -ENOSYS; + if (!params) { + adev->card = get_pcm_card("Dummy"); + params = pcm_params_get(adev->card, PCM_DEVICE, PCM_OUT); + if (!params) + return -ENOSYS; + } + ALOGI("PCM playback card selected = %d, \n", adev->card); out = (struct stream_out *)calloc(1, sizeof(struct stream_out)); if (!out) { free(params); @@ -1353,7 +1356,10 @@ static int adev_open_input_stream(struct audio_hw_device *dev, } } } - + if(!params) { + adev->cardc = get_pcm_card("Dummy"); + params = pcm_params_get(adev->cardc, PCM_DEVICE, PCM_IN); + } ALOGI("PCM capture card selected = %d, \n", adev->cardc); in = (struct stream_in *)calloc(1, sizeof(struct stream_in));