From 1add33efe7adaf0f76e54610b7805c12f6b3e193 Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Tue, 17 Dec 2013 15:51:13 -0600 Subject: [PATCH] wcte13xp: Add support for te131 and te132 products These are similar to te133 and te134 but without integrated echo cancel. Signed-off-by: Russ Meyerriecks --- drivers/dahdi/wcte13xp-base.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/dahdi/wcte13xp-base.c b/drivers/dahdi/wcte13xp-base.c index 4d9651b..02ba172 100644 --- a/drivers/dahdi/wcte13xp-base.c +++ b/drivers/dahdi/wcte13xp-base.c @@ -657,7 +657,7 @@ static struct vpm450m *init_vpm450m(struct t13x *wc, int isalaw, } } - if (vpmsupport != 0) + if (vpmsupport) wcxb_enable_echocan(&wc->xb); kfree(ChipOpen); @@ -797,8 +797,8 @@ struct t13x_desc { const char *name; }; -static const struct t13x_desc te133 = {"Wildcard TE133"}; /* pci express */ -static const struct t13x_desc te134 = {"Wildcard TE134"}; /* legacy pci */ +static const struct t13x_desc te133 = {"Wildcard TE131/TE133"}; /* pci express*/ +static const struct t13x_desc te134 = {"Wildcard TE132/TE134"}; /* legacy pci */ static inline bool is_pcie(const struct t13x *t1) { @@ -2187,7 +2187,7 @@ static void te13x_handle_receive(struct wcxb *xb, void *vfp) } } - if (0 == vpmsupport) { + if (!vpmsupport || !wc->vpm) { for (i = 0; i < wc->span.channels; i++) { struct dahdi_chan *const c = wc->span.chans[i]; __dahdi_ec_chunk(c, c->readchunk, c->readchunk, @@ -2440,6 +2440,7 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev, int res; unsigned int index = -1; enum linemode type; + bool vpmcapable = false; for (x = 0; x < ARRAY_SIZE(ifaces); x++) { if (!ifaces[x]) { @@ -2526,6 +2527,17 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev, } wc->ddev->hardware_id = t13x_read_serial(wc); + if (!wc->ddev->hardware_id) { + dev_info(&wc->dev->dev, "No serial number found.\n"); + res = -EIO; + goto fail_exit; + } + + /* Check for hardware echo cancel support */ + if (!strncmp("TE133", wc->ddev->hardware_id+1, 5) || + !strncmp("TE134", wc->ddev->hardware_id+1, 5)) { + vpmcapable = true; + } wc->wq = create_singlethread_workqueue(wc->name); if (!wc->wq) { @@ -2565,7 +2577,7 @@ static int __devinit te13xp_init_one(struct pci_dev *pdev, goto fail_exit; #ifdef VPM_SUPPORT - if (!wc->vpm) + if (!wc->vpm && vpmsupport && vpmcapable) t13x_vpm_init(wc); #endif