Skip to content

Commit 9250673

Browse files
committed
Merge tag 'asoc-fix-v7.0-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v7.0 Quite a large pull request, but nothing too concerning here - everything is fairly small. We've got a couple of smaller core fixes for races on card teardown from Matteo Cotifava, a fix for handling dodgy DMI information generated by u-boot, some driver specific fixes and some new device IDs for Tegra.
2 parents 5182e5e + 30c64fb commit 9250673

10 files changed

Lines changed: 70 additions & 20 deletions

File tree

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,11 +1610,17 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
16101610
region_name);
16111611

16121612
if (reg) {
1613+
/*
1614+
* Although we expect the underlying bus does not require
1615+
* physically-contiguous buffers, we pessimistically use
1616+
* a temporary buffer instead of trusting that the
1617+
* alignment of region->data is ok.
1618+
*/
16131619
region_len = le32_to_cpu(region->len);
16141620
if (region_len > buf_len) {
16151621
buf_len = round_up(region_len, PAGE_SIZE);
1616-
kfree(buf);
1617-
buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA);
1622+
vfree(buf);
1623+
buf = vmalloc(buf_len);
16181624
if (!buf) {
16191625
ret = -ENOMEM;
16201626
goto out_fw;
@@ -1643,7 +1649,7 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
16431649

16441650
ret = 0;
16451651
out_fw:
1646-
kfree(buf);
1652+
vfree(buf);
16471653

16481654
if (ret == -EOVERFLOW)
16491655
cs_dsp_err(dsp, "%s: file content overflows file data\n", file);
@@ -2331,11 +2337,17 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware
23312337
}
23322338

23332339
if (reg) {
2340+
/*
2341+
* Although we expect the underlying bus does not require
2342+
* physically-contiguous buffers, we pessimistically use
2343+
* a temporary buffer instead of trusting that the
2344+
* alignment of blk->data is ok.
2345+
*/
23342346
region_len = le32_to_cpu(blk->len);
23352347
if (region_len > buf_len) {
23362348
buf_len = round_up(region_len, PAGE_SIZE);
2337-
kfree(buf);
2338-
buf = kmalloc(buf_len, GFP_KERNEL | GFP_DMA);
2349+
vfree(buf);
2350+
buf = vmalloc(buf_len);
23392351
if (!buf) {
23402352
ret = -ENOMEM;
23412353
goto out_fw;
@@ -2366,7 +2378,7 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware
23662378

23672379
ret = 0;
23682380
out_fw:
2369-
kfree(buf);
2381+
vfree(buf);
23702382

23712383
if (ret == -EOVERFLOW)
23722384
cs_dsp_err(dsp, "%s: file content overflows file data\n", file);

sound/soc/amd/acp/acp-mach-common.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,13 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd)
127127
if (drvdata->hs_codec_id != RT5682)
128128
return -EINVAL;
129129

130-
drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
131-
drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
130+
drvdata->wclk = devm_clk_get(component->dev, "rt5682-dai-wclk");
131+
if (IS_ERR(drvdata->wclk))
132+
return PTR_ERR(drvdata->wclk);
133+
134+
drvdata->bclk = devm_clk_get(component->dev, "rt5682-dai-bclk");
135+
if (IS_ERR(drvdata->bclk))
136+
return PTR_ERR(drvdata->bclk);
132137

133138
ret = snd_soc_dapm_new_controls(dapm, rt5682_widgets,
134139
ARRAY_SIZE(rt5682_widgets));
@@ -370,8 +375,13 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd)
370375
return -EINVAL;
371376

372377
if (!drvdata->soc_mclk) {
373-
drvdata->wclk = clk_get(component->dev, "rt5682-dai-wclk");
374-
drvdata->bclk = clk_get(component->dev, "rt5682-dai-bclk");
378+
drvdata->wclk = devm_clk_get(component->dev, "rt5682-dai-wclk");
379+
if (IS_ERR(drvdata->wclk))
380+
return PTR_ERR(drvdata->wclk);
381+
382+
drvdata->bclk = devm_clk_get(component->dev, "rt5682-dai-bclk");
383+
if (IS_ERR(drvdata->bclk))
384+
return PTR_ERR(drvdata->bclk);
375385
}
376386

377387
ret = snd_soc_dapm_new_controls(dapm, rt5682s_widgets,

sound/soc/amd/acp3x-rt5682-max9836.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd)
9494
return ret;
9595
}
9696

97-
rt5682_dai_wclk = clk_get(component->dev, "rt5682-dai-wclk");
98-
rt5682_dai_bclk = clk_get(component->dev, "rt5682-dai-bclk");
97+
rt5682_dai_wclk = devm_clk_get(component->dev, "rt5682-dai-wclk");
98+
if (IS_ERR(rt5682_dai_wclk))
99+
return PTR_ERR(rt5682_dai_wclk);
100+
101+
rt5682_dai_bclk = devm_clk_get(component->dev, "rt5682-dai-bclk");
102+
if (IS_ERR(rt5682_dai_bclk))
103+
return PTR_ERR(rt5682_dai_bclk);
99104

100105
ret = snd_soc_card_jack_new_pins(card, "Headset Jack",
101106
SND_JACK_HEADSET |

sound/soc/codecs/rt1011.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ static int rt1011_recv_spk_mode_put(struct snd_kcontrol *kcontrol,
10471047
struct snd_ctl_elem_value *ucontrol)
10481048
{
10491049
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
1050-
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
1050+
struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
10511051
struct rt1011_priv *rt1011 =
10521052
snd_soc_component_get_drvdata(component);
10531053

sound/soc/generic/simple-card-utils.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,11 +1038,15 @@ int graph_util_is_ports0(struct device_node *np)
10381038
else
10391039
port = np;
10401040

1041-
struct device_node *ports __free(device_node) = of_get_parent(port);
1042-
struct device_node *top __free(device_node) = of_get_parent(ports);
1043-
struct device_node *ports0 __free(device_node) = of_get_child_by_name(top, "ports");
1041+
struct device_node *ports __free(device_node) = of_get_parent(port);
1042+
const char *at = strchr(kbasename(ports->full_name), '@');
10441043

1045-
return ports0 == ports;
1044+
/*
1045+
* Since child iteration order may differ
1046+
* between a base DT and DT overlays,
1047+
* string match "ports" or "ports@0" in the node name instead.
1048+
*/
1049+
return !at || !strcmp(at, "@0");
10461050
}
10471051
EXPORT_SYMBOL_GPL(graph_util_is_ports0);
10481052

sound/soc/qcom/qdsp6/q6apm-dai.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ static const struct snd_soc_component_driver q6apm_fe_dai_component = {
838838
.ack = q6apm_dai_ack,
839839
.compress_ops = &q6apm_dai_compress_ops,
840840
.use_dai_pcm_id = true,
841+
.remove_order = SND_SOC_COMP_ORDER_EARLY,
841842
};
842843

843844
static int q6apm_dai_probe(struct platform_device *pdev)

sound/soc/qcom/qdsp6/q6apm-lpass-dais.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static const struct snd_soc_component_driver q6apm_lpass_dai_component = {
278278
.of_xlate_dai_name = q6dsp_audio_ports_of_xlate_dai_name,
279279
.be_pcm_base = AUDIOREACH_BE_PCM_BASE,
280280
.use_dai_pcm_id = true,
281+
.remove_order = SND_SOC_COMP_ORDER_FIRST,
281282
};
282283

283284
static int q6apm_lpass_dai_dev_probe(struct platform_device *pdev)

sound/soc/qcom/qdsp6/q6apm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ static const struct snd_soc_component_driver q6apm_audio_component = {
715715
.name = APM_AUDIO_DRV_NAME,
716716
.probe = q6apm_audio_probe,
717717
.remove = q6apm_audio_remove,
718+
.remove_order = SND_SOC_COMP_ORDER_LAST,
718719
};
719720

720721
static int apm_probe(gpr_device_t *gdev)

sound/soc/soc-core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd)
462462

463463
list_del(&rtd->list);
464464

465-
if (delayed_work_pending(&rtd->delayed_work))
466-
flush_delayed_work(&rtd->delayed_work);
465+
flush_delayed_work(&rtd->delayed_work);
467466
snd_soc_pcm_component_free(rtd);
468467

469468
/*
@@ -1864,12 +1863,15 @@ static void cleanup_dmi_name(char *name)
18641863

18651864
/*
18661865
* Check if a DMI field is valid, i.e. not containing any string
1867-
* in the black list.
1866+
* in the black list and not the empty string.
18681867
*/
18691868
static int is_dmi_valid(const char *field)
18701869
{
18711870
int i = 0;
18721871

1872+
if (!field[0])
1873+
return 0;
1874+
18731875
while (dmi_blacklist[i]) {
18741876
if (strstr(field, dmi_blacklist[i]))
18751877
return 0;
@@ -2122,6 +2124,9 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
21222124
for_each_card_rtds(card, rtd)
21232125
if (rtd->initialized)
21242126
snd_soc_link_exit(rtd);
2127+
/* flush delayed work before removing DAIs and DAPM widgets */
2128+
snd_soc_flush_all_delayed_work(card);
2129+
21252130
/* remove and free each DAI */
21262131
soc_remove_link_dais(card);
21272132
soc_remove_link_components(card);

sound/soc/tegra/tegra_audio_graph_card.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ static const struct tegra_audio_cdata tegra186_data = {
231231
.plla_out0_rates[x11_RATE] = 45158400,
232232
};
233233

234+
static const struct tegra_audio_cdata tegra238_data = {
235+
/* PLLA */
236+
.plla_rates[x8_RATE] = 1277952000,
237+
.plla_rates[x11_RATE] = 1264435200,
238+
/* PLLA_OUT0 */
239+
.plla_out0_rates[x8_RATE] = 49152000,
240+
.plla_out0_rates[x11_RATE] = 45158400,
241+
};
242+
234243
static const struct tegra_audio_cdata tegra264_data = {
235244
/* PLLA1 */
236245
.plla_rates[x8_RATE] = 983040000,
@@ -245,6 +254,8 @@ static const struct of_device_id graph_of_tegra_match[] = {
245254
.data = &tegra210_data },
246255
{ .compatible = "nvidia,tegra186-audio-graph-card",
247256
.data = &tegra186_data },
257+
{ .compatible = "nvidia,tegra238-audio-graph-card",
258+
.data = &tegra238_data },
248259
{ .compatible = "nvidia,tegra264-audio-graph-card",
249260
.data = &tegra264_data },
250261
{},

0 commit comments

Comments
 (0)