[svn-commits] sruffell: branch linux/2.2 r7572 - in /linux/branches/2.2: ./ drivers/dahdi/ ...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 12 14:02:29 CST 2009


Author: sruffell
Date: Thu Nov 12 14:02:24 2009
New Revision: 7572

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7572
Log:
Merged revisions 7309,7348,7565-7571 via svnmerge from 
https://origsvn.digium.com/svn/dahdi/linux/trunk

........
  r7309 | mattf | 2009-10-02 11:31:58 -0500 (Fri, 02 Oct 2009) | 1 line
  
  Implement API update to do per-channel companding selection for VPMADT032
........
  r7348 | mattf | 2009-10-07 16:26:08 -0500 (Wed, 07 Oct 2009) | 1 line
  
  Fix a logic error in the companding check.  Duh....
........
  r7565 | sruffell | 2009-11-12 13:22:06 -0600 (Thu, 12 Nov 2009) | 7 lines
  
  voicebus: Fix race when enabling/disabling hardware echocan.
  
  This closes a race condition where it was possible for the driver to
  believe it has enabled the VPMADT032 when in fact, it really has not.
  This fixes a regression introduced in dahdi-linux 2.2.0.
  
  (issue #15724)
........
  r7566 | sruffell | 2009-11-12 13:22:06 -0600 (Thu, 12 Nov 2009) | 1 line
  
  wctdm24xxp, wcte12xp: We no longer have any DTMF events to check for.
........
  r7567 | sruffell | 2009-11-12 13:22:07 -0600 (Thu, 12 Nov 2009) | 1 line
  
  voicebus: Remove unused curtone from 'struct vpmadt032'
........
  r7568 | sruffell | 2009-11-12 13:22:07 -0600 (Thu, 12 Nov 2009) | 1 line
  
  voicebus: Remove redundant MAX_CHANNELS_FROM_SPAN
........
  r7569 | sruffell | 2009-11-12 13:22:08 -0600 (Thu, 12 Nov 2009) | 3 lines
  
  voicebus: Use dev_xxx macro when printing vpm messages.
  
  We also do not need the unused context member of the vpmadt032 structure.
........
  r7570 | sruffell | 2009-11-12 13:22:08 -0600 (Thu, 12 Nov 2009) | 4 lines
  
  wcte12xp: Change serial port configuration setting for hw echocan.
  
  The wcte12xp, like the wctdm24xpp, should have the PcmOutPortA set to
  SerialPortNull.
........
  r7571 | sruffell | 2009-11-12 13:56:49 -0600 (Thu, 12 Nov 2009) | 1 line
  
  kernel.h: Define 'list_replace' for kernels < 2.6.18
........

Modified:
    linux/branches/2.2/   (props changed)
    linux/branches/2.2/drivers/dahdi/adt_lec.c
    linux/branches/2.2/drivers/dahdi/adt_lec.h
    linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.c
    linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.h
    linux/branches/2.2/drivers/dahdi/wctdm24xxp/base.c
    linux/branches/2.2/drivers/dahdi/wcte12xp/base.c
    linux/branches/2.2/include/dahdi/kernel.h

Propchange: linux/branches/2.2/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: linux/branches/2.2/drivers/dahdi/adt_lec.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/adt_lec.c?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/adt_lec.c (original)
+++ linux/branches/2.2/drivers/dahdi/adt_lec.c Thu Nov 12 14:02:24 2009
@@ -29,8 +29,10 @@
 
 static inline void adt_lec_init_defaults(struct adt_lec_params *params, __u32 tap_length)
 {
-	memset(params, 0, sizeof(*params));
 	params->tap_length = tap_length;
+	params->nlp_type = 0;
+	params->nlp_max_suppress = 0;
+	params->nlp_threshold = 0;
 }
 
 static int adt_lec_parse_params(struct adt_lec_params *params,

Modified: linux/branches/2.2/drivers/dahdi/adt_lec.h
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/adt_lec.h?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/adt_lec.h (original)
+++ linux/branches/2.2/drivers/dahdi/adt_lec.h Thu Nov 12 14:02:24 2009
@@ -32,11 +32,17 @@
 	ADT_LEC_SUPPRESS,
 };
 
+enum adt_companding {
+	ADT_COMP_ULAW = 0,
+	ADT_COMP_ALAW,
+};
+
 struct adt_lec_params {
 	__u32 tap_length;
 	enum adt_lec_nlp_type nlp_type;
 	__u32 nlp_threshold;
 	__u32 nlp_max_suppress;
+	enum adt_companding companding;
 };
 
 #endif /* _ADT_LEC_H */

Modified: linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.c Thu Nov 12 14:02:24 2009
@@ -52,6 +52,9 @@
 
 static rwlock_t ifacelock;
 static struct vpmadt032 *ifaces[MAX_DSP_CORES];
+
+#define vpm_info(vpm, format, arg...)         \
+        dev_info(&voicebus_get_pci_dev(vpm->vb)->dev , format , ## arg)
 
 static inline struct vpmadt032 *find_iface(const unsigned short dspid)
 {
@@ -212,29 +215,42 @@
 	return res;
 }
 
-static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel)
+struct change_order {
+	struct list_head node;
+	unsigned int channel;
+	struct adt_lec_params params;
+};
+
+static struct change_order *alloc_change_order(void)
+{
+	return kzalloc(sizeof(struct change_order), GFP_KERNEL);
+}
+
+static void free_change_order(struct change_order *order)
+{
+	kfree(order);
+}
+
+static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel,
+			       enum adt_companding companding)
 {
 	int res;
 	GPAK_AlgControlStat_t pstatus;
 	GpakAlgCtrl_t control;
 
-	if (vpm->span) {
-		control = (DAHDI_LAW_ALAW == vpm->span->deflaw) ?
-				EnableALawSwCompanding :
-				EnableMuLawSwCompanding;
-	} else {
-		control = EnableMuLawSwCompanding;
-	}
+	control = (ADT_COMP_ALAW == companding) ? EnableALawSwCompanding :
+						  EnableMuLawSwCompanding;
+ 
 	if (vpm->options.debug & DEBUG_ECHOCAN) {
 		const char *law;
 		law = (control == EnableMuLawSwCompanding) ? "MuLaw" : "ALaw";
-		printk(KERN_DEBUG "Enabling ecan on channel: %d (%s)\n",
-				channel, law);
+		vpm_info(vpm, "Enabling ecan on channel: %d (%s)\n",
+			 channel, law);
 	}
 	res = gpakAlgControl(vpm->dspid, channel, control, &pstatus);
 	if (res) {
-		printk(KERN_WARNING "Unable to set SW Companding on " \
-			"channel %d (reason %d)\n", channel, res);
+		vpm_info(vpm, "Unable to set SW Companding on "
+			 "channel %d (reason %d)\n", channel, res);
 	}
 	res = gpakAlgControl(vpm->dspid, channel, EnableEcanA, &pstatus);
 	return res;
@@ -246,16 +262,96 @@
 	GPAK_AlgControlStat_t pstatus;
 
 	if (vpm->options.debug & DEBUG_ECHOCAN)
-		printk(KERN_DEBUG "Disabling ecan on channel: %d\n", channel);
+		vpm_info(vpm, "Disabling ecan on channel: %d\n", channel);
 
 	res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
 	if (res) {
-		printk(KERN_WARNING "Unable to disable sw companding on " \
-			"echo cancellation channel %d (reason %d)\n",
-			channel, res);
+		vpm_info(vpm, "Unable to disable sw companding on "
+			 "echo cancellation channel %d (reason %d)\n",
+			 channel, res);
 	}
 	res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
 	return res;
+}
+
+static struct change_order *get_next_order(struct vpmadt032 *vpm)
+{
+	struct change_order *order;
+
+	spin_lock(&vpm->change_list_lock);
+	if (!list_empty(&vpm->change_list)) {
+		order = list_entry(vpm->change_list.next,
+				   struct change_order, node);
+		list_del(&order->node);
+	} else {
+		order = NULL;
+	}
+	spin_unlock(&vpm->change_list_lock);
+
+	return order;
+}
+
+static int nlp_settings_changed(const struct adt_lec_params *a,
+				const struct adt_lec_params *b)
+{
+	return ((a->nlp_type != b->nlp_type) ||
+		(a->nlp_threshold != b->nlp_threshold) ||
+		(a->nlp_max_suppress != b->nlp_max_suppress));
+}
+
+static int echocan_on(const struct adt_lec_params *new,
+		      const struct adt_lec_params *old)
+{
+	return ((new->tap_length != old->tap_length) &&
+	       (new->tap_length > 0));
+}
+
+static int echocan_off(const struct adt_lec_params *new,
+		       const struct adt_lec_params *old)
+{
+	return ((new->tap_length != old->tap_length) &&
+	       (0 == new->tap_length));
+}
+
+static void update_channel_config(struct vpmadt032 *vpm, unsigned int channel,
+				  struct adt_lec_params *desired)
+{
+	int res;
+	GPAK_AlgControlStat_t pstatus;
+	GPAK_ChannelConfigStat_t cstatus;
+	GPAK_TearDownChanStat_t tstatus;
+	GpakChannelConfig_t chanconfig;
+
+	if (vpm->options.debug & DEBUG_ECHOCAN) {
+		vpm_info(vpm, "Reconfiguring chan %d for nlp %d, "
+			 "nlp_thresh %d, and max_supp %d\n", channel + 1,
+			 desired->nlp_type, desired->nlp_threshold,
+			 desired->nlp_max_suppress);
+	}
+
+	vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
+
+	res = gpakTearDownChannel(vpm->dspid, channel, &tstatus);
+	if (res)
+		return;
+
+	res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm,
+				   &chanconfig, &cstatus);
+	if (res)
+		return;
+
+	if (!desired->tap_length) {
+		res = gpakAlgControl(vpm->dspid, channel,
+				     BypassSwCompanding, &pstatus);
+		if (res) {
+			vpm_info(vpm, "Unable to disable sw companding on "
+				 "echo cancellation channel %d (reason %d)\n",
+				 channel, res);
+		}
+		gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
+	}
+
+	return;
 }
 
 /**
@@ -275,97 +371,80 @@
 {
 	struct vpmadt032 *vpm = container_of(data, struct vpmadt032, work);
 #endif
-	struct adt_lec_params *curstate, *desiredstate;
-	int channel;
-
-	/* Sweep through all the echo can channels on the VPMADT032 module,
-	 * looking for ones where the desired state does not match the current
-	 * state.
-	 */
-	for (channel = 0; channel < vpm->span->channels; channel++) {
-		GPAK_AlgControlStat_t pstatus;
-		int res = 1;
-		curstate = &vpm->curecstate[channel];
-		desiredstate = &vpm->desiredecstate[channel];
-
-		if ((desiredstate->nlp_type != curstate->nlp_type) ||
-		    (desiredstate->nlp_threshold != curstate->nlp_threshold) ||
-		    (desiredstate->nlp_max_suppress != curstate->nlp_max_suppress)) {
-
-			GPAK_ChannelConfigStat_t cstatus;
-			GPAK_TearDownChanStat_t tstatus;
-			GpakChannelConfig_t chanconfig;
-
-			if (vpm->options.debug & DEBUG_ECHOCAN)
-				printk(KERN_DEBUG "Reconfiguring chan %d for nlp %d, nlp_thresh %d, and max_supp %d\n", channel + 1, vpm->desiredecstate[channel].nlp_type,
-					desiredstate->nlp_threshold, desiredstate->nlp_max_suppress);
-
-			vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
-
-			res = gpakTearDownChannel(vpm->dspid, channel, &tstatus);
-			if (res)
-				goto vpm_bh_out;
-
-			res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus);
-			if (res)
-				goto vpm_bh_out;
-
-			if (!desiredstate->tap_length) {
-				res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
-				if (res)
-					printk("Unable to disable sw companding on echo cancellation channel %d (reason %d)\n", channel, res);
-				res = gpakAlgControl(vpm->dspid, channel, BypassEcanA, &pstatus);
-			}
-
-		} else if (desiredstate->tap_length != curstate->tap_length) {
-			if (desiredstate->tap_length)
-				res = vpmadt032_enable_ec(vpm, channel);
-			else
-				res = vpmadt032_disable_ec(vpm, channel);
-		}
-vpm_bh_out:
-		if (!res)
-			*curstate = *desiredstate;
-	}
-	return;
-}
+	struct change_order *order;
+
+	while ((order = get_next_order(vpm))) {
+
+		struct adt_lec_params *old;
+		struct adt_lec_params *new;
+		unsigned int channel;
+
+		channel = order->channel;
+		BUG_ON(channel >= ARRAY_SIZE(vpm->curecstate));
+		old = &vpm->curecstate[channel];
+		new = &order->params;
+
+		if (nlp_settings_changed(new, old))
+			update_channel_config(vpm, channel, new);
+		else if (echocan_on(new, old))
+			vpmadt032_enable_ec(vpm, channel, new->companding);
+		else if (echocan_off(new, old))
+			vpmadt032_disable_ec(vpm, channel);
+
+		*old = order->params;
+		free_change_order(order);
+	}
+}
+
 #include "adt_lec.c"
