Skip to content

Commit d28be0c

Browse files
committed
Merge: ALSA: hda/tas2781: Add tas2781 hda SPI driver + 6.12.11 stable picks
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6275 This patch was used to add TAS2781 devices on SPI support in sound/pci/hda. Also, apply ALSA patches between 6.12.8 and 6.12.11 stable kernels. JIRA: https://issues.redhat.com/browse/RHEL-76110 ARK config change: https://gitlab.com/cki-project/kernel-ark/-/merge_requests/3660 CVE: CVE-2024-57893 Signed-off-by: Jaroslav Kysela <jkysela@redhat.com> Approved-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Desnes Nunes <desnesn@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Patrick Talbert <ptalbert@redhat.com>
2 parents a0327d1 + b32637d commit d28be0c

File tree

19 files changed

+3580
-93
lines changed

19 files changed

+3580
-93
lines changed

drivers/acpi/scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,6 +1753,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
17531753
{"CSC3557", },
17541754
{"INT33FE", },
17551755
{"INT3515", },
1756+
{"TXNW2781", },
17561757
/* Non-conforming _HID for Cirrus Logic already released */
17571758
{"CLSA0100", },
17581759
{"CLSA0101", },

drivers/platform/x86/serial-multi-instantiate.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,17 @@ static const struct smi_node cs35l57_hda = {
369369
.bus_type = SMI_AUTO_DETECT,
370370
};
371371

372+
static const struct smi_node tas2781_hda = {
373+
.instances = {
374+
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
375+
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
376+
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
377+
{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
378+
{}
379+
},
380+
.bus_type = SMI_AUTO_DETECT,
381+
};
382+
372383
/*
373384
* Note new device-ids must also be added to ignore_serial_bus_ids in
374385
* drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
@@ -381,6 +392,7 @@ static const struct acpi_device_id smi_acpi_ids[] = {
381392
{ "CSC3556", (unsigned long)&cs35l56_hda },
382393
{ "CSC3557", (unsigned long)&cs35l57_hda },
383394
{ "INT3515", (unsigned long)&int3515_data },
395+
{ "TXNW2781", (unsigned long)&tas2781_hda },
384396
/* Non-conforming _HID for Cirrus Logic already released */
385397
{ "CLSA0100", (unsigned long)&cs35l41_hda },
386398
{ "CLSA0101", (unsigned long)&cs35l41_hda },
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m

sound/core/seq/oss/seq_oss_device.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct seq_oss_chinfo {
5555
struct seq_oss_synthinfo {
5656
struct snd_seq_oss_arg arg;
5757
struct seq_oss_chinfo *ch;
58-
struct seq_oss_synth_sysex *sysex;
5958
int nr_voices;
6059
int opened;
6160
int is_midi;

sound/core/seq/oss/seq_oss_synth.c

Lines changed: 14 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@
2626
* definition of synth info records
2727
*/
2828

29-
/* sysex buffer */
30-
struct seq_oss_synth_sysex {
31-
int len;
32-
int skip;
33-
unsigned char buf[MAX_SYSEX_BUFLEN];
34-
};
35-
3629
/* synth info */
3730
struct seq_oss_synth {
3831
int seq_device;
@@ -318,8 +311,6 @@ snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp)
318311
}
319312
snd_use_lock_free(&rec->use_lock);
320313
}
321-
kfree(info->sysex);
322-
info->sysex = NULL;
323314
kfree(info->ch);
324315
info->ch = NULL;
325316
}
@@ -395,8 +386,6 @@ snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev)
395386
info = get_synthinfo_nospec(dp, dev);
396387
if (!info || !info->opened)
397388
return;
398-
if (info->sysex)
399-
info->sysex->len = 0; /* reset sysex */
400389
reset_channels(info);
401390
if (info->is_midi) {
402391
if (midi_synth_dev.opened <= 0)
@@ -408,8 +397,6 @@ snd_seq_oss_synth_reset(struct seq_oss_devinfo *dp, int dev)
408397
dp->file_mode) < 0) {
409398
midi_synth_dev.opened--;
410399
info->opened = 0;
411-
kfree(info->sysex);
412-
info->sysex = NULL;
413400
kfree(info->ch);
414401
info->ch = NULL;
415402
}
@@ -482,63 +469,26 @@ snd_seq_oss_synth_info(struct seq_oss_devinfo *dp, int dev)
482469

