Commit 8f19f27e authored by Devin Heitmueller's avatar Devin Heitmueller Committed by Mauro Carvalho Chehab

[media] drxd: move firmware to binary blob

Abstract out the firmware for the drx-d so that it can be loaded by the
request_firmware() interface.

The firmware licensing permits free redistribution, and can be found here:

http://kernellabs.com/firmware/drxdSigned-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ad9b4bb2
...@@ -939,5 +939,3 @@ u8_t DRXD_DiversityDelay6MHZ[] = /* also used ok for 7 MHz */ ...@@ -939,5 +939,3 @@ u8_t DRXD_DiversityDelay6MHZ[] = /* also used ok for 7 MHz */
WR16( B_SC_RA_RAM_DIVERSITY_DELAY_8K_4__A , 3500 - 50 ), WR16( B_SC_RA_RAM_DIVERSITY_DELAY_8K_4__A , 3500 - 50 ),
END_OF_TABLE END_OF_TABLE
}; };
#include "drxd_micro.h"
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#include "drxd.h" #include "drxd.h"
#include "drxd_firm.h" #include "drxd_firm.h"
#define DRX_FW_FILENAME_A2 "drxd-a2-1.1.fw"
#define DRX_FW_FILENAME_B1 "drxd-b1-1.1.fw"
#define CHK_ERROR(s) if( (status = s)<0 ) break #define CHK_ERROR(s) if( (status = s)<0 ) break
#define CHUNK_SIZE 48 #define CHUNK_SIZE 48
...@@ -854,6 +857,26 @@ static int ReadIFAgc(struct drxd_state *state, u32 *pValue) ...@@ -854,6 +857,26 @@ static int ReadIFAgc(struct drxd_state *state, u32 *pValue)
return status; return status;
} }
static int load_firmware(struct drxd_state *state, const char *fw_name)
{
const struct firmware *fw;
if (request_firmware(&fw, fw_name, state->dev) < 0) {
printk(KERN_ERR "drxd: firmware load failure [%s]\n", fw_name);
return -EIO;
}
state->microcode = kzalloc(fw->size, GFP_KERNEL);
if (state->microcode == NULL) {
printk(KERN_ERR "drxd: firmware load failure: nomemory\n");
return -ENOMEM;
}
memcpy(state->microcode, fw->data, fw->size);
state->microcode_length = fw->size;
return 0;
}
static int DownloadMicrocode(struct drxd_state *state, static int DownloadMicrocode(struct drxd_state *state,
const u8 *pMCImage, u32 Length) const u8 *pMCImage, u32 Length)
{ {
...@@ -1450,8 +1473,8 @@ static int SetDeviceTypeId(struct drxd_state *state) ...@@ -1450,8 +1473,8 @@ static int SetDeviceTypeId(struct drxd_state *state)
state->m_InitCE = DRXD_InitCEA2; state->m_InitCE = DRXD_InitCEA2;
state->m_InitEQ = DRXD_InitEQA2; state->m_InitEQ = DRXD_InitEQA2;
state->m_InitEC = DRXD_InitECA2; state->m_InitEC = DRXD_InitECA2;
state->microcode = DRXD_A2_microcode; if (load_firmware(state, DRX_FW_FILENAME_A2))
state->microcode_length = DRXD_A2_microcode_length; return -EIO;
} else { } else {
state->m_ResetCEFR = NULL; state->m_ResetCEFR = NULL;
state->m_InitFE_1 = DRXD_InitFEB1_1; state->m_InitFE_1 = DRXD_InitFEB1_1;
...@@ -1460,8 +1483,8 @@ static int SetDeviceTypeId(struct drxd_state *state) ...@@ -1460,8 +1483,8 @@ static int SetDeviceTypeId(struct drxd_state *state)
state->m_InitCE = DRXD_InitCEB1; state->m_InitCE = DRXD_InitCEB1;
state->m_InitEQ = DRXD_InitEQB1; state->m_InitEQ = DRXD_InitEQB1;
state->m_InitEC = DRXD_InitECB1; state->m_InitEC = DRXD_InitECB1;
state->microcode = DRXD_B1_microcode; if (load_firmware(state, DRX_FW_FILENAME_B1))
state->microcode_length = DRXD_B1_microcode_length; return -EIO;
} }
if (state->diversity) { if (state->diversity) {
state->m_InitDiversityFront = DRXD_InitDiversityFront; state->m_InitDiversityFront = DRXD_InitDiversityFront;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment