Parcourir la source

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
Dustin Brown il y a 8 ans
Parent
commit
c7e0c63260
3 fichiers modifiés avec 35 ajouts et 13 suppressions
  1. 16 0
      qdf/inc/qdf_mc_timer.h
  2. 3 9
      qdf/linux/src/qdf_event.c
  3. 16 4
      qdf/linux/src/qdf_mc_timer.c

+ 16 - 0
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 */

+ 3 - 9
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 <linux/export.h>
 
-/* 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,

+ 16 - 4
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);