diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2009-08-19 16:40:13 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2009-08-19 16:40:13 +0000 |
commit | 63417bd683f043e71253331542eb0ee6d77826e7 (patch) | |
tree | d53f3ccb48ad7c7cb858377ac2c55a91352b746e | |
parent | 6329a1dab946e0d77229a745671d15d887b21e58 (diff) |
Ensure that dahdi_scan correctly reports VPM presence.
The wct4xxp driver (for the dual/quad span T1/E1 cards) and the wcte12xp
driver (for the single span VoiceBus-based T1/E1 cards) did not properly
update the 'devicetype' field reported by dahdi_scan when a VPM was found
during the card startup process. As a result, dahdi_scan did not show that
a VPM was present on the card, even if it was.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7038 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | drivers/dahdi/wct4xxp/base.c | 29 | ||||
-rw-r--r-- | drivers/dahdi/wctdm24xxp/base.c | 4 | ||||
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 18 |
3 files changed, 35 insertions, 16 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c index 59c7fc0..bbfdda9 100644 --- a/drivers/dahdi/wct4xxp/base.c +++ b/drivers/dahdi/wct4xxp/base.c @@ -1581,6 +1581,24 @@ static int t4_close(struct dahdi_chan *chan) return 0; } +static void set_span_devicetype(struct t4 *wc) +{ + int x; + struct t4_span *ts; + + for (x = 0; x < wc->numspans; x++) { + ts = wc->tspans[x]; + dahdi_copy_string(ts->span.devicetype, wc->variety, sizeof(ts->span.devicetype)); + if (wc->vpm == T4_VPM_PRESENT) { + if (!wc->vpm450m) + strncat(ts->span.devicetype, " (VPM400M)", sizeof(ts->span.devicetype) - 1); + else + strncat(ts->span.devicetype, (wc->numspans > 2) ? " (VPMOCT128)" : " (VPMOCT064)", + sizeof(ts->span.devicetype) - 1); + } + } +} + /* The number of cards we have seen with each possible 'order' switch setting. */ @@ -1602,14 +1620,6 @@ static void init_spans(struct t4 *wc) snprintf(ts->span.desc, sizeof(ts->span.desc) - 1, "T%dXXP (PCI) Card %d Span %d", wc->numspans, wc->num, x+1); ts->span.manufacturer = "Digium"; - dahdi_copy_string(ts->span.devicetype, wc->variety, sizeof(ts->span.devicetype)); - if (wc->vpm == T4_VPM_PRESENT) { - if (!wc->vpm450m) - strncat(ts->span.devicetype, " with VPM400M", sizeof(ts->span.devicetype) - 1); - else - strncat(ts->span.devicetype, (wc->numspans > 2) ? " with VPMOCT128" : " with VPMOCT064", - sizeof(ts->span.devicetype) - 1); - } if (order_index[wc->order] == 1) snprintf(ts->span.location, sizeof(ts->span.location) - 1, "Board ID Switch %d", wc->order); else @@ -1682,6 +1692,7 @@ static void init_spans(struct t4 *wc) } } } + set_span_devicetype(wc); } static void t4_serial_setup(struct t4 *wc, int unit) @@ -2150,6 +2161,8 @@ static int t4_startup(struct dahdi_span *span) t4_vpm450_init(wc); wc->dmactrl |= wc->vpm; t4_pci_out(wc, WC_DMACTRL, wc->dmactrl); + if (wc->vpm) + set_span_devicetype(wc); } #endif printk(KERN_INFO "Completed startup!\n"); diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 65ff54d..4959981 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -3332,9 +3332,9 @@ static void wctdm_post_initialize(struct wctdm *wc) } if (wc->vpm100) { - strncat(wc->span.devicetype, " with VPM100M", sizeof(wc->span.devicetype) - 1); + strncat(wc->span.devicetype, " (VPM100M)", sizeof(wc->span.devicetype) - 1); } else if (wc->vpmadt032) { - strncat(wc->span.devicetype, " with VPMADT032", sizeof(wc->span.devicetype) - 1); + strncat(wc->span.devicetype, " (VPMADT032)", sizeof(wc->span.devicetype) - 1); } } diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 0d6044b..676282d 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1169,6 +1169,16 @@ static void echocan_free(struct dahdi_chan *chan, struct dahdi_echocan_state *ec vpmadt032_echocan_free(wc->vpmadt032, chan, ec); } +static void set_span_devicetype(struct t1 *wc) +{ + strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1); + +#if defined(VPM_SUPPORT) + if (wc->vpmadt032) + strncat(wc->span.devicetype, " (VPMADT032)", sizeof(wc->span.devicetype) - 1); +#endif +} + static int t1_software_init(struct t1 *wc) { int x; @@ -1194,12 +1204,7 @@ static int t1_software_init(struct t1 *wc) sprintf(wc->span.name, "WCT1/%d", num); snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, num); wc->span.manufacturer = "Digium"; - strncpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype) - 1); - -#if defined(VPM_SUPPORT) - if (wc->vpmadt032) - strncat(wc->span.devicetype, " with VPMADT032", sizeof(wc->span.devicetype) - 1); -#endif + set_span_devicetype(wc); snprintf(wc->span.location, sizeof(wc->span.location) - 1, "PCI Bus %02d Slot %02d", dev->bus->number, PCI_SLOT(dev->devfn) + 1); @@ -1377,6 +1382,7 @@ static int t1_hardware_post_init(struct t1 *wc) config_vpmadt032(wc->vpmadt032); + set_span_devicetype(wc); module_printk("VPM present and operational (Firmware version %x)\n", wc->vpmadt032->version); wc->ctlreg |= 0x10; /* turn on vpm (RX audio from vpm module) */ if (vpmtsisupport) { |