Merge "defconfig: Enable camera drivers" into msm-4.9
diff --git a/include/dt-bindings/clock/qcom,audio-ext-clk.h b/include/dt-bindings/clock/qcom,audio-ext-clk.h
index 08f7dde..100666e 100644
--- a/include/dt-bindings/clock/qcom,audio-ext-clk.h
+++ b/include/dt-bindings/clock/qcom,audio-ext-clk.h
@@ -14,20 +14,18 @@
 #define __AUDIO_EXT_CLK_H
 
 /* Audio External Clocks */
-#ifdef CONFIG_COMMON_CLK_QCOM
 #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
-#else
+#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
 #define clk_audio_ap_clk2       0x454d1e91
 #define clk_audio_lpass_mclk    0xf0f2a284
 #define clk_audio_pmi_lnbb_clk   0x57312343
-#endif
 
 #define clk_div_clk1            0xaa1157a6
 #define clk_div_clk1_ao         0x6b943d68
diff --git a/sound/soc/codecs/audio-ext-clk-up.c b/sound/soc/codecs/audio-ext-clk-up.c
index 626db69..39986d6 100644
--- a/sound/soc/codecs/audio-ext-clk-up.c
+++ b/sound/soc/codecs/audio-ext-clk-up.c
@@ -296,6 +296,8 @@
 		.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 @@
 		.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 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)
 {
@@ -489,22 +496,47 @@
 	if (!clk_data)
 		goto err_gpio;
 
-	clk_data->clk_num = ARRAY_SIZE(audio_msm_hws);
-	clk_data->clks = devm_kzalloc(&pdev->dev,
-				clk_data->clk_num * sizeof(struct clk *),
-				GFP_KERNEL);
-	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) {
+		clk_data->clk_num = ARRAY_SIZE(audio_msm_hws);
+		clk_data->clks = devm_kzalloc(&pdev->dev,
+					clk_data->clk_num *
+					sizeof(struct clk *),
+					GFP_KERNEL);
+		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: 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;
+	} else {
+		clk_data->clk_num = ARRAY_SIZE(audio_msm_hws1);
+		clk_data->clks = devm_kzalloc(&pdev->dev,
+					clk_data->clk_num *
+					sizeof(struct clk *),
+					GFP_KERNEL);
+		if (!clk_data->clks)
+			goto err_clk;
+
+		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;
+		}
 	}
 
 	ret = of_clk_add_provider(pdev->dev.of_node,