summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-03-19 22:48:17 -0500
committerShaun Ruffell <sruffell@digium.com>2011-04-15 14:19:02 -0500
commit0dc24f03ec291839316191d392b83c7c4705c9e5 (patch)
tree9df2c33e85821fa281a4dea0fe2fe5d309de4267
parentf8fec661eee5e7c843bd8e653063ba0eb56525ad (diff)
wctdm24xxp: No need to debounce the remote hook state on FXS port.
The 3215 already has a 12.5ms default debounce circuit for the loop closure detect already. Signed-off-by: Shaun Ruffell <sruffell@digium.com>
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c57
-rw-r--r--drivers/dahdi/wctdm24xxp/wctdm24xxp.h6
2 files changed, 10 insertions, 53 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 86a577f..b65f868 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -2113,62 +2113,16 @@ static void wctdm_fxs_off_hook(struct wctdm *wc, struct wctdm_module *const mod)
if (robust)
wctdm_init_proslic(wc, card, 1, 0, 1);
#endif
- fxs->oldrxhook = 1;
}
static void wctdm_fxs_on_hook(struct wctdm *wc, struct wctdm_module *const mod)
{
- struct fxs *const fxs = &mod->mod.fxs;
if (debug & DEBUG_CARD) {
dev_info(&wc->vb.pdev->dev,
"fxs_on_hook: Card %d Going on hook\n", mod->card);
}
wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_ONHOOK);
dahdi_hooksig(&mod->chan->chan, DAHDI_RXSIG_ONHOOK);
- fxs->oldrxhook = 0;
-}
-
-static void
-wctdm_proslic_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
-{
- struct fxs *const fxs = &mod->mod.fxs;
- char res;
- int hook;
-
- /* For some reason we have to debounce the
- hook detector. */
-
- res = fxs->hook_state_shadow;
- hook = (res & 1);
-
- if (hook != fxs->lastrxhook) {
- /* Reset the debounce (must be multiple of 4ms) */
- fxs->debounce = 8 * (4 * 8);
-#if 0
- dev_info(&wc->vb.pdev->dev, "Resetting debounce card %d hook %d, %d\n",
- card, hook, fxs->debounce);
-#endif
- } else {
- if (fxs->debounce > 0) {
- fxs->debounce -= 4 * DAHDI_CHUNKSIZE;
-#if 0
- dev_info(&wc->vb.pdev->dev, "Sustaining hook %d, %d\n",
- hook, fxs->debounce);
-#endif
- if (!fxs->debounce) {
-#if 0
- dev_info(&wc->vb.pdev->dev, "Counted down debounce, newhook: %d...\n", hook);
-#endif
- fxs->debouncehook = hook;
- }
-
- if (!fxs->oldrxhook && fxs->debouncehook)
- wctdm_fxs_off_hook(wc, mod);
- else if (fxs->oldrxhook && !fxs->debouncehook)
- wctdm_fxs_on_hook(wc, mod);
- }
- }
- fxs->lastrxhook = hook;
}
static const char *wctdm_echocan_name(const struct dahdi_chan *chan)
@@ -2235,7 +2189,14 @@ static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
if (fxs->palarms)
fxs->palarms--;
}
- wctdm_proslic_check_hook(wc, mod);
+
+ if (fxs->off_hook && !(fxs->hook_state_shadow & 1)) {
+ wctdm_fxs_on_hook(wc, mod);
+ fxs->off_hook = 0;
+ } else if (!fxs->off_hook && (fxs->hook_state_shadow & 1)) {
+ wctdm_fxs_off_hook(wc, mod);
+ fxs->off_hook = 1;
+ }
wctdm_proslic_check_oppending(wc, mod);
@@ -2252,7 +2213,7 @@ static void wctdm_isr_misc_fxs(struct wctdm *wc, struct wctdm_module *const mod)
SLIC_LF_OHTRAN_FWD;
} else if (fxs->oht_active) {
/* check if still OnHook */
- if (!fxs->oldrxhook) {
+ if (!fxs->off_hook) {
if (time_before(wc->framecount, fxs->ohttimer))
return;
diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
index 313931a..ec2d815 100644
--- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
+++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
@@ -45,7 +45,6 @@
* \brief Default ringer debounce (in ms)
*/
#define DEFAULT_RING_DEBOUNCE 1024
-
#define POLARITY_DEBOUNCE 64 /* Polarity debounce (in ms) */
#define OHT_TIMER 6000 /* How long after RING to retain OHT */
@@ -164,10 +163,7 @@ struct fxo {
struct fxs {
u8 oht_active:1;
- int oldrxhook;
- int debouncehook;
- int lastrxhook;
- int debounce;
+ u8 off_hook:1;
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