Skip to content

Commit 0a5cf9e

Browse files
committed
Merge tag 'asoc-fix-v5.0-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.0 A selection of driver specific fixes here, along with a few core fixes: - A fixup for some MFD devices that were broken by the previous fixes for deferred probe. - A fix for potential out of bounds array accesses when ordering DAPM power/up down sequences. - Avoid use after free issue when unloading and reloading drivers using topologies.
2 parents 2bc16b9 + 860b454 commit 0a5cf9e

File tree

10 files changed

+53
-17
lines changed

10 files changed

+53
-17
lines changed

MAINTAINERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6143,7 +6143,7 @@ FREESCALE SOC SOUND DRIVERS
61436143
M: Timur Tabi <timur@kernel.org>
61446144
M: Nicolin Chen <nicoleotsuka@gmail.com>
61456145
M: Xiubo Li <Xiubo.Lee@gmail.com>
6146-
R: Fabio Estevam <fabio.estevam@nxp.com>
6146+
R: Fabio Estevam <festevam@gmail.com>
61476147
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
61486148
L: linuxppc-dev@lists.ozlabs.org
61496149
S: Maintained
@@ -10889,7 +10889,7 @@ F: include/linux/nvmem-consumer.h
1088910889
F: include/linux/nvmem-provider.h
1089010890

1089110891
NXP SGTL5000 DRIVER
10892-
M: Fabio Estevam <fabio.estevam@nxp.com>
10892+
M: Fabio Estevam <festevam@gmail.com>
1089310893
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
1089410894
S: Maintained
1089510895
F: Documentation/devicetree/bindings/sound/sgtl5000.txt

sound/soc/codecs/hdmi-codec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,15 +795,15 @@ static int hdmi_codec_probe(struct platform_device *pdev)
795795
if (hcd->spdif)
796796
hcp->daidrv[i] = hdmi_spdif_dai;
797797

798+
dev_set_drvdata(dev, hcp);
799+
798800
ret = devm_snd_soc_register_component(dev, &hdmi_driver, hcp->daidrv,
799801
dai_count);
800802
if (ret) {
801803
dev_err(dev, "%s: snd_soc_register_component() failed (%d)\n",
802804
__func__, ret);
803805
return ret;
804806
}
805-
806-
dev_set_drvdata(dev, hcp);
807807
return 0;
808808
}
809809

