Skip to content

Commit a1fe5b6

Browse files
committed
Merge tag 'sound-fix-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of small fixes: - Lots of ASoC SOF fixes and related reworks - ASoC TAS codec fixes including DT updates - A few HD-audio quirks and regression fixes - Minor fixes for aloop, oxygen and scarlett2 mixer" * tag 'sound-fix-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (23 commits) ALSA: hda/realtek: Enable headset mic on Lenovo M70 Gen5 ALSA: hda/realtek: Enable mute/micmute LEDs and limit mic boost on HP ZBook ALSA: hda/relatek: Enable Mute LED on HP Laptop 15s-fq2xxx ASoC: SOF: ipc4-loader: remove the CPC check warnings ASoC: SOF: ipc4-pcm: remove log message for LLP ALSA: hda: generic: Remove obsolete call to ledtrig_audio_get ALSA: scarlett2: Fix yet more -Wformat-truncation warnings ALSA: hda: Properly setup HDMI stream ASoC: audio-graph-card2: fix index check on graph_parse_node_multi_nm() ASoC: SOF: icp3-dtrace: Revert "Fix wrong kfree() usage" ALSA: oxygen: Fix right channel of capture volume mixer ALSA: aloop: Introduce a function to get if access is interleaved mode ASoC: mediatek: sof-common: Add NULL check for normal_link string ASoC: mediatek: mt8195: Remove afe-dai component and rework codec link ASoC: mediatek: mt8192: Check existence of dai_name before dereferencing ASoC: Intel: bxt_rt298: Fix kernel ops due to COMP_DUMMY change ASoC: Intel: bxt_da7219_max98357a: Fix kernel ops due to COMP_DUMMY change ASoC: codecs: rtq9128: Fix TDM enable and DAI format control flow ASoC: codecs: rtq9128: Fix PM_RUNTIME usage ASoC: tas2781: Add tas2563 into driver ...
2 parents e08b575 + fb3c007 commit a1fe5b6

22 files changed

+209
-149
lines changed

Documentation/devicetree/bindings/sound/tas2562.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ description: |
1818
1919
Specifications about the audio amplifier can be found at:
2020
https://www.ti.com/lit/gpn/tas2562
21-
https://www.ti.com/lit/gpn/tas2563
2221
https://www.ti.com/lit/gpn/tas2564
2322
https://www.ti.com/lit/gpn/tas2110
2423
@@ -29,7 +28,6 @@ properties:
2928
compatible:
3029
enum:
3130
- ti,tas2562
32-
- ti,tas2563
3331
- ti,tas2564
3432
- ti,tas2110
3533

Documentation/devicetree/bindings/sound/ti,tas2781.yaml

+63-15
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,46 @@
55
$id: http://devicetree.org/schemas/sound/ti,tas2781.yaml#
66
$schema: http://devicetree.org/meta-schemas/core.yaml#
77

8-
title: Texas Instruments TAS2781 SmartAMP
8+
title: Texas Instruments TAS2563/TAS2781 SmartAMP
99

1010
maintainers:
1111
- Shenghao Ding <[email protected]>
1212

13-
description:
14-
The TAS2781 is a mono, digital input Class-D audio amplifier
15-
optimized for efficiently driving high peak power into small
16-
loudspeakers. An integrated on-chip DSP supports Texas Instruments
17-
Smart Amp speaker protection algorithm. The integrated speaker
18-
voltage and current sense provides for real time
13+
description: |
14+
The TAS2563/TAS2781 is a mono, digital input Class-D audio
15+
amplifier optimized for efficiently driving high peak power into
16+
small loudspeakers. An integrated on-chip DSP supports Texas
17+
Instruments Smart Amp speaker protection algorithm. The
18+
integrated speaker voltage and current sense provides for real time
1919
monitoring of loudspeaker behavior.
2020
21-
allOf:
22-
- $ref: dai-common.yaml#
21+
Specifications about the audio amplifier can be found at:
22+
https://www.ti.com/lit/gpn/tas2563
23+
https://www.ti.com/lit/gpn/tas2781
2324
2425
properties:
2526
compatible:
26-
enum:
27-
- ti,tas2781
27+
description: |
28+
ti,tas2563: 6.1-W Boosted Class-D Audio Amplifier With Integrated
29+
DSP and IV Sense, 16/20/24/32bit stereo I2S or multichannel TDM.
30+
31+
ti,tas2781: 24-V Class-D Amplifier with Real Time Integrated Speaker
32+
Protection and Audio Processing, 16/20/24/32bit stereo I2S or
33+
multichannel TDM.
34+
oneOf:
35+
- items:
36+
- enum:
37+
- ti,tas2563
38+
- const: ti,tas2781
39+
- enum:
40+
- ti,tas2781
2841

