From f8fec661eee5e7c843bd8e653063ba0eb56525ad Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sat, 19 Mar 2011 21:59:28 -0500 Subject: wctdm24xxp: Use interval for checking on hook transfer timer. Part of moving more of the module specific processing out of the interrupt handler. Signed-off-by: Shaun Ruffell --- drivers/dahdi/wctdm24xxp/base.c | 14 ++++++++------ drivers/dahdi/wctdm24xxp/wctdm24xxp.h | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 637cda2..86a577f 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -2246,15 +2246,14 @@ static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod) if (SLIC_LF_RINGING == fxs->lasttxhook) { /* RINGing, prepare for OHT */ - fxs->ohttimer = OHT_TIMER << 3; + fxs->ohttimer = wc->framecount + OHT_TIMER; /* OHT mode when idle */ fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_OHTRAN_REV : SLIC_LF_OHTRAN_FWD; - } else if (fxs->ohttimer) { + } else if (fxs->oht_active) { /* check if still OnHook */ if (!fxs->oldrxhook) { - fxs->ohttimer -= DAHDI_CHUNKSIZE; - if (fxs->ohttimer) + if (time_before(wc->framecount, fxs->ohttimer)) return; /* Switch to active */ @@ -2284,7 +2283,7 @@ static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod) } spin_unlock_irqrestore(&fxs->lasttxhooklock, flags); } else { - fxs->ohttimer = 0; + fxs->oht_active = 0; /* Switch to active */ fxs->idletxhookstate = POLARITY_XOR(fxs) ? SLIC_LF_ACTIVE_REV : SLIC_LF_ACTIVE_FWD; if (debug & DEBUG_CARD) { @@ -3490,7 +3489,6 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long return -EINVAL; if (get_user(x, (__user int *) data)) return -EFAULT; - fxs->ohttimer = x << 3; /* Active mode when idle */ fxs->idletxhookstate = POLARITY_XOR(fxs) ? @@ -3519,6 +3517,10 @@ static int wctdm_ioctl(struct dahdi_chan *chan, unsigned int cmd, unsigned long } } + + fxs->ohttimer = wc->framecount + x; + fxs->oht_active = 1; + break; case DAHDI_VMWI_CONFIG: if (mod->type != FXS) diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h index 5049d5a..313931a 100644 --- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h +++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h @@ -163,11 +163,11 @@ struct fxo { }; struct fxs { + u8 oht_active:1; int oldrxhook; int debouncehook; int lastrxhook; int debounce; - int ohttimer; int idletxhookstate; /* IDLE changing hook state */ /* lasttxhook reflects the last value written to the proslic's reg * 64 (LINEFEED_CONTROL) in bits 0-2. Bit 4 indicates if the last @@ -191,6 +191,7 @@ struct fxs { unsigned long check_alarm; unsigned long check_proslic; unsigned long oppending_timeout; + unsigned long ohttimer; }; struct qrv { -- cgit v1.2.3