From 9fac50a85867206bf0dc7a84ce940a8dcb81ff3d Mon Sep 17 00:00:00 2001 From: liaohj Date: Wed, 21 Oct 2020 14:21:16 +0800 Subject: [PATCH] usb audio: Let the usb sound card index from 1 Prop from (CR) If we have usb digital headphone pulled in during bootup. It will occupy index 0. primary sound card can only use index 1. But in our most audio code, We assume the primary sound card is 0. This will cause no sound issue when we use primary sound card to playback and record. Change-Id: If6635c4b7adef0925af8145d4b728f3cc481b9ad Signed-off-by: liaohj Reviewed-on: https://gerrit.mot.com/1780715 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yuesheng Huang Submit-Approved: Jira Key --- include/sound/initval.h | 1 + sound/usb/card.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/sound/initval.h b/include/sound/initval.h index 3ddae2b4177e..46c35c069d56 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -22,6 +22,7 @@ #define SNDRV_DEFAULT_PTR1 SNDRV_DEFAULT_STR1 #define SNDRV_DEFAULT_IDX { [0 ... (SNDRV_CARDS-1)] = -1 } +#define SNDRV_DEFAULT_IDX_N { 1, [1 ... (SNDRV_CARDS-1)] = -1 } #define SNDRV_DEFAULT_STR { [0 ... (SNDRV_CARDS-1)] = NULL } #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 } #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 } diff --git a/sound/usb/card.c b/sound/usb/card.c index e5a2fee4f38f..684dae3a28a4 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -62,7 +62,7 @@ MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Generic,USB Audio}}"); -static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX_N; /* Index 0-MAX */ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ /* Vendor/product IDs for this card */