aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-09-03 16:38:52 -0400
committerTakashi Iwai <tiwai@suse.de>2010-09-03 16:38:52 -0400
commit68885a3ff38ed51fa02f241feb405c9922a90ee0 (patch)
tree2fc626df39d5e0e1f6b065238141f7d49187c737 /sound
parent7b28079b3284ccb15ad4f003fb7073890600d0c1 (diff)
parenta2acad8298a42b7be684a32fafaf83332bba9c2b (diff)
Merge branch 'fix/misc' into topic/misc
Diffstat (limited to 'sound')
-rw-r--r--sound/core/pcm.c6
-rw-r--r--sound/oss/sound_timer.c2
-rw-r--r--sound/pci/asihpi/hpi6205.c7
-rw-r--r--sound/pci/hda/hda_codec.c33
-rw-r--r--sound/pci/hda/hda_codec.h2
-rw-r--r--sound/pci/hda/hda_eld.c4
-rw-r--r--sound/pci/hda/patch_conexant.c2
-rw-r--r--sound/pci/hda/patch_hdmi.c21
-rw-r--r--sound/pci/hda/patch_intelhdmi.c8
-rw-r--r--sound/pci/hda/patch_nvhdmi.c8
-rw-r--r--sound/pci/hda/patch_realtek.c177
-rw-r--r--sound/pci/hda/patch_sigmatel.c15
-rw-r--r--sound/pci/intel8x0.c6
-rw-r--r--sound/soc/codecs/wm8776.c7
-rw-r--r--sound/soc/imx/imx-ssi.c3
-rw-r--r--sound/soc/soc-core.c2
-rw-r--r--sound/usb/card.c17
-rw-r--r--sound/usb/clock.c3
-rw-r--r--sound/usb/endpoint.c11
-rw-r--r--sound/usb/format.c22
-rw-r--r--sound/usb/mixer.c10
-rw-r--r--sound/usb/pcm.c3
22 files changed, 247 insertions, 122 deletions
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index cbe815dfbdc..204af48c5cc 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -203,10 +203,16 @@ static char *snd_pcm_format_names[] = {
203 FORMAT(S18_3BE), 203 FORMAT(S18_3BE),
204 FORMAT(U18_3LE), 204 FORMAT(U18_3LE),
205 FORMAT(U18_3BE), 205 FORMAT(U18_3BE),
206 FORMAT(G723_24),
207 FORMAT(G723_24_1B),
208 FORMAT(G723_40),
209 FORMAT(G723_40_1B),
206}; 210};
207 211
208const char *snd_pcm_format_name(snd_pcm_format_t format) 212const char *snd_pcm_format_name(snd_pcm_format_t format)
209{ 213{
214 if (format >= ARRAY_SIZE(snd_pcm_format_names))
215 return "Unknown";
210 return snd_pcm_format_names[format]; 216 return snd_pcm_format_names[format];
211} 217}
212EXPORT_SYMBOL_GPL(snd_pcm_format_name); 218EXPORT_SYMBOL_GPL(snd_pcm_format_name);
diff --git a/sound/oss/sound_timer.c b/sound/oss/sound_timer.c
index f0f0c19fbff..48cda6c4c25 100644
--- a/sound/oss/sound_timer.c
+++ b/sound/oss/sound_timer.c
@@ -26,7 +26,7 @@ static unsigned long prev_event_time;
26static volatile unsigned long usecs_per_tmr; /* Length of the current interval */ 26static volatile unsigned long usecs_per_tmr; /* Length of the current interval */
27 27
28static struct sound_lowlev_timer *tmr; 28static struct sound_lowlev_timer *tmr;
29static spinlock_t lock; 29static DEFINE_SPINLOCK(lock);
30 30
31static unsigned long tmr2ticks(int tmr_value) 31static unsigned long tmr2ticks(int tmr_value)
32{ 32{
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index 3b441344822..22c5fc62553 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -941,8 +941,7 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao,
941 941
942} 942}
943 943
944static u32 outstream_get_space_available(struct hpi_hostbuffer_status 944static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status)
945 *status)
946{ 945{
947 return status->size_in_bytes - (status->host_index - 946 return status->size_in_bytes - (status->host_index -
948 status->dSP_index); 947 status->dSP_index);
@@ -987,6 +986,10 @@ static void outstream_write(struct hpi_adapter_obj *pao,
987 /* write it */ 986 /* write it */
988 phm->function = HPI_OSTREAM_WRITE; 987 phm->function = HPI_OSTREAM_WRITE;
989 hw_message(pao, phm, phr); 988 hw_message(pao, phm, phr);
989
990 if (phr->error)
991 return;
992
990 /* update status information that the DSP would typically 993 /* update status information that the DSP would typically
991 * update (and will update next time the DSP 994 * update (and will update next time the DSP
992 * buffer update task reads data from the host BBM buffer) 995 * buffer update task reads data from the host BBM buffer)
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index dd8fb86c842..3827092cc1d 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -589,6 +589,7 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
589 bus->ops = temp->ops; 589 bus->ops = temp->ops;
590 590
591 mutex_init(&bus->cmd_mutex); 591 mutex_init(&bus->cmd_mutex);
592 mutex_init(&bus->prepare_mutex);
592 INIT_LIST_HEAD(&bus->codec_list); 593 INIT_LIST_HEAD(&bus->codec_list);
593 594
594 snprintf(bus->workq_name, sizeof(bus->workq_name), 595 snprintf(bus->workq_name, sizeof(bus->workq_name),
@@ -1068,7 +1069,6 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1068 codec->addr = codec_addr; 1069 codec->addr = codec_addr;
1069 mutex_init(&codec->spdif_mutex); 1070 mutex_init(&codec->spdif_mutex);
1070 mutex_init(&codec->control_mutex); 1071 mutex_init(&codec->control_mutex);
1071 mutex_init(&codec->prepare_mutex);
1072 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); 1072 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));
1073 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); 1073 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));
1074 snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32); 1074 snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 32);
@@ -1213,6 +1213,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
1213 u32 stream_tag, 1213 u32 stream_tag,
1214 int channel_id, int format) 1214 int channel_id, int format)
1215{ 1215{
1216 struct hda_codec *c;
1216 struct hda_cvt_setup *p; 1217 struct hda_cvt_setup *p;
1217 unsigned int oldval, newval; 1218 unsigned int oldval, newval;
1218 int i; 1219 int i;
@@ -1253,10 +1254,12 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
1253 p->dirty = 0; 1254 p->dirty = 0;
1254 1255
1255 /* make other inactive cvts with the same stream-tag dirty */ 1256 /* make other inactive cvts with the same stream-tag dirty */
1256 for (i = 0; i < codec->cvt_setups.used; i++) { 1257 list_for_each_entry(c, &codec->bus->codec_list, list) {
1257 p = snd_array_elem(&codec->cvt_setups, i); 1258 for (i = 0; i < c->cvt_setups.used; i++) {
1258 if (!p->active && p->stream_tag == stream_tag) 1259 p = snd_array_elem(&c->cvt_setups, i);
1259 p->dirty = 1; 1260 if (!p->active && p->stream_tag == stream_tag)
1261 p->dirty = 1;
1262 }
1260 } 1263 }
1261} 1264}
1262EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream); 1265EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);
@@ -1306,12 +1309,16 @@ static void really_cleanup_stream(struct hda_codec *codec,
1306/* clean up the all conflicting obsolete streams */ 1309/* clean up the all conflicting obsolete streams */
1307static void purify_inactive_streams(struct hda_codec *codec) 1310static void purify_inactive_streams(struct hda_codec *codec)
1308{ 1311{
1312 struct hda_codec *c;
1309 int i; 1313 int i;
1310 1314
1311 for (i = 0; i < codec->cvt_setups.used; i++) { 1315 list_for_each_entry(c, &codec->bus->codec_list, list) {
1312 struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i); 1316 for (i = 0; i < c->cvt_setups.used; i++) {
1313 if (p->dirty) 1317 struct hda_cvt_setup *p;
1314 really_cleanup_stream(codec, p); 1318 p = snd_array_elem(&c->cvt_setups, i);
1319 if (p->dirty)
1320 really_cleanup_stream(c, p);
1321 }
1315 } 1322 }
1316} 1323}
1317 1324
@@ -3502,11 +3509,11 @@ int snd_hda_codec_prepare(struct hda_codec *codec,
3502 struct snd_pcm_substream *substream) 3509 struct snd_pcm_substream *substream)
3503{ 3510{
3504 int ret; 3511 int ret;
3505 mutex_lock(&codec->prepare_mutex); 3512 mutex_lock(&codec->bus->prepare_mutex);
3506 ret = hinfo->ops.prepare(hinfo, codec, stream, format, substream); 3513 ret = hinfo->ops.prepare(hinfo, codec, stream, format, substream);
3507 if (ret >= 0) 3514 if (ret >= 0)
3508 purify_inactive_streams(codec); 3515 purify_inactive_streams(codec);
3509 mutex_unlock(&codec->prepare_mutex); 3516 mutex_unlock(&codec->bus->prepare_mutex);
3510 return ret; 3517 return ret;
3511} 3518}
3512EXPORT_SYMBOL_HDA(snd_hda_codec_prepare); 3519EXPORT_SYMBOL_HDA(snd_hda_codec_prepare);
@@ -3515,9 +3522,9 @@ void snd_hda_codec_cleanup(struct hda_codec *codec,
3515 struct hda_pcm_stream *hinfo, 3522 struct hda_pcm_stream *hinfo,
3516 struct snd_pcm_substream *substream) 3523 struct snd_pcm_substream *substream)
3517{ 3524{
3518 mutex_lock(&codec->prepare_mutex); 3525 mutex_lock(&codec->bus->prepare_mutex);
3519 hinfo->ops.cleanup(hinfo, codec, substream); 3526 hinfo->ops.cleanup(hinfo, codec, substream);
3520 mutex_unlock(&codec->prepare_mutex); 3527 mutex_unlock(&codec->bus->prepare_mutex);
3521} 3528}
3522EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup); 3529EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup);
3523 3530
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 4303353feda..62c70224010 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -648,6 +648,7 @@ struct hda_bus {
648 struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; 648 struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1];
649 649
650 struct mutex cmd_mutex; 650 struct mutex cmd_mutex;
651 struct mutex prepare_mutex;
651 652
652 /* unsolicited event queue */ 653 /* unsolicited event queue */
653 struct hda_bus_unsolicited *unsol; 654 struct hda_bus_unsolicited *unsol;
@@ -826,7 +827,6 @@ struct hda_codec {
826 827
827 struct mutex spdif_mutex; 828 struct mutex spdif_mutex;
828 struct mutex control_mutex; 829 struct mutex control_mutex;
829 struct mutex prepare_mutex;
830 unsigned int spdif_status; /* IEC958 status bits */ 830 unsigned int spdif_status; /* IEC958 status bits */
831 unsigned short spdif_ctls; /* SPDIF control bits */ 831 unsigned short spdif_ctls; /* SPDIF control bits */
832 unsigned int spdif_in_enable; /* SPDIF input enable? */ 832 unsigned int spdif_in_enable; /* SPDIF input enable? */
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 803b298f741..26c3ade7358 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -596,6 +596,8 @@ void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
596} 596}
597EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free); 597EXPORT_SYMBOL_HDA(snd_hda_eld_proc_free);
598 598
599#endif /* CONFIG_PROC_FS */
600
599/* update PCM info based on ELD */ 601/* update PCM info based on ELD */
600void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm, 602void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
601 struct hda_pcm_stream *codec_pars) 603 struct hda_pcm_stream *codec_pars)
@@ -644,5 +646,3 @@ void hdmi_eld_update_pcm_info(struct hdmi_eld *eld, struct hda_pcm_stream *pcm,
644 pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps); 646 pcm->maxbps = min(pcm->maxbps, codec_pars->maxbps);
645} 647}
646EXPORT_SYMBOL_HDA(hdmi_eld_update_pcm_info); 648EXPORT_SYMBOL_HDA(hdmi_eld_update_pcm_info);
647
648#endif /* CONFIG_PROC_FS */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 31b5d9eeba6..5cdb80edbd7 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -3049,6 +3049,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3049 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell", 3049 SND_PCI_QUIRK(0x1028, 0x02f5, "Dell",
3050 CXT5066_DELL_LAPTOP), 3050 CXT5066_DELL_LAPTOP),
3051 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5), 3051 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT5066_OLPC_XO_1_5),
3052 SND_PCI_QUIRK(0x1028, 0x02d8, "Dell Vostro", CXT5066_DELL_VOSTO),
3052 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), 3053 SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO),
3053 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), 3054 SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
3054 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), 3055 SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5),
@@ -3058,6 +3059,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
3058 SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD), 3059 SND_PCI_QUIRK(0x17aa, 0x21b4, "Thinkpad Edge", CXT5066_IDEAPAD),
3059 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD), 3060 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo Thinkpad", CXT5066_THINKPAD),
3060 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD), 3061 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo G series", CXT5066_IDEAPAD),
3062 SND_PCI_QUIRK(0x17aa, 0x390a, "Lenovo S10-3t", CXT5066_IDEAPAD),
3061 SND_PCI_QUIRK(0x17aa, 0x3938, "Lenovo G series (AMD)", CXT5066_IDEAPAD), 3063 SND_PCI_QUIRK(0x17aa, 0x3938, "Lenovo G series (AMD)", CXT5066_IDEAPAD),
3062 SND_PCI_QUIRK(0x17aa, 0x3a0d, "ideapad", CXT5066_IDEAPAD), 3064 SND_PCI_QUIRK(0x17aa, 0x3a0d, "ideapad", CXT5066_IDEAPAD),
3063 {} 3065 {}
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 2bc0f07cf33..afd6022a96a 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -707,8 +707,6 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid,
707 u32 stream_tag, int format) 707 u32 stream_tag, int format)
708{ 708{
709 struct hdmi_spec *spec = codec->spec; 709 struct hdmi_spec *spec = codec->spec;
710 int tag;
711 int fmt;
712 int pinctl; 710 int pinctl;
713 int new_pinctl = 0; 711 int new_pinctl = 0;
714 int i; 712 int i;
@@ -745,24 +743,7 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t nid,
745 return -EINVAL; 743 return -EINVAL;
746 } 744 }
747 745
748 tag = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0) >> 4; 746 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format);
749 fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0);
750
751 snd_printdd("hdmi_setup_stream: "
752 "NID=0x%x, %sstream=0x%x, %sformat=0x%x\n",
753 nid,
754 tag == stream_tag ? "" : "new-",
755 stream_tag,
756 fmt == format ? "" : "new-",
757 format);
758
759 if (tag != stream_tag)
760 snd_hda_codec_write(codec, nid, 0,
761 AC_VERB_SET_CHANNEL_STREAMID,
762 stream_tag << 4);
763 if (fmt != format)
764 snd_hda_codec_write(codec, nid, 0,
765 AC_VERB_SET_STREAM_FORMAT, format);
766 return 0; 747 return 0;
767} 748}
768 749
diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
index d382d3c81c0..36a9b83a617 100644
--- a/sound/pci/hda/patch_intelhdmi.c
+++ b/sound/pci/hda/patch_intelhdmi.c
@@ -69,20 +69,12 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
69 return hdmi_setup_stream(codec, hinfo->nid, stream_tag, format); 69 return hdmi_setup_stream(codec, hinfo->nid, stream_tag, format);
70} 70}
71 71
72static int intel_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
73 struct hda_codec *codec,
74 struct snd_pcm_substream *substream)
75{
76 return 0;
77}
78
79static struct hda_pcm_stream intel_hdmi_pcm_playback = { 72static struct hda_pcm_stream intel_hdmi_pcm_playback = {
80 .substreams = 1, 73 .substreams = 1,
81 .channels_min = 2, 74 .channels_min = 2,
82 .ops = { 75 .ops = {
83 .open = hdmi_pcm_open, 76 .open = hdmi_pcm_open,
84 .prepare = intel_hdmi_playback_pcm_prepare, 77 .prepare = intel_hdmi_playback_pcm_prepare,
85 .cleanup = intel_hdmi_playback_pcm_cleanup,
86 }, 78 },
87}; 79};
88 80
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index f636870dc71..69b950d527c 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -326,13 +326,6 @@ static int nvhdmi_dig_playback_pcm_prepare_8ch(struct hda_pcm_stream *hinfo,
326 return 0; 326 return 0;
327} 327}
328 328
329static int nvhdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
330 struct hda_codec *codec,
331 struct snd_pcm_substream *substream)
332{
333 return 0;
334}
335
336static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo, 329static int nvhdmi_dig_playback_pcm_prepare_2ch(struct hda_pcm_stream *hinfo,
337 struct hda_codec *codec, 330 struct hda_codec *codec,
338 unsigned int stream_tag, 331 unsigned int stream_tag,
@@ -350,7 +343,6 @@ static struct hda_pcm_stream nvhdmi_pcm_digital_playback_8ch_89 = {
350 .ops = { 343 .ops = {
351 .open = hdmi_pcm_open, 344 .open = hdmi_pcm_open,
352 .prepare = nvhdmi_dig_playback_pcm_prepare_8ch_89, 345 .prepare = nvhdmi_dig_playback_pcm_prepare_8ch_89,
353 .cleanup = nvhdmi_playback_pcm_cleanup,
354 }, 346 },
355}; 347};
356 348
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 2cd1ae809e4..627bf996336 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -14467,6 +14467,7 @@ static const struct alc_fixup alc269_fixups[] = {
14467 14467
14468static struct snd_pci_quirk alc269_fixup_tbl[] = { 14468static struct snd_pci_quirk alc269_fixup_tbl[] = {
14469 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14469 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14470 SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14470 {} 14471 {}
14471}; 14472};
14472 14473
@@ -19030,6 +19031,7 @@ static int patch_alc888(struct hda_codec *codec)
19030/* 19031/*
19031 * ALC680 support 19032 * ALC680 support
19032 */ 19033 */
19034#define ALC680_DIGIN_NID ALC880_DIGIN_NID
19033#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID 19035#define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19034#define alc680_modes alc260_modes 19036#define alc680_modes alc260_modes
19035 19037
@@ -19044,23 +19046,93 @@ static hda_nid_t alc680_adc_nids[3] = {
19044 0x07, 0x08, 0x09 19046 0x07, 0x08, 0x09
19045}; 19047};
19046 19048
19049/*
19050 * Analog capture ADC cgange
19051 */
19052static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19053 struct hda_codec *codec,
19054 unsigned int stream_tag,
19055 unsigned int format,
19056 struct snd_pcm_substream *substream)
19057{
19058 struct alc_spec *spec = codec->spec;
19059 struct auto_pin_cfg *cfg = &spec->autocfg;
19060 unsigned int pre_mic, pre_line;
19061
19062 pre_mic = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19063 pre_line = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_LINE]);
19064
19065 spec->cur_adc_stream_tag = stream_tag;
19066 spec->cur_adc_format = format;
19067
19068 if (pre_mic || pre_line) {
19069 if (pre_mic)
19070 snd_hda_codec_setup_stream(codec, 0x08, stream_tag, 0,
19071 format);
19072 else
19073 snd_hda_codec_setup_stream(codec, 0x09, stream_tag, 0,
19074 format);
19075 } else
19076 snd_hda_codec_setup_stream(codec, 0x07, stream_tag, 0, format);
19077 return 0;
19078}
19079
19080static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19081 struct hda_codec *codec,
19082 struct snd_pcm_substream *substream)
19083{
19084 snd_hda_codec_cleanup_stream(codec, 0x07);
19085 snd_hda_codec_cleanup_stream(codec, 0x08);
19086 snd_hda_codec_cleanup_stream(codec, 0x09);
19087 return 0;
19088}
19089
19090static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19091 .substreams = 1, /* can be overridden */
19092 .channels_min = 2,
19093 .channels_max = 2,
19094 /* NID is set in alc_build_pcms */
19095 .ops = {
19096 .prepare = alc680_capture_pcm_prepare,
19097 .cleanup = alc680_capture_pcm_cleanup
19098 },
19099};
19100
19047static struct snd_kcontrol_new alc680_base_mixer[] = { 19101static struct snd_kcontrol_new alc680_base_mixer[] = {
19048 /* output mixer control */ 19102 /* output mixer control */
19049 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), 19103 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19050 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 19104 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19051 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT), 19105 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19052 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT), 19106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19107 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 19108 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19109 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19054 { } 19110 { }
19055}; 19111};
19056 19112
19057static struct snd_kcontrol_new alc680_capture_mixer[] = { 19113static struct hda_bind_ctls alc680_bind_cap_vol = {
19058 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 19114 .ops = &snd_hda_bind_vol,
19059 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 19115 .values = {
19060 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), 19116 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19061 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), 19117 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19062 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), 19118 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19063 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), 19119 0
19120 },
19121};
19122
19123static struct hda_bind_ctls alc680_bind_cap_switch = {
19124 .ops = &snd_hda_bind_sw,
19125 .values = {
19126 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19127 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19128 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19129 0
19130 },
19131};
19132
19133static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19134 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19135 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19064 { } /* end */ 19136 { } /* end */
19065}; 19137};
19066 19138
@@ -19068,25 +19140,73 @@ static struct snd_kcontrol_new alc680_capture_mixer[] = {
19068 * generic initialization of ADC, input mixers and output mixers 19140 * generic initialization of ADC, input mixers and output mixers
19069 */ 19141 */
19070static struct hda_verb alc680_init_verbs[] = { 19142static struct hda_verb alc680_init_verbs[] = {
19071 /* Unmute DAC0-1 and set vol = 0 */ 19143 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19072 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19144 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19073 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 19145 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19074 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
19075 19146
19076 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19147 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19077 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 19148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19078 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 19149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 19150 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19080 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 19151 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19152 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19081 19153
19082 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19083 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19155 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19156 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19157 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19086 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 19158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19159
19160 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19161 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19162
19087 { } 19163 { }
19088}; 19164};
19089 19165
19166/* toggle speaker-output according to the hp-jack state */
19167static void alc680_base_setup(struct hda_codec *codec)
19168{
19169 struct alc_spec *spec = codec->spec;
19170
19171 spec->autocfg.hp_pins[0] = 0x16;
19172 spec->autocfg.speaker_pins[0] = 0x14;
19173 spec->autocfg.speaker_pins[1] = 0x15;
19174 spec->autocfg.input_pins[AUTO_PIN_MIC] = 0x18;
19175 spec->autocfg.input_pins[AUTO_PIN_LINE] = 0x19;
19176}
19177
19178static void alc680_rec_autoswitch(struct hda_codec *codec)
19179{
19180 struct alc_spec *spec = codec->spec;
19181 struct auto_pin_cfg *cfg = &spec->autocfg;
19182 unsigned int present;
19183 hda_nid_t new_adc;
19184
19185 present = snd_hda_jack_detect(codec, cfg->input_pins[AUTO_PIN_MIC]);
19186
19187 new_adc = present ? 0x8 : 0x7;
19188 __snd_hda_codec_cleanup_stream(codec, !present ? 0x8 : 0x7, 1);
19189 snd_hda_codec_setup_stream(codec, new_adc,
19190 spec->cur_adc_stream_tag, 0,
19191 spec->cur_adc_format);
19192
19193}
19194
19195static void alc680_unsol_event(struct hda_codec *codec,
19196 unsigned int res)
19197{
19198 if ((res >> 26) == ALC880_HP_EVENT)
19199 alc_automute_amp(codec);
19200 if ((res >> 26) == ALC880_MIC_EVENT)
19201 alc680_rec_autoswitch(codec);
19202}
19203
19204static void alc680_inithook(struct hda_codec *codec)
19205{
19206 alc_automute_amp(codec);
19207 alc680_rec_autoswitch(codec);
19208}
19209
19090/* create input playback/capture controls for the given pin */ 19210/* create input playback/capture controls for the given pin */
19091static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid, 19211static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19092 const char *ctlname, int idx) 19212 const char *ctlname, int idx)
@@ -19197,13 +19317,7 @@ static void alc680_auto_init_hp_out(struct hda_codec *codec)
19197#define alc680_pcm_analog_capture alc880_pcm_analog_capture 19317#define alc680_pcm_analog_capture alc880_pcm_analog_capture
19198#define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture 19318#define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19199#define alc680_pcm_digital_playback alc880_pcm_digital_playback 19319#define alc680_pcm_digital_playback alc880_pcm_digital_playback
19200 19320#define alc680_pcm_digital_capture alc880_pcm_digital_capture
19201static struct hda_input_mux alc680_capture_source = {
19202 .num_items = 1,
19203 .items = {
19204 { "Mic", 0x0 },
19205 },
19206};
19207 19321
19208/* 19322/*
19209 * BIOS auto configuration 19323 * BIOS auto configuration
@@ -19218,6 +19332,7 @@ static int alc680_parse_auto_config(struct hda_codec *codec)
19218 alc680_ignore); 19332 alc680_ignore);
19219 if (err < 0) 19333 if (err < 0)
19220 return err; 19334 return err;
19335
19221 if (!spec->autocfg.line_outs) { 19336 if (!spec->autocfg.line_outs) {
19222 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { 19337 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19223 spec->multiout.max_channels = 2; 19338 spec->multiout.max_channels = 2;
@@ -19239,8 +19354,6 @@ static int alc680_parse_auto_config(struct hda_codec *codec)
19239 add_mixer(spec, spec->kctls.list); 19354 add_mixer(spec, spec->kctls.list);
19240 19355
19241 add_verb(spec, alc680_init_verbs); 19356 add_verb(spec, alc680_init_verbs);
19242 spec->num_mux_defs = 1;
19243 spec->input_mux = &alc680_capture_source;
19244 19357
19245 err = alc_auto_add_mic_boost(codec); 19358 err = alc_auto_add_mic_boost(codec);
19246 if (err < 0) 19359 if (err < 0)
@@ -19279,17 +19392,17 @@ static struct snd_pci_quirk alc680_cfg_tbl[] = {
19279static struct alc_config_preset alc680_presets[] = { 19392static struct alc_config_preset alc680_presets[] = {
19280 [ALC680_BASE] = { 19393 [ALC680_BASE] = {
19281 .mixers = { alc680_base_mixer }, 19394 .mixers = { alc680_base_mixer },
19282 .cap_mixer = alc680_capture_mixer, 19395 .cap_mixer = alc680_master_capture_mixer,
19283 .init_verbs = { alc680_init_verbs }, 19396 .init_verbs = { alc680_init_verbs },
19284 .num_dacs = ARRAY_SIZE(alc680_dac_nids), 19397 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19285 .dac_nids = alc680_dac_nids, 19398 .dac_nids = alc680_dac_nids,
19286 .num_adc_nids = ARRAY_SIZE(alc680_adc_nids),
19287 .adc_nids = alc680_adc_nids,
19288 .hp_nid = 0x04,
19289 .dig_out_nid = ALC680_DIGOUT_NID, 19399 .dig_out_nid = ALC680_DIGOUT_NID,
19290 .num_channel_mode = ARRAY_SIZE(alc680_modes), 19400 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19291 .channel_mode = alc680_modes, 19401 .channel_mode = alc680_modes,
19292 .input_mux = &alc680_capture_source, 19402 .unsol_event = alc680_unsol_event,
19403 .setup = alc680_base_setup,
19404 .init_hook = alc680_inithook,
19405
19293 }, 19406 },
19294}; 19407};
19295 19408
@@ -19333,9 +19446,9 @@ static int patch_alc680(struct hda_codec *codec)
19333 setup_preset(codec, &alc680_presets[board_config]); 19446 setup_preset(codec, &alc680_presets[board_config]);
19334 19447
19335 spec->stream_analog_playback = &alc680_pcm_analog_playback; 19448 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19336 spec->stream_analog_capture = &alc680_pcm_analog_capture; 19449 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19337 spec->stream_analog_alt_capture = &alc680_pcm_analog_alt_capture;
19338 spec->stream_digital_playback = &alc680_pcm_digital_playback; 19450 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19451 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19339 19452
19340 if (!spec->adc_nids) { 19453 if (!spec->adc_nids) {
19341 spec->adc_nids = alc680_adc_nids; 19454 spec->adc_nids = alc680_adc_nids;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f3f861bd1bf..95148e58026 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -6303,6 +6303,21 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
6303 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, 6303 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
6304 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, 6304 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6305 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, 6305 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
6306 { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
6307 { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
6308 { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
6309 { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
6310 { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
6311 { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
6312 { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
6313 { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
6314 { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
6315 { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
6316 { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
6317 { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
6318 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
6319 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
6320 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
6306 {} /* terminator */ 6321 {} /* terminator */
6307}; 6322};
6308 6323
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 6433e65c950..46774924957 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1776,6 +1776,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1776 }, 1776 },
1777 { 1777 {
1778 .subvendor = 0x1014, 1778 .subvendor = 0x1014,
1779 .subdevice = 0x0534,
1780 .name = "ThinkPad X31",
1781 .type = AC97_TUNE_INV_EAPD
1782 },
1783 {
1784 .subvendor = 0x1014,
1779 .subdevice = 0x1f00, 1785 .subdevice = 0x1f00,
1780 .name = "MS-9128", 1786 .name = "MS-9128",
1781 .type = AC97_TUNE_ALC_JACK 1787 .type = AC97_TUNE_ALC_JACK
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 4e212ed62ea..f8154e66152 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -178,13 +178,6 @@ static int wm8776_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
178 case SND_SOC_DAIFMT_LEFT_J: 178 case SND_SOC_DAIFMT_LEFT_J:
179 iface |= 0x0001; 179 iface |= 0x0001;
180 break; 180 break;
181 /* FIXME: CHECK A/B */
182 case SND_SOC_DAIFMT_DSP_A:
183 iface |= 0x0003;
184 break;
185 case SND_SOC_DAIFMT_DSP_B:
186 iface |= 0x0007;
187 break;
188 default: 181 default:
189 return -EINVAL; 182 return -EINVAL;
190 } 183 }
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index a11daa1e905..c81da05a4f1 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -254,6 +254,9 @@ static int imx_ssi_hw_params(struct snd_pcm_substream *substream,
254 dma_data = &ssi->dma_params_rx; 254 dma_data = &ssi->dma_params_rx;
255 } 255 }
256 256
257 if (ssi->flags & IMX_SSI_SYN)
258 reg = SSI_STCCR;
259
257 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data); 260 snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);
258 261
259 sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK; 262 sccr = readl(ssi->base + reg) & ~SSI_STCCR_WL_MASK;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 844ae8221a3..acc91daa1c5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -251,7 +251,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
251 printk(KERN_WARNING 251 printk(KERN_WARNING
252 "ASoC: Failed to create codec register debugfs file\n"); 252 "ASoC: Failed to create codec register debugfs file\n");
253 253
254 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0744, 254 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0644,
255 codec->debugfs_codec_root, 255 codec->debugfs_codec_root,
256 &codec->pop_time); 256 &codec->pop_time);
257 if (!codec->debugfs_pop_time) 257 if (!codec->debugfs_pop_time)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 498a2d8fa4b..4aa4678e0a0 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -216,6 +216,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
216 } 216 }
217 217
218 switch (protocol) { 218 switch (protocol) {
219 default:
220 snd_printdd(KERN_WARNING "unknown interface protocol %#02x, assuming v1\n",
221 protocol);
222 /* fall through */
223
219 case UAC_VERSION_1: { 224 case UAC_VERSION_1: {
220 struct uac1_ac_header_descriptor *h1 = control_header; 225 struct uac1_ac_header_descriptor *h1 = control_header;
221 226
@@ -253,10 +258,6 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
253 258
254 break; 259 break;
255 } 260 }
256
257 default:
258 snd_printk(KERN_ERR "unknown protocol version 0x%02x\n", protocol);
259 return -EINVAL;
260 } 261 }
261 262
262 return 0; 263 return 0;
@@ -480,7 +481,13 @@ static void *snd_usb_audio_probe(struct usb_device *dev,
480 goto __error; 481 goto __error;
481 } 482 }
482 483
483 chip->ctrl_intf = alts; 484 /*
485 * For devices with more than one control interface, we assume the
486 * first contains the audio controls. We might need a more specific
487 * check here in the future.
488 */
489 if (!chip->ctrl_intf)
490 chip->ctrl_intf = alts;
484 491
485 if (err > 0) { 492 if (err > 0) {
486 /* create normal USB audio interfaces */ 493 /* create normal USB audio interfaces */
diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index b853f8df794..7754a103454 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -295,12 +295,11 @@ int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface,
295 295
296 switch (altsd->bInterfaceProtocol) { 296 switch (altsd->bInterfaceProtocol) {
297 case UAC_VERSION_1: 297 case UAC_VERSION_1:
298 default:
298 return set_sample_rate_v1(chip, iface, alts, fmt, rate); 299 return set_sample_rate_v1(chip, iface, alts, fmt, rate);
299 300
300 case UAC_VERSION_2: 301 case UAC_VERSION_2:
301 return set_sample_rate_v2(chip, iface, alts, fmt, rate); 302 return set_sample_rate_v2(chip, iface, alts, fmt, rate);
302 } 303 }
303
304 return -EINVAL;
305} 304}
306 305
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index bb9f938558f..b0ef9f50189 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -275,6 +275,12 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
275 275
276 /* get audio formats */ 276 /* get audio formats */
277 switch (protocol) { 277 switch (protocol) {
278 default:
279 snd_printdd(KERN_WARNING "%d:%u:%d: unknown interface protocol %#02x, assuming v1\n",
280 dev->devnum, iface_no, altno, protocol);
281 protocol = UAC_VERSION_1;
282 /* fall through */
283
278 case UAC_VERSION_1: { 284 case UAC_VERSION_1: {
279 struct uac1_as_header_descriptor *as = 285 struct uac1_as_header_descriptor *as =
280 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 286 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
@@ -336,11 +342,6 @@ int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)
336 dev->devnum, iface_no, altno, as->bTerminalLink); 342 dev->devnum, iface_no, altno, as->bTerminalLink);
337 continue; 343 continue;
338 } 344 }
339
340 default:
341 snd_printk(KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n",
342 dev->devnum, iface_no, altno, protocol);
343 continue;
344 } 345 }
345 346
346 /* get format type */ 347 /* get format type */
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 3a1375459c0..69148212aa7 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -49,7 +49,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
49 u64 pcm_formats; 49 u64 pcm_formats;
50 50
51 switch (protocol) { 51 switch (protocol) {
52 case UAC_VERSION_1: { 52 case UAC_VERSION_1:
53 default: {
53 struct uac_format_type_i_discrete_descriptor *fmt = _fmt; 54 struct uac_format_type_i_discrete_descriptor *fmt = _fmt;
54 sample_width = fmt->bBitResolution; 55 sample_width = fmt->bBitResolution;
55 sample_bytes = fmt->bSubframeSize; 56 sample_bytes = fmt->bSubframeSize;
@@ -64,9 +65,6 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
64 format <<= 1; 65 format <<= 1;
65 break; 66 break;
66 } 67 }
67
68 default:
69 return -EINVAL;
70 } 68 }
71 69
72 pcm_formats = 0; 70 pcm_formats = 0;
@@ -384,6 +382,10 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
384 * audio class v2 uses class specific EP0 range requests for that. 382 * audio class v2 uses class specific EP0 range requests for that.
385 */ 383 */
386 switch (protocol) { 384 switch (protocol) {
385 default:
386 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
387 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
388 /* fall through */
387 case UAC_VERSION_1: 389 case UAC_VERSION_1:
388 fp->channels = fmt->bNrChannels; 390 fp->channels = fmt->bNrChannels;
389 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7); 391 ret = parse_audio_format_rates_v1(chip, fp, (unsigned char *) fmt, 7);
@@ -392,10 +394,6 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
392 /* fp->channels is already set in this case */ 394 /* fp->channels is already set in this case */
393 ret = parse_audio_format_rates_v2(chip, fp); 395 ret = parse_audio_format_rates_v2(chip, fp);
394 break; 396 break;
395 default:
396 snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
397 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
398 return -EINVAL;
399 } 397 }
400 398
401 if (fp->channels < 1) { 399 if (fp->channels < 1) {
@@ -438,6 +436,10 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
438 fp->channels = 1; 436 fp->channels = 1;
439 437
440 switch (protocol) { 438 switch (protocol) {
439 default:
440 snd_printdd(KERN_WARNING "%d:%u:%d : invalid protocol version %d, assuming v1\n",
441 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
442 /* fall through */
441 case UAC_VERSION_1: { 443 case UAC_VERSION_1: {
442 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; 444 struct uac_format_type_ii_discrete_descriptor *fmt = _fmt;
443 brate = le16_to_cpu(fmt->wMaxBitRate); 445 brate = le16_to_cpu(fmt->wMaxBitRate);
@@ -456,10 +458,6 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
456 ret = parse_audio_format_rates_v2(chip, fp); 458 ret = parse_audio_format_rates_v2(chip, fp);
457 break; 459 break;
458 } 460 }
459 default:
460 snd_printk(KERN_ERR "%d:%u:%d : invalid protocol version %d\n",
461 chip->dev->devnum, fp->iface, fp->altsetting, protocol);
462 return -EINVAL;
463 } 461 }
464 462
465 return ret; 463 return ret;
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index c166db0057d..3ed3901369c 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -2175,7 +2175,15 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2175 } 2175 }
2176 2176
2177 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0]; 2177 host_iface = &usb_ifnum_to_if(chip->dev, ctrlif)->altsetting[0];
2178 mixer->protocol = get_iface_desc(host_iface)->bInterfaceProtocol; 2178 switch (get_iface_desc(host_iface)->bInterfaceProtocol) {
2179 case UAC_VERSION_1:
2180 default:
2181 mixer->protocol = UAC_VERSION_1;
2182 break;
2183 case UAC_VERSION_2:
2184 mixer->protocol = UAC_VERSION_2;
2185 break;
2186 }
2179 2187
2180 if ((err = snd_usb_mixer_controls(mixer)) < 0 || 2188 if ((err = snd_usb_mixer_controls(mixer)) < 0 ||
2181 (err = snd_usb_mixer_status_create(mixer)) < 0) 2189 (err = snd_usb_mixer_status_create(mixer)) < 0)
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 58ed6820a8c..f49756c1b83 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -173,13 +173,12 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
173 173
174 switch (altsd->bInterfaceProtocol) { 174 switch (altsd->bInterfaceProtocol) {
175 case UAC_VERSION_1: 175 case UAC_VERSION_1:
176 default:
176 return init_pitch_v1(chip, iface, alts, fmt); 177 return init_pitch_v1(chip, iface, alts, fmt);
177 178
178 case UAC_VERSION_2: 179 case UAC_VERSION_2:
179 return init_pitch_v2(chip, iface, alts, fmt); 180 return init_pitch_v2(chip, iface, alts, fmt);
180 } 181 }
181
182 return -EINVAL;
183} 182}
184 183
185/* 184/*