-static void vpmadt032_check_and_schedule_update(struct vpmadt032 *vpm, int channo)
-{
-	int update;
-	/* Only update the parameters if the new state of the echo canceller
-	 * is different than the current state. */
-	update = memcmp(&vpm->curecstate[channo],
-			&vpm->desiredecstate[channo],
-			sizeof(vpm->curecstate[channo]));
-	if (update && test_bit(VPM150M_ACTIVE, &vpm->control)) {
-		/* Since updating the parameters can take a bit of time while
-		 * the driver sends messages to the VPMADT032 and waits for
-		 * their responses, we'll push the work of updating the
-		 * parameters to a work queue so the caller can continue to
-		 * proceed with setting up the call.
-		 */
-		queue_work(vpm->wq, &vpm->work);
-	}
+static void vpmadt032_check_and_schedule_update(struct vpmadt032 *vpm,
+						struct change_order *order)
+{
+	struct change_order *cur;
+	struct change_order *n;
+
+	INIT_LIST_HEAD(&order->node);
+	spin_lock(&vpm->change_list_lock);
+	list_for_each_entry_safe(cur, n, &vpm->change_list, node) {
+		if (cur->channel == order->channel) {
+			list_replace(&cur->node, &order->node);
+			free_change_order(cur);
+			break;
+		}
+	}
+	if (list_empty(&order->node))
+		list_add_tail(&order->node, &vpm->change_list);
+	spin_unlock(&vpm->change_list_lock);
+
+	queue_work(vpm->wq, &vpm->work);
 }
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
 {
 	unsigned int ret;
-
-	ret = adt_lec_parse_params(&vpm->desiredecstate[channo], ecp, p);
-	if (ret)
+	struct change_order *order = alloc_change_order();
+	if (!order)
+		return -ENOMEM;
+
+	memcpy(&order->params, &vpm->curecstate[channo], sizeof(order->params));
+	ret = adt_lec_parse_params(&order->params, ecp, p);
+	if (ret) {
+		free_change_order(order);
 		return ret;
-
-	if (vpm->options.debug & DEBUG_ECHOCAN)
-		printk(KERN_DEBUG "echocan: Channel is %d length %d\n", channo, ecp->tap_length);
+	}
+
+	if (vpm->options.debug & DEBUG_ECHOCAN) {
+		vpm_info(vpm, "Channel is %d length %d\n",
+			 channo, ecp->tap_length);
+	}
 
 	/* The driver cannot control the number of taps on the VPMADT032
 	 * module. Instead, it uses tap_length to enable or disable the echo
 	 * cancellation. */
-	vpm->desiredecstate[channo].tap_length = (ecp->tap_length) ? 1 : 0;
-
-	vpmadt032_check_and_schedule_update(vpm, channo);
+	order->params.tap_length = (ecp->tap_length) ? 1 : 0;
+	order->channel = channo;
+
+	vpmadt032_check_and_schedule_update(vpm, order);
 	return 0;
 }
 EXPORT_SYMBOL(vpmadt032_echocan_create);
@@ -373,15 +452,22 @@
 void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocan_state *ec)
 {
-	adt_lec_init_defaults(&vpm->desiredecstate[channo], 0);
-	vpm->desiredecstate[channo].nlp_type = vpm->options.vpmnlptype;
-	vpm->desiredecstate[channo].nlp_threshold = vpm->options.vpmnlpthresh;
-	vpm->desiredecstate[channo].nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
+	struct change_order *order;
+	order = alloc_change_order();
+	WARN_ON(!order);
+	if (!order)
+		return;
+
+	adt_lec_init_defaults(&order->params, 0);
+	order->params.nlp_type = vpm->options.vpmnlptype;
+	order->params.nlp_threshold = vpm->options.vpmnlpthresh;
+	order->params.nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
+	order->channel = channo;
 
 	if (vpm->options.debug & DEBUG_ECHOCAN)
-		printk(KERN_DEBUG "echocan: Channel is %d length 0\n", channo);
-
-	vpmadt032_check_and_schedule_update(vpm, channo);
+		vpm_info(vpm, "Channel is %d length 0\n", channo);
+
+	vpmadt032_check_and_schedule_update(vpm, order);
 }
 EXPORT_SYMBOL(vpmadt032_echocan_free);
 
