ASoC: rt5682: Add a mclk name property to the device tree
Subsystems (4)
PATCH 2/2 ASoC: rt5682: Read property to get mclk control
In reply to [email protected]From: "derek.fang" <[email protected]>
The systems can use ACPI DSDT to pass on the mclk to rt5682. Enable/Disable of the mclk is already handled in the codec so platform drivers don't have to explicitly do handling of mclk.
Signed-off-by derek.fang <[email protected]>
include/sound/rt5682.h +1 -0
@@ -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
sound/soc/codecs/rt5682.c +10 -1
@@ -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" );
Signature · 1 line
2.17.1
PATCH 1/2 ASoC: rt5682: Add a mclk name property to the device tree
From: "derek.fang" <[email protected]>
The patch adds a new property to specify the mclk name which be used.
Signed-off-by derek.fang <[email protected]>
Documentation/devicetree/bindings/sound/rt5682.txt +2 -0
@@ -46,6 +46,8 @@ Optional properties: - realtek,dmic-clk-driving-high : Set the high driving of the DMIC clock out. +- realtek,mclk-name : Specify the mclk name that codec uses as clock provider. + Pins on the device (for linking into audio routes) for RT5682: * DMIC L1
Signature · 1 line
2.17.1
Mark Brown
maintainerQuoted 1 line · On Mon, Mar 22, 2021 at 08:47:05PM +0800, [email protected] wrote:
+- realtek,mclk-name : Specify the mclk name that codec uses as clock provider.
This is really non-idiomatic interface design for the device tree (or anything really) - the names for the clocks are defined at the device scope, it doesn't make sense to have a property like this.