diff options
author | Matthew Fredrickson <creslin@digium.com> | 2009-10-02 16:31:58 +0000 |
---|---|---|
committer | Matthew Fredrickson <creslin@digium.com> | 2009-10-02 16:31:58 +0000 |
commit | edad00b3c06d0f574f6d607cebfb3e96a9832979 (patch) | |
tree | 74df9558f4d5f54c6a03a8d0630d1355f2e0bf83 /drivers | |
parent | 2baba3425563c7293163d711e481516ae2b59246 (diff) |
Implement API update to do per-channel companding selection for VPMADT032
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7309 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/dahdi/adt_lec.c | 4 | ||||
-rw-r--r-- | drivers/dahdi/adt_lec.h | 6 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.c | 13 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.h | 1 | ||||
-rw-r--r-- | drivers/dahdi/wctdm24xxp/base.c | 27 | ||||
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 7 |
6 files changed, 29 insertions, 29 deletions
diff --git a/drivers/dahdi/adt_lec.c b/drivers/dahdi/adt_lec.c index 02c1322..18de6c0 100644 --- a/drivers/dahdi/adt_lec.c +++ b/drivers/dahdi/adt_lec.c @@ -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, diff --git a/drivers/dahdi/adt_lec.h b/drivers/dahdi/adt_lec.h index b2f7896..678fb30 100644 --- a/drivers/dahdi/adt_lec.h +++ b/drivers/dahdi/adt_lec.h @@ -32,11 +32,17 @@ enum adt_lec_nlp_type { 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 */ diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c index ca85e5d..0f113e6 100644 --- a/drivers/dahdi/voicebus/GpakCust.c +++ b/drivers/dahdi/voicebus/GpakCust.c @@ -218,13 +218,10 @@ static int vpmadt032_enable_ec(struct vpmadt032 *vpm, int channel) 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 @@ static void vpmadt032_bh(struct work_struct *data) * 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]; diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h index 0546bfb..9c84df7 100644 --- a/drivers/dahdi/voicebus/GpakCust.h +++ b/drivers/dahdi/voicebus/GpakCust.h @@ -108,7 +108,6 @@ struct GpakChannelConfig; #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; diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index e3053d2..57a4f5c 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -311,18 +311,7 @@ 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 = (vpm->desiredecstate[channel].companding = ADT_COMP_ALAW) ? cmpPCMA : cmpPCMU; chanconfig->FrameRate = rate2ms; p = &chanconfig->EcanParametersA; @@ -337,7 +326,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}; @@ -426,11 +415,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; + 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); !!! */ @@ -448,6 +438,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))) { @@ -3679,7 +3674,7 @@ retry: 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 @@ 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; diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 8e031fe..dfd37cc 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -258,7 +258,7 @@ inline void cmd_decipher_vpmadt032(struct t1 *wc, unsigned char *readchunk) } } -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 @@ static int config_vpmadt032(struct vpmadt032 *vpm) 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 @@ static int t1_hardware_post_init(struct t1 *wc) 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 @@ static int t1_hardware_post_init(struct t1 *wc) 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 @@ static int t1_hardware_post_init(struct t1 *wc) 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); |