diff options
author | Shaun Ruffell <sruffell@digium.com> | 2010-04-04 16:14:59 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2010-04-04 16:14:59 +0000 |
commit | 60458ae6806bf08ae15f6990b7fb7b9b5b9f0565 (patch) | |
tree | c00b3095f4aef6cd89a426e7471b748c3909c022 /drivers/dahdi/voicebus/GpakCust.c | |
parent | f0445a9b9990aa3eb55d67ff62933082b603e00d (diff) |
wcte12xp: Poll the VPM and reset it if necessary.
When the transmit descriptor runs out completely, there (appears to be) a
chance for a random command to be sent that results in the VPMADT032 to no
longer respond, typically resulting in one way audio. This change introduces
a poll of the VPM. If it fails the poll, it will be bypassed temporarily
while the driver resets and reprograms it. Also, the VPM is initially
programmed in the spanconfig callback instead of at driver load. This moves
the potential for underruns until later in the boot process. DAHDI-573.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8468 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/voicebus/GpakCust.c')
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.c | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c index 06e73be..991e02b 100644 --- a/drivers/dahdi/voicebus/GpakCust.c +++ b/drivers/dahdi/voicebus/GpakCust.c @@ -560,6 +560,47 @@ vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name) } EXPORT_SYMBOL(vpmadt032_alloc); +int vpmadt032_reset(struct vpmadt032 *vpm) +{ + int res; + gpakPingDspStat_t pingstatus; + u16 version; + + might_sleep(); + + set_bit(VPM150M_HPIRESET, &vpm->control); + msleep(2000); + while (test_bit(VPM150M_HPIRESET, &vpm->control)) + msleep(1); + + /* Set us up to page 0 */ + vpmadt032_setpage(vpm, 0); + + res = vpmadtreg_loadfirmware(vpm->vb); + if (res) { + dev_info(&vpm->vb->pdev->dev, "Failed to load the firmware.\n"); + return res; + } + vpm->curpage = -1; + + set_bit(VPM150M_SWRESET, &vpm->control); + while (test_bit(VPM150M_SWRESET, &vpm->control)) + msleep(1); + + /* Set us up to page 0 */ + pingstatus = gpakPingDsp(vpm->dspid, &version); + if (!pingstatus) { + vpm_info(vpm, "VPM present and operational " + "(Firmware version %x)\n", version); + vpm->version = version; + res = 0; + } else { + res = -EIO; + } + return res; +} +EXPORT_SYMBOL(vpmadt032_reset); + int vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) { @@ -597,9 +638,9 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) dev_info(&vpm->vb->pdev->dev, "Passed\n"); set_bit(VPM150M_HPIRESET, &vpm->control); - msleep(2000); while (test_bit(VPM150M_HPIRESET, &vpm->control)) msleep(1); + msleep(250); /* Set us up to page 0 */ vpmadt032_setpage(vpm, 0); @@ -613,9 +654,8 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) vpmadt032_getreg(vpm, 0x1000, ®); if (reg != i) { printk(KERN_CONT "VPMADT032 Failed address test\n"); - goto failed_exit; + res = -EIO; } - } } @@ -641,11 +681,11 @@ vpmadt032_init(struct vpmadt032 *vpm, struct voicebus *vb) pingstatus = gpakPingDsp(vpm->dspid, &vpm->version); if (!pingstatus) { - dev_info(&vpm->vb->pdev->dev, - "Version of DSP is %x\n", vpm->version); + dev_info(&vb->pdev->dev, "VPM present and operational " + "(Firmware version %x)\n", vpm->version); } else { dev_notice(&vpm->vb->pdev->dev, "VPMADT032 Failed! Unable to ping the DSP (%d)!\n", pingstatus); - res = -1; + res = -EIO; goto failed_exit; } @@ -662,6 +702,7 @@ failed_exit: } EXPORT_SYMBOL(vpmadt032_init); + void vpmadt032_get_default_parameters(struct GpakEcanParms *p) { memset(p, 0, sizeof(*p)); @@ -694,7 +735,9 @@ void vpmadt032_free(struct vpmadt032 *vpm) struct change_order *order; LIST_HEAD(local_list); - BUG_ON(!vpm); + if (!vpm) + return; + BUG_ON(!vpm->wq); destroy_workqueue(vpm->wq); |