]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ASoC: qcom: move clock names into LPASS variant struct
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 5 Apr 2017 08:34:10 +0000 (10:34 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 21 Apr 2017 17:07:45 +0000 (18:07 +0100)
The clock names for the two supported codecs are either
"mi2s-*" name variants generated by code. This naming scheme
does not work for platforms like MSM8660 which has I2S channels
named CODEC_I2S_SPKR (rather than just "MI2S tertiary" and other
repetitive names) and consequently have clocks named
"codec-i2s-spkr-osr-clk" and similar.

Skip the runtime generation of clock names and replace it with
name lookup tables encoded into the variant data.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/qcom/lpass-apq8016.c
sound/soc/qcom/lpass-cpu.c
sound/soc/qcom/lpass-ipq806x.c
sound/soc/qcom/lpass.h

index 8aed72be32249ab0680b15bdb9e4bfbf1213693b..8a74844d99e2da9f7b18a4854d17bd7d2bf1feff 100644 (file)
@@ -231,6 +231,18 @@ static struct lpass_variant apq8016_data = {
        .wrdma_channels         = 2,
        .dai_driver             = apq8016_lpass_cpu_dai_driver,
        .num_dai                = ARRAY_SIZE(apq8016_lpass_cpu_dai_driver),
+       .dai_osr_clk_names      = (const char *[]) {
+                               "mi2s-osr-clk0",
+                               "mi2s-osr-clk1",
+                               "mi2s-osr-clk2",
+                               "mi2s-osr-clk3",
+                               },
+       .dai_bit_clk_names      = (const char *[]) {
+                               "mi2s-bit-clk0",
+                               "mi2s-bit-clk1",
+                               "mi2s-bit-clk2",
+                               "mi2s-bit-clk3",
+                               },
        .init                   = apq8016_lpass_init,
        .exit                   = apq8016_lpass_exit,
        .alloc_dma_channel      = apq8016_lpass_alloc_dma_channel,
index 5202a584e0c6fcb021708ddd65844dd5e57dc7e2..292b103abada9541ed6a499f614e0d3121ee4fd0 100644 (file)
@@ -429,7 +429,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
        struct lpass_variant *variant;
        struct device *dev = &pdev->dev;
        const struct of_device_id *match;
-       char clk_name[16];
        int ret, i, dai_id;
 
        dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
@@ -477,31 +476,24 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
 
        for (i = 0; i < variant->num_dai; i++) {
                dai_id = variant->dai_driver[i].id;
-               if (variant->num_dai > 1)
-                       sprintf(clk_name, "mi2s-osr-clk%d", i);
-               else
-                       sprintf(clk_name, "mi2s-osr-clk");
-
                drvdata->mi2s_osr_clk[dai_id] = devm_clk_get(&pdev->dev,
-                                                               clk_name);
+                                            variant->dai_osr_clk_names[i]);
                if (IS_ERR(drvdata->mi2s_osr_clk[dai_id])) {
                        dev_warn(&pdev->dev,
-                               "error getting optional mi2s-osr-clk: %ld\n",
+                               "%s() error getting optional %s: %ld\n",
+                               __func__,
+                               variant->dai_osr_clk_names[i],
                                PTR_ERR(drvdata->mi2s_osr_clk[dai_id]));
 
                        drvdata->mi2s_osr_clk[dai_id] = NULL;
                }
 
-               if (variant->num_dai > 1)
-                       sprintf(clk_name, "mi2s-bit-clk%d", i);
-               else
-                       sprintf(clk_name, "mi2s-bit-clk");
-
                drvdata->mi2s_bit_clk[dai_id] = devm_clk_get(&pdev->dev,
-                                                           clk_name);
+                                               variant->dai_bit_clk_names[i]);
                if (IS_ERR(drvdata->mi2s_bit_clk[dai_id])) {
                        dev_err(&pdev->dev,
-                               "error getting mi2s-bit-clk: %ld\n",
+                               "error getting %s: %ld\n",
+                               variant->dai_bit_clk_names[i],
                                PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
                        return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
                }
index 608c1a92af8a801d8364343540d8cc85cdc6f640..ca1e1f2d27877a190f57d2c470236c680cccef80 100644 (file)
@@ -92,6 +92,12 @@ static struct lpass_variant ipq806x_data = {
        .wrdma_channels         = 4,
        .dai_driver             = &ipq806x_lpass_cpu_dai_driver,
        .num_dai                = 1,
+       .dai_osr_clk_names      = (const char *[]) {
+                               "mi2s-osr-clk",
+                               },
+       .dai_bit_clk_names      = (const char *[]) {
+                               "mi2s-bit-clk",
+                               },
        .alloc_dma_channel      = ipq806x_lpass_alloc_dma_channel,
        .free_dma_channel       = ipq806x_lpass_free_dma_channel,
 };
index 9b031352ea3c24708a46e188813169393c998866..b848db2d6c3dcf870c0c8001685ad7f2c25d4fbb 100644 (file)
@@ -91,6 +91,8 @@ struct lpass_variant {
        /* SOC specific dais */
        struct snd_soc_dai_driver *dai_driver;
        int num_dai;
+       const char * const *dai_osr_clk_names;
+       const char * const *dai_bit_clk_names;
 };
 
 /* register the platform driver from the CPU DAI driver */