wctdm24xxp: Remove modmap member from 'struct wctdm'.

We can already use the module type to determine presence of a module to
check. This also moves the background polling of the modules until after
the board is completely initialized because the module type may change
while the different types are being probed. This also means that we need
to preset the shadow registers for the FXS because otherwise the shadow
register will not have been read before the first time it's checked for
a power alarm.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9954 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2011-06-02 20:02:42 +00:00
parent 712e65f0dc
commit 60406e1a0c
2 changed files with 20 additions and 22 deletions

View File

@ -877,10 +877,6 @@ static inline void wctdm_transmitprep(struct wctdm *wc, unsigned char *sframe)
* BRI modules have a different number of TDM channels than
* installed modules. */
for (y = 0; y < wc->avchannels; y++) {
if (!x && y < wc->mods_per_board) {
cmd_checkisr(wc, y);
}
if (y < wc->mods_per_board)
cmd_dequeue(wc, eframe, y, x);
}
@ -1993,19 +1989,24 @@ static inline void wctdm_isr_misc(struct wctdm *wc)
{
int x;
if (unlikely(!wc->initialized)) {
if (unlikely(!wc->initialized))
return;
}
for (x = 0; x < wc->mods_per_board; x++) {
if (wc->modmap & (1 << x)) {
if (wc->modtype[x] == MOD_TYPE_FXS) {
wctdm_isr_misc_fxs(wc, x);
} else if (wc->modtype[x] == MOD_TYPE_FXO) {
wctdm_voicedaa_check_hook(wc, x);
} else if (wc->modtype[x] == MOD_TYPE_QRV) {
wctdm_qrvdri_check_hook(wc, x);
}
spin_lock(&wc->reglock);
cmd_checkisr(wc, x);
spin_unlock(&wc->reglock);
switch (wc->modtype[x]) {
case MOD_TYPE_FXS:
wctdm_isr_misc_fxs(wc, x);
break;
case MOD_TYPE_FXO:
wctdm_voicedaa_check_hook(wc, x);
break;
case MOD_TYPE_QRV:
wctdm_qrvdri_check_hook(wc, x);
break;
}
}
}
@ -2815,6 +2816,11 @@ static int wctdm_init_proslic(struct wctdm *wc, int card, int fast, int manual,
wc->mods[card].fxs.lasttxhook = wc->mods[card].fxs.idletxhookstate;
wctdm_setreg(wc, card, LINE_STATE, wc->mods[card].fxs.lasttxhook);
/* Preset the isrshadow register so that we won't get a power alarm
* when we finish initialization, otherwise the line state register
* may not have been read yet. */
wc->cmdq[card].isrshadow[1] = wc->mods[card].fxs.lasttxhook;
return 0;
}
@ -3358,8 +3364,6 @@ static int wctdm_open(struct dahdi_chan *chan)
channo = chan->chanpos - 1;
#if 0
if (!(wc->modmap & (1 << (chan->chanpos - 1))))
return -ENODEV;
if (wc->dead)
return -ENODEV;
#endif
@ -3932,7 +3936,6 @@ static int wctdm_identify_modules(struct wctdm *wc)
break;
retry:
if (!(ret = wctdm_init_proslic(wc, x, 0, 0, sane))) {
wc->modmap |= (1 << x);
if (debug & DEBUG_CARD) {
readi = wctdm_getreg(wc,x,LOOP_I_LIMIT);
dev_info(&wc->vb.pdev->dev, "Proslic module %d loop current is %dmA\n", x, ((readi*3)+20));
@ -3943,7 +3946,6 @@ retry:
sane = 1;
/* Init with Manual Calibration */
if (!wctdm_init_proslic(wc, x, 0, 1, sane)) {
wc->modmap |= (1 << x);
if (debug & DEBUG_CARD) {
readi = wctdm_getreg(wc, x, LOOP_I_LIMIT);
@ -3956,17 +3958,14 @@ retry:
}
} else if (!(ret = wctdm_init_voicedaa(wc, x, 0, 0, sane))) {
wc->modmap |= (1 << x);
dev_info(&wc->vb.pdev->dev,
"Port %d: Installed -- AUTO FXO "
"(%s mode)\n", x + 1,
fxo_modes[_opermode].name);
} else if (!wctdm_init_qrvdri(wc, x)) {
wc->modmap |= 1 << x;
dev_info(&wc->vb.pdev->dev,
"Port %d: Installed -- QRV DRI card\n", x + 1);
} else if (is_hx8(wc) && !wctdm_init_b400m(wc, x)) {
wc->modmap |= (1 << x);
dev_info(&wc->vb.pdev->dev,
"Port %d: Installed -- BRI "
"quad-span module\n", x + 1);

View File

@ -170,7 +170,6 @@ struct wctdm {
int mods_per_board; /* maximum number of modules for this board */
int digi_mods; /* number of digital modules present */
int avchannels; /* active "voice" (voice, B and D) channels */
int modmap; /* Bit-map of present cards (1=present) */
int altcs[NUM_MODULES];