sound/soc/codecs/rt5682.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,9 @@ static const struct snd_soc_dapm_route rt5682_dapm_routes[] = {
17781778
{"ADC Stereo1 Filter", NULL, "ADC STO1 ASRC", is_using_asrc},
17791779
{"DAC Stereo1 Filter", NULL, "DAC STO1 ASRC", is_using_asrc},
17801780
{"ADC STO1 ASRC", NULL, "AD ASRC"},
1781+
{"ADC STO1 ASRC", NULL, "DA ASRC"},
17811782
{"ADC STO1 ASRC", NULL, "CLKDET"},
1783+
{"DAC STO1 ASRC", NULL, "AD ASRC"},
17821784
{"DAC STO1 ASRC", NULL, "DA ASRC"},
17831785
{"DAC STO1 ASRC", NULL, "CLKDET"},
17841786

sound/soc/samsung/i2s.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
700700
{
701701
struct i2s_dai *i2s = to_info(dai);
702702
u32 mod, mask = 0, val = 0;
703+
struct clk *rclksrc;
703704
unsigned long flags;
704705

705706
WARN_ON(!pm_runtime_active(dai->dev));
@@ -782,6 +783,10 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
782783

783784
i2s->frmclk = params_rate(params);
784785

786+
rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
787+
if (rclksrc && !IS_ERR(rclksrc))
788+
i2s->rclk_srcrate = clk_get_rate(rclksrc);
789+
785790
return 0;
786791
}
787792

@@ -886,11 +891,6 @@ static int config_setup(struct i2s_dai *i2s)
886891
return 0;
887892

888893
if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
889-
struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
890-
891-
if (rclksrc && !IS_ERR(rclksrc))
892-
i2s->rclk_srcrate = clk_get_rate(rclksrc);
893-
894894
psr = i2s->rclk_srcrate / i2s->frmclk / rfs;
895895
writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR);
896896
dev_dbg(&i2s->pdev->dev,

sound/soc/sh/rcar/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,14 +1526,14 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
15261526
int ret;
15271527

15281528
/*
1529-
* 1) Avoid duplicate register (ex. MIXer case)
1530-
* 2) re-register if card was rebinded
1529+
* 1) Avoid duplicate register for DVC with MIX case
1530+
* 2) Allow duplicate register for MIX
1531+
* 3) re-register if card was rebinded
15311532
*/
15321533
list_for_each_entry(kctrl, &card->controls, list) {
15331534
struct rsnd_kctrl_cfg *c = kctrl->private_data;
15341535

1535-
if (strcmp(kctrl->id.name, name) == 0 &&
1536-
c->mod == mod)
1536+
if (c == cfg)
15371537
return 0;
15381538
}
15391539

sound/soc/sh/rcar/ssi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
286286
if (rsnd_ssi_is_multi_slave(mod, io))
287287
return 0;
288288

289-
if (ssi->usrcnt > 1) {
289+
if (ssi->usrcnt > 0) {
290290
if (ssi->rate != rate) {
291291
dev_err(dev, "SSI parent/child should use same rate\n");
292292
return -EINVAL;

sound/soc/sh/rcar/ssiu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
7979
break;
8080
case 9:
8181
for (i = 0; i < 4; i++)
82-
rsnd_mod_write(mod, SSI_SYS_STATUS((i * 2) + 1), 0xf << (id * 4));
82+
rsnd_mod_write(mod, SSI_SYS_STATUS((i * 2) + 1), 0xf << 4);
8383
break;
8484
}
8585

sound/soc/soc-core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,17 @@ static struct snd_soc_component *soc_find_component(
735735
const struct device_node *of_node, const char *name)
736736
{
737737
struct snd_soc_component *component;
738+
struct device_node *component_of_node;
738739

739740
lockdep_assert_held(&client_mutex);
740741

741742
for_each_component(component) {
742743
if (of_node) {
743-
if (component->dev->of_node == of_node)
744+
component_of_node = component->dev->of_node;
745+
if (!component_of_node && component->dev->parent)
746+
component_of_node = component->dev->parent->of_node;
747+
748+
if (component_of_node == of_node)
744749
return component;
745750
} else if (name && strcmp(component->name, name) == 0) {
746751
return component;
@@ -951,7 +956,7 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
951956
{
952957
int err;
953958

954-
if (!dai || !dai->probed ||
959+
if (!dai || !dai->probed || !dai->driver ||
955960
dai->driver->remove_order != order)
956961
return;
957962

sound/soc/soc-dapm.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,36 @@ static int dapm_up_seq[] = {
7070
[snd_soc_dapm_clock_supply] = 1,
7171
[snd_soc_dapm_supply] = 2,
7272
[snd_soc_dapm_micbias] = 3,
73+
[snd_soc_dapm_vmid] = 3,
7374
[snd_soc_dapm_dai_link] = 2,
7475
[snd_soc_dapm_dai_in] = 4,
7576
[snd_soc_dapm_dai_out] = 4,
7677
[snd_soc_dapm_aif_in] = 4,
7778
[snd_soc_dapm_aif_out] = 4,
7879
[snd_soc_dapm_mic] = 5,
80+
[snd_soc_dapm_siggen] = 5,
81+
[snd_soc_dapm_input] = 5,
82+
[snd_soc_dapm_output] = 5,
7983
[snd_soc_dapm_mux] = 6,
8084
[snd_soc_dapm_demux] = 6,
8185
[snd_soc_dapm_dac] = 7,
8286
[snd_soc_dapm_switch] = 8,
8387
[snd_soc_dapm_mixer] = 8,
8488
[snd_soc_dapm_mixer_named_ctl] = 8,
8589
[snd_soc_dapm_pga] = 9,
90+
[snd_soc_dapm_buffer] = 9,
91+
[snd_soc_dapm_scheduler] = 9,
92+
[snd_soc_dapm_effect] = 9,
93+
[snd_soc_dapm_src] = 9,
94+
[snd_soc_dapm_asrc] = 9,
95+
[snd_soc_dapm_encoder] = 9,
96+
[snd_soc_dapm_decoder] = 9,
8697
[snd_soc_dapm_adc] = 10,
8798
[snd_soc_dapm_out_drv] = 11,
8899
[snd_soc_dapm_hp] = 11,
89100
[snd_soc_dapm_spk] = 11,
90101
[snd_soc_dapm_line] = 11,
102+
[snd_soc_dapm_sink] = 11,
91103
[snd_soc_dapm_kcontrol] = 12,
92104
[snd_soc_dapm_post] = 13,
93105
};
@@ -100,13 +112,25 @@ static int dapm_down_seq[] = {
100112
[snd_soc_dapm_spk] = 3,
101113
[snd_soc_dapm_line] = 3,
102114
[snd_soc_dapm_out_drv] = 3,
115+
[snd_soc_dapm_sink] = 3,
103116
[snd_soc_dapm_pga] = 4,
117+
[snd_soc_dapm_buffer] = 4,
118+
[snd_soc_dapm_scheduler] = 4,
119+
[snd_soc_dapm_effect] = 4,
120+
[snd_soc_dapm_src] = 4,
121+
[snd_soc_dapm_asrc] = 4,
122+
[snd_soc_dapm_encoder] = 4,
123+
[snd_soc_dapm_decoder] = 4,
104124
[snd_soc_dapm_switch] = 5,
105125
[snd_soc_dapm_mixer_named_ctl] = 5,
106126
[snd_soc_dapm_mixer] = 5,
107127
[snd_soc_dapm_dac] = 6,
108128
[snd_soc_dapm_mic] = 7,
129+
[snd_soc_dapm_siggen] = 7,
130+
[snd_soc_dapm_input] = 7,
131+
[snd_soc_dapm_output] = 7,
109132
[snd_soc_dapm_micbias] = 8,
133+
[snd_soc_dapm_vmid] = 8,
110134
[snd_soc_dapm_mux] = 9,
111135
[snd_soc_dapm_demux] = 9,
112136
[snd_soc_dapm_aif_in] = 10,

sound/soc/soc-topology.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,18 @@ static void remove_dai(struct snd_soc_component *comp,
502502
{
503503
struct snd_soc_dai_driver *dai_drv =
504504
container_of(dobj, struct snd_soc_dai_driver, dobj);
505+
struct snd_soc_dai *dai;
505506

506507
if (pass != SOC_TPLG_PASS_PCM_DAI)
507508
return;
508509

509510
if (dobj->ops && dobj->ops->dai_unload)
510511
dobj->ops->dai_unload(comp, dobj);
511512

513+
list_for_each_entry(dai, &comp->dai_list, list)
514+
if (dai->driver == dai_drv)
515+
dai->driver = NULL;
516+
512517
kfree(dai_drv->name);
513518
list_del(&dobj->list);
514519
kfree(dai_drv);

0 commit comments

Comments
 (0)