Skip to content

Commit

Permalink
ASoC: cs35l56: Fix misuse of wm_adsp 'part' string for silicon revision
Browse files Browse the repository at this point in the history
[ Upstream commit f6c9679 ]

Put the silicon revision and secured flag in the wm_adsp fwf_name
string instead of including them in the part string.

This changes the format of the firmware name string from

 cs35l56[s]-rev-misc[-system_name]

to
 cs35l56-rev[-s]-misc[-system_name]

No firmware files have been published, so this doesn't cause a
compatibility break.

Silicon revision and secured flag are included in the firmware
filename to pick a firmware compatible with the part. These strings
were being added to the part string, but that is a misuse of the
string. The correct place for these is the fwf_name string, which
is specifically intended to select between multiple firmware files
for the same part.

Backport note:
This won't apply to kernels older than v6.6.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 608f1b0 ("ASoC: cs35l56: Move DSP part string generation so that it is done only once")
Link: https://msgid.link/r/20240129162737.497-12-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: eba2eb2 ("ASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rfvirgil authored and gregkh committed Mar 6, 2024
1 parent 0bf9697 commit 1074c5d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions sound/soc/codecs/cs35l56.c
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,18 @@ static void cs35l56_dsp_work(struct work_struct *work)

pm_runtime_get_sync(cs35l56->base.dev);

/* Populate fw file qualifier with the revision and security state */
if (!cs35l56->dsp.fwf_name) {
cs35l56->dsp.fwf_name = kasprintf(GFP_KERNEL, "%02x%s-dsp1",
cs35l56->base.rev,
cs35l56->base.secured ? "-s" : "");
if (!cs35l56->dsp.fwf_name)
goto err;
}

dev_dbg(cs35l56->base.dev, "DSP fwf name: '%s' system name: '%s'\n",
cs35l56->dsp.fwf_name, cs35l56->dsp.system_name);

/*
* When the device is running in secure mode the firmware files can
* only contain insecure tunings and therefore we do not need to
Expand All @@ -905,7 +917,7 @@ static void cs35l56_dsp_work(struct work_struct *work)
* on the DAPM mutex.
*/
queue_work(cs35l56->dsp_wq, &cs35l56->mux_init_work);

err:
pm_runtime_mark_last_busy(cs35l56->base.dev);
pm_runtime_put_autosuspend(cs35l56->base.dev);
}
Expand Down Expand Up @@ -958,6 +970,9 @@ static void cs35l56_component_remove(struct snd_soc_component *component)

wm_adsp2_component_remove(&cs35l56->dsp, component);

kfree(cs35l56->dsp.fwf_name);
cs35l56->dsp.fwf_name = NULL;

cs35l56->component = NULL;
}

Expand Down Expand Up @@ -1309,12 +1324,6 @@ int cs35l56_init(struct cs35l56_private *cs35l56)
if (ret)
return ret;

/* Populate the DSP information with the revision and security state */
cs35l56->dsp.part = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "cs35l56%s-%02x",
cs35l56->base.secured ? "s" : "", cs35l56->base.rev);
if (!cs35l56->dsp.part)
return -ENOMEM;

if (!cs35l56->base.reset_gpio) {
dev_dbg(cs35l56->base.dev, "No reset gpio: using soft reset\n");
cs35l56->soft_resetting = true;
Expand Down

0 comments on commit 1074c5d

Please sign in to comment.