[svn-commits] sruffell: linux/trunk r8121 - in /linux/trunk/drivers/dahdi: voicebus/ wctdm2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 26 10:40:53 CST 2010


Author: sruffell
Date: Fri Feb 26 10:40:43 2010
New Revision: 8121

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8121
Log:
wctdm24xxp, wcte12xp:  Updating the interface for the VPMADT032.

This description needs to be filled in more.

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

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=8121&r1=8120&r2=8121
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.c Fri Feb 26 10:40:43 2010
@@ -240,6 +240,25 @@
 	kfree(order);
 }
 
+static int vpmadt032_control(struct vpmadt032 *vpm, unsigned short int channel,
+			     GpakAlgCtrl_t control_code,
+			     GPAK_AlgControlStat_t *pstatus)
+{
+	gpakAlgControlStat_t stat;
+	int retry = 4;
+	while (retry--) {
+		stat = gpakAlgControl(vpm->dspid, channel,
+				      control_code, pstatus);
+
+		if (AcDspCommFailure == stat)
+			msleep(5);
+		else
+			break;
+	}
+
+	return stat;
+}
+
 static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel,
 			       enum adt_companding companding)
 {
@@ -250,18 +269,18 @@
 	control = (ADT_COMP_ALAW == companding) ? EnableALawSwCompanding :
 						  EnableMuLawSwCompanding;
  
-	if (vpm->options.debug & DEBUG_ECHOCAN) {
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN) {
 		const char *law;
 		law = (control == EnableMuLawSwCompanding) ? "MuLaw" : "ALaw";
 		vpm_info(vpm, "Enabling ecan on channel: %d (%s)\n",
 			 channel, law);
 	}
-	res = gpakAlgControl(vpm->dspid, channel, control, &pstatus);
+	res = vpmadt032_control(vpm, channel, control, &pstatus);
 	if (res) {
 		vpm_info(vpm, "Unable to set SW Companding on "
 			 "channel %d (reason %d)\n", channel, res);
 	}
-	res = gpakAlgControl(vpm->dspid, channel, EnableEcanA, &pstatus);
+	res = vpmadt032_control(vpm, channel, EnableEcanA, &pstatus);
 	return res;
 }
 
@@ -270,16 +289,16 @@
 	int res;
 	GPAK_AlgControlStat_t pstatus;
 
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		vpm_info(vpm, "Disabling ecan on channel: %d\n", channel);
 
-	res = gpakAlgControl(vpm->dspid, channel, BypassSwCompanding, &pstatus);
+	res = vpmadt032_control(vpm, channel, BypassSwCompanding, &pstatus);
 	if (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);
+	res = vpmadt032_control(vpm, channel, BypassEcanA, &pstatus);
 	return res;
 }
 
@@ -331,7 +350,7 @@
 	GPAK_TearDownChanStat_t tstatus;
 	GpakChannelConfig_t chanconfig;
 
-	if (vpm->options.debug & DEBUG_ECHOCAN) {
+	if (vpm->options.debug & DEBUG_VPMADT032_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,
@@ -350,14 +369,14 @@
 		return;
 
 	if (!desired->tap_length) {
-		res = gpakAlgControl(vpm->dspid, channel,
+		res = vpmadt032_control(vpm, 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);
+		vpmadt032_control(vpm, channel, BypassEcanA, &pstatus);
 	}
 
 	return;
@@ -428,7 +447,9 @@
 	queue_work(vpm->wq, &vpm->work);
 }
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
-	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+			     enum adt_companding companding,
+			     struct dahdi_echocanparams *ecp,
+			     struct dahdi_echocanparam *p)
 {
 	unsigned int ret;
 	struct change_order *order = alloc_change_order();
@@ -442,7 +463,7 @@
 		return ret;
 	}
 
-	if (vpm->options.debug & DEBUG_ECHOCAN) {
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN) {
 		vpm_info(vpm, "Channel is %d length %d\n",
 			 channo, ecp->tap_length);
 	}
@@ -451,7 +472,7 @@
 	 * module. Instead, it uses tap_length to enable or disable the echo
 	 * cancellation. */
 	order->params.tap_length = (ecp->tap_length) ? 1 : 0;
-	order->params.companding = vpm->companding;
+	order->params.companding = companding;
 	order->channel = channo;
 
 	vpmadt032_check_and_schedule_update(vpm, order);
@@ -474,7 +495,7 @@
 	order->params.nlp_max_suppress = vpm->options.vpmnlpmaxsupp;
 	order->channel = channo;
 
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		vpm_info(vpm, "Channel is %d length 0\n", channo);
 
 	vpmadt032_check_and_schedule_update(vpm, order);
@@ -566,7 +587,7 @@
 
 	might_sleep();
 
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		dev_info(&vpm->vb->pdev->dev, "VPMADT032 Testing page access: ");
 
 	for (i = 0; i < 0xf; i++) {
@@ -575,7 +596,7 @@
 			vpmadt032_setpage(vpm, i);
 			reg = vpmadt032_getpage(vpm);
 			if (reg != i) {
-				if (vpm->options.debug & DEBUG_ECHOCAN)
+				if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 					dev_info(&vpm->vb->pdev->dev, "Failed: Sent %x != %x VPMADT032 Failed HI page test\n", i, reg);
 				res = -ENODEV;
 				goto failed_exit;
@@ -583,7 +604,7 @@
 		}
 	}
 
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		dev_info(&vpm->vb->pdev->dev, "Passed\n");
 
 	set_bit(VPM150M_HPIRESET, &vpm->control);
@@ -593,7 +614,7 @@
 
 	/* Set us up to page 0 */
 	vpmadt032_setpage(vpm, 0);
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		dev_info(&vpm->vb->pdev->dev, "VPMADT032 now doing address test: ");
 
 	for (i = 0; i < 16; i++) {
@@ -609,7 +630,7 @@
 		}
 	}
 
