@@ -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
@@ -2875,7 +2875,8 @@ 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 = devm_clk_get(NULL, rt5682->pdata.mclk_name);
if (IS_ERR(rt5682->mclk)) {
if (PTR_ERR(rt5682->mclk) != -ENOENT) {
ret = PTR_ERR(rt5682->mclk);
@@ -2905,6 +2906,11 @@ static void rt5682_remove(struct snd_soc_component *component)
struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
rt5682_reset(rt5682);
+
+#ifdef CONFIG_COMMON_CLK
+ if (rt5682->pdata.mclk_name)
+ devm_clk_put(rt5682->mclk);
+#endif
}
#ifdef CONFIG_PM
@@ -3002,6 +3008,9 @@ int rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev)
rt5682->pdata.dai_clk_names[RT5682_DAI_WCLK_IDX],
rt5682->pdata.dai_clk_names[RT5682_DAI_BCLK_IDX]);
+ device_property_read_string(dev, "realtek,mclk-name",
+ &rt5682->pdata.mclk_name);
+
rt5682->pdata.dmic_clk_driving_high = device_property_read_bool(dev,
"realtek,dmic-clk-driving-high");