[svn-commits] kpfleming: branch linux/kpfleming/echocan_work r6496 - in /linux/team/kpflemi...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Apr 27 10:46:22 CDT 2009


Author: kpfleming
Date: Mon Apr 27 10:46:19 2009
New Revision: 6496

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6496
Log:
convert wcte12xp over to new API as well... now on to testing :-)


Modified:
    linux/team/kpfleming/echocan_work/drivers/dahdi/wctdm24xxp/base.c
    linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/base.c
    linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=6496&r1=6495&r2=6496
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/wctdm24xxp/base.c Mon Apr 27 10:46:19 2009
@@ -60,10 +60,10 @@
 
 #ifdef VPM150M_SUPPORT
 #include "adt_lec.h"
-#endif
 
 #include "GpakCust.h"
 #include "GpakApi.h"
+#endif
 
 /*
   Experimental max loop current limit for the proslic

Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6496&r1=6495&r2=6496
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/base.c Mon Apr 27 10:46:19 2009
@@ -94,6 +94,20 @@
 int vpmnlptype = 1;
 int vpmnlpthresh = 24;
 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 vpm150m_ec_features = {
+	.NLP_automatic = 1,
+	.CED_tx_detect = 1,
+	.CED_rx_detect = 1,
+};
+
+static const struct dahdi_echocan_ops vpm150m_ec_ops = {
+	.name = "VPM150M",
+	.echocan_free = echocan_free,
+};
 #endif
 
 struct t1 *ifaces[WC_MAX_IFACES];
@@ -455,6 +469,7 @@
 	dahdi_unregister(&wc->span);
 	for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
 		kfree(wc->chans[x]);
+		kfree(wc->ec[x]);
 	}
 	kfree(wc);
 	printk(KERN_INFO "Freed a Wildcard TE12xP\n");
@@ -1049,26 +1064,27 @@
 
 #include "adt_lec.c"
 
-static int t1xxp_echocan_with_params(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
-{
-	struct adt_lec_params params;
+static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+			  struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
+{
 	struct t1 *wc = chan->pvt;
 	struct vpm150m *vpm150m = wc->vpm150m;
-	unsigned long flags;
+	struct adt_lec_params params;
 	struct vpm150m_workentry *work;
 	unsigned int ret;
-
-	if (!wc->vpm150m)
+	unsigned long flags;
+
+	if (!vpm150m)
 		return -ENODEV;
+
+	*ec = wc->ec[chan->chanpos - 1];
+	(*ec)->ops = &vpm150m_ec_ops;
+	(*ec)->features = vpm150m_ec_features;
 
 	adt_lec_init_defaults(&params, 32);
 
 	if ((ret = adt_lec_parse_params(&params, ecp, p)))
 		return ret;
-
-	/* we can't really control the tap length, but the value is used
-	   to control whether the ec is on or off, so translate it */
-	params.tap_length = ecp->tap_length ? 1 : 0;
 
 	if (!(work = kmalloc(sizeof(*work), GFP_KERNEL)))
 		return -ENOMEM;
@@ -1084,7 +1100,34 @@
 	if (test_bit(VPM150M_ACTIVE, &vpm150m->control))
 		queue_work(vpm150m->wq, &vpm150m->work_echocan);
 
-	return 0; /* how do I return the status since it is done later by the workqueue? */
+	return 0;
+}
+
+static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
+{
+	struct t1 *wc = chan->pvt;
+	struct vpm150m *vpm150m = wc->vpm150m;
+	struct adt_lec_params params;
+	struct vpm150m_workentry *work;
+	unsigned long flags;
+
+	memset(ec, 0, sizeof(*ec));
+
+	adt_lec_init_defaults(&params, 0);
+
+	if (!(work = kmalloc(sizeof(*work), GFP_KERNEL)))
+		return;
+
+	work->params = params;
+	work->wc = wc;
+	work->chan = chan; 
+	spin_lock_irqsave(&vpm150m->lock, flags);
+	list_add_tail(&work->list, &vpm150m->worklist);
+	spin_unlock_irqrestore(&vpm150m->lock, flags);
+	
+	/* we must do this later since we cannot sleep in the echocan function */
+	if (test_bit(VPM150M_ACTIVE, &vpm150m->control))
+		queue_work(vpm150m->wq, &vpm150m->work_echocan);
 }
 #endif
 
@@ -1133,7 +1176,7 @@
 	wc->span.close = t1xxp_close;
 	wc->span.ioctl = t1xxp_ioctl;
 #ifdef VPM_SUPPORT
-	wc->span.echocan_with_params = t1xxp_echocan_with_params;
+	wc->span.echocan_create = echocan_create;
 #endif
 
 	if (wc->spantype == TYPE_E1) {
@@ -1630,6 +1673,7 @@
 		if (!(wc->chans[x] = kmalloc(sizeof(*wc->chans[x]), GFP_KERNEL))) {
 			while (x) {
 				kfree(wc->chans[--x]);
+				kfree(wc->ec[x]);
 			}
 
 			kfree(wc);
@@ -1637,6 +1681,17 @@
 			return -ENOMEM;
 		}
 		memset(wc->chans[x], 0, sizeof(*wc->chans[x]));
+		if (!(wc->ec[x] = kmalloc(sizeof(*wc->ec[x]), GFP_KERNEL))) {
+			while (x) {
+				kfree(wc->chans[--x]);
+				kfree(wc->ec[x]);
+			}
+
+			kfree(wc);
+			ifaces[index] = NULL;
+			return -ENOMEM;
+		}
+		memset(wc->ec[x], 0, sizeof(*wc->ec[x]));
 	}
 
 	t1_software_init(wc);

Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=6496&r1=6495&r2=6496
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/wcte12xp/wcte12xp.h Mon Apr 27 10:46:19 2009
@@ -140,6 +140,7 @@
 	unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
 	struct dahdi_span span;						/* Span */
 	struct dahdi_chan *chans[32];					/* Channels */
+	struct dahdi_echocan_state *ec[32];				/* Echocan state for channels */
 	wait_queue_head_t regq;
 	struct cmdq	cmdq;
 	struct command dummy;	/* preallocate for dummy noop command */




More information about the svn-commits mailing list