From a25294f1d516ca2f599bd31edbddb349e3387237 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Fri, 8 Sep 2006 16:02:43 +0000 Subject: fix problem with VPM450M/VPMOCT when T1 and E1 are both used on the card make hardware DTMF detection default based on whether the module is a VPM400M or a VPM450M/VPMOCT git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1436 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- wct4xxp/base.c | 15 ++++++++++++--- wct4xxp/vpm450m.c | 5 ++++- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'wct4xxp') diff --git a/wct4xxp/base.c b/wct4xxp/base.c index 8594611..66a7265 100644 --- a/wct4xxp/base.c +++ b/wct4xxp/base.c @@ -184,7 +184,8 @@ static int loopback = 0; static int alarmdebounce = 0; #ifdef VPM_SUPPORT static int vpmsupport = 1; -static int vpmdtmfsupport = 0; +/* If set to auto, vpmdtmfsupport is enabled for VPM400M and disabled for VPM450M */ +static int vpmdtmfsupport = -1; /* -1=auto, 0=disabled, 1=enabled*/ static int vpmspans = 4; #define VPM_DEFAULT_DTMFTHRESHOLD 1000 static int dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD; @@ -1039,7 +1040,7 @@ static int t4_ioctl(struct zt_chan *chan, unsigned int cmd, unsigned long data) return -EFAULT; if (!wc->vpm) return -ENOSYS; - if (j && !vpmdtmfsupport) + if (j && (vpmdtmfsupport == 0)) return -ENOSYS; if (j & ZT_TONEDETECT_ON) ts->dtmfmask |= (1 << (chan->chanpos - 1)); @@ -2576,7 +2577,7 @@ static void t4_interrupt_gen2(int irq, void *dev_id, struct pt_regs *regs) } spin_unlock_irqrestore(&wc->reglock, flags); - if (needcheckvpm450 && vpmdtmfsupport) { + if (needcheckvpm450 && (vpmdtmfsupport == 1)) { t4_check_vpm450(wc); needcheckvpm450 = 0; } @@ -2725,6 +2726,10 @@ static void t4_vpm450_init(struct t4 *wc) #ifdef HOTPLUG_FIRMWARE release_firmware(firmware); #endif + if (vpmdtmfsupport<0){ + printk("VPM450: hardware DTMF disabled.\n"); + vpmdtmfsupport = 0; + } wc->vpm = T4_VPM_PRESENT; printk("VPM450: Present and operational servicing %d span(s)\n", wc->numspans); } @@ -2861,6 +2866,10 @@ static void t4_vpm400_init(struct t4 *wc) t4_vpm_out(wc, x, i, (x < 4) ? 0x55 : 0xAA); } + if (vpmdtmfsupport<0){ + printk("VPM400: hardware DTMF enabled.\n"); + vpmdtmfsupport = 1; + } printk("VPM400%s: Present and operational servicing %d span(s)\n", (gen2vpm ? "(2nd Gen)" : ""), wc->numspans); wc->vpm = T4_VPM_PRESENT; } diff --git a/wct4xxp/vpm450m.c b/wct4xxp/vpm450m.c index d423c12..5e52b79 100644 --- a/wct4xxp/vpm450m.c +++ b/wct4xxp/vpm450m.c @@ -442,7 +442,10 @@ struct vpm450m *init_vpm450m(void *wc, int *isalaw) return NULL; } for (x=0;x<128;x++) { - if (isalaw[x >> 5]) + /* span timeslots are interleaved 12341234... + * therefore, the lower 2 bits tell us which span this timeslot/channel + */ + if (isalaw[x & 0x03]) law = cOCT6100_PCM_A_LAW; else law = cOCT6100_PCM_U_LAW; -- cgit v1.2.3