2942
reg:
3043
description:
31-
I2C address, in multiple tas2781s case, all the i2c address
44+
I2C address, in multiple-AMP case, all the i2c address
3245
aggregate as one Audio Device to support multiple audio slots.
3346
maxItems: 8
3447
minItems: 1
35-
items:
36-
minimum: 0x38
37-
maximum: 0x3f
3848

3949
reset-gpios:
4050
maxItems: 1
@@ -49,6 +59,44 @@ required:
4959
- compatible
5060
- reg
5161

62+
allOf:
63+
- $ref: dai-common.yaml#
64+
- if:
65+
properties:
66+
compatible:
67+
contains:
68+
enum:
69+
- ti,tas2563
70+
then:
71+
properties:
72+
reg:
73+
description:
74+
I2C address, in multiple-AMP case, all the i2c address
75+
aggregate as one Audio Device to support multiple audio slots.
76+
maxItems: 4
77+
minItems: 1
78+
items:
79+
minimum: 0x4c
80+
maximum: 0x4f
81+
82+
- if:
83+
properties:
84+
compatible:
85+
contains:
86+
enum:
87+
- ti,tas2781
88+
then:
89+
properties:
90+
reg:
91+
description:
92+
I2C address, in multiple-AMP case, all the i2c address
93+
aggregate as one Audio Device to support multiple audio slots.
94+
maxItems: 8
95+
minItems: 1
96+
items:
97+
minimum: 0x38
98+
maximum: 0x3f
99+
52100
additionalProperties: false
53101

54102
examples:

include/sound/tas2781.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
//
3-
// ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
3+
// ALSA SoC Texas Instruments TAS2563/TAS2781 Audio Smart Amplifier
44
//
55
// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
66
// https://www.ti.com
77
//
8-
// The TAS2781 driver implements a flexible and configurable
8+
// The TAS2563/TAS2781 driver implements a flexible and configurable
99
// algo coefficient setting for one, two, or even multiple
10-
// TAS2781 chips.
10+
// TAS2563/TAS2781 chips.
1111
//
1212
// Author: Shenghao Ding <[email protected]>
1313
// Author: Kevin Lu <[email protected]>
@@ -60,7 +60,8 @@
6060
#define TASDEVICE_CMD_FIELD_W 0x4
6161

6262
enum audio_device {
63-
TAS2781 = 0,
63+
TAS2563,
64+
TAS2781,
6465
};
6566

6667
enum device_catlog_id {

sound/drivers/aloop.c

+17-6
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ static int loopback_snd_timer_close_cable(struct loopback_pcm *dpcm)
322322
return 0;
323323
}
324324