@@ -413,6 +499,8 @@
 	/* Init our vpmadt032 struct */
 	memcpy(&vpm->options, options, sizeof(*options));
 	spin_lock_init(&vpm->list_lock);
+	spin_lock_init(&vpm->change_list_lock);
+	INIT_LIST_HEAD(&vpm->change_list);
 	INIT_LIST_HEAD(&vpm->free_cmds);
 	INIT_LIST_HEAD(&vpm->pending_cmds);
 	INIT_LIST_HEAD(&vpm->active_cmds);
@@ -446,8 +534,6 @@
 		kfree(vpm);
 		printk(KERN_NOTICE "Unable to initialize another vpmadt032 modules\n");
 		vpm = NULL;
-	} else if (vpm->options.debug & DEBUG_ECHOCAN) {
-		printk(KERN_DEBUG "Setting VPMADT032 DSP ID to %d\n", vpm->dspid);
 	}
 
 	return vpm;
@@ -464,6 +550,9 @@
 
 	BUG_ON(!vpm->setchanconfig_from_state);
 	BUG_ON(!vpm->wq);
+	BUG_ON(!vb);
+
+	vpm->vb = vb;
 
 	might_sleep();
 
@@ -583,6 +672,7 @@
 {
 	unsigned long flags;
 	struct vpmadt032_cmd *cmd;
+	struct change_order *order;
 	LIST_HEAD(local_list);
 
 	BUG_ON(!vpm);
@@ -601,6 +691,16 @@
 		cmd = list_entry(local_list.next, struct vpmadt032_cmd, node);
 		list_del(&cmd->node);
 		kfree(cmd);
+	}
+
+	spin_lock(&vpm->change_list_lock);
+	list_splice(&vpm->change_list, &local_list);
+	spin_unlock(&vpm->change_list_lock);
+
+	while (!list_empty(&local_list)) {
+		order = list_entry(local_list.next, struct change_order, node);
+		list_del(&order->node);
+		kfree(order);
 	}
 
 	BUG_ON(ifaces[vpm->dspid] != vpm);

