Merge "config: Enable AVTIMER_LEGACY for sdm450"
diff --git a/config/sdm450auto.conf b/config/sdm450auto.conf
index 3a7e303..0d367ae 100644
--- a/config/sdm450auto.conf
+++ b/config/sdm450auto.conf
@@ -33,6 +33,7 @@
CONFIG_DTS_SRS_TM=m
CONFIG_SND_SOC_MSM_STUB=m
CONFIG_MSM_AVTIMER=m
+CONFIG_AVTIMER_LEGACY=m
CONFIG_SND_SOC_SDM660_CDC=m
CONFIG_SND_SOC_ANALOG_CDC=m
CONFIG_SND_SOC_DIGITAL_CDC_LEGACY=m
diff --git a/config/sdm450autoconf.h b/config/sdm450autoconf.h
index 737461a..1aca114 100644
--- a/config/sdm450autoconf.h
+++ b/config/sdm450autoconf.h
@@ -46,6 +46,7 @@
#define CONFIG_MSM_CDC_PINCTRL 1
#define CONFIG_SND_SOC_MSM_STUB 1
#define CONFIG_MSM_AVTIMER 1
+#define CONFIG_AVTIMER_LEGACY 1
#define CONFIG_SND_SOC_EXT_CODEC 1
#define CONFIG_SND_SOC_INT_CODEC 1
#define CONFIG_SND_SOC_SDM660_CDC 1
diff --git a/dsp/avtimer.c b/dsp/avtimer.c
index b6833ed..db9eb9a 100644
--- a/dsp/avtimer.c
+++ b/dsp/avtimer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2015, 2017-2018 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
@@ -25,6 +25,9 @@
#include <linux/of.h>
#include <linux/wait.h>
#include <linux/sched.h>
+#if IS_ENABLED(CONFIG_AVTIMER_LEGACY)
+#include <media/msmb_isp.h>
+#endif
#include <ipc/apr.h>
#include <dsp/q6core.h>
@@ -70,6 +73,7 @@
};
static struct avtimer_t avtimer;
+static void avcs_set_isp_fptr(bool enable);
static int32_t aprv2_core_fn_q(struct apr_client_data *data, void *priv)
{
@@ -313,6 +317,29 @@
}
EXPORT_SYMBOL(avcs_core_query_timer);
+#if IS_ENABLED(CONFIG_AVTIMER_LEGACY)
+static void avcs_set_isp_fptr(bool enable)
+{
+ struct avtimer_fptr_t av_fptr;
+
+ if (enable) {
+ av_fptr.fptr_avtimer_open = avcs_core_open;
+ av_fptr.fptr_avtimer_enable = avcs_core_disable_power_collapse;
+ av_fptr.fptr_avtimer_get_time = avcs_core_query_timer;
+ msm_isp_set_avtimer_fptr(av_fptr);
+ } else {
+ av_fptr.fptr_avtimer_open = NULL;
+ av_fptr.fptr_avtimer_enable = NULL;
+ av_fptr.fptr_avtimer_get_time = NULL;
+ msm_isp_set_avtimer_fptr(av_fptr);
+ }
+}
+#else
+static void avcs_set_isp_fptr(bool enable)
+{
+}
+#endif
+
static int avtimer_open(struct inode *inode, struct file *file)
{
return avcs_core_disable_power_collapse(1);
@@ -469,6 +496,8 @@
else
avtimer.clk_mult = clk_mult_val;
+ avcs_set_isp_fptr(true);
+
pr_debug("%s: avtimer.clk_div = %d, avtimer.clk_mult = %d\n",
__func__, avtimer.clk_div, avtimer.clk_mult);
return 0;
@@ -500,6 +529,7 @@
cdev_del(&avtimer.myc);
class_destroy(avtimer.avtimer_class);
unregister_chrdev_region(MKDEV(major, 0), 1);
+ avcs_set_isp_fptr(false);
return 0;
}