483470
/*
484471
* receive OSS 6 byte sysex packet:
485-
* the full sysex message will be sent if it reaches to the end of data
486-
* (0xff).
472+
* the event is filled and prepared for sending immediately
473+
* (i.e. sysex messages are fragmented)
487474
*/
488475
int
489476
snd_seq_oss_synth_sysex(struct seq_oss_devinfo *dp, int dev, unsigned char *buf, struct snd_seq_event *ev)
490477
{
491-
int i, send;
492-
unsigned char *dest;
493-
struct seq_oss_synth_sysex *sysex;
494-
struct seq_oss_synthinfo *info;
478+
unsigned char *p;
479+
int len = 6;
495480

496-
info = snd_seq_oss_synth_info(dp, dev);
497-
if (!info)
498-
return -ENXIO;
481+
p = memchr(buf, 0xff, 6);
482+
if (p)
483+
len = p - buf + 1;
499484

500-
sysex = info->sysex;
501-
if (sysex == NULL) {
502-
sysex = kzalloc(sizeof(*sysex), GFP_KERNEL);
503-
if (sysex == NULL)
504-
return -ENOMEM;
505-
info->sysex = sysex;
506-
}
507-
508-
send = 0;
509-
dest = sysex->buf + sysex->len;
510-
/* copy 6 byte packet to the buffer */
511-
for (i = 0; i < 6; i++) {
512-
if (buf[i] == 0xff) {
513-
send = 1;
514-
break;
515-
}
516-
dest[i] = buf[i];
517-
sysex->len++;
518-
if (sysex->len >= MAX_SYSEX_BUFLEN) {
519-
sysex->len = 0;
520-
sysex->skip = 1;
521-
break;
522-
}
523-
}
524-
525-
if (sysex->len && send) {
526-
if (sysex->skip) {
527-
sysex->skip = 0;
528-
sysex->len = 0;
529-
return -EINVAL; /* skip */
530-
}
531-
/* copy the data to event record and send it */
532-
ev->flags = SNDRV_SEQ_EVENT_LENGTH_VARIABLE;
533-
if (snd_seq_oss_synth_addr(dp, dev, ev))
534-
return -EINVAL;
535-
ev->data.ext.len = sysex->len;
536-
ev->data.ext.ptr = sysex->buf;
537-
sysex->len = 0;
538-
return 0;
539-
}
540-
541-
return -EINVAL; /* skip */
485+
/* copy the data to event record and send it */
486+
if (snd_seq_oss_synth_addr(dp, dev, ev))
487+
return -EINVAL;
488+
ev->flags = SNDRV_SEQ_EVENT_LENGTH_VARIABLE;
489+
ev->data.ext.len = len;
490+
ev->data.ext.ptr = buf;
491+
return 0;
542492
}
543493

544494
/*

sound/core/seq/seq_clientmgr.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,10 +1275,16 @@ static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
12751275
if (client->type != client_info->type)
12761276
return -EINVAL;
12771277

1278-
/* check validity of midi_version field */
1279-
if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3) &&
1280-
client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)
1281-
return -EINVAL;
1278+
if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3)) {
1279+
/* check validity of midi_version field */
1280+
if (client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)
1281+
return -EINVAL;
1282+
1283+
/* check if UMP is supported in kernel */
1284+
if (!IS_ENABLED(CONFIG_SND_SEQ_UMP) &&
1285+
client_info->midi_version > 0)
1286+
return -EINVAL;
1287+
}
12821288

