[dahdi-commits] sruffell: branch linux/sruffell/wctdm24xxp-updates r10132 - /linux/team/sruff...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Fri Aug 12 19:36:32 CDT 2011
Author: sruffell
Date: Fri Aug 12 19:36:28 2011
New Revision: 10132
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10132
Log:
wctdm24xxp: Debounce FXS hook state in hardware.
Sets a 5ms debounce in the hardware and eliminates the software
debounce.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10132&r1=10131&r2=10132
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c Fri Aug 12 19:36:28 2011
@@ -2235,7 +2235,6 @@
if (robust)
wctdm_init_proslic(wc, mod, 1, 0, 1);
#endif
- fxs->oldrxhook = 1;
}
/**
@@ -2251,58 +2250,14 @@
*/
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);
}
- if ((fxs->lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)
+
+ if ((mod->mod.fxs.lasttxhook & SLIC_LF_SETMASK) != SLIC_LF_OPEN)
wctdm_fxs_hooksig(wc, mod, DAHDI_TXSIG_ONHOOK);
dahdi_hooksig(get_dahdi_chan(wc, mod), 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)
@@ -2384,7 +2339,14 @@
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);
@@ -2401,7 +2363,7 @@
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;
@@ -3296,6 +3258,8 @@
wctdm_setreg(wc, mod, 20, 0xff);
wctdm_setreg(wc, mod, 22, 0xff);
wctdm_setreg(wc, mod, 73, 0x04);
+
+ wctdm_setreg(wc, mod, 69, 0x4);
if (fxshonormode) {
static const int ACIM2TISS[16] = { 0x0, 0x1, 0x4, 0x5, 0x7,
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=10132&r1=10131&r2=10132
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Fri Aug 12 19:36:28 2011
@@ -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 */
@@ -167,10 +166,7 @@
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
More information about the dahdi-commits
mailing list