aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/ves1820.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/ves1820.c')
-rw-r--r--drivers/media/dvb/frontends/ves1820.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
index 9c0d23e1d9e5..70fb44b391a7 100644
--- a/drivers/media/dvb/frontends/ves1820.c
+++ b/drivers/media/dvb/frontends/ves1820.c
@@ -70,7 +70,6 @@ static int ves1820_writereg(struct ves1820_state *state, u8 reg, u8 data)
70 printk("ves1820: %s(): writereg error (reg == 0x%02x," 70 printk("ves1820: %s(): writereg error (reg == 0x%02x,"
71 "val == 0x%02x, ret == %i)\n", __FUNCTION__, reg, data, ret); 71 "val == 0x%02x, ret == %i)\n", __FUNCTION__, reg, data, ret);
72 72
73 msleep(10);
74 return (ret != 1) ? -EREMOTEIO : 0; 73 return (ret != 1) ? -EREMOTEIO : 0;
75} 74}
76 75
@@ -193,7 +192,7 @@ static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate)
193 192
194static int ves1820_init(struct dvb_frontend* fe) 193static int ves1820_init(struct dvb_frontend* fe)
195{ 194{
196 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 195 struct ves1820_state* state = fe->demodulator_priv;
197 int i; 196 int i;
198 int val; 197 int val;
199 198
@@ -214,7 +213,7 @@ static int ves1820_init(struct dvb_frontend* fe)
214 213
215static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) 214static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
216{ 215{
217 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 216 struct ves1820_state* state = fe->demodulator_priv;
218 static const u8 reg0x00[] = { 0x00, 0x04, 0x08, 0x0c, 0x10 }; 217 static const u8 reg0x00[] = { 0x00, 0x04, 0x08, 0x0c, 0x10 };
219 static const u8 reg0x01[] = { 140, 140, 106, 100, 92 }; 218 static const u8 reg0x01[] = { 140, 140, 106, 100, 92 };
220 static const u8 reg0x05[] = { 135, 100, 70, 54, 38 }; 219 static const u8 reg0x05[] = { 135, 100, 70, 54, 38 };
@@ -241,7 +240,7 @@ static int ves1820_set_parameters(struct dvb_frontend* fe, struct dvb_frontend_p
241 240
242static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status) 241static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status)
243{ 242{
244 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 243 struct ves1820_state* state = fe->demodulator_priv;
245 int sync; 244 int sync;
246 245
247 *status = 0; 246 *status = 0;
@@ -267,7 +266,7 @@ static int ves1820_read_status(struct dvb_frontend* fe, fe_status_t* status)
267 266
268static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber) 267static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber)
269{ 268{
270 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 269 struct ves1820_state* state = fe->demodulator_priv;
271 270
272 u32 _ber = ves1820_readreg(state, 0x14) | 271 u32 _ber = ves1820_readreg(state, 0x14) |
273 (ves1820_readreg(state, 0x15) << 8) | 272 (ves1820_readreg(state, 0x15) << 8) |
@@ -279,7 +278,7 @@ static int ves1820_read_ber(struct dvb_frontend* fe, u32* ber)
279 278
280static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength) 279static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength)
281{ 280{
282 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 281 struct ves1820_state* state = fe->demodulator_priv;
283 282
284 u8 gain = ves1820_readreg(state, 0x17); 283 u8 gain = ves1820_readreg(state, 0x17);
285 *strength = (gain << 8) | gain; 284 *strength = (gain << 8) | gain;
@@ -289,7 +288,7 @@ static int ves1820_read_signal_strength(struct dvb_frontend* fe, u16* strength)
289 288
290static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr) 289static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr)
291{ 290{
292 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 291 struct ves1820_state* state = fe->demodulator_priv;
293 292
294 u8 quality = ~ves1820_readreg(state, 0x18); 293 u8 quality = ~ves1820_readreg(state, 0x18);
295 *snr = (quality << 8) | quality; 294 *snr = (quality << 8) | quality;
@@ -299,7 +298,7 @@ static int ves1820_read_snr(struct dvb_frontend* fe, u16* snr)
299 298
300static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) 299static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
301{ 300{
302 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 301 struct ves1820_state* state = fe->demodulator_priv;
303 302
304 *ucblocks = ves1820_readreg(state, 0x13) & 0x7f; 303 *ucblocks = ves1820_readreg(state, 0x13) & 0x7f;
305 if (*ucblocks == 0x7f) 304 if (*ucblocks == 0x7f)
@@ -314,7 +313,7 @@ static int ves1820_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
314 313
315static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p) 314static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_parameters *p)
316{ 315{
317 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 316 struct ves1820_state* state = fe->demodulator_priv;
318 int sync; 317 int sync;
319 s8 afc = 0; 318 s8 afc = 0;
320 319
@@ -345,7 +344,7 @@ static int ves1820_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
345 344
346static int ves1820_sleep(struct dvb_frontend* fe) 345static int ves1820_sleep(struct dvb_frontend* fe)
347{ 346{
348 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 347 struct ves1820_state* state = fe->demodulator_priv;
349 348
350 ves1820_writereg(state, 0x1b, 0x02); /* pdown ADC */ 349 ves1820_writereg(state, 0x1b, 0x02); /* pdown ADC */
351 ves1820_writereg(state, 0x00, 0x80); /* standby */ 350 ves1820_writereg(state, 0x00, 0x80); /* standby */
@@ -364,7 +363,7 @@ static int ves1820_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronten
364 363
365static void ves1820_release(struct dvb_frontend* fe) 364static void ves1820_release(struct dvb_frontend* fe)
366{ 365{
367 struct ves1820_state* state = (struct ves1820_state*) fe->demodulator_priv; 366 struct ves1820_state* state = fe->demodulator_priv;
368 kfree(state); 367 kfree(state);
369} 368}
370 369
@@ -377,7 +376,7 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config,
377 struct ves1820_state* state = NULL; 376 struct ves1820_state* state = NULL;
378 377
379 /* allocate memory for the internal state */ 378 /* allocate memory for the internal state */
380 state = (struct ves1820_state*) kmalloc(sizeof(struct ves1820_state), GFP_KERNEL); 379 state = kmalloc(sizeof(struct ves1820_state), GFP_KERNEL);
381 if (state == NULL) 380 if (state == NULL)
382 goto error; 381 goto error;
383 382