Skip to content

Commit bbc54a0

Browse files
committed
Merge tag 'sound-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "This is a round of HD-audio fixes: there are a long-standing regression fix and a few more device/codec-specific quirks. In addition, a couple of FireWire regression fixes, a USB-audio quirk for Roland UA-22 and a sanity check in API for user-defined control elements" * tag 'sound-4.0-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda - Don't access stereo amps for mono channel widgets ALSA: hda - Add workaround for MacBook Air 5,2 built-in mic ALSA: hda - Set single_adc_amp flag for CS420x codecs ALSA: snd-usb: add quirks for Roland UA-22 ALSA: control: Add sanity checks for user ctl id name string ALSA: hda - Fix built-in mic on Compaq Presario CQ60 ALSA: firewire-lib: leave unit reference counting completely Revert "ALSA: dice: fix wrong offsets for Dice interface" ALSA: hda - Fix regression of HD-audio controller fallback modes
2 parents 3d52c5b + ef403ed commit bbc54a0

File tree

9 files changed

+82
-22
lines changed

9 files changed

+82
-22
lines changed

sound/core/control.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
11701170

11711171
if (info->count < 1)
11721172
return -EINVAL;
1173+
if (!*info->id.name)
1174+
return -EINVAL;
1175+
if (strnlen(info->id.name, sizeof(info->id.name)) >= sizeof(info->id.name))
1176+
return -EINVAL;
11731177
access = info->access == 0 ? SNDRV_CTL_ELEM_ACCESS_READWRITE :
11741178
(info->access & (SNDRV_CTL_ELEM_ACCESS_READWRITE|
11751179
SNDRV_CTL_ELEM_ACCESS_INACTIVE|

sound/firewire/dice/dice-interface.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,24 +298,24 @@
298298
*/
299299
#define RX_ISOCHRONOUS 0x008
300300

301+
/*
302+
* Index of first quadlet to be interpreted; read/write. If > 0, that many
303+
* quadlets at the beginning of each data block will be ignored, and all the
304+
* audio and MIDI quadlets will follow.
305+
*/
306+
#define RX_SEQ_START 0x00c
307+
301308
/*
302309
* The number of audio channels; read-only. There will be one quadlet per
303310
* channel.
304311
*/
305-
#define RX_NUMBER_AUDIO 0x00c
312+
#define RX_NUMBER_AUDIO 0x010
306313

307314
/*
308315
* The number of MIDI ports, 0-8; read-only. If > 0, there will be one
309316
* additional quadlet in each data block, following the audio quadlets.
310317
*/
311-
#define RX_NUMBER_MIDI 0x010
312-
313-
/*
314-
* Index of first quadlet to be interpreted; read/write. If > 0, that many
315-
* quadlets at the beginning of each data block will be ignored, and all the
316-
* audio and MIDI quadlets will follow.
317-
*/
318-
#define RX_SEQ_START 0x014
318+
#define RX_NUMBER_MIDI 0x014
319319

320320
/*
321321
* Names of all audio channels; read-only. Quadlets are byte-swapped. Names

sound/firewire/dice/dice-proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ static void dice_proc_read(struct snd_info_entry *entry,
9999
} tx;
100100
struct {
101101
u32 iso;
102+
u32 seq_start;
102103
u32 number_audio;
103104
u32 number_midi;
104-
u32 seq_start;
105105
char names[RX_NAMES_SIZE];
106106
u32 ac3_caps;
107107
u32 ac3_enable;
@@ -204,10 +204,10 @@ static void dice_proc_read(struct snd_info_entry *entry,
204204
break;
205205
snd_iprintf(buffer, "rx %u:\n", stream);
206206
snd_iprintf(buffer, " iso channel: %d\n", (int)buf.rx.iso);
207+
snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start);
207208
snd_iprintf(buffer, " audio channels: %u\n",
208209
buf.rx.number_audio);
209210
snd_iprintf(buffer, " midi ports: %u\n", buf.rx.number_midi);
210-
snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start);
211211
if (quadlets >= 68) {
212212
dice_proc_fixup_string(buf.rx.names, RX_NAMES_SIZE);
213213
snd_iprintf(buffer, " names: %s\n", buf.rx.names);

sound/firewire/iso-resources.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
int fw_iso_resources_init(struct fw_iso_resources *r, struct fw_unit *unit)
2727
{
2828
r->channels_mask = ~0uLL;
29-
r->unit = fw_unit_get(unit);
29+
r->unit = unit;
3030
mutex_init(&r->mutex);
3131
r->allocated = false;
3232

@@ -42,7 +42,6 @@ void fw_iso_resources_destroy(struct fw_iso_resources *r)
4242
{
4343
WARN_ON(r->allocated);
4444
mutex_destroy(&r->mutex);
45-
fw_unit_put(r->unit);
4645
}
4746
EXPORT_SYMBOL(fw_iso_resources_destroy);
4847

sound/pci/hda/hda_controller.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
11641164
}
11651165
}
11661166

1167-
if (!bus->no_response_fallback)
1167+
if (bus->no_response_fallback)
11681168
return -1;
11691169

11701170
if (!chip->polling_mode && chip->poll_count < 2) {

sound/pci/hda/hda_generic.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,23 @@ static void init_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx)
692692
{
693693
unsigned int caps = query_amp_caps(codec, nid, dir);
694694
int val = get_amp_val_to_activate(codec, nid, dir, caps, false);
695-
snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val);
695+
696+
if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
697+
snd_hda_codec_amp_init_stereo(codec, nid, dir, idx, 0xff, val);
698+
else
699+
snd_hda_codec_amp_init(codec, nid, 0, dir, idx, 0xff, val);
700+
}
701+
702+
/* update the amp, doing in stereo or mono depending on NID */
703+
static int update_amp(struct hda_codec *codec, hda_nid_t nid, int dir, int idx,
704+
unsigned int mask, unsigned int val)
705+
{
706+
if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
707+
return snd_hda_codec_amp_stereo(codec, nid, dir, idx,
708+
mask, val);
709+
else
710+
return snd_hda_codec_amp_update(codec, nid, 0, dir, idx,
711+
mask, val);
696712
}
697713

698714
/* calculate amp value mask we can modify;
@@ -732,7 +748,7 @@ static void activate_amp(struct hda_codec *codec, hda_nid_t nid, int dir,
732748
return;
733749

734750
val &= mask;
735-
snd_hda_codec_amp_stereo(codec, nid, dir, idx, mask, val);
751+
update_amp(codec, nid, dir, idx, mask, val);
736752
}
737753

738754
static void activate_amp_out(struct hda_codec *codec, struct nid_path *path,
@@ -4424,13 +4440,11 @@ static void mute_all_mixer_nid(struct hda_codec *codec, hda_nid_t mix)
44244440
has_amp = nid_has_mute(codec, mix, HDA_INPUT);
44254441
for (i = 0; i < nums; i++) {
44264442
if (has_amp)
4427-
snd_hda_codec_amp_stereo(codec, mix,
4428-
HDA_INPUT, i,
4429-
0xff, HDA_AMP_MUTE);
4443+
update_amp(codec, mix, HDA_INPUT, i,
4444+
0xff, HDA_AMP_MUTE);
44304445
else if (nid_has_volume(codec, conn[i], HDA_OUTPUT))
4431-
snd_hda_codec_amp_stereo(codec, conn[i],
4432-
HDA_OUTPUT, 0,
4433-
0xff, HDA_AMP_MUTE);
4446+
update_amp(codec, conn[i], HDA_OUTPUT, 0,
4447+
0xff, HDA_AMP_MUTE);
44344448
}
44354449
}
44364450

sound/pci/hda/patch_cirrus.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = {
393393
SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81),
394394
SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
395395
SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
396+
SND_PCI_QUIRK(0x106b, 0x5600, "MacBookAir 5,2", CS420X_MBP81),
396397
SND_PCI_QUIRK(0x106b, 0x5b00, "MacBookAir 4,2", CS420X_MBA42),
397398
SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
398399
{} /* terminator */
@@ -584,6 +585,7 @@ static int patch_cs420x(struct hda_codec *codec)
584585
return -ENOMEM;
585586

586587
spec->gen.automute_hook = cs_automute;
588+
codec->single_adc_amp = 1;
587589

588590
snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl,
589591
cs420x_fixups);

sound/pci/hda/patch_conexant.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ enum {
223223
CXT_PINCFG_LENOVO_TP410,
224224
CXT_PINCFG_LEMOTE_A1004,
225225
CXT_PINCFG_LEMOTE_A1205,
226+
CXT_PINCFG_COMPAQ_CQ60,
226227
CXT_FIXUP_STEREO_DMIC,
227228
CXT_FIXUP_INC_MIC_BOOST,
228229
CXT_FIXUP_HEADPHONE_MIC_PIN,
@@ -660,6 +661,15 @@ static const struct hda_fixup cxt_fixups[] = {
660661
.type = HDA_FIXUP_PINS,
661662
.v.pins = cxt_pincfg_lemote,
662663
},
664+
[CXT_PINCFG_COMPAQ_CQ60] = {
665+
.type = HDA_FIXUP_PINS,
666+
.v.pins = (const struct hda_pintbl[]) {
667+
/* 0x17 was falsely set up as a mic, it should 0x1d */
668+
{ 0x17, 0x400001f0 },
669+
{ 0x1d, 0x97a70120 },
670+
{ }
671+
}
672+
},
663673
[CXT_FIXUP_STEREO_DMIC] = {
664674
.type = HDA_FIXUP_FUNC,
665675
.v.func = cxt_fixup_stereo_dmic,
@@ -769,6 +779,7 @@ static const struct hda_model_fixup cxt5047_fixup_models[] = {
769779
};
770780

771781
static const struct snd_pci_quirk cxt5051_fixups[] = {
782+
SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60),
772783
SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
773784
{}
774785
};

sound/usb/quirks-table.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,6 +1773,36 @@ YAMAHA_DEVICE(0x7010, "UB99"),
17731773
}
17741774
}
17751775
},
1776+
{
1777+
USB_DEVICE(0x0582, 0x0159),
1778+
.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1779+
/* .vendor_name = "Roland", */
1780+
/* .product_name = "UA-22", */
1781+
.ifnum = QUIRK_ANY_INTERFACE,
1782+
.type = QUIRK_COMPOSITE,
1783+
.data = (const struct snd_usb_audio_quirk[]) {
1784+
{
1785+
.ifnum = 0,
1786+
.type = QUIRK_AUDIO_STANDARD_INTERFACE
1787+
},
1788+
{
1789+
.ifnum = 1,
1790+
.type = QUIRK_AUDIO_STANDARD_INTERFACE
1791+
},
1792+
{
1793+
.ifnum = 2,
1794+
.type = QUIRK_MIDI_FIXED_ENDPOINT,
1795+
.data = & (const struct snd_usb_midi_endpoint_info) {
1796+
.out_cables = 0x0001,
1797+
.in_cables = 0x0001
1798+
}
1799+
},
1800+
{
1801+
.ifnum = -1
1802+
}
1803+
}
1804+
}
1805+
},
17761806
/* this catches most recent vendor-specific Roland devices */
17771807
{
17781808
.match_flags = USB_DEVICE_ID_MATCH_VENDOR |

0 commit comments

Comments
 (0)