From: Katsuhiro Suzuki <katsuhiro@katsuster.net>
To: Mark Brown <broonie@kernel.org>,
David Yang <yangxiaohua@everest-semi.com>,
Daniel Drake <drake@endlessm.com>,
Hans de Goede <hdegoede@redhat.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
Katsuhiro Suzuki <katsuhiro@katsuster.net>
Subject: [PATCH v3 3/4] ASoC: es8316: support fixed clock rate
Date: Wed, 4 Sep 2019 01:53:21 +0900 [thread overview]
Message-ID: <20190903165322.20791-3-katsuhiro@katsuster.net> (raw)
In-Reply-To: <20190903165322.20791-1-katsuhiro@katsuster.net>
This patch supports some type of machine drivers that use fixed clock
rate. After applied this patch, sysclk == 0 means there is no
constraint of sound rate and other values will set constraints which
is derived by sysclk setting.
Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
---
Changes from v2:
- Newly added
---
sound/soc/codecs/es8316.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index ab41f2c056bd..bf390bc64177 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -432,20 +432,6 @@ static int es8316_set_dai_fmt(struct snd_soc_dai *codec_dai,
return 0;
}
-static int es8316_pcm_startup(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_component *component = dai->component;
- struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
-
- if (es8316->sysclk == 0) {
- dev_err(component->dev, "No sysclk provided\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -455,17 +441,16 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
u8 wordlen = 0;
int i;
- if (!es8316->sysclk) {
- dev_err(component->dev, "No MCLK configured\n");
- return -EINVAL;
- }
-
/* Limit supported sample rates to ones that can be autodetected
* by the codec running in slave mode.
*/
for (i = 0; i < NR_SUPPORTED_MCLK_LRCK_RATIOS; i++) {
const unsigned int ratio = supported_mclk_lrck_ratios[i];
+ /* Accept any rates if sysclk is 0. */
+ if (es8316->sysclk == 0)
+ break;
+
if (es8316->sysclk % ratio != 0)
continue;
if (es8316->sysclk / ratio == params_rate(params))
@@ -509,7 +494,6 @@ static int es8316_mute(struct snd_soc_dai *dai, int mute)
SNDRV_PCM_FMTBIT_S24_LE)
static const struct snd_soc_dai_ops es8316_ops = {
- .startup = es8316_pcm_startup,
.hw_params = es8316_pcm_hw_params,
.set_fmt = es8316_set_dai_fmt,
.set_sysclk = es8316_set_dai_sysclk,
--
2.23.0.rc1
next prev parent reply other threads:[~2019-09-03 16:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-03 16:53 [PATCH v3 1/4] ASoC: es8316: judge PCM rate at later timing Katsuhiro Suzuki
2019-09-03 16:53 ` [PATCH v3 2/4] ASoC: es8316: add clock control of MCLK Katsuhiro Suzuki
2019-09-03 18:00 ` Applied "ASoC: es8316: add clock control of MCLK" to the asoc tree Mark Brown
2019-09-04 14:37 ` [PATCH v3 2/4] ASoC: es8316: add clock control of MCLK Andy Shevchenko
2019-09-04 15:46 ` Katsuhiro Suzuki
2019-09-03 16:53 ` Katsuhiro Suzuki [this message]
2019-09-03 17:29 ` [PATCH v3 3/4] ASoC: es8316: support fixed clock rate Mark Brown
2019-09-03 16:53 ` [PATCH v3 4/4] ASoC: es8316: add DT-bindings Katsuhiro Suzuki
2019-09-03 18:00 ` Applied "ASoC: es8316: add DT-bindings" to the asoc tree Mark Brown
2019-09-03 17:48 ` [PATCH v3 1/4] ASoC: es8316: judge PCM rate at later timing Mark Brown
2019-09-04 15:06 ` Katsuhiro Suzuki
2019-09-04 15:30 ` Mark Brown
2019-09-04 15:55 ` Katsuhiro Suzuki
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=20190903165322.20791-3-katsuhiro@katsuster.net \
--to=katsuhiro@katsuster.net \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=drake@endlessm.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yangxiaohua@everest-semi.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).