[svn-commits] sruffell: branch linux/sruffell/staging r6507 - in /linux/team/sruffell/stagi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 27 12:52:42 CDT 2009


Author: sruffell
Date: Mon Apr 27 12:52:38 2009
New Revision: 6507

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6507
Log:
improve new echocan API a bit to add some parameters that hw echocans need for andling their state structures

convert wcb4xxp, wct4xxp and wctdm24xxp over to new echocan API... still need to finish wcte12xp

fix up some API function names to match what they really do, and add a specific events-only echocan function for hwecs to use to report events

Modified:
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c
    linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c
    linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h

Modified: linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=6507&r1=6506&r2=6507
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.c Mon Apr 27 12:52:38 2009
@@ -331,6 +331,13 @@
 }
 EXPORT_SYMBOL(vpmadt032_echocan_with_params);
 
+void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo, struct dahdi_echocan_state *ec)
+{
+	return; /* !!! fill in */
+}
+EXPORT_SYMBOL(vpmadt032_echocan_free);
+
+
 struct vpmadt032 *vpmadt032_alloc(struct vpmadt032_options *options)
 {
 	struct vpmadt032 *vpm;

Modified: linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=6507&r1=6506&r2=6507
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/team/sruffell/staging/drivers/dahdi/voicebus/GpakCust.h Mon Apr 27 12:52:38 2009
@@ -123,6 +123,7 @@
 struct voicebus;
 struct dahdi_echocanparams;
 struct dahdi_echocanparam;
+struct dahdi_echocan_state;
 
 char vpmadt032tone_to_zaptone(GpakToneCodes_t tone);
 int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb);
@@ -130,6 +131,7 @@
 void vpmadt032_free(struct vpmadt032 *vpm);
 int vpmadt032_echocan_with_params(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);
+void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo, struct dahdi_echocan_state *ec);
 
 /* If there is a command ready to go to the VPMADT032, return it, otherwise NULL */
 static inline struct vpmadt032_cmd *vpmadt032_get_ready_cmd(struct vpmadt032 *vpm)

Modified: linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=6507&r1=6506&r2=6507
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/base.c Mon Apr 27 12:52:38 2009
@@ -227,6 +227,32 @@
 static int vpmnlpthresh = 24;
 /* See vpmnlptype = 4 for more info */
 static int vpmnlpmaxsupp = 0;
+
+static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+			   struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
+static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
+
+static const struct dahdi_echocan_features vpm100m_ec_features = {
+	.NLP_automatic = 1,
+	.CED_tx_detect = 1,
+	.CED_rx_detect = 1,
+};
+
+static const struct dahdi_echocan_features vpm150m_ec_features = {
+	.NLP_automatic = 1,
+	.CED_tx_detect = 1,
+	.CED_rx_detect = 1,
+};
+
+static const struct dahdi_echocan_ops vpm100m_ec_ops = {
+	.name = "VPM100M",
+	.echocan_free = echocan_free,
+};
+
+static const struct dahdi_echocan_ops vpm150m_ec_ops = {
+	.name = "VPM150M",
+	.echocan_free = echocan_free,
+};
 
 static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane);
 
@@ -1628,10 +1654,33 @@
 	}
 }
 
-static int wctdm_echocan_with_params(struct dahdi_chan *chan, 
-	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
-{
+static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+			  struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+{
+	int res;
 	struct wctdm *wc = chan->pvt;
+	const struct dahdi_echocan_ops *ops;
+	const struct dahdi_echocan_features *features;
+
+	if (!wc->vpm100 && !wc->vpmadt032)
+		return -ENODEV;
+
+	if (wc->vpmadt032) {
+		ops = &vpm150m_ec_ops;
+		features = &vpm150m_ec_features;
+	} else {
+		ops = &vpm100m_ec_ops;
+		features = &vpm100m_ec_features;
+	}
+
+	if (ecp->param_count > 0) {
+		printk(KERN_WARNING "%s echo canceller does not support parameters; failing request\n", ops->name);
+		return -EINVAL;
+	}
+
+	*ec = wc->ec[chan->chanpos - 1];
+	(*ec)->ops = ops;
+	(*ec)->features = *features;
 
 	if (wc->vpm100) {
 		int channel;
@@ -1642,20 +1691,40 @@
 		if (wc->vpm100 < 2)
 			channel >>= 2;
 	
-		if(debug & DEBUG_ECHOCAN) 
+		if (debug & DEBUG_ECHOCAN) 
 			printk(KERN_DEBUG "echocan: Unit is %d, Channel is  %d length %d\n", 
-				unit, channel, ecp->tap_length);
-		if (ecp->tap_length)
-			wctdm_vpm_out(wc,unit,channel,0x3e);
-		else
-			wctdm_vpm_out(wc,unit,channel,0x01);
-
-		return 0;
+			       unit, channel, ecp->tap_length);
+		wctdm_vpm_out(wc, unit, channel, 0x3e);
+		res = 0;
 	} else if (wc->vpmadt032) {
-		return vpmadt032_echocan_with_params(wc->vpmadt032, 
+		res = vpmadt032_echocan_with_params(wc->vpmadt032, 
 			chan->chanpos-1, ecp, p);
 	} else {
-		return -ENODEV;
+		res = -ENODEV;
+	}
+	return res;
+}
+
+static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
+{
+	struct wctdm *wc = chan->pvt;
+
+	memset(ec, 0, sizeof(*ec));
+	if (wc->vpm100) {
+		int channel;
+		int unit;
+
+		channel = (chan->chanpos - 1);
+		unit = (chan->chanpos - 1) & 0x3;
+		if (wc->vpm100 < 2)
+			channel >>= 2;
+	
+		if (debug & DEBUG_ECHOCAN) 
+			printk(KERN_DEBUG "echocan: Unit is %d, Channel is %d length 0\n", 
+			       unit, channel);
+		wctdm_vpm_out(wc, unit, channel, 0x01);
+	} else if (wc->vpmadt032) {
+		vpmadt032_echocan_free(wc->vpmadt032, chan->chanpos-1, ec);
 	}
 }
 
@@ -3187,7 +3256,7 @@
 	wc->span.watchdog = wctdm_watchdog;
 	wc->span.dacs= wctdm_dacs;
 #ifdef VPM_SUPPORT
-	wc->span.echocan_with_params = wctdm_echocan_with_params;
+	wc->span.echocan_create = echocan_create;
 #endif	
 	init_waitqueue_head(&wc->span.maintq);
 
@@ -3587,6 +3656,8 @@
 		if (wc->chans[x]) {
 			kfree(wc->chans[x]);
 		}
+		if (wc->ec[x])
+			kfree(wc->ec[x]);
 	}
 	kfree(wc);
 }
@@ -3651,6 +3722,11 @@
 			return -ENOMEM;
 		}
 		memset(wc->chans[i], 0, sizeof(*wc->chans[i]));
+		if (!(wc->ec[i] = kmalloc(sizeof(*wc->ec[i]), GFP_KERNEL))) {
+			free_wc(wc);
+			return -ENOMEM;
+		}
+		memset(wc->ec[i], 0, sizeof(*wc->ec[i]));
 	}
 
 

Modified: linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=6507&r1=6506&r2=6507
==============================================================================
--- linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/staging/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Mon Apr 27 12:52:38 2009
@@ -235,6 +235,7 @@
 #endif	
 	struct voicebus *vb;
 	struct dahdi_chan *chans[NUM_CARDS];
+	struct dahdi_echocan_state *ec[NUM_CARDS];
 	int initialized;
 };
 




More information about the svn-commits mailing list