Skip to content

Commit e069642

Browse files
committed
Merge tag 'asoc-fix-v6.8-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v6.8 A bunch of small fixes that come in during the merge window, mainly fixing issues from some core refactoring around dummy components that weren't detected until things reached mainline. The TAS driver changes are a little larger than normal for a device ID addition due to some shuffling around of where things are registered and DT updates but aren't really any more substantial than normal.
2 parents b018cee + ab09fb9 commit e069642

File tree

16 files changed

+161
-120
lines changed

16 files changed

+161
-120
lines changed

Documentation/devicetree/bindings/sound/tas2562.yaml

Lines changed: 0 additions & 2 deletions
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

Lines changed: 63 additions & 15 deletions
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 <shenghao-ding@ti.com>
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

Lines changed: 5 additions & 4 deletions
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 <shenghao-ding@ti.com>
1313
// Author: Kevin Lu <kevin-lu@ti.com>
@@ -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/soc/codecs/rtq9128.c

Lines changed: 41 additions & 32 deletions
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;

sound/soc/codecs/tas2562.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct tas2562_data {
5959

6060
enum tas256x_model {
6161
TAS2562,
62-
TAS2563,
6362
TAS2564,
6463
TAS2110,
6564
};
@@ -721,7 +720,6 @@ static int tas2562_parse_dt(struct tas2562_data *tas2562)
721720

722721
static const struct i2c_device_id tas2562_id[] = {
723722
{ "tas2562", TAS2562 },
724-
{ "tas2563", TAS2563 },
725723
{ "tas2564", TAS2564 },
726724
{ "tas2110", TAS2110 },
727725
{ }
@@ -770,7 +768,6 @@ static int tas2562_probe(struct i2c_client *client)
770768
#ifdef CONFIG_OF
771769
static const struct of_device_id tas2562_of_match[] = {
772770
{ .compatible = "ti,tas2562", },
773-
{ .compatible = "ti,tas2563", },
774771
{ .compatible = "ti,tas2564", },
775772
{ .compatible = "ti,tas2110", },
776773
{ },

sound/soc/codecs/tas2781-i2c.c

Lines changed: 5 additions & 3 deletions
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 <shenghao-ding@ti.com>
1313
// Author: Kevin Lu <kevin-lu@ti.com>
@@ -32,13 +32,15 @@
3232
#include <sound/tas2781-tlv.h>
3333

3434
static const struct i2c_device_id tasdevice_id[] = {
35+
{ "tas2563", TAS2563 },
3536
{ "tas2781", TAS2781 },
3637
{}
3738
};
3839
MODULE_DEVICE_TABLE(i2c, tasdevice_id);
3940

4041
#ifdef CONFIG_OF
4142
static const struct of_device_id tasdevice_of_match[] = {
43+
{ .compatible = "ti,tas2563" },
4244
{ .compatible = "ti,tas2781" },
4345
{},
4446
};

sound/soc/generic/audio-graph-card2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link,
556556
struct device_node *mcodec_port;
557557
int codec_idx;
558558

559-
if (*nm_idx >= nm_max)
559+
if (*nm_idx > nm_max)
560560
break;
561561

562562
mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n);

sound/soc/intel/boards/bxt_da7219_max98357a.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,9 @@ static int broxton_audio_probe(struct platform_device *pdev)
797797
broxton_audio_card.name = "glkda7219max";
798798
/* Fixup the SSP entries for geminilake */
799799
for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
800+
if (!broxton_dais[i].codecs->dai_name)
801+
continue;
802+
800803
/* MAXIM_CODEC is connected to SSP1. */
801804
if (!strcmp(broxton_dais[i].codecs->dai_name,
802805
BXT_MAXIM_CODEC_DAI)) {
@@ -822,6 +825,9 @@ static int broxton_audio_probe(struct platform_device *pdev)
822825
broxton_audio_card.name = "cmlda7219max";
823826

824827
for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
828+
if (!broxton_dais[i].codecs->dai_name)
829+
continue;
830+
825831
/* MAXIM_CODEC is connected to SSP1. */
826832
if (!strcmp(broxton_dais[i].codecs->dai_name,
827833
BXT_MAXIM_CODEC_DAI)) {

sound/soc/intel/boards/bxt_rt298.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,8 @@ static int broxton_audio_probe(struct platform_device *pdev)
604604
int i;
605605

606606
for (i = 0; i < ARRAY_SIZE(broxton_rt298_dais); i++) {
607-
if (!strncmp(card->dai_link[i].codecs->name, "i2c-INT343A:00",
607+
if (card->dai_link[i].codecs->name &&
608+
!strncmp(card->dai_link[i].codecs->name, "i2c-INT343A:00",
608609
I2C_NAME_SIZE)) {
609610
if (!strncmp(card->name, "broxton-rt298",
610611
PLATFORM_NAME_SIZE)) {

sound/soc/mediatek/common/mtk-dsp-sof-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ int mtk_sof_dai_link_fixup(struct snd_soc_pcm_runtime *rtd,
2424
struct snd_soc_dai_link *sof_dai_link = NULL;
2525
const struct sof_conn_stream *conn = &sof_priv->conn_streams[i];
2626

27-
if (strcmp(rtd->dai_link->name, conn->normal_link))
27+
if (conn->normal_link && strcmp(rtd->dai_link->name, conn->normal_link))
2828
continue;
2929

3030
for_each_card_rtds(card, runtime) {

0 commit comments

Comments
 (0)