[svn-commits] sruffell: linux/trunk r8198 - in /linux/trunk: drivers/dahdi/voicebus/ driver...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 1 17:15:53 CST 2010


Author: sruffell
Date: Mon Mar  1 17:15:49 2010
New Revision: 8198

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8198
Log:
wctdm24xxp, wcte12xp: Add optional module parameter to set the maximum latency.

Setting the maximum latency can be useful if you have a system event that
normally causes a latency increase, but you would rather have a break in the
audio or frame slip, then let the latency grow to the current default maximum
which is 25ms. DAHDI-278.

Modified:
    linux/trunk/drivers/dahdi/voicebus/voicebus.h
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.h?view=diff&rev=8198&r1=8197&r2=8198
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.h Mon Mar  1 17:15:49 2010
@@ -37,11 +37,11 @@
 #include <linux/etherdevice.h>
 #endif
 
-#define VOICEBUS_DEFAULT_LATENCY	3
-#define VOICEBUS_DEFAULT_MAXLATENCY	25
-#define VOICEBUS_MAXLATENCY_BUMP	6
-
-#define VOICEBUS_SFRAME_SIZE 1004
+#define VOICEBUS_DEFAULT_LATENCY	3U
+#define VOICEBUS_DEFAULT_MAXLATENCY	25U
+#define VOICEBUS_MAXLATENCY_BUMP	6U
+
+#define VOICEBUS_SFRAME_SIZE 1004U
 
 /*! The number of descriptors in both the tx and rx descriptor ring. */
 #define DRING_SIZE	(1 << 7)  /* Must be a power of 2 */
@@ -189,4 +189,17 @@
 {
 	set_bit(VOICEBUS_NORMAL_MODE, &vb->flags);
 }
+
+/**
+ * voicebus_set_max_latency() - Set the maximum number of milliseconds the latency will be able to grow to.
+ */
+static inline void
+voicebus_set_maxlatency(struct voicebus *vb, unsigned int max_latency)
+{
+	spin_lock_bh(&vb->lock);
+	vb->max_latency = clamp(max_latency,
+				vb->min_tx_buffer_count,
+				VOICEBUS_DEFAULT_MAXLATENCY);
+	spin_unlock_bh(&vb->lock);
+}
 #endif /* __VOICEBUS_H__ */

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8198&r1=8197&r2=8198
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Mon Mar  1 17:15:49 2010
@@ -237,6 +237,7 @@
 static int ringdebounce = DEFAULT_RING_DEBOUNCE;
 static int fwringdetect = 0;
 static int latency = VOICEBUS_DEFAULT_LATENCY;
+static unsigned int max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
 static int forceload;
 
 #define MS_PER_HOOKCHECK	(1)
@@ -4670,6 +4671,7 @@
 		wc->vb.ops = &voicebus_operations;
 		ret = voicebus_init(&wc->vb, wc->board_name);
 		voicebus_set_minlatency(&wc->vb, latency);
+		voicebus_set_maxlatency(&wc->vb, max_latency);
 	}
 
 	if (ret) {
@@ -4716,6 +4718,7 @@
 		voicebus_stop(&wc->vb);
 		wc->vb.ops = &voicebus_operations;
 		voicebus_set_minlatency(&wc->vb, latency);
+		voicebus_set_maxlatency(&wc->vb, max_latency);
 		voicebus_set_normal_mode(&wc->vb);
 		if (voicebus_start(&wc->vb))
 			BUG_ON(1);
@@ -5036,6 +5039,7 @@
 module_param(ringdebounce, int, 0600);
 module_param(fwringdetect, int, 0600);
 module_param(latency, int, 0400);
+module_param(max_latency, int, 0400);
 module_param(neonmwi_monitor, int, 0600);
 module_param(neonmwi_level, int, 0600);
 module_param(neonmwi_envelope, int, 0600);

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8198&r1=8197&r2=8198
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Mon Mar  1 17:15:49 2010
@@ -40,6 +40,7 @@
 #include <linux/delay.h>
 #include <linux/sched.h>
 
+#include <stdbool.h>
 #include <dahdi/kernel.h>
 
 #include "wct4xxp/wct4xxp.h"	/* For certain definitions */
@@ -64,6 +65,7 @@
 static int t1e1override = -1;
 static int unchannelized = 0;
 static int latency = VOICEBUS_DEFAULT_LATENCY;
+static unsigned int max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
 static int vpmsupport = 1;
 static int vpmtsisupport = 0;
 
@@ -1880,6 +1882,7 @@
 	
 	if (VOICEBUS_DEFAULT_LATENCY != latency) {
 		voicebus_set_minlatency(&wc->vb, latency);
+		voicebus_set_maxlatency(&wc->vb, max_latency);
 	}
 
 	voicebus_lock_latency(&wc->vb);

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=8198&r1=8197&r2=8198
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Mon Mar  1 17:15:49 2010
@@ -1185,6 +1185,8 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31)
 #define KERN_CONT ""
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
+#define clamp(x, low, high) min (max (low, x), high)
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
 
 /* Some distributions backported fatal_signal_pending so we'll use a macro to
@@ -1222,6 +1224,7 @@
 #endif /* 2.6.14 */
 #endif /* 2.6.18 */
 #endif /* 2.6.25 */
+#endif /* 2.6.26 */
 #endif /* 2.6.31 */
 
 #ifndef DMA_BIT_MASK




More information about the svn-commits mailing list