aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/Kconfig1
-rw-r--r--drivers/media/common/saa7146_core.c70
-rw-r--r--drivers/media/dvb/frontends/mt2131.c2
-rw-r--r--drivers/media/dvb/frontends/s5h1409.c96
-rw-r--r--drivers/media/dvb/frontends/stv0297.c22
-rw-r--r--drivers/media/dvb/frontends/tda10021.c6
-rw-r--r--drivers/media/dvb/frontends/ves1820.c2
-rw-r--r--drivers/media/dvb/ttpci/Kconfig2
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c6
-rw-r--r--drivers/media/video/cafe_ccic.c6
-rw-r--r--drivers/media/video/cx23885/Kconfig2
-rw-r--r--drivers/media/video/cx88/Kconfig2
-rw-r--r--drivers/media/video/em28xx/Kconfig2
-rw-r--r--drivers/media/video/em28xx/em28xx-i2c.c6
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c1
-rw-r--r--drivers/media/video/planb.c8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-main.c5
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c8
-rw-r--r--drivers/media/video/saa7134/Kconfig2
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c16
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c4
-rw-r--r--drivers/media/video/tuner-core.c6
-rw-r--r--drivers/media/video/tvp5150.c16
25 files changed, 222 insertions, 73 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index dd9bd4310c84..1604f0490404 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -151,6 +151,7 @@ config VIDEO_IR_I2C
151 151
152config VIDEO_IR 152config VIDEO_IR
153 tristate 153 tristate
154 depends on INPUT
154 select VIDEO_IR_I2C if I2C 155 select VIDEO_IR_I2C if I2C
155 156
156config VIDEO_TVEEPROM 157config VIDEO_TVEEPROM
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index cb034ead95ab..7d04a6fd1acb 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -59,43 +59,89 @@ void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
59} 59}
60 60
61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ 61/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */
62int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop) 62static inline int saa7146_wait_for_debi_done_sleep(struct saa7146_dev *dev,
63 unsigned long us1, unsigned long us2)
63{ 64{
64 unsigned long start; 65 unsigned long timeout;
65 int err; 66 int err;
66 67
67 /* wait for registers to be programmed */ 68 /* wait for registers to be programmed */
68 start = jiffies; 69 timeout = jiffies + usecs_to_jiffies(us1);
69 while (1) { 70 while (1) {
70 err = time_after(jiffies, start + HZ/20); 71 err = time_after(jiffies, timeout);
71 if (saa7146_read(dev, MC2) & 2) 72 if (saa7146_read(dev, MC2) & 2)
72 break; 73 break;
73 if (err) { 74 if (err) {
74 DEB_S(("timed out while waiting for registers getting programmed\n")); 75 printk(KERN_ERR "%s: %s timed out while waiting for "
76 "registers getting programmed\n",
77 dev->name, __FUNCTION__);
75 return -ETIMEDOUT; 78 return -ETIMEDOUT;
76 } 79 }
77 if (nobusyloop) 80 msleep(1);
78 msleep(1);
79 } 81 }
80 82
81 /* wait for transfer to complete */ 83 /* wait for transfer to complete */
82 start = jiffies; 84 timeout = jiffies + usecs_to_jiffies(us2);
83 while (1) { 85 while (1) {
84 err = time_after(jiffies, start + HZ/4); 86 err = time_after(jiffies, timeout);
85 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) 87 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
86 break; 88 break;
87 saa7146_read(dev, MC2); 89 saa7146_read(dev, MC2);
88 if (err) { 90 if (err) {
89 DEB_S(("timed out while waiting for transfer completion\n")); 91 DEB_S(("%s: %s timed out while waiting for transfer "
92 "completion\n", dev->name, __FUNCTION__));
90 return -ETIMEDOUT; 93 return -ETIMEDOUT;
91 } 94 }
92 if (nobusyloop) 95 msleep(1);
93 msleep(1);
94 } 96 }
95 97
96 return 0; 98 return 0;
97} 99}
98 100
101static inline int saa7146_wait_for_debi_done_busyloop(struct saa7146_dev *dev,
102 unsigned long us1, unsigned long us2)
103{
104 unsigned long loops;
105
106 /* wait for registers to be programmed */
107 loops = us1;
108 while (1) {
109 if (saa7146_read(dev, MC2) & 2)
110 break;
111 if (!loops--) {
112 printk(KERN_ERR "%s: %s timed out while waiting for "
113 "registers getting programmed\n",
114 dev->name, __FUNCTION__);
115 return -ETIMEDOUT;
116 }
117 udelay(1);
118 }
119
120 /* wait for transfer to complete */
121 loops = us2 / 5;
122 while (1) {
123 if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S))
124 break;
125 saa7146_read(dev, MC2);
126 if (!loops--) {
127 DEB_S(("%s: %s timed out while waiting for transfer "
128 "completion\n", dev->name, __FUNCTION__));
129 return -ETIMEDOUT;
130 }
131 udelay(5);
132 }
133
134 return 0;
135}
136
137int saa7146_wait_for_debi_done(struct saa7146_dev *dev, int nobusyloop)
138{
139 if (nobusyloop)
140 return saa7146_wait_for_debi_done_sleep(dev, 50000, 250000);
141 else
142 return saa7146_wait_for_debi_done_busyloop(dev, 50000, 250000);
143}
144
99/**************************************************************************** 145/****************************************************************************
100 * general helper functions 146 * general helper functions
101 ****************************************************************************/ 147 ****************************************************************************/
diff --git a/drivers/media/dvb/frontends/mt2131.c b/drivers/media/dvb/frontends/mt2131.c
index 4b93931de4e1..13cf16668171 100644
--- a/drivers/media/dvb/frontends/mt2131.c
+++ b/drivers/media/dvb/frontends/mt2131.c
@@ -116,7 +116,7 @@ static int mt2131_set_params(struct dvb_frontend *fe,
116 f_lo1 = (f_lo1 / 250) * 250; 116 f_lo1 = (f_lo1 / 250) * 250;
117 f_lo2 = f_lo1 - freq - MT2131_IF2; 117 f_lo2 = f_lo1 - freq - MT2131_IF2;
118 118
119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000, 119 priv->frequency = (f_lo1 - f_lo2 - MT2131_IF2) * 1000;
120 120
121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */ 121 /* Frequency LO1 = 16MHz * (DIV1 + NUM1/8192 ) */
122 num1 = f_lo1 * 64 / (MT2131_FREF / 128); 122 num1 = f_lo1 * 64 / (MT2131_FREF / 128);
diff --git a/drivers/media/dvb/frontends/s5h1409.c b/drivers/media/dvb/frontends/s5h1409.c
index 30e8a705fad4..8dee7ec9456a 100644
--- a/drivers/media/dvb/frontends/s5h1409.c
+++ b/drivers/media/dvb/frontends/s5h1409.c
@@ -42,6 +42,9 @@ struct s5h1409_state {
42 fe_modulation_t current_modulation; 42 fe_modulation_t current_modulation;
43 43
44 u32 current_frequency; 44 u32 current_frequency;
45
46 u32 is_qam_locked;
47 u32 qam_state;
45}; 48};
46 49
47static int debug = 0; 50static int debug = 0;
@@ -94,6 +97,7 @@ static struct init_tab {
94 { 0xac, 0x1003, }, 97 { 0xac, 0x1003, },
95 { 0xad, 0x103f, }, 98 { 0xad, 0x103f, },
96 { 0xe2, 0x0100, }, 99 { 0xe2, 0x0100, },
100 { 0xe3, 0x0000, },
97 { 0x28, 0x1010, }, 101 { 0x28, 0x1010, },
98 { 0xb1, 0x000e, }, 102 { 0xb1, 0x000e, },
99}; 103};
@@ -335,6 +339,8 @@ static int s5h1409_softreset(struct dvb_frontend* fe)
335 339
336 s5h1409_writereg(state, 0xf5, 0); 340 s5h1409_writereg(state, 0xf5, 0);
337 s5h1409_writereg(state, 0xf5, 1); 341 s5h1409_writereg(state, 0xf5, 1);
342 state->is_qam_locked = 0;
343 state->qam_state = 0;
338 return 0; 344 return 0;
339} 345}
340 346
@@ -349,6 +355,11 @@ static int s5h1409_set_if_freq(struct dvb_frontend* fe, int KHz)
349 s5h1409_writereg(state, 0x87, 0x01be); 355 s5h1409_writereg(state, 0x87, 0x01be);
350 s5h1409_writereg(state, 0x88, 0x0436); 356 s5h1409_writereg(state, 0x88, 0x0436);
351 s5h1409_writereg(state, 0x89, 0x054d); 357 s5h1409_writereg(state, 0x89, 0x054d);
358 } else
359 if (KHz == 4000) {
360 s5h1409_writereg(state, 0x87, 0x014b);
361 s5h1409_writereg(state, 0x88, 0x0cb5);
362 s5h1409_writereg(state, 0x89, 0x03e2);
352 } else { 363 } else {
353 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz); 364 printk("%s() Invalid arg = %d KHz\n", __FUNCTION__, KHz);
354 ret = -1; 365 ret = -1;
@@ -361,7 +372,7 @@ static int s5h1409_set_spectralinversion(struct dvb_frontend* fe, int inverted)
361{ 372{
362 struct s5h1409_state* state = fe->demodulator_priv; 373 struct s5h1409_state* state = fe->demodulator_priv;
363 374
364 dprintk("%s()\n", __FUNCTION__); 375 dprintk("%s(%d)\n", __FUNCTION__, inverted);
365 376
366 if(inverted == 1) 377 if(inverted == 1)
367 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */ 378 return s5h1409_writereg(state, 0x1b, 0x1101); /* Inverted */
@@ -382,14 +393,10 @@ static int s5h1409_enable_modulation(struct dvb_frontend* fe,
382 s5h1409_writereg(state, 0xf4, 0); 393 s5h1409_writereg(state, 0xf4, 0);
383 break; 394 break;
384 case QAM_64: 395 case QAM_64:
385 dprintk("%s() QAM_64\n", __FUNCTION__);
386 s5h1409_writereg(state, 0xf4, 1);
387 s5h1409_writereg(state, 0x85, 0x100);
388 break;
389 case QAM_256: 396 case QAM_256:
390 dprintk("%s() QAM_256\n", __FUNCTION__); 397 dprintk("%s() QAM_AUTO (64/256)\n", __FUNCTION__);
391 s5h1409_writereg(state, 0xf4, 1); 398 s5h1409_writereg(state, 0xf4, 1);
392 s5h1409_writereg(state, 0x85, 0x101); 399 s5h1409_writereg(state, 0x85, 0x110);
393 break; 400 break;
394 default: 401 default:
395 dprintk("%s() Invalid modulation\n", __FUNCTION__); 402 dprintk("%s() Invalid modulation\n", __FUNCTION__);
@@ -423,7 +430,7 @@ static int s5h1409_set_gpio(struct dvb_frontend* fe, int enable)
423 if (enable) 430 if (enable)
424 return s5h1409_writereg(state, 0xe3, 0x1100); 431 return s5h1409_writereg(state, 0xe3, 0x1100);
425 else 432 else
426 return s5h1409_writereg(state, 0xe3, 0); 433 return s5h1409_writereg(state, 0xe3, 0x1000);
427} 434}
428 435
429static int s5h1409_sleep(struct dvb_frontend* fe, int enable) 436static int s5h1409_sleep(struct dvb_frontend* fe, int enable)
@@ -444,6 +451,66 @@ static int s5h1409_register_reset(struct dvb_frontend* fe)
444 return s5h1409_writereg(state, 0xfa, 0); 451 return s5h1409_writereg(state, 0xfa, 0);
445} 452}
446 453
454static void s5h1409_set_qam_amhum_mode(struct dvb_frontend *fe)
455{
456 struct s5h1409_state *state = fe->demodulator_priv;
457 u16 reg;
458
459 if (state->is_qam_locked)
460 return;
461
462 /* QAM EQ lock check */
463 reg = s5h1409_readreg(state, 0xf0);
464
465 if ((reg >> 13) & 0x1) {
466
467 state->is_qam_locked = 1;
468 reg &= 0xff;
469
470 s5h1409_writereg(state, 0x96, 0x00c);
471 if ((reg < 0x38) || (reg > 0x68) ) {
472 s5h1409_writereg(state, 0x93, 0x3332);
473 s5h1409_writereg(state, 0x9e, 0x2c37);
474 } else {
475 s5h1409_writereg(state, 0x93, 0x3130);
476 s5h1409_writereg(state, 0x9e, 0x2836);
477 }
478
479 } else {
480 s5h1409_writereg(state, 0x96, 0x0008);
481 s5h1409_writereg(state, 0x93, 0x3332);
482 s5h1409_writereg(state, 0x9e, 0x2c37);
483 }
484}
485
486static void s5h1409_set_qam_interleave_mode(struct dvb_frontend *fe)
487{
488 struct s5h1409_state *state = fe->demodulator_priv;
489 u16 reg, reg1, reg2;
490
491 reg = s5h1409_readreg(state, 0xf1);
492
493 /* Master lock */
494 if ((reg >> 15) & 0x1) {
495 if (state->qam_state != 2) {
496 state->qam_state = 2;
497 reg1 = s5h1409_readreg(state, 0xb2);
498 reg2 = s5h1409_readreg(state, 0xad);
499
500 s5h1409_writereg(state, 0x96, 0x20);
501 s5h1409_writereg(state, 0xad,
502 ( ((reg1 & 0xf000) >> 4) | (reg2 & 0xf0ff)) );
503 s5h1409_writereg(state, 0xab, 0x1100);
504 }
505 } else {
506 if (state->qam_state != 1) {
507 state->qam_state = 1;
508 s5h1409_writereg(state, 0x96, 0x08);
509 s5h1409_writereg(state, 0xab, 0x1101);
510 }
511 }
512}
513
447/* Talk to the demod, set the FEC, GUARD, QAM settings etc */ 514/* Talk to the demod, set the FEC, GUARD, QAM settings etc */
448static int s5h1409_set_frontend (struct dvb_frontend* fe, 515static int s5h1409_set_frontend (struct dvb_frontend* fe,
449 struct dvb_frontend_parameters *p) 516 struct dvb_frontend_parameters *p)
@@ -458,12 +525,21 @@ static int s5h1409_set_frontend (struct dvb_frontend* fe,
458 525
459 s5h1409_enable_modulation(fe, p->u.vsb.modulation); 526 s5h1409_enable_modulation(fe, p->u.vsb.modulation);
460 527
528 /* Allow the demod to settle */
529 msleep(100);
530
461 if (fe->ops.tuner_ops.set_params) { 531 if (fe->ops.tuner_ops.set_params) {
462 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); 532 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1);
463 fe->ops.tuner_ops.set_params(fe, p); 533 fe->ops.tuner_ops.set_params(fe, p);
464 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); 534 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
465 } 535 }
466 536
537 /* Optimize the demod for QAM */
538 if (p->u.vsb.modulation != VSB_8) {
539 s5h1409_set_qam_amhum_mode(fe);
540 s5h1409_set_qam_interleave_mode(fe);
541 }
542
467 return 0; 543 return 0;
468} 544}
469 545
@@ -495,8 +571,8 @@ static int s5h1409_init (struct dvb_frontend* fe)
495 s5h1409_set_gpio(fe, state->config->gpio); 571 s5h1409_set_gpio(fe, state->config->gpio);
496 s5h1409_softreset(fe); 572 s5h1409_softreset(fe);
497 573
498 /* Note: Leaving the I2C gate open here. */ 574 /* Note: Leaving the I2C gate closed. */
499 s5h1409_i2c_gate_ctrl(fe, 1); 575 s5h1409_i2c_gate_ctrl(fe, 0);
500 576
501 return 0; 577 return 0;
502} 578}
diff --git a/drivers/media/dvb/frontends/stv0297.c b/drivers/media/dvb/frontends/stv0297.c
index 17e5cb561cd8..7c23775f77db 100644
--- a/drivers/media/dvb/frontends/stv0297.c
+++ b/drivers/media/dvb/frontends/stv0297.c
@@ -358,11 +358,23 @@ static int stv0297_read_ber(struct dvb_frontend *fe, u32 * ber)
358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength) 358static int stv0297_read_signal_strength(struct dvb_frontend *fe, u16 * strength)
359{ 359{
360 struct stv0297_state *state = fe->demodulator_priv; 360 struct stv0297_state *state = fe->demodulator_priv;
361 u8 STRENGTH[2]; 361 u8 STRENGTH[3];
362 362 u16 tmp;
363 stv0297_readregs(state, 0x41, STRENGTH, 2); 363
364 *strength = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0]; 364 stv0297_readregs(state, 0x41, STRENGTH, 3);
365 365 tmp = (STRENGTH[1] & 0x03) << 8 | STRENGTH[0];
366 if (STRENGTH[2] & 0x20) {
367 if (tmp < 0x200)
368 tmp = 0;
369 else
370 tmp = tmp - 0x200;
371 } else {
372 if (tmp > 0x1ff)
373 tmp = 0;
374 else
375 tmp = 0x1ff - tmp;
376 }
377 *strength = (tmp << 7) | (tmp >> 2);
366 return 0; 378 return 0;
367} 379}
368 380
diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c
index 4cd9e82c4669..45137d2ebfb9 100644
--- a/drivers/media/dvb/frontends/tda10021.c
+++ b/drivers/media/dvb/frontends/tda10021.c
@@ -301,6 +301,8 @@ static int tda10021_read_ber(struct dvb_frontend* fe, u32* ber)
301 u32 _ber = tda10021_readreg(state, 0x14) | 301 u32 _ber = tda10021_readreg(state, 0x14) |
302 (tda10021_readreg(state, 0x15) << 8) | 302 (tda10021_readreg(state, 0x15) << 8) |
303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16); 303 ((tda10021_readreg(state, 0x16) & 0x0f) << 16);
304 _tda10021_writereg(state, 0x10, (tda10021_readreg(state, 0x10) & ~0xc0)
305 | (tda10021_inittab[0x10] & 0xc0));
304 *ber = 10 * _ber; 306 *ber = 10 * _ber;
305 307
306 return 0; 308 return 0;
@@ -310,7 +312,11 @@ static int tda10021_read_signal_strength(struct dvb_frontend* fe, u16* strength)
310{ 312{
311 struct tda10021_state* state = fe->demodulator_priv; 313 struct tda10021_state* state = fe->demodulator_priv;
312 314
315 u8 config = tda10021_readreg(state, 0x02);
313 u8 gain = tda10021_readreg(state, 0x17); 316 u8 gain = tda10021_readreg(state, 0x17);
317 if (config & 0x02)
318 /* the agc value is inverted */
319 gain = ~gain;
314 *strength = (gain << 8) | gain; 320 *strength = (gain << 8) | gain;
315 321
316 return 0; 322 return 0;
diff --git a/drivers/media/dvb/frontends/ves1820.c b/drivers/media/dvb/frontends/ves1820.c
index 066b73b75698..60433b5011fd 100644
--- a/drivers/media/dvb/frontends/ves1820.c
+++ b/drivers/media/dvb/frontends/ves1820.c
@@ -47,7 +47,7 @@ struct ves1820_state {
47static int verbose; 47static int verbose;
48 48
49static u8 ves1820_inittab[] = { 49static u8 ves1820_inittab[] = {
50 0x69, 0x6A, 0x93, 0x12, 0x12, 0x46, 0x26, 0x1A, 50 0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A,
51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20, 51 0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20,
52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00, 52 0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 53 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig
index 6d53289b3276..54b91f26ca63 100644
--- a/drivers/media/dvb/ttpci/Kconfig
+++ b/drivers/media/dvb/ttpci/Kconfig
@@ -84,7 +84,7 @@ config DVB_BUDGET
84 84
85config DVB_BUDGET_CI 85config DVB_BUDGET_CI
86 tristate "Budget cards with onboard CI connector" 86 tristate "Budget cards with onboard CI connector"
87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 87 depends on DVB_CORE && PCI && I2C && VIDEO_V4L1 && INPUT
88 select VIDEO_SAA7146 88 select VIDEO_SAA7146
89 select DVB_STV0297 if !DVB_FE_CUSTOMISE 89 select DVB_STV0297 if !DVB_FE_CUSTOMISE
90 select DVB_STV0299 if !DVB_FE_CUSTOMISE 90 select DVB_STV0299 if !DVB_FE_CUSTOMISE
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 2e571eb9313a..c9f14bfc8544 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -363,7 +363,7 @@ endmenu # encoder / decoder chips
363 363
364config VIDEO_VIVI 364config VIDEO_VIVI
365 tristate "Virtual Video Driver" 365 tristate "Virtual Video Driver"
366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 && PCI 366 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64
367 select VIDEOBUF_VMALLOC 367 select VIDEOBUF_VMALLOC
368 default n 368 default n
369 ---help--- 369 ---help---
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 9feeb636ff9b..a88b56e6ca05 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2881,10 +2881,6 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2881 if (NULL == fmt) 2881 if (NULL == fmt)
2882 return -EINVAL; 2882 return -EINVAL;
2883 mutex_lock(&fh->cap.lock); 2883 mutex_lock(&fh->cap.lock);
2884 if (fmt->depth != pic->depth) {
2885 retval = -EINVAL;
2886 goto fh_unlock_and_return;
2887 }
2888 if (fmt->flags & FORMAT_FLAGS_RAW) { 2884 if (fmt->flags & FORMAT_FLAGS_RAW) {
2889 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL * 2885 /* VIDIOCMCAPTURE uses gbufsize, not RAW_BPL *
2890 RAW_LINES * 2. F1 is stored at offset 0, F2 2886 RAW_LINES * 2. F1 is stored at offset 0, F2
@@ -3117,6 +3113,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
3117 vm->width,vm->height,field); 3113 vm->width,vm->height,field);
3118 if (0 != retval) 3114 if (0 != retval)
3119 goto fh_unlock_and_return; 3115 goto fh_unlock_and_return;
3116 btv->init.width = vm->width;
3117 btv->init.height = vm->height;
3120 spin_lock_irqsave(&btv->s_lock,flags); 3118 spin_lock_irqsave(&btv->s_lock,flags);
3121 buffer_queue(&fh->cap,&buf->vb); 3119 buffer_queue(&fh->cap,&buf->vb);
3122 spin_unlock_irqrestore(&btv->s_lock,flags); 3120 spin_unlock_irqrestore(&btv->s_lock,flags);
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index b63cab336920..7ae499c9c54c 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -3,6 +3,9 @@
3 * multifunction chip. Currently works with the Omnivision OV7670 3 * multifunction chip. Currently works with the Omnivision OV7670
4 * sensor. 4 * sensor.
5 * 5 *
6 * The data sheet for this device can be found at:
7 * http://www.marvell.com/products/pcconn/88ALP01.jsp
8 *
6 * Copyright 2006 One Laptop Per Child Association, Inc. 9 * Copyright 2006 One Laptop Per Child Association, Inc.
7 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> 10 * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net>
8 * 11 *
@@ -2232,13 +2235,16 @@ static int cafe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
2232{ 2235{
2233 struct cafe_camera *cam = cafe_find_by_pdev(pdev); 2236 struct cafe_camera *cam = cafe_find_by_pdev(pdev);
2234 int ret; 2237 int ret;
2238 enum cafe_state cstate;
2235 2239
2236 ret = pci_save_state(pdev); 2240 ret = pci_save_state(pdev);
2237 if (ret) 2241 if (ret)
2238 return ret; 2242 return ret;
2243 cstate = cam->state; /* HACK - stop_dma sets to idle */
2239 cafe_ctlr_stop_dma(cam); 2244 cafe_ctlr_stop_dma(cam);
2240 cafe_ctlr_power_down(cam); 2245 cafe_ctlr_power_down(cam);
2241 pci_disable_device(pdev); 2246 pci_disable_device(pdev);
2247 cam->state = cstate;
2242 return 0; 2248 return 0;
2243} 2249}
2244 2250
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig
index 72004a07b2d5..d8b1ccb44913 100644
--- a/drivers/media/video/cx23885/Kconfig
+++ b/drivers/media/video/cx23885/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX23885 1config VIDEO_CX23885
2 tristate "Conexant cx23885 (2388x successor) support" 2 tristate "Conexant cx23885 (2388x successor) support"
3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C 3 depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index eeb5224ca101..ceb31d4a2512 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX88 1config VIDEO_CX88
2 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select I2C_ALGOBIT 4 select I2C_ALGOBIT
5 select FW_LOADER 5 select FW_LOADER
6 select VIDEO_BTCX 6 select VIDEO_BTCX
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index 5b6a40371602..c1127802ad9c 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_EM28XX 1config VIDEO_EM28XX
2 tristate "Empia EM2800/2820/2840 USB video capture support" 2 tristate "Empia EM2800/2820/2840 USB video capture support"
3 depends on VIDEO_V4L1 && I2C 3 depends on VIDEO_V4L1 && I2C && INPUT
4 select VIDEO_TUNER 4 select VIDEO_TUNER
5 select VIDEO_TVEEPROM 5 select VIDEO_TVEEPROM
6 select VIDEO_IR 6 select VIDEO_IR
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c
index 997d067e32e0..e3a4aa7a9df4 100644
--- a/drivers/media/video/em28xx/em28xx-i2c.c
+++ b/drivers/media/video/em28xx/em28xx-i2c.c
@@ -416,8 +416,10 @@ static int attach_inform(struct i2c_client *client)
416 struct em28xx *dev = client->adapter->algo_data; 416 struct em28xx *dev = client->adapter->algo_data;
417 417
418 switch (client->addr << 1) { 418 switch (client->addr << 1) {
419 case 0x43: 419 case 0x86:
420 case 0x4b: 420 case 0x84:
421 case 0x96:
422 case 0x94:
421 { 423 {
422 struct tuner_setup tun_setup; 424 struct tuner_setup tun_setup;
423 425
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index a4c2a907124a..2529c298b862 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -32,6 +32,7 @@
32#include <linux/usb.h> 32#include <linux/usb.h>
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/version.h> 34#include <linux/version.h>
35#include <linux/mm.h>
35#include <linux/video_decoder.h> 36#include <linux/video_decoder.h>
36#include <linux/mutex.h> 37#include <linux/mutex.h>
37 38
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c
index ce4b2f9791ee..36047d4e70f6 100644
--- a/drivers/media/video/planb.c
+++ b/drivers/media/video/planb.c
@@ -91,7 +91,6 @@ static void planb_close(struct video_device *);
91static int planb_ioctl(struct video_device *, unsigned int, void *); 91static int planb_ioctl(struct video_device *, unsigned int, void *);
92static int planb_init_done(struct video_device *); 92static int planb_init_done(struct video_device *);
93static int planb_mmap(struct video_device *, const char *, unsigned long); 93static int planb_mmap(struct video_device *, const char *, unsigned long);
94static void planb_irq(int, void *);
95static void release_planb(void); 94static void release_planb(void);
96int init_planbs(struct video_init *); 95int init_planbs(struct video_init *);
97 96
@@ -1315,7 +1314,7 @@ cmd_tab_data_end:
1315 return c1; 1314 return c1;
1316} 1315}
1317 1316
1318static void planb_irq(int irq, void *dev_id) 1317static irqreturn_t planb_irq(int irq, void *dev_id)
1319{ 1318{
1320 unsigned int stat, astat; 1319 unsigned int stat, astat;
1321 struct planb *pb = (struct planb *)dev_id; 1320 struct planb *pb = (struct planb *)dev_id;
@@ -1358,13 +1357,14 @@ static void planb_irq(int irq, void *dev_id)
1358 pb->frame_stat[fr] = GBUFFER_DONE; 1357 pb->frame_stat[fr] = GBUFFER_DONE;
1359 pb->grabbing--; 1358 pb->grabbing--;
1360 wake_up_interruptible(&pb->capq); 1359 wake_up_interruptible(&pb->capq);
1361 return; 1360 return IRQ_HANDLED;
1362 } 1361 }
1363 /* incorrect interrupts? */ 1362 /* incorrect interrupts? */
1364 pb->intr_mask = PLANB_CLR_IRQ; 1363 pb->intr_mask = PLANB_CLR_IRQ;
1365 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ); 1364 out_le32(&pb->planb_base->intr_stat, PLANB_CLR_IRQ);
1366 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts" 1365 printk(KERN_ERR "PlanB: IRQ lockup, cleared intrrupts"
1367 " unconditionally\n"); 1366 " unconditionally\n");
1367 return IRQ_HANDLED;
1368} 1368}
1369 1369
1370/******************************* 1370/*******************************
@@ -2090,7 +2090,7 @@ static int init_planb(struct planb *pb)
2090 /* clear interrupt mask */ 2090 /* clear interrupt mask */
2091 pb->intr_mask = PLANB_CLR_IRQ; 2091 pb->intr_mask = PLANB_CLR_IRQ;
2092 2092
2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); 2093 result = request_irq(pb->irq, planb_irq, 0, "PlanB", pb);
2094 if (result < 0) { 2094 if (result < 0) {
2095 if (result==-EINVAL) 2095 if (result==-EINVAL)
2096 printk(KERN_ERR "PlanB: Bad irq number (%d) " 2096 printk(KERN_ERR "PlanB: Bad irq number (%d) "
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index f569b00201dd..46f156fb108c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
410 int msk; 410 int msk;
411 *valptr = 0; 411 *valptr = 0;
412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) { 412 for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) {
413 if (!msk & valid_bits) continue; 413 if (!(msk & valid_bits)) continue;
414 valid_bits &= ~msk; 414 valid_bits &= ~msk;
415 if (!names[idx]) continue; 415 if (!names[idx]) continue;
416 slen = strlen(names[idx]); 416 slen = strlen(names[idx]);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c
index ca9e2789c8ca..11b3b2e84b90 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -136,14 +136,13 @@ static int __init pvr_init(void)
136 136
137static void __exit pvr_exit(void) 137static void __exit pvr_exit(void)
138{ 138{
139
140 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit"); 139 pvr2_trace(PVR2_TRACE_INIT,"pvr_exit");
141 140
141 usb_deregister(&pvr_driver);
142
142#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS 143#ifdef CONFIG_VIDEO_PVRUSB2_SYSFS
143 pvr2_sysfs_class_destroy(class_ptr); 144 pvr2_sysfs_class_destroy(class_ptr);
144#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */ 145#endif /* CONFIG_VIDEO_PVRUSB2_SYSFS */
145
146 usb_deregister(&pvr_driver);
147} 146}
148 147
149module_init(pvr_init); 148module_init(pvr_init);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index 2ee3c3049e8f..3c57a7d8200b 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -905,13 +905,6 @@ struct pvr2_sysfs *pvr2_sysfs_create(struct pvr2_context *mp,
905} 905}
906 906
907 907
908static int pvr2_sysfs_hotplug(struct device *d,
909 struct kobj_uevent_env *env)
910{
911 /* Even though we don't do anything here, we still need this function
912 because sysfs will still try to call it. */
913 return 0;
914}
915 908
916struct pvr2_sysfs_class *pvr2_sysfs_class_create(void) 909struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
917{ 910{
@@ -922,7 +915,6 @@ struct pvr2_sysfs_class *pvr2_sysfs_class_create(void)
922 clp->class.name = "pvrusb2"; 915 clp->class.name = "pvrusb2";
923 clp->class.class_release = pvr2_sysfs_class_release; 916 clp->class.class_release = pvr2_sysfs_class_release;
924 clp->class.dev_release = pvr2_sysfs_release; 917 clp->class.dev_release = pvr2_sysfs_release;
925 clp->class.dev_uevent = pvr2_sysfs_hotplug;
926 if (class_register(&clp->class)) { 918 if (class_register(&clp->class)) {
927 pvr2_sysfs_trace( 919 pvr2_sysfs_trace(
928 "Registration failed for pvr2_sysfs_class id=%p",clp); 920 "Registration failed for pvr2_sysfs_class id=%p",clp);
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index d6d8d660196d..3aa8cb2b860a 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_SAA7134 1config VIDEO_SAA7134
2 tristate "Philips SAA7134 support" 2 tristate "Philips SAA7134 support"
3 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C && INPUT
4 select VIDEOBUF_DMA_SG 4 select VIDEOBUF_DMA_SG
5 select VIDEO_IR 5 select VIDEO_IR
6 select VIDEO_TUNER 6 select VIDEO_TUNER
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index c6f7279669c1..b9c5cf7dc849 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -543,8 +543,10 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
543 V4L functions, and force ALSA to use that as the DMA area */ 543 V4L functions, and force ALSA to use that as the DMA area */
544 544
545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc; 545 substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
546 substream->runtime->dma_bytes = dev->dmasound.bufsize;
547 substream->runtime->dma_addr = 0;
546 548
547 return 1; 549 return 0;
548 550
549} 551}
550 552
@@ -652,6 +654,17 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
652} 654}
653 655
654/* 656/*
657 * page callback (needed for mmap)
658 */
659
660static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
661 unsigned long offset)
662{
663 void *pageptr = substream->runtime->dma_area + offset;
664 return vmalloc_to_page(pageptr);
665}
666
667/*
655 * ALSA capture callbacks definition 668 * ALSA capture callbacks definition
656 */ 669 */
657 670
@@ -664,6 +677,7 @@ static struct snd_pcm_ops snd_card_saa7134_capture_ops = {
664 .prepare = snd_card_saa7134_capture_prepare, 677 .prepare = snd_card_saa7134_capture_prepare,
665 .trigger = snd_card_saa7134_capture_trigger, 678 .trigger = snd_card_saa7134_capture_trigger,
666 .pointer = snd_card_saa7134_capture_pointer, 679 .pointer = snd_card_saa7134_capture_pointer,
680 .page = snd_card_saa7134_page,
667}; 681};
668 682
669/* 683/*
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index a4c192fb4e41..4f3dad9ae6d6 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2996,11 +2996,11 @@ struct saa7134_board saa7134_boards[] = {
2996 },{ 2996 },{
2997 .name = name_comp1, 2997 .name = name_comp1,
2998 .vmux = 0, 2998 .vmux = 0,
2999 .amux = LINE2, 2999 .amux = LINE1,
3000 },{ 3000 },{
3001 .name = name_svideo, 3001 .name = name_svideo,
3002 .vmux = 8, 3002 .vmux = 8,
3003 .amux = LINE2, 3003 .amux = LINE1,
3004 }}, 3004 }},
3005 }, 3005 },
3006 [SAA7134_BOARD_FLYDVBS_LR300] = { 3006 [SAA7134_BOARD_FLYDVBS_LR300] = {
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6a777604f070..9e99f3636d3d 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -30,7 +30,7 @@
30 30
31/* standard i2c insmod options */ 31/* standard i2c insmod options */
32static unsigned short normal_i2c[] = { 32static unsigned short normal_i2c[] = {
33#ifdef CONFIG_TUNER_TEA5761 33#if defined(CONFIG_TUNER_TEA5761) || (defined(CONFIG_TUNER_TEA5761_MODULE) && defined(MODULE))
34 0x10, 34 0x10,
35#endif 35#endif
36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */ 36 0x42, 0x43, 0x4a, 0x4b, /* tda8290 */
@@ -292,7 +292,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
292 } 292 }
293 t->mode_mask = T_RADIO; 293 t->mode_mask = T_RADIO;
294 break; 294 break;
295#ifdef CONFIG_TUNER_TEA5761
296 case TUNER_TEA5761: 295 case TUNER_TEA5761:
297 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) { 296 if (tea5761_attach(&t->fe, t->i2c.adapter, t->i2c.addr) == NULL) {
298 t->type = TUNER_ABSENT; 297 t->type = TUNER_ABSENT;
@@ -301,7 +300,6 @@ static void set_type(struct i2c_client *c, unsigned int type,
301 } 300 }
302 t->mode_mask = T_RADIO; 301 t->mode_mask = T_RADIO;
303 break; 302 break;
304#endif
305 case TUNER_PHILIPS_FMD1216ME_MK3: 303 case TUNER_PHILIPS_FMD1216ME_MK3:
306 buffer[0] = 0x0b; 304 buffer[0] = 0x0b;
307 buffer[1] = 0xdc; 305 buffer[1] = 0xdc;
@@ -594,7 +592,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
594 /* autodetection code based on the i2c addr */ 592 /* autodetection code based on the i2c addr */
595 if (!no_autodetect) { 593 if (!no_autodetect) {
596 switch (addr) { 594 switch (addr) {
597#ifdef CONFIG_TUNER_TEA5761
598 case 0x10: 595 case 0x10:
599 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) { 596 if (tea5761_autodetection(t->i2c.adapter, t->i2c.addr) != EINVAL) {
600 t->type = TUNER_TEA5761; 597 t->type = TUNER_TEA5761;
@@ -606,7 +603,6 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
606 goto register_client; 603 goto register_client;
607 } 604 }
608 break; 605 break;
609#endif
610 case 0x42: 606 case 0x42:
611 case 0x43: 607 case 0x43:
612 case 0x4a: 608 case 0x4a:
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index e2f1c972754b..25d0aef88ef5 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -799,10 +799,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
799 tvp5150_write_inittab(c, tvp5150_init_enable); 799 tvp5150_write_inittab(c, tvp5150_init_enable);
800 800
801 /* Initialize image preferences */ 801 /* Initialize image preferences */
802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8); 802 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright);
803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8); 803 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast);
804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8); 804 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast);
805 tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8); 805 tvp5150_write(c, TVP5150_HUE_CTL, decoder->hue);
806 806
807 tvp5150_set_std(c, decoder->norm); 807 tvp5150_set_std(c, decoder->norm);
808}; 808};
@@ -1077,10 +1077,10 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */ 1077 core->norm = V4L2_STD_ALL; /* Default is autodetect */
1078 core->route.input = TVP5150_COMPOSITE1; 1078 core->route.input = TVP5150_COMPOSITE1;
1079 core->enable = 1; 1079 core->enable = 1;
1080 core->bright = 32768; 1080 core->bright = 128;
1081 core->contrast = 32768; 1081 core->contrast = 128;
1082 core->hue = 32768; 1082 core->hue = 0;
1083 core->sat = 32768; 1083 core->sat = 128;
1084 1084
1085 if (rv) { 1085 if (rv) {
1086 kfree(c); 1086 kfree(c);