12831289
/* fill the info fields */
12841290
if (client_info->name[0])

sound/pci/hda/Kconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ config SND_HDA_SCODEC_TAS2781_I2C
206206
comment "Set to Y if you want auto-loading the side codec driver"
207207
depends on SND_HDA=y && SND_HDA_SCODEC_TAS2781_I2C=m
208208

209+
config SND_HDA_SCODEC_TAS2781_SPI
210+
tristate "Build TAS2781 HD-audio side codec support for SPI Bus"
211+
depends on SPI_MASTER
212+
depends on ACPI
213+
depends on EFI
214+
depends on SND_SOC
215+
select CRC32
216+
help
217+
Say Y or M here to include TAS2781 SPI HD-audio side codec support
218+
in snd-hda-intel driver, such as ALC287.
219+
220+
comment "Set to Y if you want auto-loading the side codec driver"
221+
depends on SND_HDA=y && SND_HDA_SCODEC_TAS2781_SPI=m
222+
209223
config SND_HDA_CODEC_REALTEK
210224
tristate "Build Realtek HD-audio codec support"
211225
select SND_HDA_GENERIC

sound/pci/hda/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ snd-hda-scodec-cs35l56-spi-y := cs35l56_hda_spi.o
4040
snd-hda-cs-dsp-ctls-y := hda_cs_dsp_ctl.o
4141
snd-hda-scodec-component-y := hda_component.o
4242
snd-hda-scodec-tas2781-i2c-y := tas2781_hda_i2c.o
43+
snd-hda-scodec-tas2781-spi-y := tas2781_hda_spi.o tas2781_spi_fwlib.o
4344

4445
# common driver
4546
obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
@@ -72,6 +73,7 @@ obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o
7273
obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o
7374
obj-$(CONFIG_SND_HDA_SCODEC_COMPONENT) += snd-hda-scodec-component.o
7475
obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_I2C) += snd-hda-scodec-tas2781-i2c.o
76+
obj-$(CONFIG_SND_HDA_SCODEC_TAS2781_SPI) += snd-hda-scodec-tas2781-spi.o
7577

7678
# this must be the last entry after codec drivers;
7779
# otherwise the codec patches won't be hooked before the PCI probe

