From 0400a2e6a773a5f30e271e218f124080f2f355ae Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Mon, 4 Jul 2011 14:04:33 +0000 Subject: xpp: add FXO HWEC quirks handling In some cases the hardware echo canceller cannot be used. Mostly related to an FXO module. * FXO module if the first module is BRI or PRI * FXS module if the Astribank has another FXO, no PRI/BRI, and is a sync slave. Signed-off-by: Oron Peled Acked-By: Tzafrir Cohen git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10019 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/xpp/xbus-core.c | 4 ++++ drivers/dahdi/xpp/xbus-core.h | 4 ++++ drivers/dahdi/xpp/xpp_dahdi.c | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index 3d37f71..105c2eb 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -664,6 +664,10 @@ static int new_card(xbus_t *xbus, subunits, port_dir ); + if (type == XPD_TYPE_PRI || type == XPD_TYPE_BRI) + xbus->quirks.has_digital_span = 1; + if (type == XPD_TYPE_FXO) + xbus->quirks.has_fxo = 1; xbus->worker.num_units += subunits - 1; for(i = 0; i < subunits; i++) { int subunit_ports = proto_table->ports_per_subunit; diff --git a/drivers/dahdi/xpp/xbus-core.h b/drivers/dahdi/xpp/xbus-core.h index b781e94..14678ff 100644 --- a/drivers/dahdi/xpp/xbus-core.h +++ b/drivers/dahdi/xpp/xbus-core.h @@ -207,6 +207,10 @@ struct xbus { int cpu_rcv_intr[NR_CPUS]; int cpu_rcv_tasklet[NR_CPUS]; + struct quirks { + int has_fxo:1; + int has_digital_span:1; + } quirks; bool self_ticking; enum sync_mode sync_mode; /* Managed by low-level drivers: */ diff --git a/drivers/dahdi/xpp/xpp_dahdi.c b/drivers/dahdi/xpp/xpp_dahdi.c index 3bad387..3c25392 100644 --- a/drivers/dahdi/xpp/xpp_dahdi.c +++ b/drivers/dahdi/xpp/xpp_dahdi.c @@ -940,6 +940,26 @@ const char *xpp_echocan_name(const struct dahdi_chan *chan) LINE_DBG(GENERAL, xpd, pos, "%s:\n", __func__); if (!ECHOOPS(xbus)) return NULL; + /* + * quirks and limitations + */ + if (xbus->quirks.has_fxo) { + if ( + xbus->quirks.has_digital_span && + xpd->type == XPD_TYPE_FXO) { + LINE_NOTICE(xpd, pos, + "quirk: give up HWEC on FXO: " + "AB has digital span\n"); + return NULL; + } else if ( + xbus->sync_mode != SYNC_MODE_AB && + xpd->type == XPD_TYPE_FXS) { + LINE_NOTICE(xpd, pos, + "quirk: give up HWEC on FXS: " + "AB has FXO and is sync slave\n"); + return NULL; + } + } return "XPP"; } EXPORT_SYMBOL(xpp_echocan_name); -- cgit v1.2.3