diff options
| -rw-r--r-- | sound/pci/hda/hda_generic.c | 6 | ||||
| -rw-r--r-- | sound/pci/hda/patch_realtek.c | 11 | ||||
| -rw-r--r-- | sound/soc/codecs/cs42l52.c | 5 | ||||
| -rw-r--r-- | sound/soc/codecs/sgtl5000.c | 18 | ||||
| -rw-r--r-- | sound/soc/soc-dapm.c | 7 | ||||
| -rw-r--r-- | sound/soc/tegra/tegra30_i2s.c | 2 | ||||
| -rw-r--r-- | sound/usb/6fire/midi.c | 16 | ||||
| -rw-r--r-- | sound/usb/6fire/midi.h | 6 | ||||
| -rw-r--r-- | sound/usb/6fire/pcm.c | 41 | ||||
| -rw-r--r-- | sound/usb/6fire/pcm.h | 2 | ||||
| -rw-r--r-- | sound/usb/mixer.c | 1 | ||||
| -rw-r--r-- | sound/usb/quirks.c | 6 |
12 files changed, 98 insertions, 23 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 8e77cbbad871..e3c7ba8d7582 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
| @@ -522,7 +522,7 @@ static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1, | |||
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | #define nid_has_mute(codec, nid, dir) \ | 524 | #define nid_has_mute(codec, nid, dir) \ |
| 525 | check_amp_caps(codec, nid, dir, AC_AMPCAP_MUTE) | 525 | check_amp_caps(codec, nid, dir, (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) |
| 526 | #define nid_has_volume(codec, nid, dir) \ | 526 | #define nid_has_volume(codec, nid, dir) \ |
| 527 | check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS) | 527 | check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS) |
| 528 | 528 | ||
| @@ -624,7 +624,7 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid, | |||
| 624 | if (enable) | 624 | if (enable) |
| 625 | val = (caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; | 625 | val = (caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; |
| 626 | } | 626 | } |
| 627 | if (caps & AC_AMPCAP_MUTE) { | 627 | if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) { |
| 628 | if (!enable) | 628 | if (!enable) |
| 629 | val |= HDA_AMP_MUTE; | 629 | val |= HDA_AMP_MUTE; |
| 630 | } | 630 | } |
| @@ -648,7 +648,7 @@ static unsigned int get_amp_mask_to_modify(struct hda_codec *codec, | |||
| 648 | { | 648 | { |
| 649 | unsigned int mask = 0xff; | 649 | unsigned int mask = 0xff; |
| 650 | 650 | ||
| 651 | if (caps & AC_AMPCAP_MUTE) { | 651 | if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) { |
| 652 | if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL)) | 652 | if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL)) |
| 653 | mask &= ~0x80; | 653 | mask &= ~0x80; |
| 654 | } | 654 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8bd226149868..f303cd898515 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -1031,6 +1031,7 @@ enum { | |||
| 1031 | ALC880_FIXUP_GPIO2, | 1031 | ALC880_FIXUP_GPIO2, |
| 1032 | ALC880_FIXUP_MEDION_RIM, | 1032 | ALC880_FIXUP_MEDION_RIM, |
| 1033 | ALC880_FIXUP_LG, | 1033 | ALC880_FIXUP_LG, |
| 1034 | ALC880_FIXUP_LG_LW25, | ||
| 1034 | ALC880_FIXUP_W810, | 1035 | ALC880_FIXUP_W810, |
| 1035 | ALC880_FIXUP_EAPD_COEF, | 1036 | ALC880_FIXUP_EAPD_COEF, |
| 1036 | ALC880_FIXUP_TCL_S700, | 1037 | ALC880_FIXUP_TCL_S700, |
| @@ -1089,6 +1090,14 @@ static const struct hda_fixup alc880_fixups[] = { | |||
| 1089 | { } | 1090 | { } |
| 1090 | } | 1091 | } |
| 1091 | }, | 1092 | }, |
| 1093 | [ALC880_FIXUP_LG_LW25] = { | ||
| 1094 | .type = HDA_FIXUP_PINS, | ||
| 1095 | .v.pins = (const struct hda_pintbl[]) { | ||
| 1096 | { 0x1a, 0x0181344f }, /* line-in */ | ||
| 1097 | { 0x1b, 0x0321403f }, /* headphone */ | ||
| 1098 | { } | ||
| 1099 | } | ||
| 1100 | }, | ||
| 1092 | [ALC880_FIXUP_W810] = { | 1101 | [ALC880_FIXUP_W810] = { |
| 1093 | .type = HDA_FIXUP_PINS, | 1102 | .type = HDA_FIXUP_PINS, |
| 1094 | .v.pins = (const struct hda_pintbl[]) { | 1103 | .v.pins = (const struct hda_pintbl[]) { |
| @@ -1341,6 +1350,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = { | |||
| 1341 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), | 1350 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), |
| 1342 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), | 1351 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), |
| 1343 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), | 1352 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), |
| 1353 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25), | ||
| 1344 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), | 1354 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), |
| 1345 | 1355 | ||
| 1346 | /* Below is the copied entries from alc880_quirks.c. | 1356 | /* Below is the copied entries from alc880_quirks.c. |
| @@ -4329,6 +4339,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
| 4329 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), | 4339 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
| 4330 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), | 4340 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
| 4331 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), | 4341 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
| 4342 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), | ||
| 4332 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), | 4343 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
| 4333 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 4344 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
| 4334 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 4345 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 987f728718c5..be2ba1b6fe4a 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
| @@ -195,6 +195,8 @@ static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); | |||
| 195 | 195 | ||
| 196 | static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); | 196 | static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); |
| 197 | 197 | ||
| 198 | static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0); | ||
| 199 | |||
| 198 | static const unsigned int limiter_tlv[] = { | 200 | static const unsigned int limiter_tlv[] = { |
| 199 | TLV_DB_RANGE_HEAD(2), | 201 | TLV_DB_RANGE_HEAD(2), |
| 200 | 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), | 202 | 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0), |
| @@ -451,7 +453,8 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = { | |||
| 451 | SOC_ENUM("Beep Pitch", beep_pitch_enum), | 453 | SOC_ENUM("Beep Pitch", beep_pitch_enum), |
| 452 | SOC_ENUM("Beep on Time", beep_ontime_enum), | 454 | SOC_ENUM("Beep on Time", beep_ontime_enum), |
| 453 | SOC_ENUM("Beep off Time", beep_offtime_enum), | 455 | SOC_ENUM("Beep off Time", beep_offtime_enum), |
| 454 | SOC_SINGLE_TLV("Beep Volume", CS42L52_BEEP_VOL, 0, 0x1f, 0x07, hl_tlv), | 456 | SOC_SINGLE_SX_TLV("Beep Volume", CS42L52_BEEP_VOL, |
| 457 | 0, 0x07, 0x1f, beep_tlv), | ||
| 455 | SOC_SINGLE("Beep Mixer Switch", CS42L52_BEEP_TONE_CTL, 5, 1, 1), | 458 | SOC_SINGLE("Beep Mixer Switch", CS42L52_BEEP_TONE_CTL, 5, 1, 1), |
| 456 | SOC_ENUM("Beep Treble Corner Freq", beep_treble_enum), | 459 | SOC_ENUM("Beep Treble Corner Freq", beep_treble_enum), |
| 457 | SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum), | 460 | SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum), |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 6c8a9e7bee25..760e8bfeacaa 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
| @@ -153,6 +153,8 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, | |||
| 153 | static int power_vag_event(struct snd_soc_dapm_widget *w, | 153 | static int power_vag_event(struct snd_soc_dapm_widget *w, |
| 154 | struct snd_kcontrol *kcontrol, int event) | 154 | struct snd_kcontrol *kcontrol, int event) |
| 155 | { | 155 | { |
| 156 | const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP; | ||
| 157 | |||
| 156 | switch (event) { | 158 | switch (event) { |
| 157 | case SND_SOC_DAPM_POST_PMU: | 159 | case SND_SOC_DAPM_POST_PMU: |
| 158 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 160 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, |
| @@ -160,9 +162,17 @@ static int power_vag_event(struct snd_soc_dapm_widget *w, | |||
| 160 | break; | 162 | break; |
| 161 | 163 | ||
| 162 | case SND_SOC_DAPM_PRE_PMD: | 164 | case SND_SOC_DAPM_PRE_PMD: |
| 163 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 165 | /* |
| 164 | SGTL5000_VAG_POWERUP, 0); | 166 | * Don't clear VAG_POWERUP, when both DAC and ADC are |
| 165 | msleep(400); | 167 | * operational to prevent inadvertently starving the |
| 168 | * other one of them. | ||
| 169 | */ | ||
| 170 | if ((snd_soc_read(w->codec, SGTL5000_CHIP_ANA_POWER) & | ||
| 171 | mask) != mask) { | ||
| 172 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | ||
| 173 | SGTL5000_VAG_POWERUP, 0); | ||
| 174 | msleep(400); | ||
| 175 | } | ||
| 166 | break; | 176 | break; |
| 167 | default: | 177 | default: |
| 168 | break; | 178 | break; |
| @@ -388,7 +398,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = { | |||
| 388 | SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0), | 398 | SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0), |
| 389 | SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)", | 399 | SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)", |
| 390 | SGTL5000_CHIP_ANA_ADC_CTRL, | 400 | SGTL5000_CHIP_ANA_ADC_CTRL, |
| 391 | 8, 2, 0, capture_6db_attenuate), | 401 | 8, 1, 0, capture_6db_attenuate), |
| 392 | SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0), | 402 | SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0), |
| 393 | 403 | ||
| 394 | SOC_DOUBLE_TLV("Headphone Playback Volume", | 404 | SOC_DOUBLE_TLV("Headphone Playback Volume", |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index bd16010441cc..4375c9f2b791 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
| @@ -679,13 +679,14 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w) | |||
| 679 | return -EINVAL; | 679 | return -EINVAL; |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | path = list_first_entry(&w->sources, struct snd_soc_dapm_path, | 682 | if (list_empty(&w->sources)) { |
| 683 | list_sink); | ||
| 684 | if (!path) { | ||
| 685 | dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name); | 683 | dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name); |
| 686 | return -EINVAL; | 684 | return -EINVAL; |
| 687 | } | 685 | } |
| 688 | 686 | ||
| 687 | path = list_first_entry(&w->sources, struct snd_soc_dapm_path, | ||
| 688 | list_sink); | ||
| 689 | |||
| 689 | ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path); | 690 | ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path); |
| 690 | if (ret < 0) | 691 | if (ret < 0) |
| 691 | return ret; | 692 | return ret; |
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index d04146cad61f..47565fd04505 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c | |||
| @@ -228,7 +228,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 228 | reg = TEGRA30_I2S_CIF_RX_CTRL; | 228 | reg = TEGRA30_I2S_CIF_RX_CTRL; |
| 229 | } else { | 229 | } else { |
| 230 | val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX; | 230 | val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX; |
| 231 | reg = TEGRA30_I2S_CIF_RX_CTRL; | 231 | reg = TEGRA30_I2S_CIF_TX_CTRL; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | regmap_write(i2s->regmap, reg, val); | 234 | regmap_write(i2s->regmap, reg, val); |
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c index 26722423330d..f3dd7266c391 100644 --- a/sound/usb/6fire/midi.c +++ b/sound/usb/6fire/midi.c | |||
| @@ -19,6 +19,10 @@ | |||
| 19 | #include "chip.h" | 19 | #include "chip.h" |
| 20 | #include "comm.h" | 20 | #include "comm.h" |
| 21 | 21 | ||
| 22 | enum { | ||
| 23 | MIDI_BUFSIZE = 64 | ||
| 24 | }; | ||
| 25 | |||
| 22 | static void usb6fire_midi_out_handler(struct urb *urb) | 26 | static void usb6fire_midi_out_handler(struct urb *urb) |
| 23 | { | 27 | { |
| 24 | struct midi_runtime *rt = urb->context; | 28 | struct midi_runtime *rt = urb->context; |
| @@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip) | |||
| 156 | if (!rt) | 160 | if (!rt) |
| 157 | return -ENOMEM; | 161 | return -ENOMEM; |
| 158 | 162 | ||
| 163 | rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL); | ||
| 164 | if (!rt->out_buffer) { | ||
| 165 | kfree(rt); | ||
| 166 | return -ENOMEM; | ||
| 167 | } | ||
| 168 | |||
| 159 | rt->chip = chip; | 169 | rt->chip = chip; |
| 160 | rt->in_received = usb6fire_midi_in_received; | 170 | rt->in_received = usb6fire_midi_in_received; |
| 161 | rt->out_buffer[0] = 0x80; /* 'send midi' command */ | 171 | rt->out_buffer[0] = 0x80; /* 'send midi' command */ |
| @@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip) | |||
| 169 | 179 | ||
| 170 | ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); | 180 | ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance); |
| 171 | if (ret < 0) { | 181 | if (ret < 0) { |
| 182 | kfree(rt->out_buffer); | ||
| 172 | kfree(rt); | 183 | kfree(rt); |
| 173 | snd_printk(KERN_ERR PREFIX "unable to create midi.\n"); | 184 | snd_printk(KERN_ERR PREFIX "unable to create midi.\n"); |
| 174 | return ret; | 185 | return ret; |
| @@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip) | |||
| 197 | 208 | ||
| 198 | void usb6fire_midi_destroy(struct sfire_chip *chip) | 209 | void usb6fire_midi_destroy(struct sfire_chip *chip) |
| 199 | { | 210 | { |
| 200 | kfree(chip->midi); | 211 | struct midi_runtime *rt = chip->midi; |
| 212 | |||
| 213 | kfree(rt->out_buffer); | ||
| 214 | kfree(rt); | ||
| 201 | chip->midi = NULL; | 215 | chip->midi = NULL; |
| 202 | } | 216 | } |
diff --git a/sound/usb/6fire/midi.h b/sound/usb/6fire/midi.h index c321006e5430..84851b9f5559 100644 --- a/sound/usb/6fire/midi.h +++ b/sound/usb/6fire/midi.h | |||
| @@ -16,10 +16,6 @@ | |||
| 16 | 16 | ||
| 17 | #include "common.h" | 17 | #include "common.h" |
| 18 | 18 | ||
| 19 | enum { | ||
| 20 | MIDI_BUFSIZE = 64 | ||
| 21 | }; | ||
| 22 | |||
| 23 | struct midi_runtime { | 19 | struct midi_runtime { |
| 24 | struct sfire_chip *chip; | 20 | struct sfire_chip *chip; |
| 25 | struct snd_rawmidi *instance; | 21 | struct snd_rawmidi *instance; |
| @@ -32,7 +28,7 @@ struct midi_runtime { | |||
| 32 | struct snd_rawmidi_substream *out; | 28 | struct snd_rawmidi_substream *out; |
| 33 | struct urb out_urb; | 29 | struct urb out_urb; |
| 34 | u8 out_serial; /* serial number of out packet */ | 30 | u8 out_serial; /* serial number of out packet */ |
| 35 | u8 out_buffer[MIDI_BUFSIZE]; | 31 | u8 *out_buffer; |
| 36 | int buffer_offset; | 32 | int buffer_offset; |
| 37 | 33 | ||
| 38 | void (*in_received)(struct midi_runtime *rt, u8 *data, int length); | 34 | void (*in_received)(struct midi_runtime *rt, u8 *data, int length); |
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c index 3d2551cc10f2..b5eb97fdc842 100644 --- a/sound/usb/6fire/pcm.c +++ b/sound/usb/6fire/pcm.c | |||
| @@ -582,6 +582,33 @@ static void usb6fire_pcm_init_urb(struct pcm_urb *urb, | |||
| 582 | urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB; | 582 | urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB; |
| 583 | } | 583 | } |
| 584 | 584 | ||
| 585 | static int usb6fire_pcm_buffers_init(struct pcm_runtime *rt) | ||
| 586 | { | ||
| 587 | int i; | ||
| 588 | |||
| 589 | for (i = 0; i < PCM_N_URBS; i++) { | ||
| 590 | rt->out_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB | ||
| 591 | * PCM_MAX_PACKET_SIZE, GFP_KERNEL); | ||
| 592 | if (!rt->out_urbs[i].buffer) | ||
| 593 | return -ENOMEM; | ||
| 594 | rt->in_urbs[i].buffer = kzalloc(PCM_N_PACKETS_PER_URB | ||
| 595 | * PCM_MAX_PACKET_SIZE, GFP_KERNEL); | ||
| 596 | if (!rt->in_urbs[i].buffer) | ||
| 597 | return -ENOMEM; | ||
| 598 | } | ||
| 599 | return 0; | ||
| 600 | } | ||
| 601 | |||
| 602 | static void usb6fire_pcm_buffers_destroy(struct pcm_runtime *rt) | ||
| 603 | { | ||
| 604 | int i; | ||
| 605 | |||
| 606 | for (i = 0; i < PCM_N_URBS; i++) { | ||
| 607 | kfree(rt->out_urbs[i].buffer); | ||
| 608 | kfree(rt->in_urbs[i].buffer); | ||
| 609 | } | ||
| 610 | } | ||
| 611 | |||
| 585 | int usb6fire_pcm_init(struct sfire_chip *chip) | 612 | int usb6fire_pcm_init(struct sfire_chip *chip) |
| 586 | { | 613 | { |
| 587 | int i; | 614 | int i; |
| @@ -593,6 +620,13 @@ int usb6fire_pcm_init(struct sfire_chip *chip) | |||
| 593 | if (!rt) | 620 | if (!rt) |
| 594 | return -ENOMEM; | 621 | return -ENOMEM; |
| 595 | 622 | ||
| 623 | ret = usb6fire_pcm_buffers_init(rt); | ||
| 624 | if (ret) { | ||
| 625 | usb6fire_pcm_buffers_destroy(rt); | ||
| 626 | kfree(rt); | ||
| 627 | return ret; | ||
| 628 | } | ||
| 629 | |||
| 596 | rt->chip = chip; | 630 | rt->chip = chip; |
| 597 | rt->stream_state = STREAM_DISABLED; | 631 | rt->stream_state = STREAM_DISABLED; |
| 598 | rt->rate = ARRAY_SIZE(rates); | 632 | rt->rate = ARRAY_SIZE(rates); |
| @@ -614,6 +648,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip) | |||
| 614 | 648 | ||
| 615 | ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm); | 649 | ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm); |
| 616 | if (ret < 0) { | 650 | if (ret < 0) { |
| 651 | usb6fire_pcm_buffers_destroy(rt); | ||
| 617 | kfree(rt); | 652 | kfree(rt); |
| 618 | snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n"); | 653 | snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n"); |
| 619 | return ret; | 654 | return ret; |
| @@ -625,6 +660,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip) | |||
| 625 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); | 660 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); |
| 626 | 661 | ||
| 627 | if (ret) { | 662 | if (ret) { |
| 663 | usb6fire_pcm_buffers_destroy(rt); | ||
| 628 | kfree(rt); | 664 | kfree(rt); |
| 629 | snd_printk(KERN_ERR PREFIX | 665 | snd_printk(KERN_ERR PREFIX |
| 630 | "error preallocating pcm buffers.\n"); | 666 | "error preallocating pcm buffers.\n"); |
| @@ -669,6 +705,9 @@ void usb6fire_pcm_abort(struct sfire_chip *chip) | |||
| 669 | 705 | ||
| 670 | void usb6fire_pcm_destroy(struct sfire_chip *chip) | 706 | void usb6fire_pcm_destroy(struct sfire_chip *chip) |
| 671 | { | 707 | { |
| 672 | kfree(chip->pcm); | 708 | struct pcm_runtime *rt = chip->pcm; |
| 709 | |||
| 710 | usb6fire_pcm_buffers_destroy(rt); | ||
| 711 | kfree(rt); | ||
| 673 | chip->pcm = NULL; | 712 | chip->pcm = NULL; |
| 674 | } | 713 | } |
diff --git a/sound/usb/6fire/pcm.h b/sound/usb/6fire/pcm.h index 9b01133ee3fe..f5779d6182c6 100644 --- a/sound/usb/6fire/pcm.h +++ b/sound/usb/6fire/pcm.h | |||
| @@ -32,7 +32,7 @@ struct pcm_urb { | |||
| 32 | struct urb instance; | 32 | struct urb instance; |
| 33 | struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB]; | 33 | struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB]; |
| 34 | /* END DO NOT SEPARATE */ | 34 | /* END DO NOT SEPARATE */ |
| 35 | u8 buffer[PCM_N_PACKETS_PER_URB * PCM_MAX_PACKET_SIZE]; | 35 | u8 *buffer; |
| 36 | 36 | ||
| 37 | struct pcm_urb *peer; | 37 | struct pcm_urb *peer; |
| 38 | }; | 38 | }; |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index d5438083fd6a..95558ef4a7a0 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
| @@ -888,6 +888,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
| 888 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ | 888 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ |
| 889 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ | 889 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ |
| 890 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ | 890 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ |
| 891 | case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */ | ||
| 891 | case USB_ID(0x046d, 0x0991): | 892 | case USB_ID(0x046d, 0x0991): |
| 892 | /* Most audio usb devices lie about volume resolution. | 893 | /* Most audio usb devices lie about volume resolution. |
| 893 | * Most Logitech webcams have res = 384. | 894 | * Most Logitech webcams have res = 384. |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 1bc45e71f1fe..0df9ede99dfd 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
| @@ -319,19 +319,19 @@ static int create_auto_midi_quirk(struct snd_usb_audio *chip, | |||
| 319 | if (altsd->bNumEndpoints < 1) | 319 | if (altsd->bNumEndpoints < 1) |
| 320 | return -ENODEV; | 320 | return -ENODEV; |
| 321 | epd = get_endpoint(alts, 0); | 321 | epd = get_endpoint(alts, 0); |
| 322 | if (!usb_endpoint_xfer_bulk(epd) || | 322 | if (!usb_endpoint_xfer_bulk(epd) && |
| 323 | !usb_endpoint_xfer_int(epd)) | 323 | !usb_endpoint_xfer_int(epd)) |
| 324 | return -ENODEV; | 324 | return -ENODEV; |
| 325 | 325 | ||
| 326 | switch (USB_ID_VENDOR(chip->usb_id)) { | 326 | switch (USB_ID_VENDOR(chip->usb_id)) { |
| 327 | case 0x0499: /* Yamaha */ | 327 | case 0x0499: /* Yamaha */ |
| 328 | err = create_yamaha_midi_quirk(chip, iface, driver, alts); | 328 | err = create_yamaha_midi_quirk(chip, iface, driver, alts); |
| 329 | if (err < 0 && err != -ENODEV) | 329 | if (err != -ENODEV) |
| 330 | return err; | 330 | return err; |
| 331 | break; | 331 | break; |
| 332 | case 0x0582: /* Roland */ | 332 | case 0x0582: /* Roland */ |
| 333 | err = create_roland_midi_quirk(chip, iface, driver, alts); | 333 | err = create_roland_midi_quirk(chip, iface, driver, alts); |
| 334 | if (err < 0 && err != -ENODEV) | 334 | if (err != -ENODEV) |
| 335 | return err; | 335 | return err; |
| 336 | break; | 336 | break; |
| 337 | } | 337 | } |
