summaryrefslogtreecommitdiff
path: root/wctdm24xxp/base.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:28:28 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:28:28 +0000
commit72f1ad2419858a9a591bdd7deabedb750d8688e3 (patch)
tree22adc384b94d18fdee652ad166b2862c0fcd28bc /wctdm24xxp/base.c
parent95a838e91d4d7d094be6c76a86d90a8d9a52128a (diff)
Merged revisions 3365 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r3365 | kpfleming | 2007-12-08 11:04:11 -0600 (Sat, 08 Dec 2007) | 5 lines clean up firmware handling across wct4xxp, wctc4xxp, wctdm24xxp and wcte12xp drivers to use consistent methods add non-hotplug firmware loading support to wctdm24xxp and wcte12xp add license and copyright headers to various files that did not have them clean up header inclusion in some files ........ git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3366 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp/base.c')
-rw-r--r--wctdm24xxp/base.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c
index b2aff24..97efb5f 100644
--- a/wctdm24xxp/base.c
+++ b/wctdm24xxp/base.c
@@ -1,5 +1,5 @@
/*
- * Wilcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface
+ * Wildcard TDM2400P TDM FXS/FXO Interface Driver for Zapata Telephony interface
*
* Written by Mark Spencer <markster@digium.com>
* Support for TDM800P and VPM150M by Matthew Fredrickson <creslin@digium.com>
@@ -42,22 +42,27 @@ Tx Gain - W/Pre-Emphasis: -23.99 to 0.00 db
#include <linux/errno.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
-#ifdef VPM150M_SUPPORT
-#include <linux/firmware.h>
-#endif
#include <linux/workqueue.h>
#include <linux/delay.h>
#include <asm/semaphore.h>
-#include "../proslic.h"
-#include "../wctdm.h"
-#include "GpakCust.h"
-#include "GpakApi.h"
+#ifdef LINUX26
+#include <linux/moduleparam.h>
+#endif
-/* Comment to disable VPM support */
+#ifdef VPM150M_SUPPORT
+#include <linux/firmware.h>
+#endif
+
+#include "zaptel.h"
+#include "proslic.h"
+#include "wctdm.h"
#include "wctdm24xxp.h"
+#include "GpakCust.h"
+#include "GpakApi.h"
+
/*
Experimental max loop current limit for the proslic
Loop current limit is from 20 mA to 41 mA in steps of 3
@@ -234,13 +239,6 @@ static struct fxo_mode {
{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, },
};
-#include "zaptel.h"
-
-#ifdef LINUX26
-#include <linux/moduleparam.h>
-#endif
-
-
#define DEBUG_CARD (1 << 0)
#define DEBUG_ECHOCAN (1 << 1)
@@ -287,8 +285,6 @@ static int vpmsupport = 1;
static int vpmdtmfsupport = 0;
#define VPM_DEFAULT_DTMFTHRESHOLD 1250
static int dtmfthreshold = VPM_DEFAULT_DTMFTHRESHOLD;
-
-static const char *vpm150m_firmware = "zaptel-fw-vpmadt032.bin";
#endif
static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane);
@@ -3607,6 +3603,14 @@ static void wctdm_vpm150m_init(struct wctdm *wc)
#ifdef VPM150M_SUPPORT
struct wctdm_firmware fw;
+ struct firmware embedded_firmware;
+ const struct firmware *firmware = &embedded_firmware;
+#if !defined(HOTPLUG_FIRMWARE)
+ extern void _binary_vpmadt032_bin_size;
+ extern u8 _binary_vpmadt032_bin_start[];
+#else
+ static const char vpmadt032_firmware[] = "zaptel-fw-vpmadt032.bin";
+#endif
gpakDownloadStatus_t downloadstatus;
gpakPingDspStat_t pingstatus;
#endif
@@ -3698,10 +3702,18 @@ static void wctdm_vpm150m_init(struct wctdm *wc)
if (pingstatus || (version != 0x106)) {
#endif
- fw.offset = 0;
- if (request_firmware(&fw.fw, vpm150m_firmware, &wc->dev->dev)) {
- printk("Unable to locate VPMADT032.bin firmware!\n");
+#if defined(HOTPLUG_FIRMWARE)
+ if ((request_firmware(&firmware, vpmadt032_firmware, &wc->dev->dev) != 0) ||
+ !firmware) {
+ printk("VPMADT032: firmware %s not available from userspace\n", vpmadt032_firmware);
+ return;
}
+#else
+ embedded_firmware.data = _binary_vpmadt032_bin_start;
+ embedded_firmware.size = (size_t) &_binary_vpmadt032_bin_size;
+#endif
+ fw.fw = firmware;
+ fw.offset = 0;
set_bit(VPM150M_HPIRESET, &vpm150m->control);
@@ -3711,7 +3723,8 @@ static void wctdm_vpm150m_init(struct wctdm *wc)
printk("VPMADT032 Loading firwmare... ");
downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw);
- release_firmware(fw.fw);
+ if (firmware != &embedded_firmware)
+ release_firmware(firmware);
if (downloadstatus != 0) {
printk("Unable to download firmware to VPMADT032 with cause %d\n", downloadstatus);