Skip to content

Commit dcd46eb

Browse files
committed
Merge tag 'asoc-fix-v5.16-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.16 There's a large but repetitive set of fixes here for issues with the Tegra kcontrols not correctly reporting changes to userspace, a fix for some issues with matching on older x86 platforms introduced during the merge window together with a set of smaller fixes and one new system quirk.
2 parents ae26c08 + 86f74ba commit dcd46eb

18 files changed

+802
-258
lines changed

include/sound/soc-acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct snd_soc_acpi_link_adr {
147147
*/
148148
/* Descriptor for SST ASoC machine driver */
149149
struct snd_soc_acpi_mach {
150-
const u8 id[ACPI_ID_LEN];
150+
u8 id[ACPI_ID_LEN];
151151
const struct snd_soc_acpi_codecs *comp_ids;
152152
const u32 link_mask;
153153
const struct snd_soc_acpi_link_adr *links;

sound/soc/codecs/cs35l41-spi.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,6 @@ static const struct spi_device_id cs35l41_id_spi[] = {
4242

4343
MODULE_DEVICE_TABLE(spi, cs35l41_id_spi);
4444

45-
static void cs35l41_spi_otp_setup(struct cs35l41_private *cs35l41,
46-
bool is_pre_setup, unsigned int *freq)
47-
{
48-
struct spi_device *spi;
49-
u32 orig_spi_freq;
50-
51-
spi = to_spi_device(cs35l41->dev);
52-
53-
if (!spi) {
54-
dev_err(cs35l41->dev, "%s: No SPI device\n", __func__);
55-
return;
56-
}
57-
58-
if (is_pre_setup) {
59-
orig_spi_freq = spi->max_speed_hz;
60-
if (orig_spi_freq > CS35L41_SPI_MAX_FREQ_OTP) {
61-
spi->max_speed_hz = CS35L41_SPI_MAX_FREQ_OTP;
62-
spi_setup(spi);
63-
}
64-
*freq = orig_spi_freq;
65-
} else {
66-
if (spi->max_speed_hz != *freq) {
67-
spi->max_speed_hz = *freq;
68-
spi_setup(spi);
69-
}
70-
}
71-
}
72-
7345
static int cs35l41_spi_probe(struct spi_device *spi)
7446
{
7547
const struct regmap_config *regmap_config = &cs35l41_regmap_spi;
@@ -81,6 +53,9 @@ static int cs35l41_spi_probe(struct spi_device *spi)
8153
if (!cs35l41)
8254
return -ENOMEM;
8355

56+
spi->max_speed_hz = CS35L41_SPI_MAX_FREQ;
57+
spi_setup(spi);
58+
8459
spi_set_drvdata(spi, cs35l41);
8560
cs35l41->regmap = devm_regmap_init_spi(spi, regmap_config);
8661
if (IS_ERR(cs35l41->regmap)) {
@@ -91,7 +66,6 @@ static int cs35l41_spi_probe(struct spi_device *spi)
9166

9267
cs35l41->dev = &spi->dev;
9368
cs35l41->irq = spi->irq;
94-
cs35l41->otp_setup = cs35l41_spi_otp_setup;
9569

9670
return cs35l41_probe(cs35l41, pdata);
9771
}

sound/soc/codecs/cs35l41.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ static int cs35l41_otp_unpack(void *data)
302302
const struct cs35l41_otp_packed_element_t *otp_map;
303303
struct cs35l41_private *cs35l41 = data;
304304
int bit_offset, word_offset, ret, i;
305-
unsigned int orig_spi_freq;
306305
unsigned int bit_sum = 8;
307306
u32 otp_val, otp_id_reg;
308307
u32 *otp_mem;
@@ -326,19 +325,13 @@ static int cs35l41_otp_unpack(void *data)
326325
goto err_otp_unpack;
327326
}
328327

329-
if (cs35l41->otp_setup)
330-
cs35l41->otp_setup(cs35l41, true, &orig_spi_freq);
331-
332328
ret = regmap_bulk_read(cs35l41->regmap, CS35L41_OTP_MEM0, otp_mem,
333329
CS35L41_OTP_SIZE_WORDS);
334330
if (ret < 0) {
335331
dev_err(cs35l41->dev, "Read OTP Mem failed: %d\n", ret);
336332
goto err_otp_unpack;
337333
}
338334

339-
if (cs35l41->otp_setup)
340-
cs35l41->otp_setup(cs35l41, false, &orig_spi_freq);
341-
342335
otp_map = otp_map_match->map;
343336

344337
bit_offset = otp_map_match->bit_offset;

sound/soc/codecs/cs35l41.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@
726726
#define CS35L41_FS2_WINDOW_MASK 0x00FFF800
727727
#define CS35L41_FS2_WINDOW_SHIFT 12
728728

729-
#define CS35L41_SPI_MAX_FREQ_OTP 4000000
729+
#define CS35L41_SPI_MAX_FREQ 4000000
730730

731731
#define CS35L41_RX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
732732
#define CS35L41_TX_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
@@ -764,8 +764,6 @@ struct cs35l41_private {
764764
int irq;
765765
/* GPIO for /RST */
766766
struct gpio_desc *reset_gpio;
767-
void (*otp_setup)(struct cs35l41_private *cs35l41, bool is_pre_setup,
768-
unsigned int *freq);
769767
};
770768

771769
int cs35l41_probe(struct cs35l41_private *cs35l41,

sound/soc/codecs/rk817_codec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,4 @@ module_platform_driver(rk817_codec_driver);
539539
MODULE_DESCRIPTION("ASoC RK817 codec driver");
540540
MODULE_AUTHOR("binyuan <[email protected]>");
541541
MODULE_LICENSE("GPL v2");
542+
MODULE_ALIAS("platform:rk817-codec");

sound/soc/intel/common/soc-acpi-intel-cml-match.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
8181
.sof_fw_filename = "sof-cml.ri",
8282
.sof_tplg_filename = "sof-cml-da7219-max98390.tplg",
8383
},
84+
{
85+
.id = "ESSX8336",
86+
.drv_name = "sof-essx8336",
87+
.sof_fw_filename = "sof-cml.ri",
88+
.sof_tplg_filename = "sof-cml-es8336.tplg",
89+
},
8490
{},
8591
};
8692
EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);

sound/soc/soc-acpi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ static bool snd_soc_acpi_id_present(struct snd_soc_acpi_mach *machine)
2020

2121
if (comp_ids) {
2222
for (i = 0; i < comp_ids->num_codecs; i++) {
23-
if (acpi_dev_present(comp_ids->codecs[i], NULL, -1))
23+
if (acpi_dev_present(comp_ids->codecs[i], NULL, -1)) {
24+
strscpy(machine->id, comp_ids->codecs[i], ACPI_ID_LEN);
2425
return true;
26+
}
2527
}
2628
}
2729

sound/soc/sof/intel/hda.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w)
5858
return -EINVAL;
5959
}
6060

