ASoC: apq8009: add changes to enable lpass_mclk for apq8009
Modify audio_ref_clk_probe and lpass_mclk_prepare functions to read lpass
gpio register and lpass-clock values from dtsi to enable lpass_mclk.
Enable LPASS_CLK_VER_2 and use cdc digital clock support for apq8009
target.
Change-Id: I5532d274b51cb69fbb58e39dd8f48bb3a8d10039
Signed-off-by: Raja Mallik <rmallik@codeaurora.org>
Signed-off-by: Chinkit Kumar,Kirti Kumar Parmar <parma@codeaurora.org>
Signed-off-by: Raja Mallik <rmallik@codeaurora.org>
diff --git a/dsp/q6afe.c b/dsp/q6afe.c
index 5d52ec1..5a92fa5 100644
--- a/dsp/q6afe.c
+++ b/dsp/q6afe.c
@@ -25,6 +25,7 @@
#include <dsp/q6audio-v2.h>
#include <ipc/apr_tal.h>
#include "adsp_err.h"
+#include <dsp/q6core.h>
#define WAKELOCK_TIMEOUT 5000
enum {
@@ -6358,6 +6359,47 @@
}
EXPORT_SYMBOL(afe_set_lpass_clock_v2);
+static int afe_get_service_ver(void)
+{
+ int ret = 0;
+ size_t ver_size;
+ struct avcs_fwk_ver_info *ver_info = NULL;
+
+ ver_size = sizeof(struct avcs_get_fwk_version) +
+ sizeof(struct avs_svc_api_info);
+ ver_info = kzalloc(ver_size, GFP_KERNEL);
+ if (ver_info == NULL)
+ return -ENOMEM;
+
+ ret = q6core_get_service_version(AVCS_SERVICE_ID_AFE, ver_info, ver_size);
+ if (ret)
+ pr_err("%s: q6core_get_service_version failed %d\n",
+ __func__, ret);
+
+ return ret;
+}
+
+enum lpass_clk_ver afe_get_lpass_clk_ver(void)
+{
+ enum lpass_clk_ver lpass_clk_ver;
+
+ /*
+ * Use different APIs to set the LPASS clock depending on the AFE
+ * version. On success afe_get_service_ver returns 0 signyfing the
+ * latest AFE version is supported. Use LPASS clock version 2 if the
+ * latest AFE version is supported, otherwise use LPASS clock version 1.
+ */
+ lpass_clk_ver = (afe_get_service_ver() == 0) ?
+ LPASS_CLK_VER_2 : LPASS_CLK_VER_1;
+
+ pr_debug("%s: returning %s\n", __func__,
+ (lpass_clk_ver == LPASS_CLK_VER_2) ?
+ "LPASS_CLK_VER_2" : "LPASS_CLK_VER_1");
+
+ return lpass_clk_ver;
+}
+EXPORT_SYMBOL(afe_get_lpass_clk_ver);
+
int afe_set_lpass_internal_digital_codec_clock(u16 port_id,
struct afe_digital_clk_cfg *cfg)
{