From 0d73a54fe285566ef66e56ba440f84454964f68b Mon Sep 17 00:00:00 2001 From: niuli1 Date: Wed, 22 Nov 2017 11:04:56 +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: Ic6cc79fc475e4e9978535f9557f05cef8c65d1f1 Signed-off-by: niuli1 Reviewed-on: https://gerrit.mot.com/1093502 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Dandan Du Reviewed-by: Guobin Zhang Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1516459 Reviewed-by: Yuesheng Huang (cherry picked from commit 780fde85cfdaaeb836c93b52cfd98210e5a98c30) Reviewed-on: https://gerrit.mot.com/1586901 Reviewed-by: Xiangpo Zhao --- 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 ac62c67e6f42..43d614d49d8c 100644 --- a/include/sound/initval.h +++ b/include/sound/initval.h @@ -36,6 +36,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 bce053bfe1d9..7d563dbc97b0 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -75,7 +75,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 */