Modified: linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/branches/2.2/drivers/dahdi/voicebus/GpakCust.h Thu Nov 12 14:02:24 2009
@@ -105,10 +105,8 @@
 
 struct GpakChannelConfig;
 
-#define MAX_CHANNELS_PER_SPAN 32
 struct vpmadt032 {
-	void *context;
-	const struct dahdi_span *span;
+	struct voicebus *vb;
 	struct work_struct work;
 	struct workqueue_struct *wq;
 	int dspid;
@@ -116,8 +114,10 @@
 	unsigned long control;
 	unsigned char curpage;
 	unsigned short version;
-	struct adt_lec_params curecstate[MAX_CHANNELS_PER_SPAN];
-	struct adt_lec_params desiredecstate[MAX_CHANNELS_PER_SPAN];
+	enum adt_companding companding;
+	struct adt_lec_params curecstate[MAX_CHANNELS];
+	spinlock_t change_list_lock;
+	struct list_head change_list;
 	spinlock_t list_lock;
 	/* Commands that are ready to be used. */
 	struct list_head free_cmds;
@@ -125,7 +125,6 @@
 	struct list_head pending_cmds;
 	/* Commands that are currently in progress by the VPM module */
 	struct list_head active_cmds;
-	unsigned char curtone[MAX_CHANNELS_PER_SPAN];
 	struct vpmadt032_options options;
 	void (*setchanconfig_from_state)(struct vpmadt032 *vpm, int channel, struct GpakChannelConfig *chanconfig);
 	/* This must be last */

Modified: linux/branches/2.2/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/branches/2.2/drivers/dahdi/wctdm24xxp/base.c Thu Nov 12 14:02:24 2009
@@ -312,18 +312,8 @@
 	chanconfig->MuteToneB = Disabled;
 	chanconfig->FaxCngDetB = Disabled;
 
-	switch (vpm->span->deflaw) {
-	case DAHDI_LAW_MULAW:
-		chanconfig->SoftwareCompand = cmpPCMU;
-		break;
-	case DAHDI_LAW_ALAW:
-		chanconfig->SoftwareCompand = cmpPCMA;
-		break;
-	default:
-		chanconfig->SoftwareCompand = cmpPCMU;
-		break;
-	}
-		
+	chanconfig->SoftwareCompand = (ADT_COMP_ALAW == vpm->companding) ?
+						cmpPCMA : cmpPCMU;
 	chanconfig->FrameRate = rate2ms;
 	p = &chanconfig->EcanParametersA;
 
@@ -338,7 +328,7 @@
 		sizeof(chanconfig->EcanParametersB));
 }
 
