summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcte12xp
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2009-04-29 18:24:04 +0000
committerShaun Ruffell <sruffell@digium.com>2009-04-29 18:24:04 +0000
commit5f94a3b91de2c3835d6852d59cab9f6876177156 (patch)
tree4c25956b6ecdcd5b902ac80b40237bc3e938be44 /drivers/dahdi/wcte12xp
parent4a192a3e8f16ed6143377b5726e1fb53b446f5e9 (diff)
echocan: Improve interface for echo cancelers.
Echo cancelers are now able to report if they are able to automatically disable their NLP portions in the presence of tones in the audio stream. Also, the interface is changed to allow user space to just disable the NLP portion of the echo canceler. These changes improve fax and modem handling in DAHDI. This commit merges in the changes on http://svn.digium.com/svn/dahdi/linux/team/kpfleming/echocan_work Patch by: kpfleming Also contains improvements to CED tone detection. (closes issue #13286) Reported by: viniciusfontes git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@6529 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcte12xp')
-rw-r--r--drivers/dahdi/wcte12xp/base.c41
-rw-r--r--drivers/dahdi/wcte12xp/wcte12xp.h1
2 files changed, 37 insertions, 5 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 30f89e9..03eb34c 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -63,6 +63,20 @@ static int vpmtsisupport = 0;
int vpmnlptype = 3;
int vpmnlpthresh = 24;
int vpmnlpmaxsupp = 0;
+static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec);
+static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
+
+static const struct dahdi_echocan_features vpm150m_ec_features = {
+ .NLP_automatic = 1,
+ .CED_tx_detect = 1,
+ .CED_rx_detect = 1,
+};
+
+static const struct dahdi_echocan_ops vpm150m_ec_ops = {
+ .name = "VPM150M",
+ .echocan_free = echocan_free,
+};
struct t1 *ifaces[WC_MAX_IFACES];
spinlock_t ifacelock = SPIN_LOCK_UNLOCKED;
@@ -636,8 +650,10 @@ static void free_wc(struct t1 *wc)
struct command *cmd;
LIST_HEAD(list);
- for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++)
+ for (x = 0; x < (wc->spantype == TYPE_E1 ? 31 : 24); x++) {
kfree(wc->chans[x]);
+ kfree(wc->ec[x]);
+ }
spin_lock_irqsave(&wc->cmd_list_lock, flags);
list_splice_init(&wc->active_cmds, &list);
@@ -1150,17 +1166,26 @@ static int t1xxp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
return 0;
}
-static int t1xxp_echocan_with_params(struct dahdi_chan *chan,
- struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p)
+static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
+ struct dahdi_echocanparam *p, struct dahdi_echocan_state **ec)
{
struct t1 *wc = chan->pvt;
if (!wc->vpmadt032) {
return -ENODEV;
}
- return vpmadt032_echocan_with_params(wc->vpmadt032, chan->chanpos - 1,
+ return vpmadt032_echocan_create(wc->vpmadt032, chan->chanpos - 1,
ecp, p);
}
+static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec)
+{
+ struct t1 *wc = chan->pvt;
+ if (!wc->vpmadt032)
+ return;
+
+ vpmadt032_echocan_free(wc->vpmadt032, chan, ec);
+}
+
static int t1_software_init(struct t1 *wc)
{
int x;
@@ -1207,7 +1232,7 @@ static int t1_software_init(struct t1 *wc)
wc->span.close = t1xxp_close;
wc->span.ioctl = t1xxp_ioctl;
#ifdef VPM_SUPPORT
- wc->span.echocan_with_params = t1xxp_echocan_with_params;
+ wc->span.echocan_create = echocan_create;
#endif
if (wc->spantype == TYPE_E1) {
@@ -1752,6 +1777,12 @@ retry:
return -ENOMEM;
}
memset(wc->chans[x], 0, sizeof(*wc->chans[x]));
+ if (!(wc->ec[x] = kmalloc(sizeof(*wc->ec[x]), GFP_KERNEL))) {
+ free_wc(wc);
+ ifaces[index] = NULL;
+ return -ENOMEM;
+ }
+ memset(wc->ec[x], 0, sizeof(*wc->ec[x]));
}
mod_timer(&wc->timer, jiffies + HZ/5);
diff --git a/drivers/dahdi/wcte12xp/wcte12xp.h b/drivers/dahdi/wcte12xp/wcte12xp.h
index a93df54..2a0a0f4 100644
--- a/drivers/dahdi/wcte12xp/wcte12xp.h
+++ b/drivers/dahdi/wcte12xp/wcte12xp.h
@@ -127,6 +127,7 @@ struct t1 {
unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
struct dahdi_span span; /* Span */
struct dahdi_chan *chans[32]; /* Channels */
+ struct dahdi_echocan_state *ec[32]; /* Echocan state for channels */
unsigned long ctlreg;
struct voicebus* vb;
atomic_t txints;