From 356b68c1e208bb5be15c0489a2284519c61dcb81 Mon Sep 17 00:00:00 2001 From: Laxminath Kasam Date: Mon, 5 Mar 2018 15:56:29 +0530 Subject: [PATCH] dsp: avtimer: Update function pointers for camera isp to use avtimer After DLKM, avtimer functions cannot be invoked directly from kernel driver. Camera driver exposes API to get the function pointers to use avtimer. Update the function pointers by calling respective camera set API. AVTIMER_LEGACY config should be enabled in audio conf to enable this support. CRs-Fixed: 2201340 Change-Id: I165e7ea0226e174288f3e8b81ef01fce137e2e35 Signed-off-by: Laxminath Kasam --- dsp/avtimer.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/dsp/avtimer.c b/dsp/avtimer.c index c9ef9f4a8a..41718ef672 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 #include #include +#if IS_ENABLED(CONFIG_AVTIMER_LEGACY) +#include +#endif #include #include @@ -70,6 +73,7 @@ struct avtimer_t { }; 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 @@ int avcs_core_query_timer(uint64_t *avtimer_tick) } 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 @@ static int dev_avtimer_probe(struct platform_device *pdev) 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 @@ static int dev_avtimer_remove(struct platform_device *pdev) cdev_del(&avtimer.myc); class_destroy(avtimer.avtimer_class); unregister_chrdev_region(MKDEV(major, 0), 1); + avcs_set_isp_fptr(false); return 0; }