From 63fdc5efa8ae957a31b5d5897b65835e06677f6e Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Thu, 9 Dec 2010 20:19:26 +0000 Subject: dahdi-base, dahdi_echocan_*, wcb4xxp, wct4xxp, wctdm24xxp, wcte12xp, kernel: Allow name of EC factory to vary based on channel Changed the echocan factory name to a function (get_name) called to get the name. This allows a factory to return a different name when being called in reference to a channel such as in the case of hardware echo cancellers. To further accommodate this change for HWEC, a new echocan_name function was added to the span ops struct and is used in hwec_factory in dahdi-base for all cards that support hardware echo cancellation. Signed-off-by: Kinsey Moore Acked-by: Shaun Ruffell git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9524 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/wct4xxp/base.c | 46 +++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'drivers/dahdi/wct4xxp') diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 71d98f8..4df3c34 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -236,6 +236,11 @@ static int altab[] = { #define CANARY 0xc0de +/* names of available HWEC modules */ +static const char *vpm400_name = "VPM400M"; +static const char *vpmoct064_name = "VPMOCT064"; +static const char *vpmoct128_name = "VPMOCT128"; +static const char *noec_name = "NONE"; #define PORTS_PER_FRAMER 4 @@ -393,23 +398,13 @@ static void t4_vpm_set_dtmf_threshold(struct t4 *wc, unsigned int threshold); static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec); -static const struct dahdi_echocan_features vpm400m_ec_features = { +static const struct dahdi_echocan_features vpm_ec_features = { .NLP_automatic = 1, .CED_tx_detect = 1, .CED_rx_detect = 1, }; -static const struct dahdi_echocan_features vpm450m_ec_features = { - .NLP_automatic = 1, - .CED_tx_detect = 1, - .CED_rx_detect = 1, -}; - -static const struct dahdi_echocan_ops vpm400m_ec_ops = { - .echocan_free = echocan_free, -}; - -static const struct dahdi_echocan_ops vpm450m_ec_ops = { +static const struct dahdi_echocan_ops vpm_ec_ops = { .echocan_free = echocan_free, }; #endif @@ -1279,6 +1274,21 @@ static int t4_vpm_unit(int span, int channel) return unit; } +static const char *t4_echocan_name(const struct dahdi_chan *chan) +{ + struct t4 *wc = chan->pvt; + if (wc->vpm == T4_VPM_PRESENT) { + if (!wc->vpm450m) + return vpm400_name; + else + if (wc->numspans == 2) + return vpmoct064_name; + else if (wc->numspans == 4) + return vpmoct128_name; + } + return noec_name; +} + static int t4_echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p, @@ -1296,18 +1306,13 @@ static int t4_echocan_create(struct dahdi_chan *chan, if (chan->span->offset >= vpmspans) return -ENODEV; - if (wc->vpm450m) { - ops = &vpm450m_ec_ops; - features = &vpm450m_ec_features; - } else { - ops = &vpm400m_ec_ops; - features = &vpm400m_ec_features; - } + ops = &vpm_ec_ops; + features = &vpm_ec_features; if (ecp->param_count > 0) { dev_warn(&wc->dev->dev, "%s echo canceller does not support " "parameters; failing request\n", - chan->ec_factory->name); + chan->ec_factory->get_name(chan)); return -EINVAL; } @@ -2082,6 +2087,7 @@ static const struct dahdi_span_ops t4_gen2_span_ops = { .dacs = t4_dacs, #ifdef VPM_SUPPORT .echocan_create = t4_echocan_create, + .echocan_name = t4_echocan_name, #endif }; -- cgit v1.2.3