Skip to content

Commit f43c606

Browse files
committed
Merge tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "This batch contains a few USB audio fixes, a couple of HD-audio quirks, various small ASoC driver fixes in addition to an ASoC core fix that may lead to memory corruption. Unfortunately slightly more volume than the previous pull request, but all are reasonable regression fixes" * tag 'sound-3.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - Add a fixup for Gateway LT27 ASoC: tegra: fix Tegra30 I2S capture parameter setup ALSA: usb-audio: Fix invalid volume resolution for Logitech HD Webcam C525 ALSA: hda - Fix missing mute controls for CX5051 ALSA: usb-audio: fix automatic Roland/Yamaha MIDI detection ALSA: 6fire: make buffers DMA-able (midi) ALSA: 6fire: make buffers DMA-able (pcm) ALSA: hda - Add pinfix for LG LW25 laptop ASoC: cs42l52: Add new TLV for Beep Volume ASoC: cs42l52: Reorder Min/Max and update to SX_TLV for Beep Volume ASoC: dapm: Fix empty list check in dapm_new_mux() ASoC: sgtl5000: fix buggy 'Capture Attenuate Switch' control ASoC: sgtl5000: prevent playback to be muted when terminating concurrent capture
2 parents 89cb9ae + 1801928 commit f43c606

File tree

12 files changed

+98
-23
lines changed

12 files changed

+98
-23
lines changed

sound/pci/hda/hda_generic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1,
522522
}
523523

524524
#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))
526526
#define nid_has_volume(codec, nid, dir) \
527527
check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS)
528528

