Skip to content

Commit 262eef2

Browse files
committed
Merge tag 'sound-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Just a few small fixes: - A regression fix for HDMI audio on HD-audio AMD codecs - Fixes for LINE6 MIDI handling - HD-audio quirk for Dell laptops" * tag 'sound-6.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda/hdmi: Static PCM mapping again with AMD HDMI codecs ALSA: hda/realtek: Apply dual codec fixup for Dell Latitude laptops ALSA: line6: fix stack overflow in line6_midi_transmit ALSA: line6: correct midi status byte when receiving data from podxt
2 parents bff687b + 090ddad commit 262eef2

File tree

7 files changed

+61
-21
lines changed

7 files changed

+61
-21
lines changed

sound/pci/hda/patch_hdmi.c

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ struct hdmi_spec {
167167
struct hdmi_ops ops;
168168

169169
bool dyn_pin_out;
170+
bool static_pcm_mapping;
170171
/* hdmi interrupt trigger control flag for Nvidia codec */
171172
bool hdmi_intr_trig_ctrl;
172173
bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
@@ -1525,13 +1526,16 @@ static void update_eld(struct hda_codec *codec,
15251526
*/
15261527
pcm_jack = pin_idx_to_pcm_jack(codec, per_pin);
15271528

1528-
if (eld->eld_valid) {
1529-
hdmi_attach_hda_pcm(spec, per_pin);
1530-
hdmi_pcm_setup_pin(spec, per_pin);
1531-
} else {
1532-
hdmi_pcm_reset_pin(spec, per_pin);
1533-
hdmi_detach_hda_pcm(spec, per_pin);
1529+
if (!spec->static_pcm_mapping) {
1530+
if (eld->eld_valid) {
1531+
hdmi_attach_hda_pcm(spec, per_pin);
1532+
hdmi_pcm_setup_pin(spec, per_pin);
1533+
} else {
1534+
hdmi_pcm_reset_pin(spec, per_pin);
1535+
hdmi_detach_hda_pcm(spec, per_pin);
1536+
}
15341537
}
1538+
15351539
/* if pcm_idx == -1, it means this is in monitor connection event
15361540
* we can get the correct pcm_idx now.
15371541
*/
@@ -2281,8 +2285,8 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
22812285
struct hdmi_spec *spec = codec->spec;
22822286
int idx, pcm_num;
22832287

2284-
/* limit the PCM devices to the codec converters */
2285-
pcm_num = spec->num_cvts;
2288+
/* limit the PCM devices to the codec converters or available PINs */
2289+
pcm_num = min(spec->num_cvts, spec->num_pins);
22862290
codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num);
22872291

22882292
for (idx = 0; idx < pcm_num; idx++) {
@@ -2379,6 +2383,11 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
23792383
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
23802384
struct hdmi_eld *pin_eld = &per_pin->sink_eld;
23812385

2386+
if (spec->static_pcm_mapping) {
2387+
hdmi_attach_hda_pcm(spec, per_pin);
2388+
hdmi_pcm_setup_pin(spec, per_pin);
2389+
}
2390+
23822391
pin_eld->eld_valid = false;
23832392
hdmi_present_sense(per_pin, 0);
23842393
}
@@ -4419,6 +4428,8 @@ static int patch_atihdmi(struct hda_codec *codec)
44194428

44204429
spec = codec->spec;
44214430

4431+
spec->static_pcm_mapping = true;
4432+
44224433
spec->ops.pin_get_eld = atihdmi_pin_get_eld;
44234434
spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
44244435
spec->ops.pin_hbr_setup = atihdmi_pin_hbr_setup;

sound/pci/hda/patch_realtek.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7175,6 +7175,7 @@ enum {
71757175
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK,
71767176
ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN,
71777177
ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS,
7178+
ALC236_FIXUP_DELL_DUAL_CODECS,
71787179
};
71797180

71807181
/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9130,6 +9131,12 @@ static const struct hda_fixup alc269_fixups[] = {
91309131
.chained = true,
91319132
.chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
91329133
},
9134+
[ALC236_FIXUP_DELL_DUAL_CODECS] = {
9135+
.type = HDA_FIXUP_PINS,
9136+
.v.func = alc1220_fixup_gb_dual_codecs,
9137+
.chained = true,
9138+
.chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9139+
},
91339140
};
91349141

91359142
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9232,6 +9239,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
92329239
SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
92339240
SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
92349241
SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
9242+
SND_PCI_QUIRK(0x1028, 0x0c19, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9243+
SND_PCI_QUIRK(0x1028, 0x0c1a, "Dell Precision 3340", ALC236_FIXUP_DELL_DUAL_CODECS),
9244+
SND_PCI_QUIRK(0x1028, 0x0c1b, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9245+
SND_PCI_QUIRK(0x1028, 0x0c1c, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
9246+
SND_PCI_QUIRK(0x1028, 0x0c1d, "Dell Precision 3440", ALC236_FIXUP_DELL_DUAL_CODECS),
9247+
SND_PCI_QUIRK(0x1028, 0x0c1e, "Dell Precision 3540", ALC236_FIXUP_DELL_DUAL_CODECS),
92359248
SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
92369249
SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
92379250
SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),

sound/usb/line6/driver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ static void line6_data_received(struct urb *urb)
304304
for (;;) {
305305
done =
306306
line6_midibuf_read(mb, line6->buffer_message,
307-
LINE6_MIDI_MESSAGE_MAXLEN);
307+
LINE6_MIDI_MESSAGE_MAXLEN,
308+
LINE6_MIDIBUF_READ_RX);
308309

309310
if (done <= 0)
310311
break;

sound/usb/line6/midi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ static void line6_midi_transmit(struct snd_rawmidi_substream *substream)
4444
int req, done;
4545

4646
for (;;) {
47-
req = min(line6_midibuf_bytes_free(mb), line6->max_packet_size);
47+
req = min3(line6_midibuf_bytes_free(mb), line6->max_packet_size,
48+
LINE6_FALLBACK_MAXPACKETSIZE);
4849
done = snd_rawmidi_transmit_peek(substream, chunk, req);
4950

5051
if (done == 0)
@@ -56,7 +57,8 @@ static void line6_midi_transmit(struct snd_rawmidi_substream *substream)
5657

5758
for (;;) {
5859
done = line6_midibuf_read(mb, chunk,
59-
LINE6_FALLBACK_MAXPACKETSIZE);
60+
LINE6_FALLBACK_MAXPACKETSIZE,
61+
LINE6_MIDIBUF_READ_TX);
6062

6163
if (done == 0)
6264
break;

sound/usb/line6/midibuf.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "midibuf.h"
1111

12+
1213
static int midibuf_message_length(unsigned char code)
1314
{
1415
int message_length;
@@ -20,12 +21,7 @@ static int midibuf_message_length(unsigned char code)
2021

2122
message_length = length[(code >> 4) - 8];
2223
} else {
23-
/*
24-
Note that according to the MIDI specification 0xf2 is
25-
the "Song Position Pointer", but this is used by Line 6
26-
to send sysex messages to the host.
27-
*/
28-
static const int length[] = { -1, 2, -1, 2, -1, -1, 1, 1, 1, 1,
24+
static const int length[] = { -1, 2, 2, 2, -1, -1, 1, 1, 1, -1,
2925
1, 1, 1, -1, 1, 1
3026
};
3127
message_length = length[code & 0x0f];
@@ -125,7 +121,7 @@ int line6_midibuf_write(struct midi_buffer *this, unsigned char *data,
125121
}
126122

127123
int line6_midibuf_read(struct midi_buffer *this, unsigned char *data,
128-
int length)
124+
int length, int read_type)
129125
{
130126
int bytes_used;
131127
int length1, length2;
@@ -148,9 +144,22 @@ int line6_midibuf_read(struct midi_buffer *this, unsigned char *data,
148144

149145
length1 = this->size - this->pos_read;
150146

151-
/* check MIDI command length */
152147
command = this->buf[this->pos_read];
148+
/*
149+
PODxt always has status byte lower nibble set to 0010,
150+
when it means to send 0000, so we correct if here so
151+
that control/program changes come on channel 1 and
152+
sysex message status byte is correct
153+
*/
154+
if (read_type == LINE6_MIDIBUF_READ_RX) {
155+
if (command == 0xb2 || command == 0xc2 || command == 0xf2) {
156+
unsigned char fixed = command & 0xf0;
157+
this->buf[this->pos_read] = fixed;
158+
command = fixed;
159+
}
160+
}
153161

162+
/* check MIDI command length */
154163
if (command & 0x80) {
155164
midi_length = midibuf_message_length(command);
156165
this->command_prev = command;

sound/usb/line6/midibuf.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
#ifndef MIDIBUF_H
99
#define MIDIBUF_H
1010

11+
#define LINE6_MIDIBUF_READ_TX 0
12+
#define LINE6_MIDIBUF_READ_RX 1
13+
1114
struct midi_buffer {
1215
unsigned char *buf;
1316
int size;
@@ -23,7 +26,7 @@ extern void line6_midibuf_destroy(struct midi_buffer *mb);
2326
extern int line6_midibuf_ignore(struct midi_buffer *mb, int length);
2427
extern int line6_midibuf_init(struct midi_buffer *mb, int size, int split);
2528
extern int line6_midibuf_read(struct midi_buffer *mb, unsigned char *data,
26-
int length);
29+
int length, int read_type);
2730
extern void line6_midibuf_reset(struct midi_buffer *mb);
2831
extern int line6_midibuf_write(struct midi_buffer *mb, unsigned char *data,
2932
int length);

sound/usb/line6/pod.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ static struct line6_pcm_properties pod_pcm_properties = {
159159
.bytes_per_channel = 3 /* SNDRV_PCM_FMTBIT_S24_3LE */
160160
};
161161

162+
162163
static const char pod_version_header[] = {
163-
0xf2, 0x7e, 0x7f, 0x06, 0x02
164+
0xf0, 0x7e, 0x7f, 0x06, 0x02
164165
};
165166

166167
static char *pod_alloc_sysex_buffer(struct usb_line6_pod *pod, int code,

0 commit comments

Comments
 (0)