From d9c6c401a232b45b454316700aad63cf5d9f539a Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 12 Nov 2009 20:02:24 +0000 Subject: 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 ........ git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.2@7572 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wctdm24xxp/base.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) (limited to 'drivers/dahdi/wctdm24xxp/base.c') diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 1386e5f..70aa969 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -312,18 +312,8 @@ void setchanconfig_from_state(struct vpmadt032 *vpm, int channel, GpakChannelCon 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 @@ void setchanconfig_from_state(struct vpmadt032 *vpm, int channel, GpakChannelCon 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 @@ static int config_vpmadt032(struct vpmadt032 *vpm) 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); @@ -449,6 +439,11 @@ static int config_vpmadt032(struct vpmadt032 *vpm) 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; + } } if ((res = gpakPingDsp(vpm->dspid, &vpm->version))) { @@ -567,11 +562,6 @@ static inline void cmd_dequeue_vpmadt032(struct wctdm *wc, u8 *writechunk, int w 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); - } } static inline void cmd_dequeue(struct wctdm *wc, unsigned char *writechunk, int card, int pos) @@ -3677,8 +3667,7 @@ retry: 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 @@ retry: /* 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; -- cgit v1.2.3