From 102f3045e32d043519edf9751b38ddb77eea8125 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 completes the framework query for sink devices Tests done: Audio playback over USB Audio playback on HDMI Signed-off-by: Deepa G K Tracked-On: OAM-116957 Tracked-On: OAM-116990 --- primary/audio_hw.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/primary/audio_hw.c b/primary/audio_hw.c index b5ae1ad..9363fef 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,12 @@ 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); + if (!params) + return -ENOSYS; + } ALOGI("PCM capture card selected = %d, \n", adev->cardc); in = (struct stream_in *)calloc(1, sizeof(struct stream_in));