From 6140d436654639ca2a53743b28b1c1adda877bb3 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Thu, 9 Dec 2010 20:19:13 +0000 Subject: [PATCH] dahdi-base: Allow HWEC to use the modular echocan interface This change adds an echocan factory to dahdi-base that will allow hardware echo cancellation to use the same interface as the current software echo cancellers. The additions in this commit will not have any effect until the current HWEC mechanism is removed. Signed-off-by: Kinsey Moore Acked-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9520 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 9f9516f..c7a346a 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8920,6 +8920,22 @@ int dahdi_unregister_chardev(struct dahdi_chardev *dev) return 0; } +static int hwec_echocan_create(struct dahdi_chan *chan, + struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p, + struct dahdi_echocan_state **ec) +{ + if (chan->span && chan->span->ops->echocan_create) + return chan->span->ops->echocan_create(chan, ecp, p, ec); + else + return -ENODEV; +} + +static const struct dahdi_echocan_factory hwec_factory = { + .name = "HWEC", + .owner = THIS_MODULE, + .echocan_create = hwec_echocan_create, +}; + static int __init dahdi_init(void) { int res = 0; @@ -8948,6 +8964,12 @@ static int __init dahdi_init(void) watchdog_init(); #endif coretimer_init(); + + if (dahdi_register_echocan_factory(&hwec_factory)) { + WARN_ON(1); + return -EFAULT; + } + return res; } @@ -8955,6 +8977,7 @@ static void __exit dahdi_cleanup(void) { int x; + dahdi_unregister_echocan_factory(&hwec_factory); coretimer_cleanup(); CLASS_DEV_DESTROY(dahdi_class, MKDEV(DAHDI_MAJOR, 253)); /* timer */