summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-03-19 18:01:13 -0500
committerShaun Ruffell <sruffell@digium.com>2011-04-15 14:19:02 -0500
commitd37c549827021232df2c8f3e90f75401eef54d9b (patch)
tree0bad850f170f30938703c50f3587c12435519086
parent14a54798c26ce41f9e6d636e97aa98daecb9ba87 (diff)
wctdm24xxp: Name the shadow registers for each modules.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c54
-rw-r--r--drivers/dahdi/wctdm24xxp/wctdm24xxp.h7
2 files changed, 34 insertions, 27 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index afdbc89..012b5b8 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -930,13 +930,20 @@ static void _cmd_decipher(struct wctdm *wc, const u8 *eframe, int card)
return;
}
+ kfree(cmd);
+
switch (mod->type) {
case FXS:
- mod->isrshadow[(68 == address) ? 0 : 1] = value;
+ if (68 == address)
+ mod->mod.fxs.hook_state_shadow = value;
+ else
+ mod->mod.fxs.linefeed_control_shadow = value;
break;
case FXO:
- /* 5 = Hook/Ring 29 = Battery */
- mod->isrshadow[(5 == address) ? 0 : 1] = value;
+ if (5 == address)
+ mod->mod.fxo.hook_ring_shadow = value;
+ else
+ mod->mod.fxo.line_voltage_status = value;
break;
case QRV:
/* wctdm_isr_getreg(wc, mod, 3); */ /* COR/CTCSS state */
@@ -947,8 +954,6 @@ static void _cmd_decipher(struct wctdm *wc, const u8 *eframe, int card)
default:
break;
}
-
- kfree(cmd);
}
/* Call with wc.reglock held and local interrupts disabled. */
@@ -1526,29 +1531,28 @@ static void
wctdm_proslic_check_oppending(struct wctdm *wc, struct wctdm_module *const mod)
{
struct fxs *const fxs = &mod->mod.fxs;
- unsigned long flags;
- int res;
if (!(fxs->lasttxhook & SLIC_LF_OPPENDING))
return;
/* Monitor the Pending LF state change, for the next 100ms */
- spin_lock_irqsave(&fxs->lasttxhooklock, flags);
+ spin_lock(&fxs->lasttxhooklock);
if (!(fxs->lasttxhook & SLIC_LF_OPPENDING)) {
- spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
+ spin_unlock(&fxs->lasttxhooklock);
return;
}
- res = mod->isrshadow[1];
- if ((res & SLIC_LF_SETMASK) == (fxs->lasttxhook & SLIC_LF_SETMASK)) {
+ if ((fxs->linefeed_control_shadow & SLIC_LF_SETMASK) ==
+ (fxs->lasttxhook & SLIC_LF_SETMASK)) {
fxs->lasttxhook &= SLIC_LF_SETMASK;
fxs->oppending_ms = 0;
if (debug & DEBUG_CARD) {
dev_info(&wc->vb.pdev->dev,
"SLIC_LF OK: card=%d shadow=%02x "
"lasttxhook=%02x framecount=%ld\n", mod->card,
- res, fxs->lasttxhook, wc->framecount);
+ fxs->linefeed_control_shadow,
+ fxs->lasttxhook, wc->framecount);
}
} else if (fxs->oppending_ms && (--fxs->oppending_ms == 0)) {
wctdm_setreg_intr(wc, mod, LINE_STATE, fxs->lasttxhook);
@@ -1556,12 +1560,13 @@ wctdm_proslic_check_oppending(struct wctdm *wc, struct wctdm_module *const mod)
dev_info(&wc->vb.pdev->dev,
"SLIC_LF RETRY: card=%d shadow=%02x "
"lasttxhook=%02x framecount=%ld\n", mod->card,
- res, fxs->lasttxhook, wc->framecount);
+ fxs->linefeed_control_shadow,
+ fxs->lasttxhook, wc->framecount);
}
} else { /* Start 100ms Timeout */
fxs->oppending_ms = 100;
}
- spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
+ spin_unlock(&fxs->lasttxhooklock);
}
/* 256ms interrupt */
@@ -1589,8 +1594,6 @@ wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
}
#else
spin_lock_irqsave(&fxs->lasttxhooklock, flags);
- res = mod->isrshadow[1];
-
#if 0
/* This makes sure the lasthook was put in reg 64 the linefeed reg */
if (fxs->lasttxhook & SLIC_LF_OPPENDING) {
@@ -1613,7 +1616,7 @@ wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
}
#endif
- res = !res && /* reg 64 has to be zero at last isr read */
+ res = !fxs->linefeed_control_shadow && /* reg 64 has to be zero at last isr read */
!(fxs->lasttxhook & SLIC_LF_OPPENDING) && /* not a transition */
fxs->lasttxhook; /* not an intended zero */
spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
@@ -1634,8 +1637,9 @@ wctdm_proslic_recheck_sanity(struct wctdm *wc, struct wctdm_module *const mod)
mod->sethook = CMD_WR(LINE_STATE, fxs->lasttxhook);
spin_unlock_irqrestore(&fxs->lasttxhooklock, flags);
- /* Update shadow register to avoid extra power alarms until next read */
- mod->isrshadow[1] = fxs->lasttxhook;
+ /* Update shadow register to avoid extra power alarms
+ * until next read */
+ fxs->linefeed_control_shadow = fxs->lasttxhook;
} else {
if (fxs->palarms == MAX_ALARMS) {
dev_notice(&wc->vb.pdev->dev,
@@ -1654,7 +1658,7 @@ static void wctdm_qrvdri_check_hook(struct wctdm *wc, int card)
if (wc->mods[card].mod.qrv.debtime >= 2)
wc->mods[card].mod.qrv.debtime--;
- b = wc->mods[qrvcard].isrshadow[0]; /* Hook/Ring state */
+ b = wc->mods[qrvcard].mod.qrv.isrshadow[0]; /* Hook/Ring state */
b &= 0xcc; /* use bits 3-4 and 6-7 only */
if (wc->mods[qrvcard].mod.qrv.radmode & RADMODE_IGNORECOR)
@@ -1726,7 +1730,7 @@ wctdm_voicedaa_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
struct fxo *const fxo = &mod->mod.fxo;
/* Try to track issues that plague slot one FXO's */
- b = mod->isrshadow[0]; /* Hook/Ring state */
+ b = fxo->hook_ring_shadow;
b &= 0x9b;
if (fxo->offhook) {
if (b != 0x9)
@@ -1746,7 +1750,7 @@ wctdm_voicedaa_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
* but not to have transitions between the two bits (i.e. no negative
* to positive or positive to negative transversals )
*/
- res = mod->isrshadow[0] & 0x60;
+ res = fxo->hook_ring_shadow & 0x60;
if (0 == fxo->wasringing) {
if (res) {
/* Look for positive/negative crossings in ring status reg */
@@ -1784,7 +1788,7 @@ wctdm_voicedaa_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
}
}
} else {
- res = mod->isrshadow[0];
+ res = fxo->hook_ring_shadow;
if ((res & 0x60) && (fxo->battery == BATTERY_PRESENT)) {
fxo->ringdebounce += (DAHDI_CHUNKSIZE * 16);
if (fxo->ringdebounce >= DAHDI_CHUNKSIZE * ringdebounce) {
@@ -1812,7 +1816,7 @@ wctdm_voicedaa_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
}
}
- b = mod->isrshadow[1]; /* Voltage */
+ b = fxo->line_voltage_status;
abs_voltage = abs(b);
if (fxovoltage && time_after(wc->framecount, fxo->display_fxovoltage)) {
@@ -2122,7 +2126,7 @@ wctdm_proslic_check_hook(struct wctdm *wc, struct wctdm_module *const mod)
/* For some reason we have to debounce the
hook detector. */
- res = mod->isrshadow[0]; /* Hook state */
+ res = fxs->hook_state_shadow;
hook = (res & 1);
if (hook != fxs->lastrxhook) {
diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
index 8dafb10..909dd26 100644
--- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
+++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
@@ -85,7 +85,6 @@
#define NUM_CAL_REGS 12
-#define ISR_COMMANDS 2
#define QRV_DEBOUNCETIME 20
#define VPM150M_HPI_CONTROL 0x00
@@ -159,6 +158,8 @@ struct fxo {
unsigned int neonmwi_debounce;
unsigned int neonmwi_offcounter;
unsigned long display_fxovoltage;
+ u8 hook_ring_shadow;
+ s8 line_voltage_status;
};
struct fxs {
@@ -179,6 +180,8 @@ struct fxs {
*/
int lasttxhook;
int oppending_ms;
+ u8 linefeed_control_shadow;
+ u8 hook_state_shadow;
spinlock_t lasttxhooklock;
int palarms;
struct dahdi_vmwi_info vmwisetting;
@@ -204,6 +207,7 @@ struct qrv {
int radmode;
signed short rxgain;
signed short txgain;
+ u8 isrshadow[3];
};
enum module_type {
@@ -229,7 +233,6 @@ struct wctdm_module {
struct list_head active_cmds;
u8 offsets[3];
u8 subaddr;
- u8 isrshadow[ISR_COMMANDS];
u8 card;
enum module_type type;