61+
/* DAI already configured, reset it before reconfiguring it */
62+
if (sof_dai->configured) {
63+
ret = hda_ctrl_dai_widget_free(w);
64+
if (ret < 0)
65+
return ret;
66+
}
67+
6168
config = &sof_dai->dai_config[sof_dai->current_config];
6269

6370
/*

sound/soc/tegra/tegra186_dspk.c

Lines changed: 147 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,162 @@ static const struct reg_default tegra186_dspk_reg_defaults[] = {
2626
{ TEGRA186_DSPK_CODEC_CTRL, 0x03000000 },
2727
};
2828

29-
static int tegra186_dspk_get_control(struct snd_kcontrol *kcontrol,
29+
static int tegra186_dspk_get_fifo_th(struct snd_kcontrol *kcontrol,
3030
struct snd_ctl_elem_value *ucontrol)
3131
{
3232
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
3333
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
3434

35-
if (strstr(kcontrol->id.name, "FIFO Threshold"))
36-
ucontrol->value.integer.value[0] = dspk->rx_fifo_th;
37-
else if (strstr(kcontrol->id.name, "OSR Value"))
38-
ucontrol->value.integer.value[0] = dspk->osr_val;
39-
else if (strstr(kcontrol->id.name, "LR Polarity Select"))
40-
ucontrol->value.integer.value[0] = dspk->lrsel;
41-
else if (strstr(kcontrol->id.name, "Channel Select"))
42-
ucontrol->value.integer.value[0] = dspk->ch_sel;
43-
else if (strstr(kcontrol->id.name, "Mono To Stereo"))
44-
ucontrol->value.integer.value[0] = dspk->mono_to_stereo;
45-
else if (strstr(kcontrol->id.name, "Stereo To Mono"))
46-
ucontrol->value.integer.value[0] = dspk->stereo_to_mono;
35+
ucontrol->value.integer.value[0] = dspk->rx_fifo_th;
4736

4837
return 0;
4938
}
5039

51-
static int tegra186_dspk_put_control(struct snd_kcontrol *kcontrol,
40+
static int tegra186_dspk_put_fifo_th(struct snd_kcontrol *kcontrol,
5241
struct snd_ctl_elem_value *ucontrol)
5342
{
5443
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
5544
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
56-
int val = ucontrol->value.integer.value[0];
57-
58-
if (strstr(kcontrol->id.name, "FIFO Threshold"))
59-
dspk->rx_fifo_th = val;
60-
else if (strstr(kcontrol->id.name, "OSR Value"))
61-
dspk->osr_val = val;
62-
else if (strstr(kcontrol->id.name, "LR Polarity Select"))
63-
dspk->lrsel = val;
64-
else if (strstr(kcontrol->id.name, "Channel Select"))
65-
dspk->ch_sel = val;
66-
else if (strstr(kcontrol->id.name, "Mono To Stereo"))
67-
dspk->mono_to_stereo = val;
68-
else if (strstr(kcontrol->id.name, "Stereo To Mono"))
69-
dspk->stereo_to_mono = val;
45+
int value = ucontrol->value.integer.value[0];
46+
47+
if (value == dspk->rx_fifo_th)
48+
return 0;
49+
50+
dspk->rx_fifo_th = value;
51+
52+
return 1;
53+
}
54+
55+
static int tegra186_dspk_get_osr_val(struct snd_kcontrol *kcontrol,
56+
struct snd_ctl_elem_value *ucontrol)
57+
{
58+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
59+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
60+
61+
ucontrol->value.enumerated.item[0] = dspk->osr_val;
7062

7163
return 0;
7264
}
7365

66+
static int tegra186_dspk_put_osr_val(struct snd_kcontrol *kcontrol,
67+
struct snd_ctl_elem_value *ucontrol)
68+
{
69+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
70+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
71+
unsigned int value = ucontrol->value.enumerated.item[0];
72+
73+
if (value == dspk->osr_val)
74+
return 0;
75+
76+
dspk->osr_val = value;
77+
78+
return 1;
79+
}
80+
81+
static int tegra186_dspk_get_pol_sel(struct snd_kcontrol *kcontrol,
82+
struct snd_ctl_elem_value *ucontrol)
83+
{
84+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
85+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
86+
87+
ucontrol->value.enumerated.item[0] = dspk->lrsel;
88+
89+
return 0;
90+
}
91+
92+
static int tegra186_dspk_put_pol_sel(struct snd_kcontrol *kcontrol,
93+
struct snd_ctl_elem_value *ucontrol)
94+
{
95+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
96+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
97+
unsigned int value = ucontrol->value.enumerated.item[0];
98+
99+
if (value == dspk->lrsel)
100+
return 0;
101+
102+
dspk->lrsel = value;
103+
104+
return 1;
105+
}
106+
107+
static int tegra186_dspk_get_ch_sel(struct snd_kcontrol *kcontrol,
108+
struct snd_ctl_elem_value *ucontrol)
109+
{
110+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
111+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
112+
113+
ucontrol->value.enumerated.item[0] = dspk->ch_sel;
114+
115+
return 0;
116+
}
117+
118+
static int tegra186_dspk_put_ch_sel(struct snd_kcontrol *kcontrol,
119+
struct snd_ctl_elem_value *ucontrol)
120+
{
121+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
122+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
123+
unsigned int value = ucontrol->value.enumerated.item[0];
124+
125+
if (value == dspk->ch_sel)
126+
return 0;
127+
128+
dspk->ch_sel = value;
129+
130+
return 1;
131+
}
132+
133+
static int tegra186_dspk_get_mono_to_stereo(struct snd_kcontrol *kcontrol,
134+
struct snd_ctl_elem_value *ucontrol)
135+
{
136+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
137+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
138+
139+
ucontrol->value.enumerated.item[0] = dspk->mono_to_stereo;
140+
141+
return 0;
142+
}
143+
144+
static int tegra186_dspk_put_mono_to_stereo(struct snd_kcontrol *kcontrol,
145+
struct snd_ctl_elem_value *ucontrol)
146+
{
147+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
148+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
149+
unsigned int value = ucontrol->value.enumerated.item[0];
150+
151+
if (value == dspk->mono_to_stereo)
152+
return 0;
153+
154+
dspk->mono_to_stereo = value;
155+
156+
return 1;
157+
}
158+
159+
static int tegra186_dspk_get_stereo_to_mono(struct snd_kcontrol *kcontrol,
160+
struct snd_ctl_elem_value *ucontrol)
161+
{
162+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
163+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
164+
165+
ucontrol->value.enumerated.item[0] = dspk->stereo_to_mono;
166+
167+
return 0;
168+
}
169+
170+
static int tegra186_dspk_put_stereo_to_mono(struct snd_kcontrol *kcontrol,
171+
struct snd_ctl_elem_value *ucontrol)
172+
{
173+
struct snd_soc_component *codec = snd_soc_kcontrol_component(kcontrol);
174+
struct tegra186_dspk *dspk = snd_soc_component_get_drvdata(codec);
175+
unsigned int value = ucontrol->value.enumerated.item[0];
176+
177+
if (value == dspk->stereo_to_mono)
178+
return 0;
179+
180+
dspk->stereo_to_mono = value;
181+
182+
return 1;
183+
}
184+
74185
static int __maybe_unused tegra186_dspk_runtime_suspend(struct device *dev)
75186
{
76187
struct tegra186_dspk *dspk = dev_get_drvdata(dev);
@@ -279,17 +390,19 @@ static const struct soc_enum tegra186_dspk_lrsel_enum =
279390
static const struct snd_kcontrol_new tegrat186_dspk_controls[] = {
280391
SOC_SINGLE_EXT("FIFO Threshold", SND_SOC_NOPM, 0,
281392
TEGRA186_DSPK_RX_FIFO_DEPTH - 1, 0,
282-
tegra186_dspk_get_control, tegra186_dspk_put_control),
393+
tegra186_dspk_get_fifo_th, tegra186_dspk_put_fifo_th),
283394
SOC_ENUM_EXT("OSR Value", tegra186_dspk_osr_enum,
284-
tegra186_dspk_get_control, tegra186_dspk_put_control),
395+
tegra186_dspk_get_osr_val, tegra186_dspk_put_osr_val),
285396
SOC_ENUM_EXT("LR Polarity Select", tegra186_dspk_lrsel_enum,
286-
tegra186_dspk_get_control, tegra186_dspk_put_control),
397+
tegra186_dspk_get_pol_sel, tegra186_dspk_put_pol_sel),
287398
SOC_ENUM_EXT("Channel Select", tegra186_dspk_ch_sel_enum,
288-
tegra186_dspk_get_control, tegra186_dspk_put_control),
399+
tegra186_dspk_get_ch_sel, tegra186_dspk_put_ch_sel),
289400
SOC_ENUM_EXT("Mono To Stereo", tegra186_dspk_mono_conv_enum,
290-
tegra186_dspk_get_control, tegra186_dspk_put_control),
401+
tegra186_dspk_get_mono_to_stereo,
402+
tegra186_dspk_put_mono_to_stereo),
291403
SOC_ENUM_EXT("Stereo To Mono", tegra186_dspk_stereo_conv_enum,
292-
tegra186_dspk_get_control, tegra186_dspk_put_control),
404+
tegra186_dspk_get_stereo_to_mono,
405+
tegra186_dspk_put_stereo_to_mono),
293406
};
294407

295408
static const struct snd_soc_component_driver tegra186_dspk_cmpnt = {

0 commit comments

Comments
 (0)