From: Simon Trimmer <simont@opensource.cirrus.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: <alsa-devel@alsa-project.org>, <patches@opensource.cirrus.com>,
<linux-kernel@vger.kernel.org>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Simon Trimmer <simont@opensource.cirrus.com>
Subject: [PATCH 03/16] ASoC: wm_adsp: Switch to using wm_coeff_read_ctrl for compressed buffers
Date: Mon, 13 Sep 2021 17:00:44 +0100 [thread overview]
Message-ID: <20210913160057.103842-4-simont@opensource.cirrus.com> (raw)
In-Reply-To: <20210913160057.103842-1-simont@opensource.cirrus.com>
From: Charles Keepax <ckeepax@opensource.cirrus.com>
When parsing a compressed buffer from the firmware the driver currently
open codes reading the firmware coefficient containing the buffer
description. Improve this slightly by using the coefficient read
functions already provided by the wm_adsp driver. It is worth noting
this change requires the running variable to be set before
wm_adsp_buffer_init is called, however this is safe, since its all still
under the power lock and nothing in the compressed code gates itself on
running.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
---
sound/soc/codecs/wm_adsp.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b300af6fdd41..9c3d4b96fd7c 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -3277,14 +3277,14 @@ int wm_adsp_event(struct snd_soc_dapm_widget *w,
goto err;
}
+ dsp->running = true;
+
if (wm_adsp_fw[dsp->fw].num_caps != 0) {
ret = wm_adsp_buffer_init(dsp);
if (ret < 0)
goto err;
}
- dsp->running = true;
-
mutex_unlock(&dsp->pwr_lock);
break;
@@ -3869,26 +3869,21 @@ static int wm_adsp_buffer_parse_coeff(struct wm_coeff_ctl *ctl)
{
struct wm_adsp_host_buf_coeff_v1 coeff_v1;
struct wm_adsp_compr_buf *buf;
- unsigned int reg, version;
- __be32 bufp;
+ unsigned int version;
int ret, i;
- ret = wm_coeff_base_reg(ctl, ®);
- if (ret)
- return ret;
-
for (i = 0; i < 5; ++i) {
- ret = regmap_raw_read(ctl->dsp->regmap, reg, &bufp, sizeof(bufp));
+ ret = wm_coeff_read_ctrl(ctl, &coeff_v1, sizeof(coeff_v1));
if (ret < 0)
return ret;
- if (bufp)
+ if (coeff_v1.host_buf_ptr)
break;
usleep_range(1000, 2000);
}
- if (!bufp) {
+ if (!coeff_v1.host_buf_ptr) {
adsp_err(ctl->dsp, "Failed to acquire host buffer\n");
return -EIO;
}
@@ -3898,7 +3893,7 @@ static int wm_adsp_buffer_parse_coeff(struct wm_coeff_ctl *ctl)
return -ENOMEM;
buf->host_buf_mem_type = ctl->alg_region.type;
- buf->host_buf_ptr = be32_to_cpu(bufp);
+ buf->host_buf_ptr = be32_to_cpu(coeff_v1.host_buf_ptr);
ret = wm_adsp_buffer_populate(buf);
if (ret < 0)
@@ -3913,11 +3908,6 @@ static int wm_adsp_buffer_parse_coeff(struct wm_coeff_ctl *ctl)
return 0;
}
- ret = regmap_raw_read(ctl->dsp->regmap, reg, &coeff_v1,
- sizeof(coeff_v1));
- if (ret < 0)
- return ret;
-
version = be32_to_cpu(coeff_v1.versions) & HOST_BUF_COEFF_COMPAT_VER_MASK;
version >>= HOST_BUF_COEFF_COMPAT_VER_SHIFT;
--
2.33.0
next prev parent reply other threads:[~2021-09-13 16:01 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 16:00 [PATCH 00/16] add driver to support firmware loading on Cirrus Logic DSPs Simon Trimmer
2021-09-13 16:00 ` [PATCH 01/16] ASoC: wm_adsp: Remove use of snd_ctl_elem_type_t Simon Trimmer
2021-09-13 16:00 ` [PATCH 02/16] ASoC: wm_adsp: Move check for control existence Simon Trimmer
2021-09-13 16:00 ` Simon Trimmer [this message]
2021-09-13 16:00 ` [PATCH 04/16] ASoC: wm_adsp: Cancel ongoing work when removing controls Simon Trimmer
2021-09-13 16:00 ` [PATCH 05/16] ASoC: wm_adsp: Rename generic DSP support Simon Trimmer
2021-09-13 16:00 ` [PATCH 06/16] ASoC: wm_adsp: Introduce cs_dsp logging macros Simon Trimmer
2021-09-13 16:00 ` [PATCH 07/16] ASoC: wm_adsp: Separate some ASoC and generic functions Simon Trimmer
2021-09-13 16:00 ` [PATCH 08/16] ASoC: wm_adsp: Split DSP power operations into helper functions Simon Trimmer
2021-09-13 16:00 ` [PATCH 09/16] ASoC: wm_adsp: Move sys_config_size to wm_adsp Simon Trimmer
2021-09-13 16:00 ` [PATCH 10/16] ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handling Simon Trimmer
2021-09-13 16:00 ` [PATCH 11/16] ASoC: wm_adsp: Move check of dsp->running to better place Simon Trimmer
2021-09-13 16:00 ` [PATCH 12/16] ASoC: wm_adsp: Pass firmware names as parameters when starting DSP core Simon Trimmer
2021-09-13 16:00 ` [PATCH 13/16] ASoC: wm_adsp: move firmware loading to client Simon Trimmer
2021-09-13 16:00 ` [PATCH 14/16] ASoC: wm_adsp: Split out struct cs_dsp from struct wm_adsp Simon Trimmer
2021-09-13 16:00 ` [PATCH 15/16] ASoC: wm_adsp: Separate wm_adsp specifics in cs_dsp_client_ops Simon Trimmer
2021-09-13 16:00 ` [PATCH 16/16] firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs Simon Trimmer
2021-09-27 17:45 ` [PATCH 00/16] " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210913160057.103842-4-simont@opensource.cirrus.com \
--to=simont@opensource.cirrus.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®