提交 e4f4f875 编写于 作者: M Mauro Carvalho Chehab

[media] drxk: Add a parameter for the microcode name

The microcode firmware provided on Terratec H5 seems to be
different. Add a parameter to allow specifying a different
firmware per-device.
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 fec528b7
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
struct drxk_config { struct drxk_config {
u8 adr; u8 adr;
u32 single_master : 1; u32 single_master : 1;
const char *microcode_name;
}; };
extern struct dvb_frontend *drxk_attach(const struct drxk_config *config, extern struct dvb_frontend *drxk_attach(const struct drxk_config *config,
......
...@@ -343,10 +343,11 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len) ...@@ -343,10 +343,11 @@ static int i2c_write(struct i2c_adapter *adap, u8 adr, u8 *data, int len)
static int i2c_read(struct i2c_adapter *adap, static int i2c_read(struct i2c_adapter *adap,
u8 adr, u8 *msg, int len, u8 *answ, int alen) u8 adr, u8 *msg, int len, u8 *answ, int alen)
{ {
struct i2c_msg msgs[2] = { {.addr = adr, .flags = 0, struct i2c_msg msgs[2] = {
{.addr = adr, .flags = 0,
.buf = msg, .len = len}, .buf = msg, .len = len},
{.addr = adr, .flags = I2C_M_RD, {.addr = adr, .flags = I2C_M_RD,
.buf = answ, .len = alen} .buf = answ, .len = alen}
}; };
dprintk(3, ":"); dprintk(3, ":");
if (debug > 2) { if (debug > 2) {
...@@ -5904,7 +5905,7 @@ static int PowerDownDevice(struct drxk_state *state) ...@@ -5904,7 +5905,7 @@ static int PowerDownDevice(struct drxk_state *state)
return 0; return 0;
} }
static int load_microcode(struct drxk_state *state, char *mc_name) static int load_microcode(struct drxk_state *state, const char *mc_name)
{ {
const struct firmware *fw = NULL; const struct firmware *fw = NULL;
int err = 0; int err = 0;
...@@ -6010,20 +6011,11 @@ static int init_drxk(struct drxk_state *state) ...@@ -6010,20 +6011,11 @@ static int init_drxk(struct drxk_state *state)
if (status < 0) if (status < 0)
break; break;
#if 0 if (!state->microcode_name)
if (state->m_DRXK_A3_PATCH_CODE) load_microcode(state, "drxk_a3.mc");
status = DownloadMicrocode(state, DRXK_A3_microcode, DRXK_A3_microcode_length); else
if (status < 0) load_microcode(state, state->microcode_name);
break;
#else
load_microcode(state, "drxk_a3.mc");
#endif
#if NOA1ROM
if (state->m_DRXK_A2_PATCH_CODE)
status = DownloadMicrocode(state, DRXK_A2_microcode, DRXK_A2_microcode_length);
if (status < 0)
break;
#endif
/* disable token-ring bus through OFDM block for possible ucode upload */ /* disable token-ring bus through OFDM block for possible ucode upload */
status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, SIO_OFDM_SH_OFDM_RING_ENABLE_OFF); status = write16(state, SIO_OFDM_SH_OFDM_RING_ENABLE__A, SIO_OFDM_SH_OFDM_RING_ENABLE_OFF);
if (status < 0) if (status < 0)
...@@ -6367,6 +6359,7 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config, ...@@ -6367,6 +6359,7 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config,
state->i2c = i2c; state->i2c = i2c;
state->demod_address = adr; state->demod_address = adr;
state->single_master = config->single_master; state->single_master = config->single_master;
state->microcode_name = config->microcode_name;
mutex_init(&state->mutex); mutex_init(&state->mutex);
mutex_init(&state->ctlock); mutex_init(&state->ctlock);
......
...@@ -330,6 +330,7 @@ struct drxk_state { ...@@ -330,6 +330,7 @@ struct drxk_state {
/* Configurable parameters at the driver */ /* Configurable parameters at the driver */
u32 single_master : 1; /* Use single master i2c mode */ u32 single_master : 1; /* Use single master i2c mode */
const char *microcode_name;
}; };
......
...@@ -301,10 +301,10 @@ static struct drxd_config em28xx_drxd = { ...@@ -301,10 +301,10 @@ static struct drxd_config em28xx_drxd = {
.disable_i2c_gate_ctrl = 1, .disable_i2c_gate_ctrl = 1,
}; };
#define TERRATEC_H5_DRXK_I2C_ADDR 0x29
struct drxk_config terratec_h5_drxk = { struct drxk_config terratec_h5_drxk = {
.adr = 0x29, .adr = 0x29,
.single_master = 1,
.microcode_name = "terratec_h5.fw",
}; };
static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable) static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册