-static int config_vpmadt032(struct vpmadt032 *vpm)
+static int config_vpmadt032(struct vpmadt032 *vpm, struct wctdm *wc)
 {
 	int res, i;
 	GpakPortConfig_t portconfig = {0};
@@ -427,12 +417,12 @@
 		return -1;
 	}
 
-	for (i = 0; i < vpm->span->channels; ++i) {
+	for (i = 0; i < vpm->options.channels; ++i) {
 		vpm->curecstate[i].tap_length = 0;
 		vpm->curecstate[i].nlp_type = vpm->options.vpmnlptype;
 		vpm->curecstate[i].nlp_threshold = vpm->options.vpmnlpthresh;
 		vpm->curecstate[i].nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
-		memcpy(&vpm->desiredecstate[i], &vpm->curecstate[i], sizeof(vpm->curecstate[i]));
+		vpm->curecstate[i].companding = (wc->span.deflaw == DAHDI_LAW_MULAW) ? ADT_COMP_ULAW : ADT_COMP_ALAW;
 
 		/* set_vpmadt032_chanconfig_from_state(&vpm->curecstate[i], &vpm->options, i, &chanconfig); !!! */
 		vpm->setchanconfig_from_state(vpm, i, &chanconfig);
@@ -446,6 +436,11 @@
 		}
 
 		if ((res = gpakAlgControl(vpm->dspid, i, BypassEcanA, &algstatus))) {
+			printk(KERN_NOTICE "Unable to disable echo can on channel %d (reason %d:%d)\n", i + 1, res, algstatus);
+			return -1;
+		}
+
+		if ((res = gpakAlgControl(vpm->dspid, i, BypassSwCompanding, &algstatus))) {
 			printk(KERN_NOTICE "Unable to disable echo can on channel %d (reason %d:%d)\n", i + 1, res, algstatus);
 			return -1;
 		}
@@ -566,11 +561,6 @@
 	/* Add our leds in */
 	for (x = 24; x < 28; x++) {
 		writechunk[CMD_BYTE(x, 0, 0)] |= leds;
-	}
-
-	/* Now let's figure out if we need to check for DTMF */
-	if (test_bit(VPM150M_ACTIVE, &vpmadt032->control) && !whichframe && !(wc->intcount % 100)) {
-		schedule_work(&vpmadt032->work);
 	}
 }
 
