summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeleswarapu Nagaradhesh <nagaradh@codeaurora.org>2017-01-17 16:05:34 +0530
committerLaxminath Kasam <lkasam@codeaurora.org>2017-01-19 00:52:56 +0530
commit1a43bb07cb43624ca206c68b1d5071e0a4b8a373 (patch)
tree5dd6683a5cb0f2daa4324d3ea4f6dc893c7019b0
parent71fb9c8efa5bb4dde74b7ea6de17d6b010fef9a6 (diff)
ASoC: audio-ext-clk: add parent to div and lnbb clks
Add parents to div_clk1 and ln_bbclk. And register both the clocks independently. Change-Id: Ic0435ebad533879e3e0648775956c91cc680644d Signed-off-by: Yeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
-rw-r--r--include/dt-bindings/clock/audio-ext-clk.h12
-rw-r--r--sound/soc/codecs/audio-ext-clk-up.c43
2 files changed, 39 insertions, 16 deletions
diff --git a/include/dt-bindings/clock/audio-ext-clk.h b/include/dt-bindings/clock/audio-ext-clk.h
index a384ddf68ea0..6fe8a466cf0e 100644
--- a/include/dt-bindings/clock/audio-ext-clk.h
+++ b/include/dt-bindings/clock/audio-ext-clk.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -15,11 +15,11 @@
/* Audio External Clocks */
#define AUDIO_PMI_CLK 0
-#define AUDIO_PMIC_LNBB_CLK 1
-#define AUDIO_AP_CLK 2
-#define AUDIO_AP_CLK2 3
-#define AUDIO_LPASS_MCLK 4
-#define AUDIO_LPASS_MCLK2 5
+#define AUDIO_PMIC_LNBB_CLK 0
+#define AUDIO_AP_CLK 1
+#define AUDIO_AP_CLK2 2
+#define AUDIO_LPASS_MCLK 3
+#define AUDIO_LPASS_MCLK2 4
#define clk_audio_ap_clk 0x9b5727cb
#define clk_audio_pmi_clk 0xcbfe416d
diff --git a/sound/soc/codecs/audio-ext-clk-up.c b/sound/soc/codecs/audio-ext-clk-up.c
index f989498e9c32..6de88aff0dd4 100644
--- a/sound/soc/codecs/audio-ext-clk-up.c
+++ b/sound/soc/codecs/audio-ext-clk-up.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -296,6 +296,8 @@ static struct audio_ext_pmi_clk audio_pmi_clk = {
.div = 1,
.hw.init = &(struct clk_init_data){
.name = "audio_ext_pmi_clk",
+ .parent_names = (const char *[]){ "div_clk1" },
+ .num_parents = 1,
.ops = &clk_dummy_ops,
},
},
@@ -308,6 +310,8 @@ static struct audio_ext_pmi_clk audio_pmi_lnbb_clk = {
.div = 1,
.hw.init = &(struct clk_init_data){
.name = "audio_ext_pmi_lnbb_clk",
+ .parent_names = (const char *[]){ "ln_bb_clk2" },
+ .num_parents = 1,
.ops = &clk_dummy_ops,
},
},
@@ -364,13 +368,16 @@ static struct audio_ext_lpass_mclk audio_lpass_mclk2 = {
static struct clk_hw *audio_msm_hws[] = {
&audio_pmi_clk.fact.hw,
- &audio_pmi_lnbb_clk.fact.hw,
&audio_ap_clk.fact.hw,
&audio_ap_clk2.fact.hw,
&audio_lpass_mclk.fact.hw,
&audio_lpass_mclk2.fact.hw,
};
+static struct clk_hw *audio_msm_hws1[] = {
+ &audio_pmi_lnbb_clk.fact.hw,
+};
+
static int audio_get_pinctrl(struct platform_device *pdev,
enum audio_clk_mux mux)
{
@@ -496,15 +503,31 @@ static int audio_ref_clk_probe(struct platform_device *pdev)
if (!clk_data->clks)
goto err_clk;
- for (i = 0; i < ARRAY_SIZE(audio_msm_hws); i++) {
- audio_clk = devm_clk_register(dev, audio_msm_hws[i]);
- if (IS_ERR(audio_clk)) {
- dev_err(&pdev->dev,
- "%s: audio ref clock i = %d register failed\n",
- __func__, i);
- return PTR_ERR(audio_clk);
+
+ clk_gpio = of_get_named_gpio(pdev->dev.of_node,
+ "qcom,audio-ref-clk-gpio", 0);
+ if (clk_gpio > 0) {
+ for (i = 0; i < ARRAY_SIZE(audio_msm_hws); i++) {
+ audio_clk = devm_clk_register(dev, audio_msm_hws[i]);
+ if (IS_ERR(audio_clk)) {
+ dev_err(&pdev->dev,
+ "%s: ref clock: %d register failed\n",
+ __func__, i);
+ return PTR_ERR(audio_clk);
+ }
+ clk_data->clks[i] = audio_clk;
+ }
+ } else {
+ for (i = 0; i < ARRAY_SIZE(audio_msm_hws1); i++) {
+ audio_clk = devm_clk_register(dev, audio_msm_hws1[i]);
+ if (IS_ERR(audio_clk)) {
+ dev_err(&pdev->dev,
+ "%s: ref clock: %d register failed\n",
+ __func__, i);
+ return PTR_ERR(audio_clk);
+ }
+ clk_data->clks[i] = audio_clk;
}
- clk_data->clks[i] = audio_clk;
}
ret = of_clk_add_provider(pdev->dev.of_node,