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
This commit is contained in:
parent
fd01eef199
commit
7a7d4000a0
@ -799,7 +799,7 @@ static int dahdi_proc_read(char *page, char **start, off_t off, int count, int *
|
|||||||
|
|
||||||
if (chan->ec_factory)
|
if (chan->ec_factory)
|
||||||
len += snprintf(page+len, count-len, "(EC: %s - %s) ",
|
len += snprintf(page+len, count-len, "(EC: %s - %s) ",
|
||||||
chan->ec_factory->name,
|
chan->ec_factory->get_name(chan),
|
||||||
chan->ec_state ? "ACTIVE" : "INACTIVE");
|
chan->ec_state ? "ACTIVE" : "INACTIVE");
|
||||||
|
|
||||||
len += snprintf(page+len, count-len, "\n");
|
len += snprintf(page+len, count-len, "\n");
|
||||||
@ -1197,7 +1197,7 @@ retry:
|
|||||||
read_lock(&ecfactory_list_lock);
|
read_lock(&ecfactory_list_lock);
|
||||||
|
|
||||||
list_for_each_entry(cur, &ecfactory_list, list) {
|
list_for_each_entry(cur, &ecfactory_list, list) {
|
||||||
if (!strcmp(name_upper, cur->ec->name)) {
|
if (!strcmp(name_upper, cur->ec->get_name(NULL))) {
|
||||||
if (try_module_get(cur->ec->owner)) {
|
if (try_module_get(cur->ec->owner)) {
|
||||||
read_unlock(&ecfactory_list_lock);
|
read_unlock(&ecfactory_list_lock);
|
||||||
kfree(name_upper);
|
kfree(name_upper);
|
||||||
@ -4603,8 +4603,9 @@ static int dahdi_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long da
|
|||||||
dahdi_copy_string(vi.version, DAHDI_VERSION, sizeof(vi.version));
|
dahdi_copy_string(vi.version, DAHDI_VERSION, sizeof(vi.version));
|
||||||
read_lock(&ecfactory_list_lock);
|
read_lock(&ecfactory_list_lock);
|
||||||
list_for_each_entry(cur, &ecfactory_list, list) {
|
list_for_each_entry(cur, &ecfactory_list, list) {
|
||||||
strncat(vi.echo_canceller + strlen(vi.echo_canceller), cur->ec->name, space);
|
strncat(vi.echo_canceller + strlen(vi.echo_canceller),
|
||||||
space -= strlen(cur->ec->name);
|
cur->ec->get_name(NULL), space);
|
||||||
|
space -= strlen(cur->ec->get_name(NULL));
|
||||||
if (space < 1) {
|
if (space < 1) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5478,7 +5479,9 @@ ioctl_echocancel(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
|
|||||||
/* try to get another reference to the module providing
|
/* try to get another reference to the module providing
|
||||||
this channel's echo canceler */
|
this channel's echo canceler */
|
||||||
if (!try_module_get(chan->ec_factory->owner)) {
|
if (!try_module_get(chan->ec_factory->owner)) {
|
||||||
module_printk(KERN_ERR, "Cannot get a reference to the '%s' echo canceler\n", chan->ec_factory->name);
|
module_printk(KERN_ERR, "Cannot get a reference to the"
|
||||||
|
" '%s' echo canceler\n",
|
||||||
|
chan->ec_factory->get_name(chan));
|
||||||
goto exit_with_free;
|
goto exit_with_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5495,7 +5498,7 @@ ioctl_echocancel(struct dahdi_chan *chan, struct dahdi_echocanparams *ecp,
|
|||||||
if (!ec) {
|
if (!ec) {
|
||||||
module_printk(KERN_ERR, "%s failed to allocate an " \
|
module_printk(KERN_ERR, "%s failed to allocate an " \
|
||||||
"dahdi_echocan_state instance.\n",
|
"dahdi_echocan_state instance.\n",
|
||||||
ec_current->name);
|
ec_current->get_name(chan));
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto exit_with_free;
|
goto exit_with_free;
|
||||||
}
|
}
|
||||||
@ -8899,6 +8902,15 @@ int dahdi_unregister_chardev(struct dahdi_chardev *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *hwec_def_name = "HWEC";
|
||||||
|
static const char *hwec_get_name(const struct dahdi_chan *chan)
|
||||||
|
{
|
||||||
|
if (chan && chan->span && chan->span->ops->echocan_name)
|
||||||
|
return chan->span->ops->echocan_name(chan);
|
||||||
|
else
|
||||||
|
return hwec_def_name;
|
||||||
|
}
|
||||||
|
|
||||||
static int hwec_echocan_create(struct dahdi_chan *chan,
|
static int hwec_echocan_create(struct dahdi_chan *chan,
|
||||||
struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p,
|
struct dahdi_echocanparams *ecp, struct dahdi_echocanparam *p,
|
||||||
struct dahdi_echocan_state **ec)
|
struct dahdi_echocan_state **ec)
|
||||||
@ -8910,7 +8922,7 @@ static int hwec_echocan_create(struct dahdi_chan *chan,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory hwec_factory = {
|
static const struct dahdi_echocan_factory hwec_factory = {
|
||||||
.name = "HWEC",
|
.get_name = hwec_get_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = hwec_echocan_create,
|
.echocan_create = hwec_echocan_create,
|
||||||
};
|
};
|
||||||
|
@ -46,9 +46,11 @@ static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *
|
|||||||
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
|
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
|
||||||
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
||||||
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
||||||
|
static const char *name = "JPAH";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "JPAH",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -124,7 +126,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -148,9 +148,11 @@ static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *e
|
|||||||
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
||||||
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
||||||
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
||||||
|
static const char *name = "KB1";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "KB1",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -722,7 +724,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -180,9 +180,11 @@ static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *e
|
|||||||
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
||||||
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
||||||
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
||||||
|
static const char *name = "MG2";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "MG2",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -869,7 +871,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,11 @@ static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val)
|
|||||||
static void echo_can_hpf_tx(struct dahdi_echocan_state *ec,
|
static void echo_can_hpf_tx(struct dahdi_echocan_state *ec,
|
||||||
short *tx, u32 size);
|
short *tx, u32 size);
|
||||||
#endif
|
#endif
|
||||||
|
static const char *name = "OSLEC";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "OSLEC",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -147,7 +149,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_INFO, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_INFO, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,11 @@ static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *e
|
|||||||
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
||||||
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
||||||
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
|
||||||
|
static const char *name = "SEC";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "SEC",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -335,7 +337,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,11 @@ static int echo_can_create(struct dahdi_chan *chan, struct dahdi_echocanparams *
|
|||||||
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
|
static void echo_can_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
|
||||||
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
static void echo_can_process(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
|
||||||
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
|
||||||
|
static const char *name = "SEC2";
|
||||||
|
static const char *ec_name(const struct dahdi_chan *chan) { return name; }
|
||||||
|
|
||||||
static const struct dahdi_echocan_factory my_factory = {
|
static const struct dahdi_echocan_factory my_factory = {
|
||||||
.name = "SEC2",
|
.get_name = ec_name,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.echocan_create = echo_can_create,
|
.echocan_create = echo_can_create,
|
||||||
};
|
};
|
||||||
@ -330,7 +332,8 @@ static int __init mod_init(void)
|
|||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n", my_factory.name);
|
module_printk(KERN_NOTICE, "Registered echo canceler '%s'\n",
|
||||||
|
my_factory.get_name(NULL));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,10 @@ static char *companding = "alaw";
|
|||||||
#define MAX_B4_CARDS 64
|
#define MAX_B4_CARDS 64
|
||||||
static struct b4xxp *cards[MAX_B4_CARDS];
|
static struct b4xxp *cards[MAX_B4_CARDS];
|
||||||
|
|
||||||
|
/* names of HWEC modules */
|
||||||
|
static const char *lasvegas2_name = "LASVEGAS2";
|
||||||
|
static const char *noec_name = "NONE";
|
||||||
|
|
||||||
static int led_fader_table[] = {
|
static int led_fader_table[] = {
|
||||||
0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24,
|
0, 0, 0, 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18, 20, 22, 24,
|
||||||
25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22,
|
25, 27, 28, 29, 30, 31, 31, 32, 31, 31, 30, 29, 28, 27, 25, 23, 22,
|
||||||
@ -2129,6 +2133,15 @@ static void b4xxp_update_leds(struct b4xxp *b4)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *b4xxp_echocan_name(const struct dahdi_chan *chan)
|
||||||
|
{
|
||||||
|
struct b4xxp_span *bspan = container_of(chan->span, struct b4xxp_span,
|
||||||
|
span);
|
||||||
|
if (bspan->parent->card_type == B410P)
|
||||||
|
return lasvegas2_name;
|
||||||
|
return noec_name;
|
||||||
|
}
|
||||||
|
|
||||||
static int b4xxp_echocan_create(struct dahdi_chan *chan,
|
static int b4xxp_echocan_create(struct dahdi_chan *chan,
|
||||||
struct dahdi_echocanparams *ecp,
|
struct dahdi_echocanparams *ecp,
|
||||||
struct dahdi_echocanparam *p,
|
struct dahdi_echocanparam *p,
|
||||||
@ -2370,6 +2383,7 @@ static const struct dahdi_span_ops b4xxp_span_ops = {
|
|||||||
.ioctl = b4xxp_ioctl,
|
.ioctl = b4xxp_ioctl,
|
||||||
.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit,
|
.hdlc_hard_xmit = b4xxp_hdlc_hard_xmit,
|
||||||
.echocan_create = b4xxp_echocan_create,
|
.echocan_create = b4xxp_echocan_create,
|
||||||
|
.echocan_name = b4xxp_echocan_name,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* initialize the span/chan structures. Doesn't touch hardware, although the callbacks might. */
|
/* initialize the span/chan structures. Doesn't touch hardware, although the callbacks might. */
|
||||||
|
@ -236,6 +236,11 @@ static int altab[] = {
|
|||||||
|
|
||||||
#define CANARY 0xc0de
|
#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
|
#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 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,
|
.NLP_automatic = 1,
|
||||||
.CED_tx_detect = 1,
|
.CED_tx_detect = 1,
|
||||||
.CED_rx_detect = 1,
|
.CED_rx_detect = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct dahdi_echocan_features vpm450m_ec_features = {
|
static const struct dahdi_echocan_ops vpm_ec_ops = {
|
||||||
.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 = {
|
|
||||||
.echocan_free = echocan_free,
|
.echocan_free = echocan_free,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -1279,6 +1274,21 @@ static int t4_vpm_unit(int span, int channel)
|
|||||||
return unit;
|
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,
|
static int t4_echocan_create(struct dahdi_chan *chan,
|
||||||
struct dahdi_echocanparams *ecp,
|
struct dahdi_echocanparams *ecp,
|
||||||
struct dahdi_echocanparam *p,
|
struct dahdi_echocanparam *p,
|
||||||
@ -1296,18 +1306,13 @@ static int t4_echocan_create(struct dahdi_chan *chan,
|
|||||||
if (chan->span->offset >= vpmspans)
|
if (chan->span->offset >= vpmspans)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (wc->vpm450m) {
|
ops = &vpm_ec_ops;
|
||||||
ops = &vpm450m_ec_ops;
|
features = &vpm_ec_features;
|
||||||
features = &vpm450m_ec_features;
|
|
||||||
} else {
|
|
||||||
ops = &vpm400m_ec_ops;
|
|
||||||
features = &vpm400m_ec_features;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ecp->param_count > 0) {
|
if (ecp->param_count > 0) {
|
||||||
dev_warn(&wc->dev->dev, "%s echo canceller does not support "
|
dev_warn(&wc->dev->dev, "%s echo canceller does not support "
|
||||||
"parameters; failing request\n",
|
"parameters; failing request\n",
|
||||||
chan->ec_factory->name);
|
chan->ec_factory->get_name(chan));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2082,6 +2087,7 @@ static const struct dahdi_span_ops t4_gen2_span_ops = {
|
|||||||
.dacs = t4_dacs,
|
.dacs = t4_dacs,
|
||||||
#ifdef VPM_SUPPORT
|
#ifdef VPM_SUPPORT
|
||||||
.echocan_create = t4_echocan_create,
|
.echocan_create = t4_echocan_create,
|
||||||
|
.echocan_name = t4_echocan_name,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,6 +174,11 @@ static int ectrans[4] = { 0, 1, 3, 2 };
|
|||||||
#define EC_SIZE_Q (sizeof(ectab) / 4)
|
#define EC_SIZE_Q (sizeof(ectab) / 4)
|
||||||
#endif
|
#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
|
/* Undefine to enable Power alarm / Transistor debug -- note: do not
|
||||||
enable for normal operation! */
|
enable for normal operation! */
|
||||||
/* #define PAQ_DEBUG */
|
/* #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 void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec);
|
||||||
|
|
||||||
static const struct dahdi_echocan_features vpm100m_ec_features = {
|
static const struct dahdi_echocan_features vpm_ec_features = {
|
||||||
.NLP_automatic = 1,
|
.NLP_automatic = 1,
|
||||||
.CED_tx_detect = 1,
|
.CED_tx_detect = 1,
|
||||||
.CED_rx_detect = 1,
|
.CED_rx_detect = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct dahdi_echocan_features vpm150m_ec_features = {
|
static const struct dahdi_echocan_ops vpm_ec_ops = {
|
||||||
.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 = {
|
|
||||||
.echocan_free = echocan_free,
|
.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,
|
static int wctdm_echocan_create(struct dahdi_chan *chan,
|
||||||
struct dahdi_echocanparams *ecp,
|
struct dahdi_echocanparams *ecp,
|
||||||
struct dahdi_echocanparam *p,
|
struct dahdi_echocanparam *p,
|
||||||
@ -1980,18 +1985,13 @@ static int wctdm_echocan_create(struct dahdi_chan *chan,
|
|||||||
if (!wc->vpm100 && !wc->vpmadt032)
|
if (!wc->vpm100 && !wc->vpmadt032)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (wc->vpmadt032) {
|
ops = &vpm_ec_ops;
|
||||||
ops = &vpm150m_ec_ops;
|
features = &vpm_ec_features;
|
||||||
features = &vpm150m_ec_features;
|
|
||||||
} else {
|
|
||||||
ops = &vpm100m_ec_ops;
|
|
||||||
features = &vpm100m_ec_features;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wc->vpm100 && (ecp->param_count > 0)) {
|
if (wc->vpm100 && (ecp->param_count > 0)) {
|
||||||
dev_warn(&wc->vb.pdev->dev, "%s echo canceller does not "
|
dev_warn(&wc->vb.pdev->dev, "%s echo canceller does not "
|
||||||
"support parameters; failing request\n",
|
"support parameters; failing request\n",
|
||||||
chan->ec_factory->name);
|
chan->ec_factory->get_name(chan));
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3682,6 +3682,7 @@ static const struct dahdi_span_ops wctdm24xxp_analog_span_ops = {
|
|||||||
.dacs = wctdm_dacs,
|
.dacs = wctdm_dacs,
|
||||||
#ifdef VPM_SUPPORT
|
#ifdef VPM_SUPPORT
|
||||||
.echocan_create = wctdm_echocan_create,
|
.echocan_create = wctdm_echocan_create,
|
||||||
|
.echocan_name = wctdm_echocan_name,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3697,6 +3698,7 @@ static const struct dahdi_span_ops wctdm24xxp_digital_span_ops = {
|
|||||||
.dacs = wctdm_dacs,
|
.dacs = wctdm_dacs,
|
||||||
#ifdef VPM_SUPPORT
|
#ifdef VPM_SUPPORT
|
||||||
.echocan_create = wctdm_echocan_create,
|
.echocan_create = wctdm_echocan_create,
|
||||||
|
.echocan_name = wctdm_echocan_name,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,6 +95,10 @@ static const struct t1_desc te120p = {"Wildcard TE120P"};
|
|||||||
static const struct t1_desc te122 = {"Wildcard TE122"};
|
static const struct t1_desc te122 = {"Wildcard TE122"};
|
||||||
static const struct t1_desc te121 = {"Wildcard TE121"};
|
static const struct t1_desc te121 = {"Wildcard TE121"};
|
||||||
|
|
||||||
|
/* names of HWEC modules */
|
||||||
|
static const char *vpmadt032_name = "VPMADT032";
|
||||||
|
static const char *noec_name = "NONE";
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
|
||||||
static kmem_cache_t *cmd_cache;
|
static kmem_cache_t *cmd_cache;
|
||||||
#else
|
#else
|
||||||
@ -945,10 +949,9 @@ static void set_span_devicetype(struct t1 *wc)
|
|||||||
sizeof(wc->span.devicetype) - 1);
|
sizeof(wc->span.devicetype) - 1);
|
||||||
|
|
||||||
#if defined(VPM_SUPPORT)
|
#if defined(VPM_SUPPORT)
|
||||||
if (wc->vpmadt032) {
|
if (wc->vpmadt032)
|
||||||
strncat(wc->span.devicetype, " (VPMADT032)",
|
strncat(wc->span.devicetype, " (VPMADT032)",
|
||||||
sizeof(wc->span.devicetype) - 1);
|
sizeof(wc->span.devicetype) - 1);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1308,6 +1311,14 @@ static int t1xxp_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *t1xxp_echocan_name(const struct dahdi_chan *chan)
|
||||||
|
{
|
||||||
|
struct t1 *wc = chan->pvt;
|
||||||
|
if (wc->vpmadt032)
|
||||||
|
return vpmadt032_name;
|
||||||
|
return noec_name;
|
||||||
|
}
|
||||||
|
|
||||||
static int t1xxp_echocan_create(struct dahdi_chan *chan,
|
static int t1xxp_echocan_create(struct dahdi_chan *chan,
|
||||||
struct dahdi_echocanparams *ecp,
|
struct dahdi_echocanparams *ecp,
|
||||||
struct dahdi_echocanparam *p,
|
struct dahdi_echocanparam *p,
|
||||||
@ -1537,6 +1548,7 @@ static const struct dahdi_span_ops t1_span_ops = {
|
|||||||
.ioctl = t1xxp_ioctl,
|
.ioctl = t1xxp_ioctl,
|
||||||
#ifdef VPM_SUPPORT
|
#ifdef VPM_SUPPORT
|
||||||
.echocan_create = t1xxp_echocan_create,
|
.echocan_create = t1xxp_echocan_create,
|
||||||
|
.echocan_name = t1xxp_echocan_name,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -268,8 +268,8 @@ struct dahdi_echocan_ops {
|
|||||||
/*! A factory for creating instances of software echo cancelers to be used on DAHDI channels. */
|
/*! A factory for creating instances of software echo cancelers to be used on DAHDI channels. */
|
||||||
struct dahdi_echocan_factory {
|
struct dahdi_echocan_factory {
|
||||||
|
|
||||||
/*! The name of the factory. */
|
/*! Get the name of the factory. */
|
||||||
const char *name;
|
const char *(*get_name)(const struct dahdi_chan *chan);
|
||||||
|
|
||||||
/*! Pointer to the module that owns this factory; the module's reference count will be
|
/*! Pointer to the module that owns this factory; the module's reference count will be
|
||||||
* incremented/decremented by the DAHDI core as needed.
|
* incremented/decremented by the DAHDI core as needed.
|
||||||
@ -851,6 +851,9 @@ struct dahdi_span_ops {
|
|||||||
struct dahdi_echocanparams *ecp,
|
struct dahdi_echocanparams *ecp,
|
||||||
struct dahdi_echocanparam *p,
|
struct dahdi_echocanparam *p,
|
||||||
struct dahdi_echocan_state **ec);
|
struct dahdi_echocan_state **ec);
|
||||||
|
|
||||||
|
/*! Opt: Provide the name of the echo canceller on a channel */
|
||||||
|
const char *(*echocan_name)(const struct dahdi_chan *chan);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dahdi_span {
|
struct dahdi_span {
|
||||||
|
Loading…
Reference in New Issue
Block a user