From: Arnaud Ferraris <arnaud.ferraris@collabora.com>
To: unlisted-recipients:; (no To-header on input)
Cc: kernel@collabora.com,
Arnaud Ferraris <arnaud.ferraris@collabora.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Timur Tabi <timur@kernel.org>,
Nicolin Chen <nicoleotsuka@gmail.com>,
Xiubo Li <Xiubo.Lee@gmail.com>,
Fabio Estevam <festevam@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 2/4] ASoC: fsl_asrc: allow using arbitrary input and output clocks
Date: Thu, 2 Jul 2020 16:22:33 +0200 [thread overview]
Message-ID: <20200702142235.235869-3-arnaud.ferraris@collabora.com> (raw)
In-Reply-To: <20200702142235.235869-1-arnaud.ferraris@collabora.com>
fsl_asrc currently uses hardcoded input and output clocks, preventing
its use for anything other than S/PDIF output.
This patch adds the ability to select any clock as input or output (by
using new DT properties), making it possible to use this peripheral in a
more advanced way.
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
---
sound/soc/fsl/fsl_asrc.c | 18 ++++++++++++++++--
sound/soc/fsl/fsl_asrc_common.h | 3 +++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 95f6a9617b0b..75df220e4b51 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -605,8 +605,8 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
config.pair = pair->index;
config.channel_num = channels;
- config.inclk = INCLK_NONE;
- config.outclk = OUTCLK_ASRCK1_CLK;
+ config.inclk = asrc->inclk;
+ config.outclk = asrc->outclk;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
config.input_format = params_format(params);
@@ -1067,6 +1067,20 @@ static int fsl_asrc_probe(struct platform_device *pdev)
asrc->channel_avail = 10;
+ ret = of_property_read_u32(np, "fsl,asrc-input-clock",
+ &asrc->inclk);
+ if (ret) {
+ dev_info(&pdev->dev, "no input clock specified, using none\n");
+ asrc->inclk = INCLK_NONE;
+ }
+
+ ret = of_property_read_u32(np, "fsl,asrc-output-clock",
+ &asrc->outclk);
+ if (ret) {
+ dev_info(&pdev->dev, "no output clock specified, using default\n");
+ asrc->outclk = OUTCLK_ASRCK1_CLK;
+ }
+
ret = of_property_read_u32(np, "fsl,asrc-rate",
&asrc->asrc_rate);
if (ret) {
diff --git a/sound/soc/fsl/fsl_asrc_common.h b/sound/soc/fsl/fsl_asrc_common.h
index 7e1c13ca37f1..1468878fbaca 100644
--- a/sound/soc/fsl/fsl_asrc_common.h
+++ b/sound/soc/fsl/fsl_asrc_common.h
@@ -89,6 +89,9 @@ struct fsl_asrc {
struct fsl_asrc_pair *pair[PAIR_CTX_NUM];
unsigned int channel_avail;
+ enum asrc_inclk inclk;
+ enum asrc_outclk outclk;
+
int asrc_rate;
snd_pcm_format_t asrc_format;
bool use_edma;
--
2.27.0
next prev parent reply other threads:[~2020-07-02 14:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 14:22 [PATCH 0/4] ASoC: fsl_asrc: allow selecting arbitrary clocks Arnaud Ferraris
2020-07-02 14:22 ` [PATCH 1/4] dt-bindings: sound: fsl,asrc: add properties to select in/out clocks Arnaud Ferraris
2020-07-02 14:22 ` Arnaud Ferraris [this message]
2020-07-02 14:22 ` [PATCH 3/4] ASoC: fsl_asrc: always use ratio for conversion Arnaud Ferraris
2020-07-02 14:22 ` [PATCH 4/4] ASoC: fsl_asrc: swap input and output clocks in capture mode Arnaud Ferraris
2020-07-02 18:42 ` [PATCH 0/4] ASoC: fsl_asrc: allow selecting arbitrary clocks Nicolin Chen
2020-07-03 9:38 ` Arnaud Ferraris
2020-07-14 16:20 ` Arnaud Ferraris
2020-07-14 20:15 ` Nicolin Chen
2020-07-14 20:27 ` Mark Brown
2020-07-14 20:50 ` Nicolin Chen
2020-07-15 14:05 ` Mark Brown
2020-07-15 16:18 ` Arnaud Ferraris
2020-07-15 16:22 ` Mark Brown
2020-07-15 16:32 ` Arnaud Ferraris
2020-07-15 20:46 ` Nicolin Chen
2020-07-16 9:54 ` Arnaud Ferraris
2020-07-15 21:03 ` Nicolin Chen
2020-07-16 12:18 ` Mark Brown
2020-07-16 14:26 ` Arnaud Ferraris
2020-07-17 11:16 ` Arnaud Ferraris
2020-07-23 5:46 ` Nicolin Chen
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=20200702142235.235869-3-arnaud.ferraris@collabora.com \
--to=arnaud.ferraris@collabora.com \
--cc=Xiubo.Lee@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=kernel@collabora.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=timur@kernel.org \
--cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).