| From 42f8374197668b7c55bc0cb903147962555a1388 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-i2c.c | 5 ++++- |
| sound/soc/codecs/rt5682.c | 1 + |
| 3 files changed, 6 insertions(+), 1 deletion(-) |
| |
| diff --git a/include/sound/rt5682.h b/include/sound/rt5682.h |
| --- 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-i2c.c b/sound/soc/codecs/rt5682-i2c.c |
| --- a/sound/soc/codecs/rt5682-i2c.c |
| +++ b/sound/soc/codecs/rt5682-i2c.c |
| @@ -280,7 +280,10 @@ static int rt5682_i2c_probe(struct i2c_client *i2c, |
| |
| #ifdef CONFIG_COMMON_CLK |
| /* Check if MCLK provided */ |
| - rt5682->mclk = devm_clk_get_optional(&i2c->dev, "mclk"); |
| + if (rt5682->pdata.mclk_name) |
| + rt5682->mclk = clk_get(NULL, rt5682->pdata.mclk_name); |
| + if (!rt5682->mclk) |
| + rt5682->mclk = devm_clk_get_optional(&i2c->dev, "mclk"); |
| if (IS_ERR(rt5682->mclk)) |
| return PTR_ERR(rt5682->mclk); |
| |
| diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c |
| --- a/sound/soc/codecs/rt5682.c |
| +++ b/sound/soc/codecs/rt5682.c |
| @@ -3073,6 +3073,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.34.0.rc2.393.gf8c9666880-goog |
| |