blob: e1b259f69e0a1c448b463c8ad96c388bf2b36150 [file] [log] [blame]
From d8186645e4c220cc768b2e06f7a0f508e27a623f Mon Sep 17 00:00:00 2001
From: Akshu Agrawal <akshu.agrawal@amd.com>
Date: Mon, 6 Jul 2020 19:28:01 +0530
Subject: [PATCH] FROMLIST: ASoC: rt5682: Add fmw property to get name of mclk
Non-dts based systems can use ACPI DSDT to pass on the mclk.
Thus add fmw property mclk-name to get the name of the system clk
and link it to rt5682 mclk.
Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
(am from https://patchwork.kernel.org/patch/11648137/)
BUG=b:158906189
TEST=rt5682 driver get the correct clk and tested audio playback
Change-Id: I547a5d438c3d22f16e51d193554182722cecbe63
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2282500
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@google.com>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
---
include/sound/rt5682.h | 1 +
sound/soc/codecs/rt5682.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h
index 3900a07e3935..8b5288176bc4 100644
--- a/include/sound/rt5682.h
+++ b/include/sound/rt5682.h
@@ -43,6 +43,7 @@ struct rt5682_platform_data {
bool dmic_clk_driving_high;
const char *dai_clk_names[RT5682_DAI_NUM_CLKS];
+ const char *mclk_name;
};
#endif
diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c
index b306ac4b9b2e..14bdff75fd48 100644
--- a/sound/soc/codecs/rt5682.c
+++ b/sound/soc/codecs/rt5682.c
@@ -2873,7 +2873,10 @@ static int rt5682_probe(struct snd_soc_component *component)
} else {
#ifdef CONFIG_COMMON_CLK
/* Check if MCLK provided */
- rt5682->mclk = devm_clk_get(component->dev, "mclk");
+ if (rt5682->pdata.mclk_name)
+ rt5682->mclk = clk_get(NULL, rt5682->pdata.mclk_name);
+ if (!rt5682->mclk)
+ rt5682->mclk = devm_clk_get(component->dev, "mclk");
if (IS_ERR(rt5682->mclk)) {
if (PTR_ERR(rt5682->mclk) != -ENOENT) {
ret = PTR_ERR(rt5682->mclk);
@@ -3002,6 +3005,7 @@ int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
rt5682->pdata.dmic_clk_driving_high = device_property_read_bool(dev,
"realtek,dmic-clk-driving-high");
+ device_property_read_string(dev, "realtek,mclk-name", &rt5682->pdata.mclk_name);
return 0;
}
--
2.17.1