sound/pci/hda/patch_ca0132.c

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,6 @@ struct ca0132_spec {
11341134

11351135
struct hda_codec *codec;
11361136
struct delayed_work unsol_hp_work;
1137-
int quirk;
11381137

11391138
#ifdef ENABLE_TUNING_CONTROLS
11401139
long cur_ctl_vals[TUNING_CTLS_COUNT];
@@ -1166,7 +1165,6 @@ struct ca0132_spec {
11661165
* CA0132 quirks table
11671166
*/
11681167
enum {
1169-
QUIRK_NONE,
11701168
QUIRK_ALIENWARE,
11711169
QUIRK_ALIENWARE_M17XR4,
11721170
QUIRK_SBZ,
@@ -1176,10 +1174,11 @@ enum {
11761174
QUIRK_R3D,
11771175
QUIRK_AE5,
11781176
QUIRK_AE7,
1177+
QUIRK_NONE = HDA_FIXUP_ID_NOT_SET,
11791178
};
11801179

11811180
#ifdef CONFIG_PCI
1182-
#define ca0132_quirk(spec) ((spec)->quirk)
1181+
#define ca0132_quirk(spec) ((spec)->codec->fixup_id)
11831182
#define ca0132_use_pci_mmio(spec) ((spec)->use_pci_mmio)
11841183
#define ca0132_use_alt_functions(spec) ((spec)->use_alt_functions)
11851184
#define ca0132_use_alt_controls(spec) ((spec)->use_alt_controls)
@@ -1293,7 +1292,7 @@ static const struct hda_pintbl ae7_pincfgs[] = {
12931292
{}
12941293
};
12951294

1296-
static const struct snd_pci_quirk ca0132_quirks[] = {
1295+
static const struct hda_quirk ca0132_quirks[] = {
12971296
SND_PCI_QUIRK(0x1028, 0x057b, "Alienware M17x R4", QUIRK_ALIENWARE_M17XR4),
12981297
SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
12991298
SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
@@ -1316,6 +1315,19 @@ static const struct snd_pci_quirk ca0132_quirks[] = {
13161315
{}
13171316
};
13181317

1318+
static const struct hda_model_fixup ca0132_quirk_models[] = {
1319+
{ .id = QUIRK_ALIENWARE, .name = "alienware" },
1320+
{ .id = QUIRK_ALIENWARE_M17XR4, .name = "alienware-m17xr4" },
1321+
{ .id = QUIRK_SBZ, .name = "sbz" },
1322+
{ .id = QUIRK_ZXR, .name = "zxr" },
1323+
{ .id = QUIRK_ZXR_DBPRO, .name = "zxr-dbpro" },
1324+
{ .id = QUIRK_R3DI, .name = "r3di" },
1325+
{ .id = QUIRK_R3D, .name = "r3d" },
1326+
{ .id = QUIRK_AE5, .name = "ae5" },
1327+
{ .id = QUIRK_AE7, .name = "ae7" },
1328+
{}
1329+
};
1330+
13191331
/* Output selection quirk info structures. */
13201332
#define MAX_QUIRK_MMIO_GPIO_SET_VALS 3
13211333
#define MAX_QUIRK_SCP_SET_VALS 2
@@ -9957,17 +9969,15 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
99579969
*/
99589970
static void sbz_detect_quirk(struct hda_codec *codec)
99599971
{
9960-
struct ca0132_spec *spec = codec->spec;
9961-
99629972
switch (codec->core.subsystem_id) {
99639973
case 0x11020033:
9964-
spec->quirk = QUIRK_ZXR;
9974+
codec->fixup_id = QUIRK_ZXR;
99659975
break;
99669976
case 0x1102003f:
9967-
spec->quirk = QUIRK_ZXR_DBPRO;
9977+
codec->fixup_id = QUIRK_ZXR_DBPRO;
99689978
break;
99699979
default:
9970-
spec->quirk = QUIRK_SBZ;
9980+
codec->fixup_id = QUIRK_SBZ;
99719981
break;
99729982
}
99739983
}
@@ -9976,7 +9986,6 @@ static int patch_ca0132(struct hda_codec *codec)
99769986
{
99779987
struct ca0132_spec *spec;
99789988
int err;
9979-
const struct snd_pci_quirk *quirk;
99809989

99819990
codec_dbg(codec, "patch_ca0132\n");
99829991

@@ -9987,11 +9996,7 @@ static int patch_ca0132(struct hda_codec *codec)
99879996
spec->codec = codec;
99889997

99899998
/* Detect codec quirk */
9990-
quirk = snd_pci_quirk_lookup(codec->bus->pci, ca0132_quirks);
9991-
if (quirk)
9992-
spec->quirk = quirk->value;
9993-
else
9994-
spec->quirk = QUIRK_NONE;
9999+
snd_hda_pick_fixup(codec, ca0132_quirk_models, ca0132_quirks, NULL);
999510000
if (ca0132_quirk(spec) == QUIRK_SBZ)
999610001
sbz_detect_quirk(codec);
999710002

@@ -10068,7 +10073,7 @@ static int patch_ca0132(struct hda_codec *codec)
1006810073
spec->mem_base = pci_iomap(codec->bus->pci, 2, 0xC20);
1006910074
if (spec->mem_base == NULL) {
1007010075
codec_warn(codec, "pci_iomap failed! Setting quirk to QUIRK_NONE.");
10071-
spec->quirk = QUIRK_NONE;
10076+
codec->fixup_id = QUIRK_NONE;
1007210077
}
1007310078
}
1007410079
#endif

0 commit comments

Comments
 (0)