summaryrefslogtreecommitdiff
path: root/wct4xxp/base.c
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-05 06:44:13 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-05 06:44:13 +0000
commit085c150989f1202fe3321e39803fae633de66ca5 (patch)
treec2c574f91e63928d4f098bfb3c4b78ea66bb532a /wct4xxp/base.c
parentdc8b376b4caffcbe301f11c2ce67159781d2a279 (diff)
Add support for VPMOCT64 module
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1556 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp/base.c')
-rw-r--r--wct4xxp/base.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c
index bca6ddf..6db860f 100644
--- a/wct4xxp/base.c
+++ b/wct4xxp/base.c
@@ -2677,6 +2677,8 @@ static void t4_vpm450_init(struct t4 *wc)
unsigned int check1, check2;
int laws[4] = { 0, };
int x;
+ int try;
+ int passedinit = 0;
#ifdef HOTPLUG_FIRMWARE
const struct firmware *firmware;
#endif
@@ -2697,31 +2699,46 @@ static void t4_vpm450_init(struct t4 *wc)
printk("VPM450: Not Present\n");
return;
}
+ /* First try to load the VPMOCT128 then fallback to VPMOCT064 */
+ for (try=0; try<2; try++) {
#ifdef HOTPLUG_FIRMWARE
- if (request_firmware(&firmware, "OCT6114-128D.ima", &wc->dev->dev) != 0 || !firmware) {
- printk("VPM450M: Firmware not found to be loaded\n");
- return;
- }
- printk("VPM450: Firmware of size %zd found\n", firmware->size);
+ if (!try) { /* vpmoct128 */
+ if (request_firmware(&firmware, "OCT6114-128D.ima", &wc->dev->dev) != 0 || !firmware) {
+ printk("VPM450M: firmware OCT6114-128D.ima not found to be loaded\n");
+ continue;
+ }
+ } else { /* vpmoct064 */
+ if (request_firmware(&firmware, "OCT6114-64D.ima", &wc->dev->dev) != 0 || !firmware) {
+ printk("VPM450M: firmware OCT6114-64D not found to be loaded\n");
+ return;
+ }
+ }
+ printk("VPM450: Firmware of size %zd found try=%d\n", firmware->size, try+1);
#else
- printk("VPM450: Using classic method of loading firmware\n");
+ printk("VPM450: Using classic method of loading firmware try=%d\n", try+1);
#endif
- /* Setup alaw vs ulaw rules */
- for (x=0;x<wc->numspans;x++) {
- if (wc->tspans[x]->span.channels > 24)
- laws[x] = 1;
- }
+ /* Setup alaw vs ulaw rules */
+ for (x=0;x<wc->numspans;x++) {
+ if (wc->tspans[x]->span.channels > 24)
+ laws[x] = 1;
+ }
#ifdef HOTPLUG_FIRMWARE
- if (!(wc->vpm450m = init_vpm450m(wc, laws, firmware))) {
+ if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans, firmware))) {
+ passedinit=1;
+ break;
+ }
+ release_firmware(firmware);
#else
- if (!(wc->vpm450m = init_vpm450m(wc, laws))) {
+ if ((wc->vpm450m = init_vpm450m(wc, laws, wc->numspans))) {
+ passedinit=1;
+ break;
+ }
#endif
+ }
+ if (!passedinit) {
printk("VPM450: Failed to initialize\n");
return;
}
-#ifdef HOTPLUG_FIRMWARE
- release_firmware(firmware);
-#endif
if (vpmdtmfsupport == -1) {
printk("VPM450: hardware DTMF disabled.\n");
vpmdtmfsupport = 0;