summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-04-05 19:15:59 +0000
committerShaun Ruffell <sruffell@digium.com>2010-04-05 19:15:59 +0000
commit35e23f0e6348c906b33d6bc3f9698b62eb36c30c (patch)
tree20ca69bebe889721defddca1932aa679b9669efb
parent60458ae6806bf08ae15f6990b7fb7b9b5b9f0565 (diff)
wcte12xp: Try to reconfigure the VPM if we fail to configure the channels.
Also, fall back to any software echocan configured for this channel for new calls while we're in the middle of a recovery. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8473 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/voicebus/GpakCust.c13
-rw-r--r--drivers/dahdi/wcte12xp/base.c58
2 files changed, 32 insertions, 39 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c
index 991e02b..74c3304 100644
--- a/drivers/dahdi/voicebus/GpakCust.c
+++ b/drivers/dahdi/voicebus/GpakCust.c
@@ -222,7 +222,7 @@ struct change_order {
static struct change_order *alloc_change_order(void)
{
- return kzalloc(sizeof(struct change_order), GFP_KERNEL);
+ return kzalloc(sizeof(struct change_order), GFP_ATOMIC);
}
static void free_change_order(struct change_order *order)
@@ -617,6 +617,11 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
might_sleep();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+ INIT_WORK(&vpm->work, vpmadt032_bh, vpm);
+#else
+ INIT_WORK(&vpm->work, vpmadt032_bh);
+#endif
if (vpm->options.debug & DEBUG_VPMADT032_ECHOCAN)
dev_info(&vpm->vb->pdev->dev, "VPMADT032 Testing page access: ");
@@ -689,12 +694,6 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb)
goto failed_exit;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
- INIT_WORK(&vpm->work, vpmadt032_bh, vpm);
-#else
- INIT_WORK(&vpm->work, vpmadt032_bh);
-#endif
-
return 0;
failed_exit:
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 0ba87ba..81eade0 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -1301,9 +1301,8 @@ static int echocan_create(struct dahdi_chan *chan, struct dahdi_echocanparams *e
struct t1 *wc = chan->pvt;
enum adt_companding comp;
- if (!wc->vpmadt032) {
+ if (!wc->vpmadt032 || !test_bit(4, &wc->ctlreg))
return -ENODEV;
- }
*ec = wc->ec[chan->chanpos - 1];
(*ec)->ops = &vpm150m_ec_ops;
@@ -1413,16 +1412,20 @@ t1xxp_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
} else if (res) {
wc->vpm_check = jiffies + HZ/2;
} else {
- config_vpmadt032(vpm, wc);
-
set_span_devicetype(wc);
- /* turn on vpm (RX audio from vpm module) */
- wc->ctlreg |= 0x10;
- wc->vpm_check = HZ*5;
- if (vpmtsisupport) {
- debug_printk(wc, 1, "enabling VPM TSI pin\n");
- /* turn on vpm timeslot interchange pin */
- wc->ctlreg |= 0x01;
+ if (config_vpmadt032(vpm, wc)) {
+ wc->vpm_check = jiffies + HZ/2;
+ } else {
+ /* turn on vpm (RX audio from vpm module) */
+ set_bit(4, &wc->ctlreg);
+ wc->vpm_check = jiffies + HZ*5;
+ if (vpmtsisupport) {
+ debug_printk(wc, 1,
+ "enabling VPM TSI pin\n");
+ /* turn on vpm timeslot
+ * interchange pin */
+ set_bit(0, &wc->ctlreg);
+ }
}
}
} else {
@@ -1937,31 +1940,27 @@ static void vpm_check_func(struct work_struct *work)
#endif
int res;
u16 version;
- unsigned long flags;
res = gpakPingDsp(wc->vpmadt032->dspid, &version);
if (!res) {
- spin_lock_irqsave(&wc->reglock, flags);
- wc->ctlreg |= 0x10;
- spin_unlock_irqrestore(&wc->reglock, flags);
+ set_bit(4, &wc->ctlreg);
return;
}
- /* Bypass the rx audio from the VPM module. */
- spin_lock_irqsave(&wc->reglock, flags);
- wc->ctlreg &= ~(0x10);
- spin_unlock_irqrestore(&wc->reglock, flags);
+ clear_bit(4, &wc->ctlreg);
t1_info(wc, "VPMADT032 is non-responsive. Resetting.\n");
res = vpmadt032_reset(wc->vpmadt032);
if (!res) {
- config_vpmadt032(wc->vpmadt032, wc);
+ res = config_vpmadt032(wc->vpmadt032, wc);
+ if (res) {
+ queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
+ return;
+ }
/* Looks like the reset went ok so we can put the VPM module
* back in the TDM path. */
- spin_lock_irqsave(&wc->reglock, flags);
- wc->ctlreg |= 0x10;
- spin_unlock_irqrestore(&wc->reglock, flags);
+ set_bit(4, &wc->ctlreg);
t1_info(wc, "VPMADT032 is reenabled.\n");
} else {
t1_info(wc, "Failed VPMADT032 reset. "
@@ -1995,16 +1994,11 @@ static void te12xp_timer(unsigned long data)
static void t1_handle_error(struct voicebus *vb)
{
struct t1 *wc = container_of(vb, struct t1, vb);
- unsigned long flags;
-
- if (wc->vpmadt032) {
- /* Bypass the rx audio from the VPM module. */
- spin_lock_irqsave(&wc->reglock, flags);
- wc->ctlreg &= ~(0x10);
- spin_unlock_irqrestore(&wc->reglock, flags);
- queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
- }
+ if (!wc->vpmadt032)
+ return;
+ clear_bit(4, &wc->ctlreg);
+ queue_work(wc->vpmadt032->wq, &wc->vpm_check_work);
}
static const struct voicebus_operations voicebus_operations = {