X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fdvb%2Ffrontends%2Fsp8870.c;h=73829e647e50ad0cccb0e2f8cf6f8b18ada520ff;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=72338d461ba5b3057958204392f531aed0d8c7b9;hpb=6a77f38946aaee1cd85eeec6cf4229b204c15071;p=linux-2.6.git diff --git a/drivers/media/dvb/frontends/sp8870.c b/drivers/media/dvb/frontends/sp8870.c index 72338d461..73829e647 100644 --- a/drivers/media/dvb/frontends/sp8870.c +++ b/drivers/media/dvb/frontends/sp8870.c @@ -22,7 +22,8 @@ /* * This driver needs external firmware. Please use the command * "/Documentation/dvb/get_dvb_firmware alps_tdlb7" to - * download/extract it, and then copy it to /usr/lib/hotplug/firmware. + * download/extract it, and then copy it to /usr/lib/hotplug/firmware + * or /lib/firmware (depending on configuration of firmware hotplug). */ #define SP8870_DEFAULT_FIRMWARE "dvb-fe-sp8870.fw" @@ -32,6 +33,8 @@ #include #include #include +#include +#include #include "dvb_frontend.h" #include "sp8870.h" @@ -65,16 +68,16 @@ static int debug; static int sp8870_writereg (struct sp8870_state* state, u16 reg, u16 data) { - u8 buf [] = { reg >> 8, reg & 0xff, data >> 8, data & 0xff }; + u8 buf [] = { reg >> 8, reg & 0xff, data >> 8, data & 0xff }; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf, .len = 4 }; int err; - if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { dprintk ("%s: writereg error (err == %i, reg == 0x%02x, data == 0x%02x)\n", __FUNCTION__, err, reg, data); return -EREMOTEIO; } - return 0; + return 0; } static int sp8870_readreg (struct sp8870_state* state, u16 reg) @@ -130,7 +133,7 @@ static int sp8870_firmware_upload (struct sp8870_state* state, const struct firm msg.flags = 0; msg.buf = tx_buf; msg.len = tx_len + 2; - if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { + if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { printk("%s: firmware upload failed!\n", __FUNCTION__); printk ("%s: i2c error (err == %i)\n", __FUNCTION__, err); return err; @@ -248,7 +251,7 @@ static int sp8870_wake_up(struct sp8870_state* state) static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; int err; u16 reg0xc05; @@ -302,8 +305,8 @@ static int sp8870_set_frontend_parameters (struct dvb_frontend* fe, static int sp8870_init (struct dvb_frontend* fe) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; - const struct firmware *fw = NULL; + struct sp8870_state* state = fe->demodulator_priv; + const struct firmware *fw = NULL; sp8870_wake_up(state); if (state->initialised) return 0; @@ -358,7 +361,7 @@ static int sp8870_init (struct dvb_frontend* fe) static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; int status; int signal; @@ -384,7 +387,7 @@ static int sp8870_read_status (struct dvb_frontend* fe, fe_status_t * fe_status) static int sp8870_read_ber (struct dvb_frontend* fe, u32 * ber) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; int ret; u32 tmp; @@ -412,7 +415,7 @@ static int sp8870_read_ber (struct dvb_frontend* fe, u32 * ber) static int sp8870_read_signal_strength(struct dvb_frontend* fe, u16 * signal) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; int ret; u16 tmp; @@ -438,7 +441,7 @@ static int sp8870_read_signal_strength(struct dvb_frontend* fe, u16 * signal) static int sp8870_read_uncorrected_blocks (struct dvb_frontend* fe, u32* ublocks) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; int ret; *ublocks = 0; @@ -467,7 +470,7 @@ static int switches = 0; static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_parameters *p) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; /* The firmware of the sp8870 sometimes locks up after setting frontend parameters. @@ -524,7 +527,7 @@ static int sp8870_set_frontend (struct dvb_frontend* fe, struct dvb_frontend_par static int sp8870_sleep(struct dvb_frontend* fe) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; // tristate TS output and disable interface pins return sp8870_writereg(state, 0xC18, 0x000); @@ -532,15 +535,15 @@ static int sp8870_sleep(struct dvb_frontend* fe) static int sp8870_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) { - fesettings->min_delay_ms = 350; - fesettings->step_size = 0; - fesettings->max_drift = 0; - return 0; + fesettings->min_delay_ms = 350; + fesettings->step_size = 0; + fesettings->max_drift = 0; + return 0; } static void sp8870_release(struct dvb_frontend* fe) { - struct sp8870_state* state = (struct sp8870_state*) fe->demodulator_priv; + struct sp8870_state* state = fe->demodulator_priv; kfree(state); } @@ -552,7 +555,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, struct sp8870_state* state = NULL; /* allocate memory for the internal state */ - state = (struct sp8870_state*) kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); + state = kmalloc(sizeof(struct sp8870_state), GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ @@ -570,7 +573,7 @@ struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, return &state->frontend; error: - if (state) kfree(state); + kfree(state); return NULL; }