提交 c4319c7d 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  eukrea-tlv320: fix platform_name
  ASoC: correct pxa AC97 DAI names
  ALSA: hda - Add support for new IDT 92HD98 and 92HD99 codecs
  ALSA: HDA: Add ideapad quirk for two Dell machines
  ALSA: HDA: Add a new Conexant codec 506e (20590)
  ALSA: usb-audio: fix oops due to cleanup race when disconnecting
  ASoC: Hook wm_hubs micbiases up to CLK_SYS
  ASoC: Correct definition of WM8903_VMID_RES_5K
  ASoC: Fix WM8958 default microphone detection argument ordering
  ALSA: HDA: Fix mic initialization in VIA auto parser
  ALSA: fix one memory leak in sound jack
...@@ -141,6 +141,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, ...@@ -141,6 +141,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
fail_input: fail_input:
input_free_device(jack->input_dev); input_free_device(jack->input_dev);
kfree(jack->id);
kfree(jack); kfree(jack);
return err; return err;
} }
......
...@@ -3114,6 +3114,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { ...@@ -3114,6 +3114,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = {
SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO),
SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO),
SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD),
SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD),
SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD),
SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP),
SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS),
SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS),
...@@ -3937,6 +3939,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = { ...@@ -3937,6 +3939,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = {
.patch = patch_cxt5066 }, .patch = patch_cxt5066 },
{ .id = 0x14f15069, .name = "CX20585", { .id = 0x14f15069, .name = "CX20585",
.patch = patch_cxt5066 }, .patch = patch_cxt5066 },
{ .id = 0x14f1506e, .name = "CX20590",
.patch = patch_cxt5066 },
{ .id = 0x14f15097, .name = "CX20631", { .id = 0x14f15097, .name = "CX20631",
.patch = patch_conexant_auto }, .patch = patch_conexant_auto },
{ .id = 0x14f15098, .name = "CX20632", { .id = 0x14f15098, .name = "CX20632",
...@@ -3963,6 +3967,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066"); ...@@ -3963,6 +3967,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066");
MODULE_ALIAS("snd-hda-codec-id:14f15067"); MODULE_ALIAS("snd-hda-codec-id:14f15067");
MODULE_ALIAS("snd-hda-codec-id:14f15068"); MODULE_ALIAS("snd-hda-codec-id:14f15068");
MODULE_ALIAS("snd-hda-codec-id:14f15069"); MODULE_ALIAS("snd-hda-codec-id:14f15069");
MODULE_ALIAS("snd-hda-codec-id:14f1506e");
MODULE_ALIAS("snd-hda-codec-id:14f15097"); MODULE_ALIAS("snd-hda-codec-id:14f15097");
MODULE_ALIAS("snd-hda-codec-id:14f15098"); MODULE_ALIAS("snd-hda-codec-id:14f15098");
MODULE_ALIAS("snd-hda-codec-id:14f150a1"); MODULE_ALIAS("snd-hda-codec-id:14f150a1");
......
...@@ -586,7 +586,12 @@ static hda_nid_t stac92hd83xxx_pin_nids[10] = { ...@@ -586,7 +586,12 @@ static hda_nid_t stac92hd83xxx_pin_nids[10] = {
0x0f, 0x10, 0x11, 0x1f, 0x20, 0x0f, 0x10, 0x11, 0x1f, 0x20,
}; };
static hda_nid_t stac92hd88xxx_pin_nids[10] = { static hda_nid_t stac92hd87xxx_pin_nids[6] = {
0x0a, 0x0b, 0x0c, 0x0d,
0x0f, 0x11,
};
static hda_nid_t stac92hd88xxx_pin_nids[8] = {
0x0a, 0x0b, 0x0c, 0x0d, 0x0a, 0x0b, 0x0c, 0x0d,
0x0f, 0x11, 0x1f, 0x20, 0x0f, 0x11, 0x1f, 0x20,
}; };
...@@ -5430,12 +5435,13 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) ...@@ -5430,12 +5435,13 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
switch (codec->vendor_id) { switch (codec->vendor_id) {
case 0x111d76d1: case 0x111d76d1:
case 0x111d76d9: case 0x111d76d9:
case 0x111d76e5:
spec->dmic_nids = stac92hd87b_dmic_nids; spec->dmic_nids = stac92hd87b_dmic_nids;
spec->num_dmics = stac92xx_connected_ports(codec, spec->num_dmics = stac92xx_connected_ports(codec,
stac92hd87b_dmic_nids, stac92hd87b_dmic_nids,
STAC92HD87B_NUM_DMICS); STAC92HD87B_NUM_DMICS);
spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); spec->num_pins = ARRAY_SIZE(stac92hd87xxx_pin_nids);
spec->pin_nids = stac92hd88xxx_pin_nids; spec->pin_nids = stac92hd87xxx_pin_nids;
spec->mono_nid = 0; spec->mono_nid = 0;
spec->num_pwrs = 0; spec->num_pwrs = 0;
break; break;
...@@ -5443,6 +5449,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) ...@@ -5443,6 +5449,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
case 0x111d7667: case 0x111d7667:
case 0x111d7668: case 0x111d7668:
case 0x111d7669: case 0x111d7669:
case 0x111d76e3:
spec->num_dmics = stac92xx_connected_ports(codec, spec->num_dmics = stac92xx_connected_ports(codec,
stac92hd88xxx_dmic_nids, stac92hd88xxx_dmic_nids,
STAC92HD88XXX_NUM_DMICS); STAC92HD88XXX_NUM_DMICS);
...@@ -6387,6 +6394,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = { ...@@ -6387,6 +6394,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = {
{ .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
{ .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
{ .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
{ .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
{} /* terminator */ {} /* terminator */
}; };
......
...@@ -567,7 +567,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec) ...@@ -567,7 +567,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec)
hda_nid_t nid = cfg->inputs[i].pin; hda_nid_t nid = cfg->inputs[i].pin;
if (spec->smart51_enabled && is_smart51_pins(spec, nid)) if (spec->smart51_enabled && is_smart51_pins(spec, nid))
ctl = PIN_OUT; ctl = PIN_OUT;
else if (i == AUTO_PIN_MIC) else if (cfg->inputs[i].type == AUTO_PIN_MIC)
ctl = PIN_VREF50; ctl = PIN_VREF50;
else else
ctl = PIN_IN; ctl = PIN_IN;
......
...@@ -165,7 +165,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, ...@@ -165,7 +165,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec,
#define WM8903_VMID_RES_50K 2 #define WM8903_VMID_RES_50K 2
#define WM8903_VMID_RES_250K 3 #define WM8903_VMID_RES_250K 3
#define WM8903_VMID_RES_5K 4 #define WM8903_VMID_RES_5K 6
/* /*
* R8 (0x08) - Analogue DAC 0 * R8 (0x08) - Analogue DAC 0
......
...@@ -3000,11 +3000,10 @@ static void wm8958_default_micdet(u16 status, void *data) ...@@ -3000,11 +3000,10 @@ static void wm8958_default_micdet(u16 status, void *data)
report |= SND_JACK_BTN_5; report |= SND_JACK_BTN_5;
done: done:
snd_soc_jack_report(wm8994->micdet[0].jack, snd_soc_jack_report(wm8994->micdet[0].jack, report,
SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 |
SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 |
SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT, SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT);
report);
} }
/** /**
......
...@@ -674,6 +674,9 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"), ...@@ -674,6 +674,9 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"),
}; };
static const struct snd_soc_dapm_route analogue_routes[] = { static const struct snd_soc_dapm_route analogue_routes[] = {
{ "MICBIAS1", NULL, "CLK_SYS" },
{ "MICBIAS2", NULL, "CLK_SYS" },
{ "IN1L PGA", "IN1LP Switch", "IN1LP" }, { "IN1L PGA", "IN1LP Switch", "IN1LP" },
{ "IN1L PGA", "IN1LN Switch", "IN1LN" }, { "IN1L PGA", "IN1LN Switch", "IN1LN" },
......
...@@ -79,7 +79,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { ...@@ -79,7 +79,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = {
.name = "tlv320aic23", .name = "tlv320aic23",
.stream_name = "TLV320AIC23", .stream_name = "TLV320AIC23",
.codec_dai_name = "tlv320aic23-hifi", .codec_dai_name = "tlv320aic23-hifi",
.platform_name = "imx-pcm-audio.0", .platform_name = "imx-fiq-pcm-audio.0",
.codec_name = "tlv320aic23-codec.0-001a", .codec_name = "tlv320aic23-codec.0-001a",
.cpu_dai_name = "imx-ssi.0", .cpu_dai_name = "imx-ssi.0",
.ops = &eukrea_tlv320_snd_ops, .ops = &eukrea_tlv320_snd_ops,
......
...@@ -117,7 +117,7 @@ static struct snd_soc_dai_link e740_dai[] = { ...@@ -117,7 +117,7 @@ static struct snd_soc_dai_link e740_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9705-hifi", .codec_dai_name = "wm9705-hifi",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9705-codec", .codec_name = "wm9705-codec",
...@@ -126,7 +126,7 @@ static struct snd_soc_dai_link e740_dai[] = { ...@@ -126,7 +126,7 @@ static struct snd_soc_dai_link e740_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name = "wm9705-aux", .codec_dai_name = "wm9705-aux",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9705-codec", .codec_name = "wm9705-codec",
......
...@@ -99,7 +99,7 @@ static struct snd_soc_dai_link e750_dai[] = { ...@@ -99,7 +99,7 @@ static struct snd_soc_dai_link e750_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9705-hifi", .codec_dai_name = "wm9705-hifi",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9705-codec", .codec_name = "wm9705-codec",
...@@ -109,7 +109,7 @@ static struct snd_soc_dai_link e750_dai[] = { ...@@ -109,7 +109,7 @@ static struct snd_soc_dai_link e750_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name ="wm9705-aux", .codec_dai_name ="wm9705-aux",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9705-codec", .codec_name = "wm9705-codec",
......
...@@ -89,7 +89,7 @@ static struct snd_soc_dai_link e800_dai[] = { ...@@ -89,7 +89,7 @@ static struct snd_soc_dai_link e800_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9712-hifi", .codec_dai_name = "wm9712-hifi",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
...@@ -98,7 +98,7 @@ static struct snd_soc_dai_link e800_dai[] = { ...@@ -98,7 +98,7 @@ static struct snd_soc_dai_link e800_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name ="wm9712-aux", .codec_dai_name ="wm9712-aux",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
......
...@@ -37,7 +37,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { ...@@ -37,7 +37,7 @@ static struct snd_soc_dai_link em_x270_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9712-hifi", .codec_dai_name = "wm9712-hifi",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
...@@ -45,7 +45,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { ...@@ -45,7 +45,7 @@ static struct snd_soc_dai_link em_x270_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name ="wm9712-aux", .codec_dai_name ="wm9712-aux",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
......
...@@ -162,7 +162,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { ...@@ -162,7 +162,7 @@ static struct snd_soc_dai_link mioa701_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9713-hifi", .codec_dai_name = "wm9713-hifi",
.codec_name = "wm9713-codec", .codec_name = "wm9713-codec",
.init = mioa701_wm9713_init, .init = mioa701_wm9713_init,
...@@ -172,7 +172,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { ...@@ -172,7 +172,7 @@ static struct snd_soc_dai_link mioa701_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name ="wm9713-aux", .codec_dai_name ="wm9713-aux",
.codec_name = "wm9713-codec", .codec_name = "wm9713-codec",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
......
...@@ -132,7 +132,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { ...@@ -132,7 +132,7 @@ static struct snd_soc_dai_link palm27x_dai[] = {
{ {
.name = "AC97 HiFi", .name = "AC97 HiFi",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9712-hifi", .codec_dai_name = "wm9712-hifi",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
...@@ -141,7 +141,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { ...@@ -141,7 +141,7 @@ static struct snd_soc_dai_link palm27x_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name = "wm9712-aux", .codec_dai_name = "wm9712-aux",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
......
...@@ -219,7 +219,7 @@ static struct snd_soc_dai_link tosa_dai[] = { ...@@ -219,7 +219,7 @@ static struct snd_soc_dai_link tosa_dai[] = {
{ {
.name = "AC97", .name = "AC97",
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_dai_name = "wm9712-hifi", .codec_dai_name = "wm9712-hifi",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
...@@ -229,7 +229,7 @@ static struct snd_soc_dai_link tosa_dai[] = { ...@@ -229,7 +229,7 @@ static struct snd_soc_dai_link tosa_dai[] = {
{ {
.name = "AC97 Aux", .name = "AC97 Aux",
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_dai_name = "wm9712-aux", .codec_dai_name = "wm9712-aux",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.codec_name = "wm9712-codec", .codec_name = "wm9712-codec",
......
...@@ -166,7 +166,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { ...@@ -166,7 +166,7 @@ static struct snd_soc_dai_link zylonite_dai[] = {
.stream_name = "AC97 HiFi", .stream_name = "AC97 HiFi",
.codec_name = "wm9713-codec", .codec_name = "wm9713-codec",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.cpu_dai_name = "pxa-ac97.0", .cpu_dai_name = "pxa2xx-ac97",
.codec_name = "wm9713-hifi", .codec_name = "wm9713-hifi",
.init = zylonite_wm9713_init, .init = zylonite_wm9713_init,
}, },
...@@ -175,7 +175,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { ...@@ -175,7 +175,7 @@ static struct snd_soc_dai_link zylonite_dai[] = {
.stream_name = "AC97 Aux", .stream_name = "AC97 Aux",
.codec_name = "wm9713-codec", .codec_name = "wm9713-codec",
.platform_name = "pxa-pcm-audio", .platform_name = "pxa-pcm-audio",
.cpu_dai_name = "pxa-ac97.1", .cpu_dai_name = "pxa2xx-ac97-aux",
.codec_name = "wm9713-aux", .codec_name = "wm9713-aux",
}, },
{ {
......
...@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, ...@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
return -ENOMEM; return -ENOMEM;
} }
mutex_init(&chip->shutdown_mutex);
chip->index = idx; chip->index = idx;
chip->dev = dev; chip->dev = dev;
chip->card = card; chip->card = card;
...@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) ...@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
chip = ptr; chip = ptr;
card = chip->card; card = chip->card;
mutex_lock(&register_mutex); mutex_lock(&register_mutex);
mutex_lock(&chip->shutdown_mutex);
chip->shutdown = 1; chip->shutdown = 1;
chip->num_interfaces--; chip->num_interfaces--;
if (chip->num_interfaces <= 0) { if (chip->num_interfaces <= 0) {
...@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) ...@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)
snd_usb_mixer_disconnect(p); snd_usb_mixer_disconnect(p);
} }
usb_chip[chip->index] = NULL; usb_chip[chip->index] = NULL;
mutex_unlock(&chip->shutdown_mutex);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
snd_card_free_when_closed(card); snd_card_free_when_closed(card);
} else { } else {
mutex_unlock(&chip->shutdown_mutex);
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} }
} }
......
...@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, ...@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
} }
if (changed) { if (changed) {
mutex_lock(&subs->stream->chip->shutdown_mutex);
/* format changed */ /* format changed */
snd_usb_release_substream_urbs(subs, 0); snd_usb_release_substream_urbs(subs, 0);
/* influenced: period_bytes, channels, rate, format, */ /* influenced: period_bytes, channels, rate, format, */
...@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, ...@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
params_rate(hw_params), params_rate(hw_params),
snd_pcm_format_physical_width(params_format(hw_params)) * snd_pcm_format_physical_width(params_format(hw_params)) *
params_channels(hw_params)); params_channels(hw_params));
mutex_unlock(&subs->stream->chip->shutdown_mutex);
} }
return ret; return ret;
...@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) ...@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
subs->cur_audiofmt = NULL; subs->cur_audiofmt = NULL;
subs->cur_rate = 0; subs->cur_rate = 0;
subs->period_bytes = 0; subs->period_bytes = 0;
if (!subs->stream->chip->shutdown) mutex_lock(&subs->stream->chip->shutdown_mutex);
snd_usb_release_substream_urbs(subs, 0); snd_usb_release_substream_urbs(subs, 0);
mutex_unlock(&subs->stream->chip->shutdown_mutex);
return snd_pcm_lib_free_vmalloc_buffer(substream); return snd_pcm_lib_free_vmalloc_buffer(substream);
} }
......
...@@ -36,6 +36,7 @@ struct snd_usb_audio { ...@@ -36,6 +36,7 @@ struct snd_usb_audio {
struct snd_card *card; struct snd_card *card;
u32 usb_id; u32 usb_id;
int shutdown; int shutdown;
struct mutex shutdown_mutex;
unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */
int num_interfaces; int num_interfaces;
int num_suspended_intf; int num_suspended_intf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册