@@ -624,7 +624,7 @@ static int get_amp_val_to_activate(struct hda_codec *codec, hda_nid_t nid,
624624
if (enable)
625625
val = (caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
626626
}
627-
if (caps & AC_AMPCAP_MUTE) {
627+
if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) {
628628
if (!enable)
629629
val |= HDA_AMP_MUTE;
630630
}
@@ -648,7 +648,7 @@ static unsigned int get_amp_mask_to_modify(struct hda_codec *codec,
648648
{
649649
unsigned int mask = 0xff;
650650

651-
if (caps & AC_AMPCAP_MUTE) {
651+
if (caps & (AC_AMPCAP_MUTE | AC_AMPCAP_MIN_MUTE)) {
652652
if (is_ctl_associated(codec, nid, dir, idx, NID_PATH_MUTE_CTL))
653653
mask &= ~0x80;
654654
}

sound/pci/hda/patch_realtek.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,7 @@ enum {
10311031
ALC880_FIXUP_GPIO2,
10321032
ALC880_FIXUP_MEDION_RIM,
10331033
ALC880_FIXUP_LG,
1034+
ALC880_FIXUP_LG_LW25,
10341035
ALC880_FIXUP_W810,
10351036
ALC880_FIXUP_EAPD_COEF,
10361037
ALC880_FIXUP_TCL_S700,
@@ -1089,6 +1090,14 @@ static const struct hda_fixup alc880_fixups[] = {
10891090
{ }
10901091
}
10911092
},
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+
},
10921101
[ALC880_FIXUP_W810] = {
10931102
.type = HDA_FIXUP_PINS,
10941103
.v.pins = (const struct hda_pintbl[]) {
@@ -1341,6 +1350,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = {
13411350
SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
13421351
SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
13431352
SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
1353+
SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
13441354
SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
13451355

13461356
/* Below is the copied entries from alc880_quirks.c.
@@ -4329,6 +4339,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
43294339
SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
43304340
SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
43314341
SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
4342+
SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
43324343
SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
43334344
SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
43344345
SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),

sound/soc/codecs/cs42l52.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0);
195195

196196
static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0);
197197

198+
static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0);
199+
198200
static const unsigned int limiter_tlv[] = {
199201
TLV_DB_RANGE_HEAD(2),
200202
0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0),
@@ -451,7 +453,8 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {
451453
SOC_ENUM("Beep Pitch", beep_pitch_enum),
452454
SOC_ENUM("Beep on Time", beep_ontime_enum),
453455
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),
455458
SOC_SINGLE("Beep Mixer Switch", CS42L52_BEEP_TONE_CTL, 5, 1, 1),
456459
SOC_ENUM("Beep Treble Corner Freq", beep_treble_enum),
457460
SOC_ENUM("Beep Bass Corner Freq", beep_bass_enum),

sound/soc/codecs/sgtl5000.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,26 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w,
153153
static int power_vag_event(struct snd_soc_dapm_widget *w,
154154
struct snd_kcontrol *kcontrol, int event)
155155
{
156+
const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;
157+
156158
switch (event) {
157159
case SND_SOC_DAPM_POST_PMU:
158160
snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
159161
SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
160162
break;
161163

162164
case SND_SOC_DAPM_PRE_PMD:
163-
snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER,
164-
SGTL5000_VAG_POWERUP, 0);
165-
msleep(400);
165+
/*
166+
* Don't clear VAG_POWERUP, when both DAC and ADC are
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+
}
166176
break;
167177
default:
168178
break;
@@ -388,7 +398,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
388398
SOC_DOUBLE("Capture Volume", SGTL5000_CHIP_ANA_ADC_CTRL, 0, 4, 0xf, 0),
389399
SOC_SINGLE_TLV("Capture Attenuate Switch (-6dB)",
390400
SGTL5000_CHIP_ANA_ADC_CTRL,
391-
8, 2, 0, capture_6db_attenuate),
401+
8, 1, 0, capture_6db_attenuate),
392402
SOC_SINGLE("Capture ZC Switch", SGTL5000_CHIP_ANA_CTRL, 1, 1, 0),
393403

394404
SOC_DOUBLE_TLV("Headphone Playback Volume",

sound/soc/soc-dapm.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,14 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
679679
return -EINVAL;
680680
}
681681

682-
path = list_first_entry(&w->sources, struct snd_soc_dapm_path,
683-
list_sink);
684-
if (!path) {
682+
if (list_empty(&w->sources)) {
685683
dev_err(dapm->dev, "ASoC: mux %s has no paths\n", w->name);
686684
return -EINVAL;
687685
}
688686

687+
path = list_first_entry(&w->sources, struct snd_soc_dapm_path,
688+
list_sink);
689+
689690
ret = dapm_create_or_share_mixmux_kcontrol(w, 0, path);
690691
if (ret < 0)
691692
return ret;

sound/soc/tegra/tegra30_i2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static int tegra30_i2s_hw_params(struct snd_pcm_substream *substream,
228228
reg = TEGRA30_I2S_CIF_RX_CTRL;
229229
} else {
230230
val |= TEGRA30_AUDIOCIF_CTRL_DIRECTION_TX;
231-
reg = TEGRA30_I2S_CIF_RX_CTRL;
231+
reg = TEGRA30_I2S_CIF_TX_CTRL;
232232
}
233233

234234
regmap_write(i2s->regmap, reg, val);

sound/usb/6fire/midi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include "chip.h"
2020
#include "comm.h"
2121

22+
enum {
23+
MIDI_BUFSIZE = 64
24+
};
25+
2226
static void usb6fire_midi_out_handler(struct urb *urb)
2327
{
2428
struct midi_runtime *rt = urb->context;
@@ -156,6 +160,12 @@ int usb6fire_midi_init(struct sfire_chip *chip)
156160
if (!rt)
157161
return -ENOMEM;
158162

163+
rt->out_buffer = kzalloc(MIDI_BUFSIZE, GFP_KERNEL);
164+
if (!rt->out_buffer) {
165+
kfree(rt);
166+
return -ENOMEM;
167+
}
168+
159169
rt->chip = chip;
160170
rt->in_received = usb6fire_midi_in_received;
161171
rt->out_buffer[0] = 0x80; /* 'send midi' command */
@@ -169,6 +179,7 @@ int usb6fire_midi_init(struct sfire_chip *chip)
169179

170180
ret = snd_rawmidi_new(chip->card, "6FireUSB", 0, 1, 1, &rt->instance);
171181
if (ret < 0) {
182+
kfree(rt->out_buffer);
172183
kfree(rt);
173184
snd_printk(KERN_ERR PREFIX "unable to create midi.\n");
174185
return ret;
@@ -197,6 +208,9 @@ void usb6fire_midi_abort(struct sfire_chip *chip)
197208

198209
void usb6fire_midi_destroy(struct sfire_chip *chip)
199210
{
200-
kfree(chip->midi);
211+
struct midi_runtime *rt = chip->midi;
212+
213+
kfree(rt->out_buffer);
214+
kfree(rt);
201215
chip->midi = NULL;
202216
}

sound/usb/6fire/midi.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616

1717
#include "common.h"
1818

19-
enum {
20-
MIDI_BUFSIZE = 64
21-
};
22-
2319
struct midi_runtime {
2420
struct sfire_chip *chip;
2521
struct snd_rawmidi *instance;
@@ -32,7 +28,7 @@ struct midi_runtime {
3228
struct snd_rawmidi_substream *out;
3329
struct urb out_urb;
3430
u8 out_serial; /* serial number of out packet */
35-
u8 out_buffer[MIDI_BUFSIZE];
31+
u8 *out_buffer;
3632
int buffer_offset;
3733

3834
void (*in_received)(struct midi_runtime *rt, u8 *data, int length);

sound/usb/6fire/pcm.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,33 @@ static void usb6fire_pcm_init_urb(struct pcm_urb *urb,
582582
urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB;
583583
}
584584

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+
585612
int usb6fire_pcm_init(struct sfire_chip *chip)
586613
{
587614
int i;
@@ -593,6 +620,13 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
593620
if (!rt)
594621
return -ENOMEM;
595622

623+
ret = usb6fire_pcm_buffers_init(rt);
624+
if (ret) {
625+
usb6fire_pcm_buffers_destroy(rt);
626+
kfree(rt);
627+
return ret;
628+
}
629+
596630
rt->chip = chip;
597631
rt->stream_state = STREAM_DISABLED;
598632
rt->rate = ARRAY_SIZE(rates);
@@ -614,6 +648,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
614648

615649
ret = snd_pcm_new(chip->card, "DMX6FireUSB", 0, 1, 1, &pcm);
616650
if (ret < 0) {
651+
usb6fire_pcm_buffers_destroy(rt);
617652
kfree(rt);
618653
snd_printk(KERN_ERR PREFIX "cannot create pcm instance.\n");
619654
return ret;
@@ -625,6 +660,7 @@ int usb6fire_pcm_init(struct sfire_chip *chip)
625660
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops);
626661

627662
if (ret) {
663+
usb6fire_pcm_buffers_destroy(rt);
628664
kfree(rt);
629665
snd_printk(KERN_ERR PREFIX
630666
"error preallocating pcm buffers.\n");
@@ -669,6 +705,9 @@ void usb6fire_pcm_abort(struct sfire_chip *chip)
669705

670706
void usb6fire_pcm_destroy(struct sfire_chip *chip)
671707
{
672-
kfree(chip->pcm);
708+
struct pcm_runtime *rt = chip->pcm;
709+
710+
usb6fire_pcm_buffers_destroy(rt);
711+
kfree(rt);
673712
chip->pcm = NULL;
674713
}

sound/usb/6fire/pcm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct pcm_urb {
3232
struct urb instance;
3333
struct usb_iso_packet_descriptor packets[PCM_N_PACKETS_PER_URB];
3434
/* END DO NOT SEPARATE */
35-
u8 buffer[PCM_N_PACKETS_PER_URB * PCM_MAX_PACKET_SIZE];
35+
u8 *buffer;
3636

3737
struct pcm_urb *peer;
3838
};

sound/usb/mixer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
888888
case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */
889889
case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */
890890
case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */
891+
case USB_ID(0x046d, 0x0826): /* HD Webcam c525 */
891892
case USB_ID(0x046d, 0x0991):
892893
/* Most audio usb devices lie about volume resolution.
893894
* Most Logitech webcams have res = 384.

sound/usb/quirks.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,19 +319,19 @@ static int create_auto_midi_quirk(struct snd_usb_audio *chip,
319319
if (altsd->bNumEndpoints < 1)
320320
return -ENODEV;
321321
epd = get_endpoint(alts, 0);
322-
if (!usb_endpoint_xfer_bulk(epd) ||
322+
if (!usb_endpoint_xfer_bulk(epd) &&
323323
!usb_endpoint_xfer_int(epd))
324324
return -ENODEV;
325325

326326
switch (USB_ID_VENDOR(chip->usb_id)) {
327327
case 0x0499: /* Yamaha */
328328
err = create_yamaha_midi_quirk(chip, iface, driver, alts);
329-
if (err < 0 && err != -ENODEV)
329+
if (err != -ENODEV)
330330
return err;
331331
break;
332332
case 0x0582: /* Roland */
333333
err = create_roland_midi_quirk(chip, iface, driver, alts);
334-
if (err < 0 && err != -ENODEV)
334+
if (err != -ENODEV)
335335
return err;
336336
break;
337337
}

0 commit comments

Comments
 (0)