From: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
To: <krzysztof.kozlowski+dt@linaro.org>, <agross@kernel.org>,
<andersson@kernel.org>, <lgirdwood@gmail.com>,
<broonie@kernel.org>, <robh+dt@kernel.org>,
<quic_plai@quicinc.com>, <bgoswami@quicinc.com>,
<srinivas.kandagatla@linaro.org>, <quic_rohkumar@quicinc.com>,
<linux-arm-msm@vger.kernel.org>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>, <swboyd@chromium.org>,
<judyhsiao@chromium.org>, <devicetree@vger.kernel.org>,
<konrad.dybcio@linaro.org>
Cc: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Subject: [PATCH 05/14] ASoC: q6dsp: audioreach: Add support to set compress params
Date: Wed, 1 Feb 2023 19:19:38 +0530 [thread overview]
Message-ID: <20230201134947.1638197-6-quic_mohs@quicinc.com> (raw)
In-Reply-To: <20230201134947.1638197-1-quic_mohs@quicinc.com>
Add function for setting compress params to set the next track
parameters during gapless playback.
Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/qdsp6/audioreach.c | 51 +++++++++++++++++++++++++++++++
sound/soc/qcom/qdsp6/audioreach.h | 1 +
sound/soc/qcom/qdsp6/q6apm-dai.c | 1 +
3 files changed, 53 insertions(+)
diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index a11bab69a676..a87df09d187f 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -1314,3 +1314,54 @@ int audioreach_enable_module(struct q6apm *apm, struct audioreach_module *module
return audioreach_send_u32_param(apm, module, PARAM_ID_MODULE_ENABLE, en);
}
EXPORT_SYMBOL_GPL(audioreach_enable_module);
+
+int audioreach_compr_set_param(struct q6apm_graph *graph, struct audioreach_module_config *mcfg)
+{
+ struct media_format *header;
+ struct gpr_pkt *pkt;
+ struct payload_media_fmt_pcm *cfg;
+ uint32_t num_channels = mcfg->num_channels;
+ int iid, payload_size, rc;
+ void *p;
+
+ payload_size = sizeof(struct apm_sh_module_media_fmt_cmd);
+
+ iid = q6apm_graph_get_rx_shmem_module_iid(graph);
+ pkt = audioreach_alloc_cmd_pkt(payload_size, DATA_CMD_WR_SH_MEM_EP_MEDIA_FORMAT,
+ 0, graph->port->id, iid);
+
+ if (IS_ERR(pkt))
+ return -ENOMEM;
+
+ p = (void *)pkt + GPR_HDR_SIZE;
+ header = p;
+
+ if (mcfg->fmt == SND_AUDIOCODEC_PCM) {
+ header->data_format = DATA_FORMAT_FIXED_POINT;
+ header->fmt_id = MEDIA_FMT_ID_PCM;
+ header->payload_size = sizeof(*cfg);
+
+ p = p + sizeof(*header);
+ cfg = p;
+ cfg->sample_rate = mcfg->sample_rate;
+ cfg->bit_width = mcfg->bit_width;
+ cfg->alignment = PCM_LSB_ALIGNED;
+ cfg->bits_per_sample = mcfg->bit_width;
+ cfg->q_factor = mcfg->bit_width - 1;
+ cfg->endianness = PCM_LITTLE_ENDIAN;
+ cfg->num_channels = mcfg->num_channels;
+
+ if (mcfg->num_channels == 1)
+ cfg->channel_mapping[0] = PCM_CHANNEL_L;
+ else if (num_channels == 2) {
+ cfg->channel_mapping[0] = PCM_CHANNEL_L;
+ cfg->channel_mapping[1] = PCM_CHANNEL_R;
+ }
+ }
+
+ rc = gpr_send_port_pkt(graph->port, pkt);
+ kfree(pkt);
+
+ return rc;
+}
+EXPORT_SYMBOL_GPL(audioreach_compr_set_param);
diff --git a/sound/soc/qcom/qdsp6/audioreach.h b/sound/soc/qcom/qdsp6/audioreach.h
index 76dea97773cc..4c4bdff45cf1 100644
--- a/sound/soc/qcom/qdsp6/audioreach.h
+++ b/sound/soc/qcom/qdsp6/audioreach.h
@@ -786,4 +786,5 @@ int audioreach_remove_initial_silence(struct q6apm *apm, struct audioreach_modul
uint32_t initial_samples);
int audioreach_remove_trailing_silence(struct q6apm *apm, struct audioreach_module *module,
uint32_t trailing_samples);
+int audioreach_compr_set_param(struct q6apm_graph *graph, struct audioreach_module_config *mcfg);
#endif /* __AUDIOREACH_H__ */
diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index ee59ef36b85a..8f5d744b3365 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -146,6 +146,7 @@ static int q6apm_dai_prepare(struct snd_soc_component *component,
cfg.sample_rate = runtime->rate;
cfg.num_channels = runtime->channels;
cfg.bit_width = prtd->bits_per_sample;
+ cfg.fmt = SND_AUDIOCODEC_PCM;
if (prtd->state) {
/* clear the previous setup if any */
--
2.25.1
next prev parent reply other threads:[~2023-02-01 13:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 13:49 [PATCH 00/14] Add support for compress offload and gapless playback Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 01/14] ALSA: compress: Update compress set params for " Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 02/14] ASoC: qcom: SC7280: audioreach: Add sc7280 hardware param fixup callback Mohammad Rafi Shaik
2023-02-01 14:40 ` Mark Brown
2023-02-03 6:33 ` Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 03/14] ASoC: q6dsp: audioreach: Add placeholder decoder for compress playback Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 04/14] ASoC: q6dsp: audioreach: Add support for compress offload commands Mohammad Rafi Shaik
2023-02-01 15:18 ` kernel test robot
2023-02-01 13:49 ` Mohammad Rafi Shaik [this message]
2023-02-01 13:49 ` [PATCH 06/14] ASoC: q6dsp: audioreach: Add support for sending real module ID to ADSP Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 07/14] ASoC: q6dsp: q6apm-dai: Add async compress write support Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 08/14] ASoC: q6dsp: q6apm-dai: Add open/free compress DAI callbacks Mohammad Rafi Shaik
2023-02-01 16:09 ` kernel test robot
2023-02-01 13:49 ` [PATCH 09/14] ASoC: q6dsp: q6apm-dai: Add compress DAI and codec caps get callbacks Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 10/14] ASoC: q6dsp: q6apm-dai: Add trigger/pointer compress DAI callbacks Mohammad Rafi Shaik
2023-02-01 16:50 ` kernel test robot
2023-02-01 13:49 ` [PATCH 11/14] ASoC: q6dsp: q6apm-dai: Add compress set params and metadata " Mohammad Rafi Shaik
2023-02-01 15:18 ` kernel test robot
2023-02-01 13:49 ` [PATCH 12/14] ASoC: q6dsp: q6apm-dai: Add mmap and copy compress " Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 13/14] ASoC: qdsp6: audioreach: Add MP3, AAC and FLAC compress format support Mohammad Rafi Shaik
2023-02-01 13:49 ` [PATCH 14/14] ASoC: q6dsp: audioreach: Add gapless feature support Mohammad Rafi Shaik
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=20230201134947.1638197-6-quic_mohs@quicinc.com \
--to=quic_mohs@quicinc.com \
--cc=agross@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=andersson@kernel.org \
--cc=bgoswami@quicinc.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=judyhsiao@chromium.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_plai@quicinc.com \
--cc=quic_rohkumar@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=srinivas.kandagatla@linaro.org \
--cc=swboyd@chromium.org \
/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;
as well as URLs for NNTP newsgroup(s).