From c7e0c632606cace98562346ebae2f8fa0821ac58 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Thu, 18 May 2017 14:59:53 -0700 Subject: [PATCH] qcacmn: Create QDF timer multiplier get/set APIs In order to provide greater flexibility on emulation platforms, replace the current hard-coded QDF_TIMER_MULTIPLIER with a pair of get/set methods, configurable at runtime. Change-Id: I0757da6c2129db08459411eaef75b6183f1aa557 CRs-Fixed: 2049309 --- qdf/inc/qdf_mc_timer.h | 16 ++++++++++++++++ qdf/linux/src/qdf_event.c | 12 +++--------- qdf/linux/src/qdf_mc_timer.c | 20 ++++++++++++++++---- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/qdf/inc/qdf_mc_timer.h b/qdf/inc/qdf_mc_timer.h index bd1d65755c..c63f292abe 100644 --- a/qdf/inc/qdf_mc_timer.h +++ b/qdf/inc/qdf_mc_timer.h @@ -285,4 +285,20 @@ void qdf_timer_module_deinit(void); */ void qdf_get_time_of_the_day_in_hr_min_sec_usec(char *tbuf, int len); void qdf_register_mc_timer_callback(void (*callback) (unsigned long data)); + +/** + * qdf_timer_set_multiplier() - set the global QDF timer scalar value + * @multiplier: the scalar value to apply + * + * Return: None + */ +void qdf_timer_set_multiplier(uint32_t multiplier); + +/** + * qdf_timer_get_multiplier() - get the global QDF timer scalar value + * + * Return: the global QDF timer scalar value + */ +uint32_t qdf_timer_get_multiplier(void); + #endif /* __QDF_MC_TIMER_H */ diff --git a/qdf/linux/src/qdf_event.c b/qdf/linux/src/qdf_event.c index 65a5eaf897..6dafcc83e9 100644 --- a/qdf/linux/src/qdf_event.c +++ b/qdf/linux/src/qdf_event.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -36,15 +36,9 @@ /* Include Files */ #include "qdf_event.h" +#include "qdf_mc_timer.h" #include -/* Flag for napier emulation */ -#ifdef QCA_WIFI_NAPIER_EMULATION -#define QDF_TIMER_MULTIPLIER 100 -#else -#define QDF_TIMER_MULTIPLIER 1 -#endif - /* Function Definitions and Documentation */ /** @@ -251,7 +245,7 @@ QDF_STATUS qdf_wait_single_event(qdf_event_t *event, uint32_t timeout) } /* update the timeout if its on a emaulation platform */ - timeout *= QDF_TIMER_MULTIPLIER; + timeout *= qdf_timer_get_multiplier(); if (timeout) { long ret; ret = wait_for_completion_timeout(&event->complete, diff --git a/qdf/linux/src/qdf_mc_timer.c b/qdf/linux/src/qdf_mc_timer.c index 0690612a07..c0d3d6f579 100644 --- a/qdf/linux/src/qdf_mc_timer.c +++ b/qdf/linux/src/qdf_mc_timer.c @@ -43,13 +43,25 @@ #define LINUX_INVALID_TIMER_COOKIE 0xfeedface #define TMR_INVALID_ID (0) -/* Flag for napier emulation */ +/* qdf timer multiplier */ #ifdef QCA_WIFI_NAPIER_EMULATION -#define QDF_TIMER_MULTIPLIER 100 +static uint32_t g_qdf_timer_multiplier = 100; #else -#define QDF_TIMER_MULTIPLIER 1 +static uint32_t g_qdf_timer_multiplier = 1; #endif +inline void qdf_timer_set_multiplier(uint32_t multiplier) +{ + g_qdf_timer_multiplier = multiplier; +} +EXPORT_SYMBOL(qdf_timer_set_multiplier); + +inline uint32_t qdf_timer_get_multiplier(void) +{ + return g_qdf_timer_multiplier; +} +EXPORT_SYMBOL(qdf_timer_get_multiplier); + /* Type declarations */ /* Static Variable Definitions */ @@ -569,7 +581,7 @@ QDF_STATUS qdf_mc_timer_start(qdf_mc_timer_t *timer, uint32_t expiration_time) } /* update expiration time based on if emulation platform */ - expiration_time *= QDF_TIMER_MULTIPLIER; + expiration_time *= qdf_timer_get_multiplier(); /* make sure the remainer of the logic isn't interrupted */ qdf_spin_lock_irqsave(&timer->platform_info.spinlock);