summaryrefslogtreecommitdiff
path: root/wctdm24xxp/base.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-08 17:04:11 +0000
commitdb2602ee74c907582858c1225bb0fffffe604a00 (patch)
treef08c566c96008fdca60d6231c653f4804ad5e263 /wctdm24xxp/base.c
parentb6c017d1b25f9621fd6738419b6cd1377ca6eb3e (diff)
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.2@3365 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wctdm24xxp/base.c')
-rw-r--r--wctdm24xxp/base.c61
1 files changed, 35 insertions, 26 deletions
diff --git a/wctdm24xxp/base.c b/wctdm24xxp/base.c
index 81dfc74..740af36 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>
@@ -32,22 +32,27 @@
#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
@@ -224,17 +229,6 @@ static struct fxo_mode {
{ "YEMEN", 0, 0, 0, 0, 0, 0x3, 0, 0, },
};
-#ifdef STANDALONE_ZAPATA
-#include "zaptel.h"
-#else
-#include <linux/zaptel.h>
-#endif
-
-#ifdef LINUX26
-#include <linux/moduleparam.h>
-#endif
-
-
#define DEBUG_CARD (1 << 0)
#define DEBUG_ECHOCAN (1 << 1)
@@ -275,8 +269,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 = "VPMADT032.bin";
#endif
static int wctdm_init_proslic(struct wctdm *wc, int card, int fast , int manual, int sane);
@@ -2969,6 +2961,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[] = "VPMADT032.bin";
+#endif
gpakDownloadStatus_t downloadstatus;
gpakPingDspStat_t pingstatus;
#endif
@@ -3060,10 +3060,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);
@@ -3073,7 +3081,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);