]> Git Repo - linux.git/commitdiff
ASoC: fsl-asoc-card: Get "extal" clock rate by clk_get_rate
authorShengjiu Wang <[email protected]>
Mon, 10 Aug 2020 08:11:43 +0000 (16:11 +0800)
committerMark Brown <[email protected]>
Tue, 18 Aug 2020 13:52:46 +0000 (14:52 +0100)
On some platform(.e.g. i.MX8QM MEK), the "extal" clock is different
with the mclk of codec, then the clock rate is also different.
So it is better to get clock rate of "extal" rate by clk_get_rate,
don't reuse the clock rate of mclk.

Signed-off-by: Shengjiu Wang <[email protected]>
Acked-by: Nicolin Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
sound/soc/fsl/fsl-asoc-card.c

index 52adedc03245b6a4895bc2adf5329d3c79e1c5b8..32f8f756e6bbd2d9e11a13345554a519d80318fa 100644 (file)
@@ -696,6 +696,17 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
                        goto asrc_fail;
                }
        } else if (of_node_name_eq(cpu_np, "esai")) {
+               struct clk *esai_clk = clk_get(&cpu_pdev->dev, "extal");
+
+               if (!IS_ERR(esai_clk)) {
+                       priv->cpu_priv.sysclk_freq[TX] = clk_get_rate(esai_clk);
+                       priv->cpu_priv.sysclk_freq[RX] = clk_get_rate(esai_clk);
+                       clk_put(esai_clk);
+               } else if (PTR_ERR(esai_clk) == -EPROBE_DEFER) {
+                       ret = -EPROBE_DEFER;
+                       goto asrc_fail;
+               }
+
                priv->cpu_priv.sysclk_id[1] = ESAI_HCKT_EXTAL;
                priv->cpu_priv.sysclk_id[0] = ESAI_HCKR_EXTAL;
        } else if (of_node_name_eq(cpu_np, "sai")) {
This page took 0.073267 seconds and 4 git commands to generate.