Ver Fonte

qcacmn: Define qdf timer multiplier as a macro

The current QDF timer multiplier factor is of type
uint32 which takes whole number, so we cannot have multiplier
factors like 0.5 or 1.5

To provide such timer multiplier,
we define timer multiplier, as a macro, provided though
build options and support values like 0.5 or 1.5 through
1/2 and 3/2 respectively and this is used to configure the
timeout value.

Change-Id: I3f5441e33cca71f4a399cbbf9c6f61e2f21ee828
CRs-Fixed: 2450710
Vivek há 5 anos atrás
pai
commit
2ec3781464

+ 8 - 0
qdf/inc/qdf_timer.h

@@ -51,6 +51,14 @@ qdf_timer_init(qdf_handle_t hdl, qdf_timer_t *timer, qdf_timer_func_t func,
 	return __qdf_timer_init(timer, func, arg, type);
 }
 
+#ifdef QDF_TIMER_MULTIPLIER_FRAC
+#define qdf_msecs_to_jiffies(msec) \
+	(QDF_TIMER_MULTIPLIER_FRAC * __qdf_msecs_to_jiffies(msec))
+#else
+#define qdf_msecs_to_jiffies(msec) \
+	(qdf_timer_get_multiplier() * __qdf_msecs_to_jiffies(msec))
+#endif
+
 /**
  * qdf_timer_start() - start a timer
  * @timer: timer to start

+ 4 - 4
qdf/linux/src/i_qdf_timer.h

@@ -36,8 +36,6 @@
 
 typedef void (*qdf_timer_func_t)(void *);
 
-#define qdf_msecs_to_jiffies(msec) \
-	(qdf_timer_get_multiplier() * msecs_to_jiffies(msec))
 
 struct __qdf_timer_t {
 	struct timer_list os_timer;
@@ -45,6 +43,8 @@ struct __qdf_timer_t {
 	void *context;
 };
 
+#define __qdf_msecs_to_jiffies(msec) msecs_to_jiffies(msec)
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
 static inline void __os_timer_shim(struct timer_list *os_timer)
 {
@@ -121,13 +121,13 @@ static inline void __qdf_timer_start(struct __qdf_timer_t *timer, uint32_t msec)
 {
 	struct timer_list *os_timer = &timer->os_timer;
 
-	os_timer->expires = jiffies + qdf_msecs_to_jiffies(msec);
+	os_timer->expires = jiffies + __qdf_msecs_to_jiffies(msec);
 	add_timer(os_timer);
 }
 
 static inline void __qdf_timer_mod(struct __qdf_timer_t *timer, uint32_t msec)
 {
-	mod_timer(&timer->os_timer, jiffies + qdf_msecs_to_jiffies(msec));
+	mod_timer(&timer->os_timer, jiffies + __qdf_msecs_to_jiffies(msec));
 }
 
 static inline bool __qdf_timer_stop(struct __qdf_timer_t *timer)

+ 4 - 4
qdf/linux/src/qdf_event.c

@@ -28,6 +28,7 @@
 /* Include Files */
 #include "qdf_event.h"
 #include "qdf_mc_timer.h"
+#include "qdf_timer.h"
 #include <qdf_module.h>
 
 struct qdf_evt_node {
@@ -211,10 +212,9 @@ QDF_STATUS qdf_wait_single_event(qdf_event_t *event, uint32_t timeout)
 	if (timeout) {
 		long ret;
 
-		/* update the timeout if it's on an emulation platform */
-		timeout *= qdf_timer_get_multiplier();
-		ret = wait_for_completion_timeout(&event->complete,
-						  msecs_to_jiffies(timeout));
+		ret = wait_for_completion_timeout(
+				&event->complete,
+				qdf_msecs_to_jiffies(timeout));
 
 		if (ret <= 0)
 			return QDF_STATUS_E_TIMEOUT;

+ 2 - 4
qdf/linux/src/qdf_mc_timer.c

@@ -29,6 +29,7 @@
 #include "qdf_list.h"
 #include "qdf_mem.h"
 #include <qdf_module.h>
+#include "qdf_timer.h"
 
 /* Preprocessor definitions and constants */
 #define LINUX_TIMER_COOKIE 0x12341234
@@ -662,9 +663,6 @@ QDF_STATUS qdf_mc_timer_start(qdf_mc_timer_t *timer, uint32_t expiration_time)
 		return QDF_STATUS_E_INVAL;
 	}
 
-	/* update expiration time based on if emulation platform */
-	expiration_time *= qdf_timer_get_multiplier();
-
 	/* make sure the remainer of the logic isn't interrupted */
 	qdf_spin_lock_irqsave(&timer->platform_info.spinlock);
 
@@ -679,7 +677,7 @@ QDF_STATUS qdf_mc_timer_start(qdf_mc_timer_t *timer, uint32_t expiration_time)
 
 	/* start the timer */
 	mod_timer(&(timer->platform_info.timer),
-		  jiffies + msecs_to_jiffies(expiration_time));
+		  jiffies + qdf_msecs_to_jiffies(expiration_time));
 
 	timer->state = QDF_TIMER_STATE_RUNNING;