summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKatsuhiro Suzuki <katsuhiro@katsuster.net>2019-09-07 18:36:52 +0200
committerMark Brown <broonie@kernel.org>2019-09-09 11:50:21 +0200
commit0db0c62c88b84b135bbaf784499a08e536354a43 (patch)
treed0adc5c377419313aaccebfbea523a13f180b702 /sound
parentASoC: SOF: imx8: Fix COMPILE_TEST error (diff)
downloadlinux-0db0c62c88b84b135bbaf784499a08e536354a43.tar.xz
linux-0db0c62c88b84b135bbaf784499a08e536354a43.zip
ASoC: es8316: fix redundant codes of clock
This patch removes redundant null checks for optional MCLK clock. And fix DT binding document for changing clock property to optional from required. Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net> Link: https://lore.kernel.org/r/20190907163653.9382-1-katsuhiro@katsuster.net Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/es8316.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 6248b01ca049..e9fa4981ccef 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -370,11 +370,9 @@ static int es8316_set_dai_sysclk(struct snd_soc_dai *codec_dai,
if (freq == 0)
return 0;
- if (es8316->mclk) {
- ret = clk_set_rate(es8316->mclk, freq);
- if (ret)
- return ret;
- }
+ ret = clk_set_rate(es8316->mclk, freq);
+ if (ret)
+ return ret;
/* Limit supported sample rates to ones that can be autodetected
* by the codec running in slave mode.
@@ -709,20 +707,18 @@ static int es8316_probe(struct snd_soc_component *component)
es8316->component = component;
- es8316->mclk = devm_clk_get(component->dev, "mclk");
- if (PTR_ERR(es8316->mclk) == -EPROBE_DEFER)
- return -EPROBE_DEFER;
+ es8316->mclk = devm_clk_get_optional(component->dev, "mclk");
if (IS_ERR(es8316->mclk)) {
- dev_err(component->dev, "clock is invalid, ignored\n");
- es8316->mclk = NULL;
+ dev_err(component->dev, "unable to get mclk\n");
+ return PTR_ERR(es8316->mclk);
}
+ if (!es8316->mclk)
+ dev_warn(component->dev, "assuming static mclk\n");
- if (es8316->mclk) {
- ret = clk_prepare_enable(es8316->mclk);
- if (ret) {
- dev_err(component->dev, "unable to enable clock\n");
- return ret;
- }
+ ret = clk_prepare_enable(es8316->mclk);
+ if (ret) {
+ dev_err(component->dev, "unable to enable mclk\n");
+ return ret;
}
/* Reset codec and enable current state machine */
@@ -751,8 +747,7 @@ static void es8316_remove(struct snd_soc_component *component)
{
struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
- if (es8316->mclk)
- clk_disable_unprepare(es8316->mclk);
+ clk_disable_unprepare(es8316->mclk);
}
static const struct snd_soc_component_driver soc_component_dev_es8316 = {