325+
static bool is_access_interleaved(snd_pcm_access_t access)
326+
{
327+
switch (access) {
328+
case SNDRV_PCM_ACCESS_MMAP_INTERLEAVED:
329+
case SNDRV_PCM_ACCESS_RW_INTERLEAVED:
330+
return true;
331+
default:
332+
return false;
333+
}
334+
};
335+
325336
static int loopback_check_format(struct loopback_cable *cable, int stream)
326337
{
327338
struct snd_pcm_runtime *runtime, *cruntime;
@@ -341,7 +352,8 @@ static int loopback_check_format(struct loopback_cable *cable, int stream)
341352
check = runtime->format != cruntime->format ||
342353
runtime->rate != cruntime->rate ||
343354
runtime->channels != cruntime->channels ||
344-
runtime->access != cruntime->access;
355+
is_access_interleaved(runtime->access) !=
356+
is_access_interleaved(cruntime->access);
345357
if (!check)
346358
return 0;
347359
if (stream == SNDRV_PCM_STREAM_CAPTURE) {
@@ -369,7 +381,8 @@ static int loopback_check_format(struct loopback_cable *cable, int stream)
369381
&setup->channels_id);
370382
setup->channels = runtime->channels;
371383
}
372-
if (setup->access != runtime->access) {
384+
if (is_access_interleaved(setup->access) !=
385+
is_access_interleaved(runtime->access)) {
373386
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
374387
&setup->access_id);
375388
setup->access = runtime->access;
@@ -584,8 +597,7 @@ static void copy_play_buf(struct loopback_pcm *play,
584597
size = play->pcm_buffer_size - src_off;
585598
if (dst_off + size > capt->pcm_buffer_size)
586599
size = capt->pcm_buffer_size - dst_off;
587-
if (runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ||
588-
runtime->access == SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED)
600+
if (!is_access_interleaved(runtime->access))
589601
copy_play_buf_part_n(play, capt, size, src_off, dst_off);
590602
else
591603
memcpy(dst + dst_off, src + src_off, size);
@@ -1544,8 +1556,7 @@ static int loopback_access_get(struct snd_kcontrol *kcontrol,
15441556
mutex_lock(&loopback->cable_lock);
15451557
access = loopback->setup[kcontrol->id.subdevice][kcontrol->id.device].access;
15461558

1547-
ucontrol->value.enumerated.item[0] = access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ||
1548-
access == SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED;
1559+
ucontrol->value.enumerated.item[0] = !is_access_interleaved(access);
15491560

15501561
mutex_unlock(&loopback->cable_lock);
15511562
return 0;

sound/pci/hda/hda_generic.c

-1
Original file line numberDiff line numberDiff line change
@@ -3946,7 +3946,6 @@ static int create_mute_led_cdev(struct hda_codec *codec,
39463946
cdev->max_brightness = 1;
39473947
cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
39483948
cdev->brightness_set_blocking = callback;
3949-
cdev->brightness = ledtrig_audio_get(idx);
39503949
cdev->flags = LED_CORE_SUSPENDRESUME;
39513950

39523951
err = led_classdev_register(&codec->core.dev, cdev);

sound/pci/hda/patch_hdmi.c

+6
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
23012301
codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num);
23022302

23032303
for (idx = 0; idx < pcm_num; idx++) {
2304+
struct hdmi_spec_per_cvt *per_cvt;
23042305
struct hda_pcm *info;
23052306
struct hda_pcm_stream *pstr;
23062307

@@ -2316,6 +2317,11 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
23162317
pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK];
23172318
pstr->substreams = 1;
23182319
pstr->ops = generic_ops;
2320+
2321+
per_cvt = get_cvt(spec, 0);
2322+
pstr->channels_min = per_cvt->channels_min;
2323+
pstr->channels_max = per_cvt->channels_max;
2324+
23192325
/* pcm number is less than pcm_rec array size */
23202326
if (spec->pcm_used >= ARRAY_SIZE(spec->pcm_rec))
23212327
break;

sound/pci/hda/patch_realtek.c

+3
Original file line numberDiff line numberDiff line change
@@ -9861,6 +9861,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
98619861
SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
98629862
SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
98639863
SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
9864+
SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
98649865
SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
98659866
SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
98669867
SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
@@ -9955,6 +9956,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
99559956
SND_PCI_QUIRK(0x103c, 0x8c71, "HP EliteBook 845 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
99569957
SND_PCI_QUIRK(0x103c, 0x8c72, "HP EliteBook 865 G11", ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),
99579958
SND_PCI_QUIRK(0x103c, 0x8c96, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
9959+
SND_PCI_QUIRK(0x103c, 0x8c97, "HP ZBook", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
99589960
SND_PCI_QUIRK(0x103c, 0x8ca4, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
99599961
SND_PCI_QUIRK(0x103c, 0x8ca7, "HP ZBook Fury", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
99609962
SND_PCI_QUIRK(0x103c, 0x8cf5, "HP ZBook Studio 16", ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED),
@@ -10231,6 +10233,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1023110233
SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
1023210234
SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
1023310235
SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
10236+
SND_PCI_QUIRK(0x17aa, 0x334b, "Lenovo ThinkCentre M70 Gen5", ALC283_FIXUP_HEADSET_MIC),
1023410237
SND_PCI_QUIRK(0x17aa, 0x3801, "Lenovo Yoga9 14IAP7", ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN),
1023510238
SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
1023610239
SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),

sound/pci/oxygen/oxygen_mixer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ static int ac97_fp_rec_volume_put(struct snd_kcontrol *ctl,
718718
oldreg = oxygen_read_ac97(chip, 1, AC97_REC_GAIN);
719719
newreg = oldreg & ~0x0707;
720720
newreg = newreg | (value->value.integer.value[0] & 7);
721-
newreg = newreg | ((value->value.integer.value[0] & 7) << 8);
721+
newreg = newreg | ((value->value.integer.value[1] & 7) << 8);
722722
change = newreg != oldreg;
723723
if (change)
724724
oxygen_write_ac97(chip, 1, AC97_REC_GAIN, newreg);

sound/soc/codecs/rtq9128.c

+41-32
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
struct rtq9128_data {
6161
struct gpio_desc *enable;
62+
unsigned int daifmt;
6263
int tdm_slots;
6364
int tdm_slot_width;
6465
bool tdm_input_data2_select;
@@ -391,7 +392,11 @@ static int rtq9128_component_probe(struct snd_soc_component *comp)
391392
unsigned int val;
392393
int i, ret;
393394

394-
pm_runtime_resume_and_get(comp->dev);
395+
ret = pm_runtime_resume_and_get(comp->dev);
396+
if (ret < 0) {
397+
dev_err(comp->dev, "Failed to resume device (%d)\n", ret);
398+
return ret;
399+
}
395400

396401
val = snd_soc_component_read(comp, RTQ9128_REG_EFUSE_DATA);
397402

@@ -437,10 +442,7 @@ static const struct snd_soc_component_driver rtq9128_comp_driver = {
437442
static int rtq9128_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
438443
{
439444
struct rtq9128_data *data = snd_soc_dai_get_drvdata(dai);
440-
struct snd_soc_component *comp = dai->component;
441445
struct device *dev = dai->dev;
442-
unsigned int audfmt, fmtval;
443-
int ret;
444446

445447
dev_dbg(dev, "%s: fmt 0x%8x\n", __func__, fmt);
446448

@@ -450,35 +452,10 @@ static int rtq9128_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
450452
return -EINVAL;
451453
}
452454

453-
fmtval = fmt & SND_SOC_DAIFMT_FORMAT_MASK;
454-
if (data->tdm_slots && fmtval != SND_SOC_DAIFMT_DSP_A && fmtval != SND_SOC_DAIFMT_DSP_B) {
455-
dev_err(dev, "TDM is used, format only support DSP_A or DSP_B\n");
456-
return -EINVAL;
457-
}
455+
/* Store here and will be used in runtime hw_params for DAI format setting */
456+
data->daifmt = fmt;
458457

459-
switch (fmtval) {
460-
case SND_SOC_DAIFMT_I2S:
461-
audfmt = 8;
462-
break;
463-
case SND_SOC_DAIFMT_LEFT_J:
464-
audfmt = 9;
465-
break;
466-
case SND_SOC_DAIFMT_RIGHT_J:
467-
audfmt = 10;
468-
break;
469-
case SND_SOC_DAIFMT_DSP_A:
470-
audfmt = data->tdm_slots ? 12 : 11;
471-
break;
472-
case SND_SOC_DAIFMT_DSP_B:
473-
audfmt = data->tdm_slots ? 4 : 3;
474-
break;
475-
default:
476-
dev_err(dev, "Unsupported format 0x%8x\n", fmt);
477-
return -EINVAL;
478-
}
479-
480-
ret = snd_soc_component_write_field(comp, RTQ9128_REG_I2S_OPT, RTQ9128_AUDFMT_MASK, audfmt);
481-
return ret < 0 ? ret : 0;
458+
return 0;
482459
}
483460

484461
static int rtq9128_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
@@ -554,10 +531,38 @@ static int rtq9128_dai_hw_params(struct snd_pcm_substream *stream, struct snd_pc
554531
unsigned int width, slot_width, bitrate, audbit, dolen;
555532
struct snd_soc_component *comp = dai->component;
556533
struct device *dev = dai->dev;
534+
unsigned int fmtval, audfmt;
557535
int ret;
558536

559537
dev_dbg(dev, "%s: width %d\n", __func__, params_width(param));
560538

539+
fmtval = FIELD_GET(SND_SOC_DAIFMT_FORMAT_MASK, data->daifmt);
540+
if (data->tdm_slots && fmtval != SND_SOC_DAIFMT_DSP_A && fmtval != SND_SOC_DAIFMT_DSP_B) {
541+
dev_err(dev, "TDM is used, format only support DSP_A or DSP_B\n");
542+
return -EINVAL;
543+
}
544+
545+
switch (fmtval) {
546+
case SND_SOC_DAIFMT_I2S:
547+
audfmt = 8;
548+
break;
549+
case SND_SOC_DAIFMT_LEFT_J:
550+
audfmt = 9;
551+
break;
552+
case SND_SOC_DAIFMT_RIGHT_J:
553+
audfmt = 10;
554+
break;
555+
case SND_SOC_DAIFMT_DSP_A:
556+
audfmt = data->tdm_slots ? 12 : 11;
557+
break;
558+
case SND_SOC_DAIFMT_DSP_B:
559+
audfmt = data->tdm_slots ? 4 : 3;
560+
break;
561+
default:
562+
dev_err(dev, "Unsupported format 0x%8x\n", fmtval);
563+
return -EINVAL;
564+
}
565+
561566
switch (width = params_width(param)) {
562567
case 16:
563568
audbit = 0;
@@ -611,6 +616,10 @@ static int rtq9128_dai_hw_params(struct snd_pcm_substream *stream, struct snd_pc
611616
return -EINVAL;
612617
}
613618

619+
ret = snd_soc_component_write_field(comp, RTQ9128_REG_I2S_OPT, RTQ9128_AUDFMT_MASK, audfmt);
620+
if (ret < 0)
621+
return ret;
622+
614623
ret = snd_soc_component_write_field(comp, RTQ9128_REG_I2S_OPT, RTQ9128_AUDBIT_MASK, audbit);
615624
if (ret < 0)
616625
return ret;

0 commit comments

Comments
 (0)