[dahdi-commits] mattf: linux/trunk r7309 - in /linux/trunk/drivers/dahdi: ./ voicebus/ wctdm2...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Oct 2 11:32:09 CDT 2009


Author: mattf
Date: Fri Oct  2 11:31:58 2009
New Revision: 7309

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7309
Log:
Implement API update to do per-channel companding selection for VPMADT032

Modified:
    linux/trunk/drivers/dahdi/adt_lec.c
    linux/trunk/drivers/dahdi/adt_lec.h
    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/adt_lec.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/adt_lec.c?view=diff&rev=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/adt_lec.c (original)
+++ linux/trunk/drivers/dahdi/adt_lec.c Fri Oct  2 11:31:58 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/trunk/drivers/dahdi/adt_lec.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/adt_lec.h?view=diff&rev=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/adt_lec.h (original)
+++ linux/trunk/drivers/dahdi/adt_lec.h Fri Oct  2 11:31:58 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/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.c Fri Oct  2 11:31:58 2009
@@ -218,13 +218,10 @@
 	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 == vpm->desiredecstate[channel].companding) ?
+ 			EnableALawSwCompanding :
+ 			EnableMuLawSwCompanding;
+ 
 	if (vpm->options.debug & DEBUG_ECHOCAN) {
 		const char *law;
 		law = (control == EnableMuLawSwCompanding) ? "MuLaw" : "ALaw";
@@ -282,7 +279,7 @@
 	 * looking for ones where the desired state does not match the current
 	 * state.
 	 */
-	for (channel = 0; channel < vpm->span->channels; channel++) {
+	for (channel = 0; channel < vpm->options.channels; channel++) {
 		GPAK_AlgControlStat_t pstatus;
 		int res = 1;
 		curstate = &vpm->curecstate[channel];

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=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.h Fri Oct  2 11:31:58 2009
@@ -108,7 +108,6 @@
 #define MAX_CHANNELS_PER_SPAN 32
 struct vpmadt032 {
 	void *context;
-	const struct dahdi_span *span;
 	struct work_struct work;
 	struct workqueue_struct *wq;
 	int dspid;

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=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Fri Oct  2 11:31:58 2009
@@ -311,18 +311,7 @@
 	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 = (vpm->desiredecstate[channel].companding = ADT_COMP_ALAW) ? cmpPCMA : cmpPCMU;
 	chanconfig->FrameRate = rate2ms;
 	p = &chanconfig->EcanParametersA;
 
@@ -337,7 +326,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};
@@ -426,11 +415,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;
+		vpm->curecstate[i].companding = (wc->span.deflaw == DAHDI_LAW_MULAW) ? ADT_COMP_ULAW : ADT_COMP_ALAW;
 		memcpy(&vpm->desiredecstate[i], &vpm->curecstate[i], sizeof(vpm->curecstate[i]));
 
 		/* set_vpmadt032_chanconfig_from_state(&vpm->curecstate[i], &vpm->options, i, &chanconfig); !!! */
@@ -445,6 +435,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;
 		}
@@ -3679,7 +3674,7 @@
 
 		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);
 		/* In case there was an error while we were loading the VPM module. */
@@ -3696,7 +3691,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/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=7309&r1=7308&r2=7309
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Fri Oct  2 11:31:58 2009
@@ -258,7 +258,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};
@@ -352,6 +352,7 @@
 		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 = (wc->spantype == TYPE_T1) ? ADT_COMP_ULAW : ADT_COMP_ALAW;
 		memcpy(&vpm->desiredecstate[channel], &vpm->curecstate[channel], sizeof(vpm->curecstate[channel]));
 
 		vpm->setchanconfig_from_state(vpm, channel, &chanconfig);
@@ -1364,6 +1365,7 @@
 		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)
@@ -1371,7 +1373,6 @@
 
 		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) {
@@ -1380,7 +1381,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);




More information about the dahdi-commits mailing list