-	if (vpm->options.debug & DEBUG_ECHOCAN)
+	if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 		printk(KERN_CONT "Passed\n");
 
 	set_bit(VPM150M_HPIRESET, &vpm->control);
@@ -631,8 +652,8 @@
 	pingstatus = gpakPingDsp(vpm->dspid, &vpm->version);
 
 	if (!pingstatus) {
-		if (vpm->options.debug & DEBUG_ECHOCAN)
-			dev_info(&vpm->vb->pdev->dev, "Version of DSP is %x\n", vpm->version);
+		dev_info(&vpm->vb->pdev->dev,
+			 "Version of DSP is %x\n", vpm->version);
 	} else {
 		dev_notice(&vpm->vb->pdev->dev, "VPMADT032 Failed! Unable to ping the DSP (%d)!\n", pingstatus);
 		res = -1;

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=8121&r1=8120&r2=8121
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.h Fri Feb 26 10:40:43 2010
@@ -43,7 +43,7 @@
 #include "gpakenum.h"
 #include "adt_lec.h"
 
-#define DEBUG_ECHOCAN (1 << 1)
+#define DEBUG_VPMADT032_ECHOCAN (1 << 4)
 
 /* Host and DSP system dependent related definitions. */
 #define MAX_DSP_CORES		128	/* maximum number of DSP cores */
@@ -114,7 +114,6 @@
 	unsigned long control;
 	unsigned char curpage;
 	unsigned short version;
-	enum adt_companding companding;
 	struct adt_lec_params curecstate[MAX_CHANNELS];
 	spinlock_t change_list_lock;
 	struct list_head change_list;
@@ -143,7 +142,9 @@
 					const char *board_name);
 void vpmadt032_free(struct vpmadt032 *vpm);
 int vpmadt032_echocan_create(struct vpmadt032 *vpm, int channo,
-	struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p);
+			     enum adt_companding companding,
+			     struct dahdi_echocanparams *ecp,
+			     struct dahdi_echocanparam *p);
 void vpmadt032_echocan_free(struct vpmadt032 *vpm, int channo,
 	struct dahdi_echocan_state *ec);
 

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=8121&r1=8120&r2=8121
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Fri Feb 26 10:40:43 2010
@@ -326,8 +326,10 @@
 	chanconfig->MuteToneB = Disabled;
 	chanconfig->FaxCngDetB = Disabled;
 
-	chanconfig->SoftwareCompand = (ADT_COMP_ALAW == vpm->companding) ?
-						cmpPCMA : cmpPCMU;
+	/* The software companding will be overridden on a channel by channel
+	 * basis when the channel is enabled. */
+	chanconfig->SoftwareCompand = cmpPCMU;
+
 	chanconfig->FrameRate = rate2ms;
 	p = &chanconfig->EcanParametersA;
 
@@ -430,9 +432,6 @@
 		dev_notice(&wc->vb.pdev->dev, "Error pinging DSP (%d)\n", res);
 		return -1;
 	}
-
-	vpm->companding = (wc->span.deflaw == DAHDI_LAW_MULAW) ?
-				ADT_COMP_ULAW : ADT_COMP_ALAW;
 
 	for (i = 0; i < vpm->options.channels; ++i) {
 		vpm->curecstate[i].tap_length = 0;
@@ -1830,8 +1829,13 @@
 		wctdm_vpm_out(wc, unit, channel, 0x3e);
 		return 0;
 	} else if (wc->vpmadt032) {
+		enum adt_companding comp;
+
+		comp = (DAHDI_LAW_ALAW == chan->span->deflaw) ?
+					ADT_COMP_ALAW : ADT_COMP_ULAW;
+
 		return vpmadt032_echocan_create(wc->vpmadt032,
-			chan->chanpos-1, ecp, p);
+						chan->chanpos-1, comp, ecp, p);
 	} else {
 		return -ENODEV;
 	}

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=8121&r1=8120&r2=8121
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Fri Feb 26 10:40:43 2010
@@ -344,7 +344,7 @@
 			configportstatus);
 		return -1;
 	} else {
-		if (vpm->options.debug & DEBUG_ECHOCAN)
+		if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
 			t1_info(wc, "Configured McBSP ports successfully\n");
 	}
 
@@ -353,14 +353,11 @@
 		return -1;
 	}
 
-	vpm->companding = (TYPE_T1 == wc->spantype) ?
-				ADT_COMP_ULAW : ADT_COMP_ALAW;
 	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;
-		vpm->curecstate[channel].companding = vpm->companding;
 
 		vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
 		if ((res = gpakConfigureChannel(vpm->dspid, channel, tdmToTdm, &chanconfig, &cstatus))) {
@@ -1198,6 +1195,8 @@
 			  struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
 {
 	struct t1 *wc = chan->pvt;
+	enum adt_companding comp;
+
 	if (!wc->vpmadt032) {
 		return -ENODEV;
 	}
@@ -1206,8 +1205,11 @@
 	(*ec)->ops = &vpm150m_ec_ops;
 	(*ec)->features = vpm150m_ec_features;
 
+	comp = (DAHDI_LAW_ALAW == chan->span->deflaw) ?
+			ADT_COMP_ALAW : ADT_COMP_ULAW;
+
 	return vpmadt032_echocan_create(wc->vpmadt032, chan->chanpos - 1,
-		ecp, p);
+					comp, ecp, p);
 }
 
 static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)




More information about the svn-commits mailing list