@@ -3677,8 +3667,7 @@
 			return -ENOMEM;
 
 		wc->vpmadt032->setchanconfig_from_state = setchanconfig_from_state;
-		wc->vpmadt032->context = wc;
-		wc->vpmadt032->span = &wc->span;
+		wc->vpmadt032->options.channels = wc->span.channels;
 		get_default_portconfig(&portconfig);
 		res = vpmadt032_init(wc->vpmadt032, wc->vb);
 		if (res) {
@@ -3689,7 +3678,7 @@
 
 		/* Now we need to configure the VPMADT032 module for this
 		 * particular board. */
-		res = config_vpmadt032(wc->vpmadt032);
+		res = config_vpmadt032(wc->vpmadt032, wc);
 		if (res) {
 			vpmadt032_free(wc->vpmadt032);
 			wc->vpmadt032 = NULL;

Modified: linux/branches/2.2/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/branches/2.2/drivers/dahdi/wcte12xp/base.c Thu Nov 12 14:02:24 2009
@@ -260,7 +260,7 @@
 	}
 }
 
-static int config_vpmadt032(struct vpmadt032 *vpm)
+static int config_vpmadt032(struct vpmadt032 *vpm, struct t1 *wc)
 {
 	int res, channel;
 	GpakPortConfig_t portconfig = {0};
@@ -349,12 +349,12 @@
 		return -1;
 	}
 
