summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wctdm24xxp/base.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2010-12-09 20:19:26 +0000
committerKinsey Moore <kmoore@digium.com>2010-12-09 20:19:26 +0000
commit63fdc5efa8ae957a31b5d5897b65835e06677f6e (patch)
tree0fbcdd9ff5ed0efbeb663981bb6ff32e6d163159 /drivers/dahdi/wctdm24xxp/base.c
parent2c00501000487765fe74037315e144c596c09a20 (diff)
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 <kmoore@digium.com> Acked-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9524 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wctdm24xxp/base.c')
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 10f7ea8..d96d176 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -174,6 +174,11 @@ static int ectrans[4] = { 0, 1, 3, 2 };
#define EC_SIZE_Q (sizeof(ectab) / 4)
#endif
+/* names of HWEC modules */
+static const char *vpm100m_name = "VPM100M";
+static const char *vpmadt032_name = "VPMADT032";
+static const char *noec_name = "NONE";
+
/* Undefine to enable Power alarm / Transistor debug -- note: do not
enable for normal operation! */
/* #define PAQ_DEBUG */
@@ -255,23 +260,13 @@ static int vpmnlpmaxsupp = DEFAULT_NLPMAXSUPP;
static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
-static const struct dahdi_echocan_features vpm100m_ec_features = {
- .NLP_automatic = 1,
- .CED_tx_detect = 1,
- .CED_rx_detect = 1,
-};
-
-static const struct dahdi_echocan_features vpm150m_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_ops vpm100m_ec_ops = {
- .echocan_free = echocan_free,
-};
-
-static const struct dahdi_echocan_ops vpm150m_ec_ops = {
+static const struct dahdi_echocan_ops vpm_ec_ops = {
.echocan_free = echocan_free,
};
@@ -1963,6 +1958,16 @@ static inline void wctdm_vpm_check(struct wctdm *wc, int x)
}
}
+static const char *wctdm_echocan_name(const struct dahdi_chan *chan)
+{
+ struct wctdm *wc = chan->pvt;
+ if (wc->vpm100)
+ return vpm100m_name;
+ else if (wc->vpmadt032)
+ return vpmadt032_name;
+ return noec_name;
+}
+
static int wctdm_echocan_create(struct dahdi_chan *chan,
struct dahdi_echocanparams *ecp,
struct dahdi_echocanparam *p,
@@ -1980,18 +1985,13 @@ static int wctdm_echocan_create(struct dahdi_chan *chan,
if (!wc->vpm100 && !wc->vpmadt032)
return -ENODEV;
- if (wc->vpmadt032) {
- ops = &vpm150m_ec_ops;
- features = &vpm150m_ec_features;
- } else {
- ops = &vpm100m_ec_ops;
- features = &vpm100m_ec_features;
- }
+ ops = &vpm_ec_ops;
+ features = &vpm_ec_features;
if (wc->vpm100 && (ecp->param_count > 0)) {
dev_warn(&wc->vb.pdev->dev, "%s echo canceller does not "
"support parameters; failing request\n",
- chan->ec_factory->name);
+ chan->ec_factory->get_name(chan));
return -EINVAL;
}
@@ -3682,6 +3682,7 @@ static const struct dahdi_span_ops wctdm24xxp_analog_span_ops = {
.dacs = wctdm_dacs,
#ifdef VPM_SUPPORT
.echocan_create = wctdm_echocan_create,
+ .echocan_name = wctdm_echocan_name,
#endif
};
@@ -3697,6 +3698,7 @@ static const struct dahdi_span_ops wctdm24xxp_digital_span_ops = {
.dacs = wctdm_dacs,
#ifdef VPM_SUPPORT
.echocan_create = wctdm_echocan_create,
+ .echocan_name = wctdm_echocan_name,
#endif
};