-	for (channel = 0; channel < MAX_CHANNELS_PER_SPAN; ++channel) {
+	for (channel = 0; channel < ARRAY_SIZE(vpm->curecstate); ++channel) {
 		vpm->curecstate[channel].tap_length = 0;
 		vpm->curecstate[channel].nlp_type = vpm->options.vpmnlptype;
 		vpm->curecstate[channel].nlp_threshold = vpm->options.vpmnlpthresh;
 		vpm->curecstate[channel].nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
-		memcpy(&vpm->desiredecstate[channel], &vpm->curecstate[channel], sizeof(vpm->curecstate[channel]));
+		vpm->curecstate[channel].companding = (wc->spantype == TYPE_T1) ? ADT_COMP_ULAW : ADT_COMP_ALAW;
 
 		vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
 		if ((res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus))) {
@@ -527,11 +527,6 @@
 		}
 	}
 #endif
-
-	/* Now let's figure out if we need to check for DTMF */
-	/* polling */
-	if (test_bit(VPM150M_ACTIVE, &vpm->control) && !whichframe && !(atomic_read(&wc->txints) % 100))
-		schedule_work(&vpm->work);
 
 #if 0
 	/* This may be needed sometime in the future to troubleshoot ADT related issues. */
@@ -1313,7 +1308,7 @@
 
 	chanconfig->PcmInPortA = 3;
 	chanconfig->PcmInSlotA = (channel + 1) * 2;
-	chanconfig->PcmOutPortA = 2;
+	chanconfig->PcmOutPortA = SerialPortNull;
 	chanconfig->PcmOutSlotA = (channel + 1) * 2;
 	chanconfig->PcmInPortB = 2;
 	chanconfig->PcmInSlotB = (channel + 1) * 2;
@@ -1388,14 +1383,13 @@
 		options.vpmnlptype = vpmnlptype;
 		options.vpmnlpthresh = vpmnlpthresh;
 		options.vpmnlpmaxsupp = vpmnlpmaxsupp;
+		options.channels = (wc->spantype == TYPE_T1) ? 24 : 32;
 
 		wc->vpmadt032 = vpmadt032_alloc(&options, wc->name);
 		if (!wc->vpmadt032)
 			return -ENOMEM;
 
-		wc->vpmadt032->context = wc;
 		wc->vpmadt032->setchanconfig_from_state = setchanconfig_from_state;
-		wc->vpmadt032->span = &wc->span;
 
 		res = vpmadt032_init(wc->vpmadt032, wc->vb);
 		if (res) {
@@ -1404,7 +1398,7 @@
 			return -EIO;
 		}
 
-		config_vpmadt032(wc->vpmadt032);
+		config_vpmadt032(wc->vpmadt032, wc);
 
 		set_span_devicetype(wc);
 		module_printk("VPM present and operational (Firmware version %x)\n", wc->vpmadt032->version);

Modified: linux/branches/2.2/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/include/dahdi/kernel.h?view=diff&rev=7572&r1=7571&r2=7572
==============================================================================
--- linux/branches/2.2/include/dahdi/kernel.h (original)
+++ linux/branches/2.2/include/dahdi/kernel.h Thu Nov 12 14:02:24 2009
@@ -1172,6 +1172,16 @@
 #define kzalloc(a, b) kcalloc(1, a, b)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
+static inline void list_replace(struct list_head *old, struct list_head *new)
+{
+        new->next = old->next;
+        new->next->prev = new;
+        new->prev = old->prev;
+        new->prev->next = new;
+}
+#endif
+
 #ifndef DMA_BIT_MASK
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 #endif




More information about the svn-commits mailing list