diff options
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 315 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 2 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 58 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 259 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 24 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 13 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 3 |
7 files changed, 532 insertions, 142 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 0e0ba50946e8..de7b9e6e932a 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -39,6 +39,23 @@ enum saa6752hs_videoformat { | |||
39 | SAA6752HS_VF_UNKNOWN, | 39 | SAA6752HS_VF_UNKNOWN, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | struct saa6752hs_mpeg_params { | ||
43 | /* transport streams */ | ||
44 | __u16 ts_pid_pmt; | ||
45 | __u16 ts_pid_audio; | ||
46 | __u16 ts_pid_video; | ||
47 | __u16 ts_pid_pcr; | ||
48 | |||
49 | /* audio */ | ||
50 | enum v4l2_mpeg_audio_l2_bitrate au_l2_bitrate; | ||
51 | |||
52 | /* video */ | ||
53 | enum v4l2_mpeg_video_aspect vi_aspect; | ||
54 | enum v4l2_mpeg_video_bitrate_mode vi_bitrate_mode; | ||
55 | __u32 vi_bitrate; | ||
56 | __u32 vi_bitrate_peak; | ||
57 | }; | ||
58 | |||
42 | static const struct v4l2_format v4l2_format_table[] = | 59 | static const struct v4l2_format v4l2_format_table[] = |
43 | { | 60 | { |
44 | [SAA6752HS_VF_D1] = | 61 | [SAA6752HS_VF_D1] = |
@@ -55,18 +72,19 @@ static const struct v4l2_format v4l2_format_table[] = | |||
55 | 72 | ||
56 | struct saa6752hs_state { | 73 | struct saa6752hs_state { |
57 | struct i2c_client client; | 74 | struct i2c_client client; |
58 | struct v4l2_mpeg_compression params; | 75 | struct v4l2_mpeg_compression old_params; |
76 | struct saa6752hs_mpeg_params params; | ||
59 | enum saa6752hs_videoformat video_format; | 77 | enum saa6752hs_videoformat video_format; |
60 | v4l2_std_id standard; | 78 | v4l2_std_id standard; |
61 | }; | 79 | }; |
62 | 80 | ||
63 | enum saa6752hs_command { | 81 | enum saa6752hs_command { |
64 | SAA6752HS_COMMAND_RESET = 0, | 82 | SAA6752HS_COMMAND_RESET = 0, |
65 | SAA6752HS_COMMAND_STOP = 1, | 83 | SAA6752HS_COMMAND_STOP = 1, |
66 | SAA6752HS_COMMAND_START = 2, | 84 | SAA6752HS_COMMAND_START = 2, |
67 | SAA6752HS_COMMAND_PAUSE = 3, | 85 | SAA6752HS_COMMAND_PAUSE = 3, |
68 | SAA6752HS_COMMAND_RECONFIGURE = 4, | 86 | SAA6752HS_COMMAND_RECONFIGURE = 4, |
69 | SAA6752HS_COMMAND_SLEEP = 5, | 87 | SAA6752HS_COMMAND_SLEEP = 5, |
70 | SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6, | 88 | SAA6752HS_COMMAND_RECONFIGURE_FORCE = 6, |
71 | 89 | ||
72 | SAA6752HS_COMMAND_MAX | 90 | SAA6752HS_COMMAND_MAX |
@@ -129,7 +147,22 @@ static u8 PMT[] = { | |||
129 | 0x00, 0x00, 0x00, 0x00 /* CRC32 */ | 147 | 0x00, 0x00, 0x00, 0x00 /* CRC32 */ |
130 | }; | 148 | }; |
131 | 149 | ||
132 | static struct v4l2_mpeg_compression param_defaults = | 150 | static struct saa6752hs_mpeg_params param_defaults = |
151 | { | ||
152 | .ts_pid_pmt = 16, | ||
153 | .ts_pid_video = 260, | ||
154 | .ts_pid_audio = 256, | ||
155 | .ts_pid_pcr = 259, | ||
156 | |||
157 | .vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, | ||
158 | .vi_bitrate = 4000, | ||
159 | .vi_bitrate_peak = 6000, | ||
160 | .vi_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, | ||
161 | |||
162 | .au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K, | ||
163 | }; | ||
164 | |||
165 | static struct v4l2_mpeg_compression old_param_defaults = | ||
133 | { | 166 | { |
134 | .st_type = V4L2_MPEG_TS_2, | 167 | .st_type = V4L2_MPEG_TS_2, |
135 | .st_bitrate = { | 168 | .st_bitrate = { |
@@ -228,45 +261,57 @@ static int saa6752hs_chip_command(struct i2c_client* client, | |||
228 | 261 | ||
229 | 262 | ||
230 | static int saa6752hs_set_bitrate(struct i2c_client* client, | 263 | static int saa6752hs_set_bitrate(struct i2c_client* client, |
231 | struct v4l2_mpeg_compression* params) | 264 | struct saa6752hs_mpeg_params* params) |
232 | { | 265 | { |
233 | u8 buf[3]; | 266 | u8 buf[3]; |
267 | int tot_bitrate; | ||
234 | 268 | ||
235 | /* set the bitrate mode */ | 269 | /* set the bitrate mode */ |
236 | buf[0] = 0x71; | 270 | buf[0] = 0x71; |
237 | buf[1] = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? 0 : 1; | 271 | buf[1] = (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) ? 0 : 1; |
238 | i2c_master_send(client, buf, 2); | 272 | i2c_master_send(client, buf, 2); |
239 | 273 | ||
240 | /* set the video bitrate */ | 274 | /* set the video bitrate */ |
241 | if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) { | 275 | if (params->vi_bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) { |
242 | /* set the target bitrate */ | 276 | /* set the target bitrate */ |
243 | buf[0] = 0x80; | 277 | buf[0] = 0x80; |
244 | buf[1] = params->vi_bitrate.target >> 8; | 278 | buf[1] = params->vi_bitrate >> 8; |
245 | buf[2] = params->vi_bitrate.target & 0xff; | 279 | buf[2] = params->vi_bitrate & 0xff; |
246 | i2c_master_send(client, buf, 3); | 280 | i2c_master_send(client, buf, 3); |
247 | 281 | ||
248 | /* set the max bitrate */ | 282 | /* set the max bitrate */ |
249 | buf[0] = 0x81; | 283 | buf[0] = 0x81; |
250 | buf[1] = params->vi_bitrate.max >> 8; | 284 | buf[1] = params->vi_bitrate_peak >> 8; |
251 | buf[2] = params->vi_bitrate.max & 0xff; | 285 | buf[2] = params->vi_bitrate_peak & 0xff; |
252 | i2c_master_send(client, buf, 3); | 286 | i2c_master_send(client, buf, 3); |
287 | tot_bitrate = params->vi_bitrate_peak; | ||
253 | } else { | 288 | } else { |
254 | /* set the target bitrate (no max bitrate for CBR) */ | 289 | /* set the target bitrate (no max bitrate for CBR) */ |
255 | buf[0] = 0x81; | 290 | buf[0] = 0x81; |
256 | buf[1] = params->vi_bitrate.target >> 8; | 291 | buf[1] = params->vi_bitrate >> 8; |
257 | buf[2] = params->vi_bitrate.target & 0xff; | 292 | buf[2] = params->vi_bitrate & 0xff; |
258 | i2c_master_send(client, buf, 3); | 293 | i2c_master_send(client, buf, 3); |
294 | tot_bitrate = params->vi_bitrate; | ||
259 | } | 295 | } |
260 | 296 | ||
261 | /* set the audio bitrate */ | 297 | /* set the audio bitrate */ |
262 | buf[0] = 0x94; | 298 | buf[0] = 0x94; |
263 | buf[1] = (256 == params->au_bitrate.target) ? 0 : 1; | 299 | buf[1] = (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 0 : 1; |
264 | i2c_master_send(client, buf, 2); | 300 | i2c_master_send(client, buf, 2); |
301 | tot_bitrate += (V4L2_MPEG_AUDIO_L2_BITRATE_256K == params->au_l2_bitrate) ? 256 : 384; | ||
302 | |||
303 | /* Note: the total max bitrate is determined by adding the video and audio | ||
304 | bitrates together and also adding an extra 768kbit/s to stay on the | ||
305 | safe side. If more control should be required, then an extra MPEG control | ||
306 | should be added. */ | ||
307 | tot_bitrate += 768; | ||
308 | if (tot_bitrate > MPEG_TOTAL_TARGET_BITRATE_MAX) | ||
309 | tot_bitrate = MPEG_TOTAL_TARGET_BITRATE_MAX; | ||
265 | 310 | ||
266 | /* set the total bitrate */ | 311 | /* set the total bitrate */ |
267 | buf[0] = 0xb1; | 312 | buf[0] = 0xb1; |
268 | buf[1] = params->st_bitrate.target >> 8; | 313 | buf[1] = tot_bitrate >> 8; |
269 | buf[2] = params->st_bitrate.target & 0xff; | 314 | buf[2] = tot_bitrate & 0xff; |
270 | i2c_master_send(client, buf, 3); | 315 | i2c_master_send(client, buf, 3); |
271 | 316 | ||
272 | return 0; | 317 | return 0; |
@@ -318,50 +363,188 @@ static void saa6752hs_set_subsampling(struct i2c_client* client, | |||
318 | } | 363 | } |
319 | 364 | ||
320 | 365 | ||
321 | static void saa6752hs_set_params(struct i2c_client* client, | 366 | static void saa6752hs_old_set_params(struct i2c_client* client, |
322 | struct v4l2_mpeg_compression* params) | 367 | struct v4l2_mpeg_compression* params) |
323 | { | 368 | { |
324 | struct saa6752hs_state *h = i2c_get_clientdata(client); | 369 | struct saa6752hs_state *h = i2c_get_clientdata(client); |
325 | 370 | ||
326 | /* check PIDs */ | 371 | /* check PIDs */ |
327 | if (params->ts_pid_pmt <= MPEG_PID_MAX) | 372 | if (params->ts_pid_pmt <= MPEG_PID_MAX) { |
373 | h->old_params.ts_pid_pmt = params->ts_pid_pmt; | ||
328 | h->params.ts_pid_pmt = params->ts_pid_pmt; | 374 | h->params.ts_pid_pmt = params->ts_pid_pmt; |
329 | if (params->ts_pid_pcr <= MPEG_PID_MAX) | 375 | } |
376 | if (params->ts_pid_pcr <= MPEG_PID_MAX) { | ||
377 | h->old_params.ts_pid_pcr = params->ts_pid_pcr; | ||
330 | h->params.ts_pid_pcr = params->ts_pid_pcr; | 378 | h->params.ts_pid_pcr = params->ts_pid_pcr; |
331 | if (params->ts_pid_video <= MPEG_PID_MAX) | 379 | } |
380 | if (params->ts_pid_video <= MPEG_PID_MAX) { | ||
381 | h->old_params.ts_pid_video = params->ts_pid_video; | ||
332 | h->params.ts_pid_video = params->ts_pid_video; | 382 | h->params.ts_pid_video = params->ts_pid_video; |
333 | if (params->ts_pid_audio <= MPEG_PID_MAX) | 383 | } |
384 | if (params->ts_pid_audio <= MPEG_PID_MAX) { | ||
385 | h->old_params.ts_pid_audio = params->ts_pid_audio; | ||
334 | h->params.ts_pid_audio = params->ts_pid_audio; | 386 | h->params.ts_pid_audio = params->ts_pid_audio; |
387 | } | ||
335 | 388 | ||
336 | /* check bitrate parameters */ | 389 | /* check bitrate parameters */ |
337 | if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) || | 390 | if ((params->vi_bitrate.mode == V4L2_BITRATE_CBR) || |
338 | (params->vi_bitrate.mode == V4L2_BITRATE_VBR)) | 391 | (params->vi_bitrate.mode == V4L2_BITRATE_VBR)) { |
339 | h->params.vi_bitrate.mode = params->vi_bitrate.mode; | 392 | h->old_params.vi_bitrate.mode = params->vi_bitrate.mode; |
393 | h->params.vi_bitrate_mode = (params->vi_bitrate.mode == V4L2_BITRATE_VBR) ? | ||
394 | V4L2_MPEG_VIDEO_BITRATE_MODE_VBR : V4L2_MPEG_VIDEO_BITRATE_MODE_CBR; | ||
395 | } | ||
340 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) | 396 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) |
341 | h->params.st_bitrate.target = params->st_bitrate.target; | 397 | h->old_params.st_bitrate.target = params->st_bitrate.target; |
342 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) | 398 | if (params->vi_bitrate.mode != V4L2_BITRATE_NONE) |
343 | h->params.vi_bitrate.target = params->vi_bitrate.target; | 399 | h->old_params.vi_bitrate.target = params->vi_bitrate.target; |
344 | if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) | 400 | if (params->vi_bitrate.mode == V4L2_BITRATE_VBR) |
345 | h->params.vi_bitrate.max = params->vi_bitrate.max; | 401 | h->old_params.vi_bitrate.max = params->vi_bitrate.max; |
346 | if (params->au_bitrate.mode != V4L2_BITRATE_NONE) | 402 | if (params->au_bitrate.mode != V4L2_BITRATE_NONE) |
347 | h->params.au_bitrate.target = params->au_bitrate.target; | 403 | h->old_params.au_bitrate.target = params->au_bitrate.target; |
348 | 404 | ||
349 | /* aspect ratio */ | 405 | /* aspect ratio */ |
350 | if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || | 406 | if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3 || |
351 | params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) | 407 | params->vi_aspect_ratio == V4L2_MPEG_ASPECT_16_9) { |
352 | h->params.vi_aspect_ratio = params->vi_aspect_ratio; | 408 | h->old_params.vi_aspect_ratio = params->vi_aspect_ratio; |
409 | if (params->vi_aspect_ratio == V4L2_MPEG_ASPECT_4_3) | ||
410 | h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3; | ||
411 | else | ||
412 | h->params.vi_aspect = V4L2_MPEG_VIDEO_ASPECT_16x9; | ||
413 | } | ||
353 | 414 | ||
354 | /* range checks */ | 415 | /* range checks */ |
355 | if (h->params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) | 416 | if (h->old_params.st_bitrate.target > MPEG_TOTAL_TARGET_BITRATE_MAX) |
356 | h->params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; | 417 | h->old_params.st_bitrate.target = MPEG_TOTAL_TARGET_BITRATE_MAX; |
357 | if (h->params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX) | 418 | if (h->old_params.vi_bitrate.target > MPEG_VIDEO_TARGET_BITRATE_MAX) |
358 | h->params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX; | 419 | h->old_params.vi_bitrate.target = MPEG_VIDEO_TARGET_BITRATE_MAX; |
359 | if (h->params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX) | 420 | if (h->old_params.vi_bitrate.max > MPEG_VIDEO_MAX_BITRATE_MAX) |
360 | h->params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX; | 421 | h->old_params.vi_bitrate.max = MPEG_VIDEO_MAX_BITRATE_MAX; |
361 | if (h->params.au_bitrate.target <= 256) | 422 | h->params.vi_bitrate = params->vi_bitrate.target; |
362 | h->params.au_bitrate.target = 256; | 423 | h->params.vi_bitrate_peak = params->vi_bitrate.max; |
424 | if (h->old_params.au_bitrate.target <= 256) { | ||
425 | h->old_params.au_bitrate.target = 256; | ||
426 | h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_256K; | ||
427 | } | ||
428 | else { | ||
429 | h->old_params.au_bitrate.target = 384; | ||
430 | h->params.au_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_384K; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | static int handle_ctrl(struct saa6752hs_mpeg_params *params, | ||
435 | struct v4l2_ext_control *ctrl, int cmd) | ||
436 | { | ||
437 | int old = 0, new; | ||
438 | int set = cmd == VIDIOC_S_EXT_CTRLS; | ||
439 | |||
440 | new = ctrl->value; | ||
441 | switch (ctrl->id) { | ||
442 | case V4L2_CID_MPEG_STREAM_TYPE: | ||
443 | old = V4L2_MPEG_STREAM_TYPE_MPEG2_TS; | ||
444 | if (set && new != old) | ||
445 | return -ERANGE; | ||
446 | new = old; | ||
447 | break; | ||
448 | case V4L2_CID_MPEG_STREAM_PID_PMT: | ||
449 | old = params->ts_pid_pmt; | ||
450 | if (set && new > MPEG_PID_MAX) | ||
451 | return -ERANGE; | ||
452 | if (new > MPEG_PID_MAX) | ||
453 | new = MPEG_PID_MAX; | ||
454 | params->ts_pid_pmt = new; | ||
455 | break; | ||
456 | case V4L2_CID_MPEG_STREAM_PID_AUDIO: | ||
457 | old = params->ts_pid_audio; | ||
458 | if (set && new > MPEG_PID_MAX) | ||
459 | return -ERANGE; | ||
460 | if (new > MPEG_PID_MAX) | ||
461 | new = MPEG_PID_MAX; | ||
462 | params->ts_pid_audio = new; | ||
463 | break; | ||
464 | case V4L2_CID_MPEG_STREAM_PID_VIDEO: | ||
465 | old = params->ts_pid_video; | ||
466 | if (set && new > MPEG_PID_MAX) | ||
467 | return -ERANGE; | ||
468 | if (new > MPEG_PID_MAX) | ||
469 | new = MPEG_PID_MAX; | ||
470 | params->ts_pid_video = new; | ||
471 | break; | ||
472 | case V4L2_CID_MPEG_STREAM_PID_PCR: | ||
473 | old = params->ts_pid_pcr; | ||
474 | if (set && new > MPEG_PID_MAX) | ||
475 | return -ERANGE; | ||
476 | if (new > MPEG_PID_MAX) | ||
477 | new = MPEG_PID_MAX; | ||
478 | params->ts_pid_pcr = new; | ||
479 | break; | ||
480 | case V4L2_CID_MPEG_AUDIO_ENCODING: | ||
481 | old = V4L2_MPEG_AUDIO_ENCODING_LAYER_2; | ||
482 | if (set && new != old) | ||
483 | return -ERANGE; | ||
484 | new = old; | ||
485 | break; | ||
486 | case V4L2_CID_MPEG_AUDIO_L2_BITRATE: | ||
487 | old = params->au_l2_bitrate; | ||
488 | if (set && new != V4L2_MPEG_AUDIO_L2_BITRATE_256K && | ||
489 | new != V4L2_MPEG_AUDIO_L2_BITRATE_384K) | ||
490 | return -ERANGE; | ||
491 | if (new <= V4L2_MPEG_AUDIO_L2_BITRATE_256K) | ||
492 | new = V4L2_MPEG_AUDIO_L2_BITRATE_256K; | ||
493 | else | ||
494 | new = V4L2_MPEG_AUDIO_L2_BITRATE_384K; | ||
495 | params->au_l2_bitrate = new; | ||
496 | break; | ||
497 | case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: | ||
498 | old = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000; | ||
499 | if (set && new != old) | ||
500 | return -ERANGE; | ||
501 | new = old; | ||
502 | break; | ||
503 | case V4L2_CID_MPEG_VIDEO_ENCODING: | ||
504 | old = V4L2_MPEG_VIDEO_ENCODING_MPEG_2; | ||
505 | if (set && new != old) | ||
506 | return -ERANGE; | ||
507 | new = old; | ||
508 | break; | ||
509 | case V4L2_CID_MPEG_VIDEO_ASPECT: | ||
510 | old = params->vi_aspect; | ||
511 | if (set && new != V4L2_MPEG_VIDEO_ASPECT_16x9 && | ||
512 | new != V4L2_MPEG_VIDEO_ASPECT_4x3) | ||
513 | return -ERANGE; | ||
514 | if (new != V4L2_MPEG_VIDEO_ASPECT_16x9) | ||
515 | new = V4L2_MPEG_VIDEO_ASPECT_4x3; | ||
516 | params->vi_aspect = new; | ||
517 | break; | ||
518 | case V4L2_CID_MPEG_VIDEO_BITRATE: | ||
519 | old = params->vi_bitrate * 1000; | ||
520 | new = 1000 * (new / 1000); | ||
521 | if (set && new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000) | ||
522 | return -ERANGE; | ||
523 | if (new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000) | ||
524 | new = MPEG_VIDEO_TARGET_BITRATE_MAX * 1000; | ||
525 | params->vi_bitrate = new / 1000; | ||
526 | break; | ||
527 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: | ||
528 | old = params->vi_bitrate_peak * 1000; | ||
529 | new = 1000 * (new / 1000); | ||
530 | if (set && new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000) | ||
531 | return -ERANGE; | ||
532 | if (new > MPEG_VIDEO_TARGET_BITRATE_MAX * 1000) | ||
533 | new = MPEG_VIDEO_TARGET_BITRATE_MAX * 1000; | ||
534 | params->vi_bitrate_peak = new / 1000; | ||
535 | break; | ||
536 | case V4L2_CID_MPEG_VIDEO_BITRATE_MODE: | ||
537 | old = params->vi_bitrate_mode; | ||
538 | params->vi_bitrate_mode = new; | ||
539 | break; | ||
540 | default: | ||
541 | return -EINVAL; | ||
542 | } | ||
543 | if (cmd == VIDIOC_G_EXT_CTRLS) | ||
544 | ctrl->value = old; | ||
363 | else | 545 | else |
364 | h->params.au_bitrate.target = 384; | 546 | ctrl->value = new; |
547 | return 0; | ||
365 | } | 548 | } |
366 | 549 | ||
367 | static int saa6752hs_init(struct i2c_client* client) | 550 | static int saa6752hs_init(struct i2c_client* client) |
@@ -395,22 +578,22 @@ static int saa6752hs_init(struct i2c_client* client) | |||
395 | buf[2] = 0x0D; | 578 | buf[2] = 0x0D; |
396 | i2c_master_send(client,buf,3); | 579 | i2c_master_send(client,buf,3); |
397 | 580 | ||
398 | /* Set minimum Q-scale {4} */ | 581 | /* Set minimum Q-scale {4} */ |
399 | buf[0] = 0x82; | 582 | buf[0] = 0x82; |
400 | buf[1] = 0x04; | 583 | buf[1] = 0x04; |
401 | i2c_master_send(client,buf,2); | 584 | i2c_master_send(client,buf,2); |
402 | 585 | ||
403 | /* Set maximum Q-scale {12} */ | 586 | /* Set maximum Q-scale {12} */ |
404 | buf[0] = 0x83; | 587 | buf[0] = 0x83; |
405 | buf[1] = 0x0C; | 588 | buf[1] = 0x0C; |
406 | i2c_master_send(client,buf,2); | 589 | i2c_master_send(client,buf,2); |
407 | 590 | ||
408 | /* Set Output Protocol */ | 591 | /* Set Output Protocol */ |
409 | buf[0] = 0xD0; | 592 | buf[0] = 0xD0; |
410 | buf[1] = 0x81; | 593 | buf[1] = 0x81; |
411 | i2c_master_send(client,buf,2); | 594 | i2c_master_send(client,buf,2); |
412 | 595 | ||
413 | /* Set video output stream format {TS} */ | 596 | /* Set video output stream format {TS} */ |
414 | buf[0] = 0xB0; | 597 | buf[0] = 0xB0; |
415 | buf[1] = 0x05; | 598 | buf[1] = 0x05; |
416 | i2c_master_send(client,buf,2); | 599 | i2c_master_send(client,buf,2); |
@@ -441,7 +624,7 @@ static int saa6752hs_init(struct i2c_client* client) | |||
441 | localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF; | 624 | localPMT[sizeof(PMT) - 2] = (crc >> 8) & 0xFF; |
442 | localPMT[sizeof(PMT) - 1] = crc & 0xFF; | 625 | localPMT[sizeof(PMT) - 1] = crc & 0xFF; |
443 | 626 | ||
444 | /* Set Audio PID */ | 627 | /* Set Audio PID */ |
445 | buf[0] = 0xC1; | 628 | buf[0] = 0xC1; |
446 | buf[1] = (h->params.ts_pid_audio >> 8) & 0xFF; | 629 | buf[1] = (h->params.ts_pid_audio >> 8) & 0xFF; |
447 | buf[2] = h->params.ts_pid_audio & 0xFF; | 630 | buf[2] = h->params.ts_pid_audio & 0xFF; |
@@ -489,11 +672,11 @@ static int saa6752hs_init(struct i2c_client* client) | |||
489 | buf[3] = 0x82; | 672 | buf[3] = 0x82; |
490 | buf[4] = 0xB0; | 673 | buf[4] = 0xB0; |
491 | buf[5] = buf2[0]; | 674 | buf[5] = buf2[0]; |
492 | switch(h->params.vi_aspect_ratio) { | 675 | switch(h->params.vi_aspect) { |
493 | case V4L2_MPEG_ASPECT_16_9: | 676 | case V4L2_MPEG_VIDEO_ASPECT_16x9: |
494 | buf[6] = buf2[1] | 0x40; | 677 | buf[6] = buf2[1] | 0x40; |
495 | break; | 678 | break; |
496 | case V4L2_MPEG_ASPECT_4_3: | 679 | case V4L2_MPEG_VIDEO_ASPECT_4x3: |
497 | default: | 680 | default: |
498 | buf[6] = buf2[1] & 0xBF; | 681 | buf[6] = buf2[1] & 0xBF; |
499 | break; | 682 | break; |
@@ -515,6 +698,7 @@ static int saa6752hs_attach(struct i2c_adapter *adap, int addr, int kind) | |||
515 | return -ENOMEM; | 698 | return -ENOMEM; |
516 | h->client = client_template; | 699 | h->client = client_template; |
517 | h->params = param_defaults; | 700 | h->params = param_defaults; |
701 | h->old_params = old_param_defaults; | ||
518 | h->client.adapter = adap; | 702 | h->client.adapter = adap; |
519 | h->client.addr = addr; | 703 | h->client.addr = addr; |
520 | 704 | ||
@@ -550,20 +734,45 @@ static int | |||
550 | saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | 734 | saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) |
551 | { | 735 | { |
552 | struct saa6752hs_state *h = i2c_get_clientdata(client); | 736 | struct saa6752hs_state *h = i2c_get_clientdata(client); |
553 | struct v4l2_mpeg_compression *params = arg; | 737 | struct v4l2_ext_controls *ctrls = arg; |
738 | struct v4l2_mpeg_compression *old_params = arg; | ||
739 | struct saa6752hs_mpeg_params params; | ||
554 | int err = 0; | 740 | int err = 0; |
741 | int i; | ||
555 | 742 | ||
556 | switch (cmd) { | 743 | switch (cmd) { |
557 | case VIDIOC_S_MPEGCOMP: | 744 | case VIDIOC_S_MPEGCOMP: |
558 | if (NULL == params) { | 745 | if (NULL == old_params) { |
559 | /* apply settings and start encoder */ | 746 | /* apply settings and start encoder */ |
560 | saa6752hs_init(client); | 747 | saa6752hs_init(client); |
561 | break; | 748 | break; |
562 | } | 749 | } |
563 | saa6752hs_set_params(client, params); | 750 | saa6752hs_old_set_params(client, old_params); |
564 | /* fall through */ | 751 | /* fall through */ |
565 | case VIDIOC_G_MPEGCOMP: | 752 | case VIDIOC_G_MPEGCOMP: |
566 | *params = h->params; | 753 | *old_params = h->old_params; |
754 | break; | ||
755 | case VIDIOC_S_EXT_CTRLS: | ||
756 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
757 | return -EINVAL; | ||
758 | if (ctrls->count == 0) { | ||
759 | /* apply settings and start encoder */ | ||
760 | saa6752hs_init(client); | ||
761 | break; | ||
762 | } | ||
763 | /* fall through */ | ||
764 | case VIDIOC_TRY_EXT_CTRLS: | ||
765 | case VIDIOC_G_EXT_CTRLS: | ||
766 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
767 | return -EINVAL; | ||
768 | params = h->params; | ||
769 | for (i = 0; i < ctrls->count; i++) { | ||
770 | if ((err = handle_ctrl(¶ms, ctrls->controls + i, cmd))) { | ||
771 | ctrls->error_idx = i; | ||
772 | return err; | ||
773 | } | ||
774 | } | ||
775 | h->params = params; | ||
567 | break; | 776 | break; |
568 | case VIDIOC_G_FMT: | 777 | case VIDIOC_G_FMT: |
569 | { | 778 | { |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index bb3e0ba946d3..d77e6a8d9432 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -818,7 +818,7 @@ static int snd_saa7134_capsrc_put(struct snd_kcontrol * kcontrol, | |||
818 | break; | 818 | break; |
819 | } | 819 | } |
820 | 820 | ||
821 | /* output xbar always main channel */ | 821 | /* output xbar always main channel */ |
822 | saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); | 822 | saa_dsp_writel(dev, SAA7133_DIGITAL_OUTPUT_SEL1, 0xbbbb10); |
823 | 823 | ||
824 | if (left || right) { // We've got data, turn the input on | 824 | if (left || right) { // We've got data, turn the input on |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 86eae3528330..927413aded10 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -2160,7 +2160,7 @@ struct saa7134_board saa7134_boards[] = { | |||
2160 | .radio = { | 2160 | .radio = { |
2161 | .name = name_radio, | 2161 | .name = name_radio, |
2162 | .amux = LINE2, | 2162 | .amux = LINE2, |
2163 | }, | 2163 | }, |
2164 | }, | 2164 | }, |
2165 | [SAA7134_BOARD_GOTVIEW_7135] = { | 2165 | [SAA7134_BOARD_GOTVIEW_7135] = { |
2166 | /* Mike Baikov <mike@baikov.com> */ | 2166 | /* Mike Baikov <mike@baikov.com> */ |
@@ -2842,6 +2842,55 @@ struct saa7134_board saa7134_boards[] = { | |||
2842 | .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */ | 2842 | .gpio = 0x000000, /* GPIO21=Low for FM radio antenna */ |
2843 | }, | 2843 | }, |
2844 | }, | 2844 | }, |
2845 | [SAA7134_BOARD_FLYVIDEO3000_NTSC] = { | ||
2846 | /* "Zac Bowling" <zac@zacbowling.com> */ | ||
2847 | .name = "LifeView FlyVIDEO3000 (NTSC)", | ||
2848 | .audio_clock = 0x00200000, | ||
2849 | .tuner_type = TUNER_PHILIPS_NTSC, | ||
2850 | .radio_type = UNSET, | ||
2851 | .tuner_addr = ADDR_UNSET, | ||
2852 | .radio_addr = ADDR_UNSET, | ||
2853 | |||
2854 | .gpiomask = 0xe000, | ||
2855 | .inputs = {{ | ||
2856 | .name = name_tv, | ||
2857 | .vmux = 1, | ||
2858 | .amux = TV, | ||
2859 | .gpio = 0x8000, | ||
2860 | .tv = 1, | ||
2861 | },{ | ||
2862 | .name = name_tv_mono, | ||
2863 | .vmux = 1, | ||
2864 | .amux = LINE2, | ||
2865 | .gpio = 0x0000, | ||
2866 | .tv = 1, | ||
2867 | },{ | ||
2868 | .name = name_comp1, | ||
2869 | .vmux = 0, | ||
2870 | .amux = LINE2, | ||
2871 | .gpio = 0x4000, | ||
2872 | },{ | ||
2873 | .name = name_comp2, | ||
2874 | .vmux = 3, | ||
2875 | .amux = LINE2, | ||
2876 | .gpio = 0x4000, | ||
2877 | },{ | ||
2878 | .name = name_svideo, | ||
2879 | .vmux = 8, | ||
2880 | .amux = LINE2, | ||
2881 | .gpio = 0x4000, | ||
2882 | }}, | ||
2883 | .radio = { | ||
2884 | .name = name_radio, | ||
2885 | .amux = LINE2, | ||
2886 | .gpio = 0x2000, | ||
2887 | }, | ||
2888 | .mute = { | ||
2889 | .name = name_mute, | ||
2890 | .amux = TV, | ||
2891 | .gpio = 0x8000, | ||
2892 | }, | ||
2893 | }, | ||
2845 | }; | 2894 | }; |
2846 | 2895 | ||
2847 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); | 2896 | const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); |
@@ -2901,6 +2950,12 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
2901 | },{ | 2950 | },{ |
2902 | .vendor = PCI_VENDOR_ID_PHILIPS, | 2951 | .vendor = PCI_VENDOR_ID_PHILIPS, |
2903 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 2952 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
2953 | .subvendor = 0x5169, | ||
2954 | .subdevice = 0x0138, | ||
2955 | .driver_data = SAA7134_BOARD_FLYVIDEO3000_NTSC, | ||
2956 | },{ | ||
2957 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
2958 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | ||
2904 | .subvendor = 0x5168, | 2959 | .subvendor = 0x5168, |
2905 | .subdevice = 0x0138, | 2960 | .subdevice = 0x0138, |
2906 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, | 2961 | .driver_data = SAA7134_BOARD_FLYVIDEO3000, |
@@ -3459,6 +3514,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) | |||
3459 | switch (dev->board) { | 3514 | switch (dev->board) { |
3460 | case SAA7134_BOARD_FLYVIDEO2000: | 3515 | case SAA7134_BOARD_FLYVIDEO2000: |
3461 | case SAA7134_BOARD_FLYVIDEO3000: | 3516 | case SAA7134_BOARD_FLYVIDEO3000: |
3517 | case SAA7134_BOARD_FLYVIDEO3000_NTSC: | ||
3462 | dev->has_remote = SAA7134_REMOTE_GPIO; | 3518 | dev->has_remote = SAA7134_REMOTE_GPIO; |
3463 | board_flyvideo(dev); | 3519 | board_flyvideo(dev); |
3464 | break; | 3520 | break; |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 222a36c38917..279828b8f299 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -132,9 +132,8 @@ static int mt352_aver777_init(struct dvb_frontend* fe) | |||
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, | 135 | static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe, |
136 | struct dvb_frontend_parameters* params, | 136 | struct dvb_frontend_parameters* params) |
137 | u8* pllbuf) | ||
138 | { | 137 | { |
139 | u8 off[] = { 0x00, 0xf1}; | 138 | u8 off[] = { 0x00, 0xf1}; |
140 | u8 on[] = { 0x00, 0x71}; | 139 | u8 on[] = { 0x00, 0x71}; |
@@ -147,30 +146,31 @@ static int mt352_pinnacle_pll_set(struct dvb_frontend* fe, | |||
147 | f.tuner = 0; | 146 | f.tuner = 0; |
148 | f.type = V4L2_TUNER_DIGITAL_TV; | 147 | f.type = V4L2_TUNER_DIGITAL_TV; |
149 | f.frequency = params->frequency / 1000 * 16 / 1000; | 148 | f.frequency = params->frequency / 1000 * 16 / 1000; |
149 | if (fe->ops.i2c_gate_ctrl) | ||
150 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
150 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 151 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
151 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); | 152 | saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f); |
152 | msg.buf = on; | 153 | msg.buf = on; |
154 | if (fe->ops.i2c_gate_ctrl) | ||
155 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
153 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 156 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
154 | 157 | ||
155 | pinnacle_antenna_pwr(dev, antenna_pwr); | 158 | pinnacle_antenna_pwr(dev, antenna_pwr); |
156 | 159 | ||
157 | /* mt352 setup */ | 160 | /* mt352 setup */ |
158 | mt352_pinnacle_init(fe); | 161 | return mt352_pinnacle_init(fe); |
159 | pllbuf[0] = 0xc2; | ||
160 | pllbuf[1] = 0x00; | ||
161 | pllbuf[2] = 0x00; | ||
162 | pllbuf[3] = 0x80; | ||
163 | pllbuf[4] = 0x00; | ||
164 | return 0; | ||
165 | } | 162 | } |
166 | 163 | ||
167 | static int mt352_aver777_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf) | 164 | static int mt352_aver777_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len) |
168 | { | 165 | { |
169 | pllbuf[0] = 0xc2; | 166 | if (buf_len < 5) |
167 | return -EINVAL; | ||
168 | |||
169 | pllbuf[0] = 0x61; | ||
170 | dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1, | 170 | dvb_pll_configure(&dvb_pll_philips_td1316, pllbuf+1, |
171 | params->frequency, | 171 | params->frequency, |
172 | params->u.ofdm.bandwidth); | 172 | params->u.ofdm.bandwidth); |
173 | return 0; | 173 | return 5; |
174 | } | 174 | } |
175 | 175 | ||
176 | static struct mt352_config pinnacle_300i = { | 176 | static struct mt352_config pinnacle_300i = { |
@@ -179,13 +179,11 @@ static struct mt352_config pinnacle_300i = { | |||
179 | .if2 = 36150, | 179 | .if2 = 36150, |
180 | .no_tuner = 1, | 180 | .no_tuner = 1, |
181 | .demod_init = mt352_pinnacle_init, | 181 | .demod_init = mt352_pinnacle_init, |
182 | .pll_set = mt352_pinnacle_pll_set, | ||
183 | }; | 182 | }; |
184 | 183 | ||
185 | static struct mt352_config avermedia_777 = { | 184 | static struct mt352_config avermedia_777 = { |
186 | .demod_address = 0xf, | 185 | .demod_address = 0xf, |
187 | .demod_init = mt352_aver777_init, | 186 | .demod_init = mt352_aver777_init, |
188 | .pll_set = mt352_aver777_pll_set, | ||
189 | }; | 187 | }; |
190 | #endif | 188 | #endif |
191 | 189 | ||
@@ -268,6 +266,8 @@ static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_ | |||
268 | tuner_buf[2] = 0xca; | 266 | tuner_buf[2] = 0xca; |
269 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; | 267 | tuner_buf[3] = (cp << 5) | (filter << 3) | band; |
270 | 268 | ||
269 | if (fe->ops.i2c_gate_ctrl) | ||
270 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
271 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 271 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
272 | return -EIO; | 272 | return -EIO; |
273 | msleep(1); | 273 | msleep(1); |
@@ -281,6 +281,8 @@ static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) | |||
281 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; | 281 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) }; |
282 | 282 | ||
283 | /* setup PLL configuration */ | 283 | /* setup PLL configuration */ |
284 | if (fe->ops.i2c_gate_ctrl) | ||
285 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
284 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 286 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
285 | return -EIO; | 287 | return -EIO; |
286 | msleep(1); | 288 | msleep(1); |
@@ -290,12 +292,12 @@ static int philips_tda6651_pll_init(u8 addr, struct dvb_frontend *fe) | |||
290 | 292 | ||
291 | /* ------------------------------------------------------------------ */ | 293 | /* ------------------------------------------------------------------ */ |
292 | 294 | ||
293 | static int philips_tu1216_pll_60_init(struct dvb_frontend *fe) | 295 | static int philips_tu1216_tuner_60_init(struct dvb_frontend *fe) |
294 | { | 296 | { |
295 | return philips_tda6651_pll_init(0x60, fe); | 297 | return philips_tda6651_pll_init(0x60, fe); |
296 | } | 298 | } |
297 | 299 | ||
298 | static int philips_tu1216_pll_60_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 300 | static int philips_tu1216_tuner_60_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
299 | { | 301 | { |
300 | return philips_tda6651_pll_set(0x60, fe, params); | 302 | return philips_tda6651_pll_set(0x60, fe, params); |
301 | } | 303 | } |
@@ -315,20 +317,17 @@ static struct tda1004x_config philips_tu1216_60_config = { | |||
315 | .xtal_freq = TDA10046_XTAL_4M, | 317 | .xtal_freq = TDA10046_XTAL_4M, |
316 | .agc_config = TDA10046_AGC_DEFAULT, | 318 | .agc_config = TDA10046_AGC_DEFAULT, |
317 | .if_freq = TDA10046_FREQ_3617, | 319 | .if_freq = TDA10046_FREQ_3617, |
318 | .pll_init = philips_tu1216_pll_60_init, | ||
319 | .pll_set = philips_tu1216_pll_60_set, | ||
320 | .pll_sleep = NULL, | ||
321 | .request_firmware = philips_tu1216_request_firmware, | 320 | .request_firmware = philips_tu1216_request_firmware, |
322 | }; | 321 | }; |
323 | 322 | ||
324 | /* ------------------------------------------------------------------ */ | 323 | /* ------------------------------------------------------------------ */ |
325 | 324 | ||
326 | static int philips_tu1216_pll_61_init(struct dvb_frontend *fe) | 325 | static int philips_tu1216_tuner_61_init(struct dvb_frontend *fe) |
327 | { | 326 | { |
328 | return philips_tda6651_pll_init(0x61, fe); | 327 | return philips_tda6651_pll_init(0x61, fe); |
329 | } | 328 | } |
330 | 329 | ||
331 | static int philips_tu1216_pll_61_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 330 | static int philips_tu1216_tuner_61_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
332 | { | 331 | { |
333 | return philips_tda6651_pll_set(0x61, fe, params); | 332 | return philips_tda6651_pll_set(0x61, fe, params); |
334 | } | 333 | } |
@@ -341,21 +340,20 @@ static struct tda1004x_config philips_tu1216_61_config = { | |||
341 | .xtal_freq = TDA10046_XTAL_4M, | 340 | .xtal_freq = TDA10046_XTAL_4M, |
342 | .agc_config = TDA10046_AGC_DEFAULT, | 341 | .agc_config = TDA10046_AGC_DEFAULT, |
343 | .if_freq = TDA10046_FREQ_3617, | 342 | .if_freq = TDA10046_FREQ_3617, |
344 | .pll_init = philips_tu1216_pll_61_init, | ||
345 | .pll_set = philips_tu1216_pll_61_set, | ||
346 | .pll_sleep = NULL, | ||
347 | .request_firmware = philips_tu1216_request_firmware, | 343 | .request_firmware = philips_tu1216_request_firmware, |
348 | }; | 344 | }; |
349 | 345 | ||
350 | /* ------------------------------------------------------------------ */ | 346 | /* ------------------------------------------------------------------ */ |
351 | 347 | ||
352 | static int philips_europa_pll_init(struct dvb_frontend *fe) | 348 | static int philips_europa_tuner_init(struct dvb_frontend *fe) |
353 | { | 349 | { |
354 | struct saa7134_dev *dev = fe->dvb->priv; | 350 | struct saa7134_dev *dev = fe->dvb->priv; |
355 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; | 351 | static u8 msg[] = { 0x0b, 0xf5, 0x86, 0xab }; |
356 | struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; | 352 | struct i2c_msg init_msg = {.addr = 0x61,.flags = 0,.buf = msg,.len = sizeof(msg) }; |
357 | 353 | ||
358 | /* setup PLL configuration */ | 354 | /* setup PLL configuration */ |
355 | if (fe->ops.i2c_gate_ctrl) | ||
356 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
359 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) | 357 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
360 | return -EIO; | 358 | return -EIO; |
361 | msleep(1); | 359 | msleep(1); |
@@ -365,18 +363,20 @@ static int philips_europa_pll_init(struct dvb_frontend *fe) | |||
365 | init_msg.len = 0x02; | 363 | init_msg.len = 0x02; |
366 | msg[0] = 0x00; | 364 | msg[0] = 0x00; |
367 | msg[1] = 0x40; | 365 | msg[1] = 0x40; |
366 | if (fe->ops.i2c_gate_ctrl) | ||
367 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
368 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) | 368 | if (i2c_transfer(&dev->i2c_adap, &init_msg, 1) != 1) |
369 | return -EIO; | 369 | return -EIO; |
370 | 370 | ||
371 | return 0; | 371 | return 0; |
372 | } | 372 | } |
373 | 373 | ||
374 | static int philips_td1316_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 374 | static int philips_td1316_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
375 | { | 375 | { |
376 | return philips_tda6651_pll_set(0x61, fe, params); | 376 | return philips_tda6651_pll_set(0x61, fe, params); |
377 | } | 377 | } |
378 | 378 | ||
379 | static void philips_europa_analog(struct dvb_frontend *fe) | 379 | static int philips_europa_tuner_sleep(struct dvb_frontend *fe) |
380 | { | 380 | { |
381 | struct saa7134_dev *dev = fe->dvb->priv; | 381 | struct saa7134_dev *dev = fe->dvb->priv; |
382 | /* this message actually turns the tuner back to analog mode */ | 382 | /* this message actually turns the tuner back to analog mode */ |
@@ -391,7 +391,20 @@ static void philips_europa_analog(struct dvb_frontend *fe) | |||
391 | analog_msg.len = 0x02; | 391 | analog_msg.len = 0x02; |
392 | msg[0] = 0x00; | 392 | msg[0] = 0x00; |
393 | msg[1] = 0x14; | 393 | msg[1] = 0x14; |
394 | if (fe->ops.i2c_gate_ctrl) | ||
395 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
394 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); | 396 | i2c_transfer(&dev->i2c_adap, &analog_msg, 1); |
397 | return 0; | ||
398 | } | ||
399 | |||
400 | static int philips_europa_demod_sleep(struct dvb_frontend *fe) | ||
401 | { | ||
402 | struct saa7134_dev *dev = fe->dvb->priv; | ||
403 | |||
404 | if (dev->original_demod_sleep) | ||
405 | dev->original_demod_sleep(fe); | ||
406 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
407 | return 0; | ||
395 | } | 408 | } |
396 | 409 | ||
397 | static struct tda1004x_config philips_europa_config = { | 410 | static struct tda1004x_config philips_europa_config = { |
@@ -402,21 +415,20 @@ static struct tda1004x_config philips_europa_config = { | |||
402 | .xtal_freq = TDA10046_XTAL_4M, | 415 | .xtal_freq = TDA10046_XTAL_4M, |
403 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, | 416 | .agc_config = TDA10046_AGC_IFO_AUTO_POS, |
404 | .if_freq = TDA10046_FREQ_052, | 417 | .if_freq = TDA10046_FREQ_052, |
405 | .pll_init = philips_europa_pll_init, | ||
406 | .pll_set = philips_td1316_pll_set, | ||
407 | .pll_sleep = philips_europa_analog, | ||
408 | .request_firmware = NULL, | 418 | .request_firmware = NULL, |
409 | }; | 419 | }; |
410 | 420 | ||
411 | /* ------------------------------------------------------------------ */ | 421 | /* ------------------------------------------------------------------ */ |
412 | 422 | ||
413 | static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | 423 | static int philips_fmd1216_tuner_init(struct dvb_frontend *fe) |
414 | { | 424 | { |
415 | struct saa7134_dev *dev = fe->dvb->priv; | 425 | struct saa7134_dev *dev = fe->dvb->priv; |
416 | /* this message is to set up ATC and ALC */ | 426 | /* this message is to set up ATC and ALC */ |
417 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; | 427 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 }; |
418 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | 428 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
419 | 429 | ||
430 | if (fe->ops.i2c_gate_ctrl) | ||
431 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
420 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 432 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
421 | return -EIO; | 433 | return -EIO; |
422 | msleep(1); | 434 | msleep(1); |
@@ -424,22 +436,27 @@ static int philips_fmd1216_pll_init(struct dvb_frontend *fe) | |||
424 | return 0; | 436 | return 0; |
425 | } | 437 | } |
426 | 438 | ||
427 | static void philips_fmd1216_analog(struct dvb_frontend *fe) | 439 | static int philips_fmd1216_tuner_sleep(struct dvb_frontend *fe) |
428 | { | 440 | { |
429 | struct saa7134_dev *dev = fe->dvb->priv; | 441 | struct saa7134_dev *dev = fe->dvb->priv; |
430 | /* this message actually turns the tuner back to analog mode */ | 442 | /* this message actually turns the tuner back to analog mode */ |
431 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; | 443 | static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 }; |
432 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; | 444 | struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) }; |
433 | 445 | ||
446 | if (fe->ops.i2c_gate_ctrl) | ||
447 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
434 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | 448 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
435 | msleep(1); | 449 | msleep(1); |
436 | fmd1216_init[2] = 0x86; | 450 | fmd1216_init[2] = 0x86; |
437 | fmd1216_init[3] = 0x54; | 451 | fmd1216_init[3] = 0x54; |
452 | if (fe->ops.i2c_gate_ctrl) | ||
453 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
438 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | 454 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
439 | msleep(1); | 455 | msleep(1); |
456 | return 0; | ||
440 | } | 457 | } |
441 | 458 | ||
442 | static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 459 | static int philips_fmd1216_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
443 | { | 460 | { |
444 | struct saa7134_dev *dev = fe->dvb->priv; | 461 | struct saa7134_dev *dev = fe->dvb->priv; |
445 | u8 tuner_buf[4]; | 462 | u8 tuner_buf[4]; |
@@ -516,6 +533,8 @@ static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ | |||
516 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; | 533 | tuner_buf[2] = 0x80 | (cp << 6) | (mode << 3) | 4; |
517 | tuner_buf[3] = 0x40 | band; | 534 | tuner_buf[3] = 0x40 | band; |
518 | 535 | ||
536 | if (fe->ops.i2c_gate_ctrl) | ||
537 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
519 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 538 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
520 | return -EIO; | 539 | return -EIO; |
521 | return 0; | 540 | return 0; |
@@ -528,9 +547,6 @@ static struct tda1004x_config medion_cardbus = { | |||
528 | .xtal_freq = TDA10046_XTAL_16M, | 547 | .xtal_freq = TDA10046_XTAL_16M, |
529 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, | 548 | .agc_config = TDA10046_AGC_IFO_AUTO_NEG, |
530 | .if_freq = TDA10046_FREQ_3613, | 549 | .if_freq = TDA10046_FREQ_3613, |
531 | .pll_init = philips_fmd1216_pll_init, | ||
532 | .pll_set = philips_fmd1216_pll_set, | ||
533 | .pll_sleep = philips_fmd1216_analog, | ||
534 | .request_firmware = NULL, | 550 | .request_firmware = NULL, |
535 | }; | 551 | }; |
536 | 552 | ||
@@ -578,12 +594,12 @@ static struct tda827x_data tda827x_dvbt[] = { | |||
578 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} | 594 | { .lomax = 0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0} |
579 | }; | 595 | }; |
580 | 596 | ||
581 | static int philips_tda827x_pll_init(struct dvb_frontend *fe) | 597 | static int philips_tda827x_tuner_init(struct dvb_frontend *fe) |
582 | { | 598 | { |
583 | return 0; | 599 | return 0; |
584 | } | 600 | } |
585 | 601 | ||
586 | static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 602 | static int philips_tda827x_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
587 | { | 603 | { |
588 | struct saa7134_dev *dev = fe->dvb->priv; | 604 | struct saa7134_dev *dev = fe->dvb->priv; |
589 | u8 tuner_buf[14]; | 605 | u8 tuner_buf[14]; |
@@ -630,6 +646,8 @@ static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ | |||
630 | tuner_buf[13] = 0x40; | 646 | tuner_buf[13] = 0x40; |
631 | 647 | ||
632 | tuner_msg.len = 14; | 648 | tuner_msg.len = 14; |
649 | if (fe->ops.i2c_gate_ctrl) | ||
650 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
633 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) | 651 | if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1) |
634 | return -EIO; | 652 | return -EIO; |
635 | 653 | ||
@@ -638,18 +656,23 @@ static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_ | |||
638 | tuner_buf[0] = 0x30; | 656 | tuner_buf[0] = 0x30; |
639 | tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp; | 657 | tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp; |
640 | tuner_msg.len = 2; | 658 | tuner_msg.len = 2; |
659 | if (fe->ops.i2c_gate_ctrl) | ||
660 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
641 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | 661 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
642 | 662 | ||
643 | return 0; | 663 | return 0; |
644 | } | 664 | } |
645 | 665 | ||
646 | static void philips_tda827x_pll_sleep(struct dvb_frontend *fe) | 666 | static int philips_tda827x_tuner_sleep(struct dvb_frontend *fe) |
647 | { | 667 | { |
648 | struct saa7134_dev *dev = fe->dvb->priv; | 668 | struct saa7134_dev *dev = fe->dvb->priv; |
649 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; | 669 | static u8 tda827x_sleep[] = { 0x30, 0xd0}; |
650 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, | 670 | struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep, |
651 | .len = sizeof(tda827x_sleep) }; | 671 | .len = sizeof(tda827x_sleep) }; |
672 | if (fe->ops.i2c_gate_ctrl) | ||
673 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
652 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | 674 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
675 | return 0; | ||
653 | } | 676 | } |
654 | 677 | ||
655 | static struct tda1004x_config tda827x_lifeview_config = { | 678 | static struct tda1004x_config tda827x_lifeview_config = { |
@@ -659,9 +682,6 @@ static struct tda1004x_config tda827x_lifeview_config = { | |||
659 | .xtal_freq = TDA10046_XTAL_16M, | 682 | .xtal_freq = TDA10046_XTAL_16M, |
660 | .agc_config = TDA10046_AGC_TDA827X, | 683 | .agc_config = TDA10046_AGC_TDA827X, |
661 | .if_freq = TDA10046_FREQ_045, | 684 | .if_freq = TDA10046_FREQ_045, |
662 | .pll_init = philips_tda827x_pll_init, | ||
663 | .pll_set = philips_tda827x_pll_set, | ||
664 | .pll_sleep = philips_tda827x_pll_sleep, | ||
665 | .request_firmware = NULL, | 685 | .request_firmware = NULL, |
666 | }; | 686 | }; |
667 | 687 | ||
@@ -753,6 +773,8 @@ static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb | |||
753 | tuner_buf[12] = 0x00; | 773 | tuner_buf[12] = 0x00; |
754 | tuner_buf[13] = 0x39; // lpsel | 774 | tuner_buf[13] = 0x39; // lpsel |
755 | msg.len = 14; | 775 | msg.len = 14; |
776 | if (fe->ops.i2c_gate_ctrl) | ||
777 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
756 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) | 778 | if (i2c_transfer(&dev->i2c_adap, &msg, 1) != 1) |
757 | return -EIO; | 779 | return -EIO; |
758 | 780 | ||
@@ -760,10 +782,14 @@ static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb | |||
760 | msg.len = 2; | 782 | msg.len = 2; |
761 | reg2[0] = 0x60; | 783 | reg2[0] = 0x60; |
762 | reg2[1] = 0x3c; | 784 | reg2[1] = 0x3c; |
785 | if (fe->ops.i2c_gate_ctrl) | ||
786 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
763 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 787 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
764 | 788 | ||
765 | reg2[0] = 0xa0; | 789 | reg2[0] = 0xa0; |
766 | reg2[1] = 0x40; | 790 | reg2[1] = 0x40; |
791 | if (fe->ops.i2c_gate_ctrl) | ||
792 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
767 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 793 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
768 | 794 | ||
769 | msleep(2); | 795 | msleep(2); |
@@ -771,36 +797,43 @@ static int philips_tda827xa_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb | |||
771 | reg2[0] = 0x30; | 797 | reg2[0] = 0x30; |
772 | reg2[1] = 0x10 + tda827xa_dvbt[i].scr; | 798 | reg2[1] = 0x10 + tda827xa_dvbt[i].scr; |
773 | msg.len = 2; | 799 | msg.len = 2; |
800 | if (fe->ops.i2c_gate_ctrl) | ||
801 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
774 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 802 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
775 | 803 | ||
776 | msleep(550); | 804 | msleep(550); |
777 | reg2[0] = 0x50; | 805 | reg2[0] = 0x50; |
778 | reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); | 806 | reg2[1] = 0x4f + (tda827xa_dvbt[i].gc3 << 4); |
807 | if (fe->ops.i2c_gate_ctrl) | ||
808 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
779 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 809 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
780 | 810 | ||
781 | return 0; | 811 | return 0; |
782 | 812 | ||
783 | } | 813 | } |
784 | 814 | ||
785 | static void philips_tda827xa_pll_sleep(u8 addr, struct dvb_frontend *fe) | 815 | static int philips_tda827xa_tuner_sleep(u8 addr, struct dvb_frontend *fe) |
786 | { | 816 | { |
787 | struct saa7134_dev *dev = fe->dvb->priv; | 817 | struct saa7134_dev *dev = fe->dvb->priv; |
788 | static u8 tda827xa_sleep[] = { 0x30, 0x90}; | 818 | static u8 tda827xa_sleep[] = { 0x30, 0x90}; |
789 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, | 819 | struct i2c_msg tuner_msg = {.addr = addr,.flags = 0,.buf = tda827xa_sleep, |
790 | .len = sizeof(tda827xa_sleep) }; | 820 | .len = sizeof(tda827xa_sleep) }; |
821 | if (fe->ops.i2c_gate_ctrl) | ||
822 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
791 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); | 823 | i2c_transfer(&dev->i2c_adap, &tuner_msg, 1); |
792 | 824 | return 0; | |
793 | } | 825 | } |
794 | 826 | ||
795 | /* ------------------------------------------------------------------ */ | 827 | /* ------------------------------------------------------------------ */ |
796 | 828 | ||
797 | static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 829 | static int philips_tiger_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
798 | { | 830 | { |
799 | int ret; | 831 | int ret; |
800 | struct saa7134_dev *dev = fe->dvb->priv; | 832 | struct saa7134_dev *dev = fe->dvb->priv; |
801 | static u8 tda8290_close[] = { 0x21, 0xc0}; | 833 | static u8 tda8290_close[] = { 0x21, 0xc0}; |
802 | static u8 tda8290_open[] = { 0x21, 0x80}; | 834 | static u8 tda8290_open[] = { 0x21, 0x80}; |
803 | struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; | 835 | struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; |
836 | |||
804 | /* close tda8290 i2c bridge */ | 837 | /* close tda8290 i2c bridge */ |
805 | tda8290_msg.buf = tda8290_close; | 838 | tda8290_msg.buf = tda8290_close; |
806 | ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); | 839 | ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); |
@@ -816,7 +849,7 @@ static int philips_tiger_pll_set(struct dvb_frontend *fe, struct dvb_frontend_pa | |||
816 | return ret; | 849 | return ret; |
817 | } | 850 | } |
818 | 851 | ||
819 | static int philips_tiger_dvb_mode(struct dvb_frontend *fe) | 852 | static int philips_tiger_tuner_init(struct dvb_frontend *fe) |
820 | { | 853 | { |
821 | struct saa7134_dev *dev = fe->dvb->priv; | 854 | struct saa7134_dev *dev = fe->dvb->priv; |
822 | static u8 data[] = { 0x3c, 0x33, 0x6a}; | 855 | static u8 data[] = { 0x3c, 0x33, 0x6a}; |
@@ -827,14 +860,15 @@ static int philips_tiger_dvb_mode(struct dvb_frontend *fe) | |||
827 | return 0; | 860 | return 0; |
828 | } | 861 | } |
829 | 862 | ||
830 | static void philips_tiger_analog_mode(struct dvb_frontend *fe) | 863 | static int philips_tiger_tuner_sleep(struct dvb_frontend *fe) |
831 | { | 864 | { |
832 | struct saa7134_dev *dev = fe->dvb->priv; | 865 | struct saa7134_dev *dev = fe->dvb->priv; |
833 | static u8 data[] = { 0x3c, 0x33, 0x68}; | 866 | static u8 data[] = { 0x3c, 0x33, 0x68}; |
834 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; | 867 | struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; |
835 | 868 | ||
836 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 869 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
837 | philips_tda827xa_pll_sleep( 0x61, fe); | 870 | philips_tda827xa_tuner_sleep( 0x61, fe); |
871 | return 0; | ||
838 | } | 872 | } |
839 | 873 | ||
840 | static struct tda1004x_config philips_tiger_config = { | 874 | static struct tda1004x_config philips_tiger_config = { |
@@ -844,15 +878,12 @@ static struct tda1004x_config philips_tiger_config = { | |||
844 | .xtal_freq = TDA10046_XTAL_16M, | 878 | .xtal_freq = TDA10046_XTAL_16M, |
845 | .agc_config = TDA10046_AGC_TDA827X, | 879 | .agc_config = TDA10046_AGC_TDA827X, |
846 | .if_freq = TDA10046_FREQ_045, | 880 | .if_freq = TDA10046_FREQ_045, |
847 | .pll_init = philips_tiger_dvb_mode, | ||
848 | .pll_set = philips_tiger_pll_set, | ||
849 | .pll_sleep = philips_tiger_analog_mode, | ||
850 | .request_firmware = NULL, | 881 | .request_firmware = NULL, |
851 | }; | 882 | }; |
852 | 883 | ||
853 | /* ------------------------------------------------------------------ */ | 884 | /* ------------------------------------------------------------------ */ |
854 | 885 | ||
855 | static int lifeview_trio_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 886 | static int lifeview_trio_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
856 | { | 887 | { |
857 | int ret; | 888 | int ret; |
858 | 889 | ||
@@ -860,16 +891,12 @@ static int lifeview_trio_pll_set(struct dvb_frontend *fe, struct dvb_frontend_pa | |||
860 | return ret; | 891 | return ret; |
861 | } | 892 | } |
862 | 893 | ||
863 | static int lifeview_trio_dvb_mode(struct dvb_frontend *fe) | 894 | static int lifeview_trio_tuner_sleep(struct dvb_frontend *fe) |
864 | { | 895 | { |
896 | philips_tda827xa_tuner_sleep(0x60, fe); | ||
865 | return 0; | 897 | return 0; |
866 | } | 898 | } |
867 | 899 | ||
868 | static void lifeview_trio_analog_mode(struct dvb_frontend *fe) | ||
869 | { | ||
870 | philips_tda827xa_pll_sleep(0x60, fe); | ||
871 | } | ||
872 | |||
873 | static struct tda1004x_config lifeview_trio_config = { | 900 | static struct tda1004x_config lifeview_trio_config = { |
874 | .demod_address = 0x09, | 901 | .demod_address = 0x09, |
875 | .invert = 1, | 902 | .invert = 1, |
@@ -877,15 +904,12 @@ static struct tda1004x_config lifeview_trio_config = { | |||
877 | .xtal_freq = TDA10046_XTAL_16M, | 904 | .xtal_freq = TDA10046_XTAL_16M, |
878 | .agc_config = TDA10046_AGC_TDA827X_GPL, | 905 | .agc_config = TDA10046_AGC_TDA827X_GPL, |
879 | .if_freq = TDA10046_FREQ_045, | 906 | .if_freq = TDA10046_FREQ_045, |
880 | .pll_init = lifeview_trio_dvb_mode, | ||
881 | .pll_set = lifeview_trio_pll_set, | ||
882 | .pll_sleep = lifeview_trio_analog_mode, | ||
883 | .request_firmware = NULL, | 907 | .request_firmware = NULL, |
884 | }; | 908 | }; |
885 | 909 | ||
886 | /* ------------------------------------------------------------------ */ | 910 | /* ------------------------------------------------------------------ */ |
887 | 911 | ||
888 | static int ads_duo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 912 | static int ads_duo_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
889 | { | 913 | { |
890 | int ret; | 914 | int ret; |
891 | 915 | ||
@@ -893,7 +917,7 @@ static int ads_duo_pll_set(struct dvb_frontend *fe, struct dvb_frontend_paramete | |||
893 | return ret; | 917 | return ret; |
894 | } | 918 | } |
895 | 919 | ||
896 | static int ads_duo_dvb_mode(struct dvb_frontend *fe) | 920 | static int ads_duo_tuner_init(struct dvb_frontend *fe) |
897 | { | 921 | { |
898 | struct saa7134_dev *dev = fe->dvb->priv; | 922 | struct saa7134_dev *dev = fe->dvb->priv; |
899 | /* route TDA8275a AGC input to the channel decoder */ | 923 | /* route TDA8275a AGC input to the channel decoder */ |
@@ -901,12 +925,13 @@ static int ads_duo_dvb_mode(struct dvb_frontend *fe) | |||
901 | return 0; | 925 | return 0; |
902 | } | 926 | } |
903 | 927 | ||
904 | static void ads_duo_analog_mode(struct dvb_frontend *fe) | 928 | static int ads_duo_tuner_sleep(struct dvb_frontend *fe) |
905 | { | 929 | { |
906 | struct saa7134_dev *dev = fe->dvb->priv; | 930 | struct saa7134_dev *dev = fe->dvb->priv; |
907 | /* route TDA8275a AGC input to the analog IF chip*/ | 931 | /* route TDA8275a AGC input to the analog IF chip*/ |
908 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20); | 932 | saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x20); |
909 | philips_tda827xa_pll_sleep( 0x61, fe); | 933 | philips_tda827xa_tuner_sleep( 0x61, fe); |
934 | return 0; | ||
910 | } | 935 | } |
911 | 936 | ||
912 | static struct tda1004x_config ads_tech_duo_config = { | 937 | static struct tda1004x_config ads_tech_duo_config = { |
@@ -916,31 +941,24 @@ static struct tda1004x_config ads_tech_duo_config = { | |||
916 | .xtal_freq = TDA10046_XTAL_16M, | 941 | .xtal_freq = TDA10046_XTAL_16M, |
917 | .agc_config = TDA10046_AGC_TDA827X_GPL, | 942 | .agc_config = TDA10046_AGC_TDA827X_GPL, |
918 | .if_freq = TDA10046_FREQ_045, | 943 | .if_freq = TDA10046_FREQ_045, |
919 | .pll_init = ads_duo_dvb_mode, | ||
920 | .pll_set = ads_duo_pll_set, | ||
921 | .pll_sleep = ads_duo_analog_mode, | ||
922 | .request_firmware = NULL, | 944 | .request_firmware = NULL, |
923 | }; | 945 | }; |
924 | 946 | ||
925 | /* ------------------------------------------------------------------ */ | 947 | /* ------------------------------------------------------------------ */ |
926 | 948 | ||
927 | static int tevion_dvb220rf_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) | 949 | static int tevion_dvb220rf_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) |
928 | { | 950 | { |
929 | int ret; | 951 | int ret; |
930 | ret = philips_tda827xa_pll_set(0x60, fe, params); | 952 | ret = philips_tda827xa_pll_set(0x60, fe, params); |
931 | return ret; | 953 | return ret; |
932 | } | 954 | } |
933 | 955 | ||
934 | static int tevion_dvb220rf_pll_init(struct dvb_frontend *fe) | 956 | static int tevion_dvb220rf_tuner_sleep(struct dvb_frontend *fe) |
935 | { | 957 | { |
958 | philips_tda827xa_tuner_sleep( 0x61, fe); | ||
936 | return 0; | 959 | return 0; |
937 | } | 960 | } |
938 | 961 | ||
939 | static void tevion_dvb220rf_pll_sleep(struct dvb_frontend *fe) | ||
940 | { | ||
941 | philips_tda827xa_pll_sleep( 0x61, fe); | ||
942 | } | ||
943 | |||
944 | static struct tda1004x_config tevion_dvbt220rf_config = { | 962 | static struct tda1004x_config tevion_dvbt220rf_config = { |
945 | .demod_address = 0x08, | 963 | .demod_address = 0x08, |
946 | .invert = 1, | 964 | .invert = 1, |
@@ -948,9 +966,6 @@ static struct tda1004x_config tevion_dvbt220rf_config = { | |||
948 | .xtal_freq = TDA10046_XTAL_16M, | 966 | .xtal_freq = TDA10046_XTAL_16M, |
949 | .agc_config = TDA10046_AGC_TDA827X, | 967 | .agc_config = TDA10046_AGC_TDA827X, |
950 | .if_freq = TDA10046_FREQ_045, | 968 | .if_freq = TDA10046_FREQ_045, |
951 | .pll_init = tevion_dvb220rf_pll_init, | ||
952 | .pll_set = tevion_dvb220rf_pll_set, | ||
953 | .pll_sleep = tevion_dvb220rf_pll_sleep, | ||
954 | .request_firmware = NULL, | 969 | .request_firmware = NULL, |
955 | }; | 970 | }; |
956 | 971 | ||
@@ -961,8 +976,6 @@ static struct tda1004x_config tevion_dvbt220rf_config = { | |||
961 | #ifdef HAVE_NXT200X | 976 | #ifdef HAVE_NXT200X |
962 | static struct nxt200x_config avertvhda180 = { | 977 | static struct nxt200x_config avertvhda180 = { |
963 | .demod_address = 0x0a, | 978 | .demod_address = 0x0a, |
964 | .pll_address = 0x61, | ||
965 | .pll_desc = &dvb_pll_tdhu2, | ||
966 | }; | 979 | }; |
967 | 980 | ||
968 | static int nxt200x_set_pll_input(u8 *buf, int input) | 981 | static int nxt200x_set_pll_input(u8 *buf, int input) |
@@ -976,8 +989,6 @@ static int nxt200x_set_pll_input(u8 *buf, int input) | |||
976 | 989 | ||
977 | static struct nxt200x_config kworldatsc110 = { | 990 | static struct nxt200x_config kworldatsc110 = { |
978 | .demod_address = 0x0a, | 991 | .demod_address = 0x0a, |
979 | .pll_address = 0x61, | ||
980 | .pll_desc = &dvb_pll_tuv1236d, | ||
981 | .set_pll_input = nxt200x_set_pll_input, | 992 | .set_pll_input = nxt200x_set_pll_input, |
982 | }; | 993 | }; |
983 | #endif | 994 | #endif |
@@ -1003,78 +1014,158 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1003 | printk("%s: pinnacle 300i dvb setup\n",dev->name); | 1014 | printk("%s: pinnacle 300i dvb setup\n",dev->name); |
1004 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, | 1015 | dev->dvb.frontend = mt352_attach(&pinnacle_300i, |
1005 | &dev->i2c_adap); | 1016 | &dev->i2c_adap); |
1017 | if (dev->dvb.frontend) { | ||
1018 | dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; | ||
1019 | } | ||
1006 | break; | 1020 | break; |
1007 | 1021 | ||
1008 | case SAA7134_BOARD_AVERMEDIA_777: | 1022 | case SAA7134_BOARD_AVERMEDIA_777: |
1009 | printk("%s: avertv 777 dvb setup\n",dev->name); | 1023 | printk("%s: avertv 777 dvb setup\n",dev->name); |
1010 | dev->dvb.frontend = mt352_attach(&avermedia_777, | 1024 | dev->dvb.frontend = mt352_attach(&avermedia_777, |
1011 | &dev->i2c_adap); | 1025 | &dev->i2c_adap); |
1026 | if (dev->dvb.frontend) { | ||
1027 | dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; | ||
1028 | } | ||
1012 | break; | 1029 | break; |
1013 | #endif | 1030 | #endif |
1014 | #ifdef HAVE_TDA1004X | 1031 | #ifdef HAVE_TDA1004X |
1015 | case SAA7134_BOARD_MD7134: | 1032 | case SAA7134_BOARD_MD7134: |
1016 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, | 1033 | dev->dvb.frontend = tda10046_attach(&medion_cardbus, |
1017 | &dev->i2c_adap); | 1034 | &dev->i2c_adap); |
1035 | if (dev->dvb.frontend) { | ||
1036 | dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; | ||
1037 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; | ||
1038 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_fmd1216_tuner_set_params; | ||
1039 | } | ||
1018 | break; | 1040 | break; |
1019 | case SAA7134_BOARD_PHILIPS_TOUGH: | 1041 | case SAA7134_BOARD_PHILIPS_TOUGH: |
1020 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, | 1042 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, |
1021 | &dev->i2c_adap); | 1043 | &dev->i2c_adap); |
1044 | if (dev->dvb.frontend) { | ||
1045 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_60_init; | ||
1046 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_60_set_params; | ||
1047 | } | ||
1022 | break; | 1048 | break; |
1023 | case SAA7134_BOARD_FLYDVBTDUO: | 1049 | case SAA7134_BOARD_FLYDVBTDUO: |
1024 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | 1050 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, |
1025 | &dev->i2c_adap); | 1051 | &dev->i2c_adap); |
1052 | if (dev->dvb.frontend) { | ||
1053 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1054 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1055 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1056 | } | ||
1026 | break; | 1057 | break; |
1027 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: | 1058 | case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: |
1028 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | 1059 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, |
1029 | &dev->i2c_adap); | 1060 | &dev->i2c_adap); |
1061 | if (dev->dvb.frontend) { | ||
1062 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1063 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1064 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1065 | } | ||
1030 | break; | 1066 | break; |
1031 | case SAA7134_BOARD_PHILIPS_EUROPA: | 1067 | case SAA7134_BOARD_PHILIPS_EUROPA: |
1032 | dev->dvb.frontend = tda10046_attach(&philips_europa_config, | 1068 | dev->dvb.frontend = tda10046_attach(&philips_europa_config, |
1033 | &dev->i2c_adap); | 1069 | &dev->i2c_adap); |
1070 | if (dev->dvb.frontend) { | ||
1071 | dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; | ||
1072 | dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; | ||
1073 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | ||
1074 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | ||
1075 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | ||
1076 | } | ||
1034 | break; | 1077 | break; |
1035 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: | 1078 | case SAA7134_BOARD_VIDEOMATE_DVBT_300: |
1036 | dev->dvb.frontend = tda10046_attach(&philips_europa_config, | 1079 | dev->dvb.frontend = tda10046_attach(&philips_europa_config, |
1037 | &dev->i2c_adap); | 1080 | &dev->i2c_adap); |
1081 | if (dev->dvb.frontend) { | ||
1082 | dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; | ||
1083 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; | ||
1084 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_td1316_tuner_set_params; | ||
1085 | } | ||
1038 | break; | 1086 | break; |
1039 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: | 1087 | case SAA7134_BOARD_VIDEOMATE_DVBT_200: |
1040 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, | 1088 | dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, |
1041 | &dev->i2c_adap); | 1089 | &dev->i2c_adap); |
1090 | if (dev->dvb.frontend) { | ||
1091 | dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_61_init; | ||
1092 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_61_set_params; | ||
1093 | } | ||
1042 | break; | 1094 | break; |
1043 | case SAA7134_BOARD_PHILIPS_TIGER: | 1095 | case SAA7134_BOARD_PHILIPS_TIGER: |
1044 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, | 1096 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, |
1045 | &dev->i2c_adap); | 1097 | &dev->i2c_adap); |
1098 | if (dev->dvb.frontend) { | ||
1099 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1100 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; | ||
1101 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1102 | } | ||
1046 | break; | 1103 | break; |
1047 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: | 1104 | case SAA7134_BOARD_ASUSTeK_P7131_DUAL: |
1048 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, | 1105 | dev->dvb.frontend = tda10046_attach(&philips_tiger_config, |
1049 | &dev->i2c_adap); | 1106 | &dev->i2c_adap); |
1107 | if (dev->dvb.frontend) { | ||
1108 | dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; | ||
1109 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; | ||
1110 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tiger_tuner_set_params; | ||
1111 | } | ||
1050 | break; | 1112 | break; |
1051 | case SAA7134_BOARD_FLYDVBT_LR301: | 1113 | case SAA7134_BOARD_FLYDVBT_LR301: |
1052 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, | 1114 | dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, |
1053 | &dev->i2c_adap); | 1115 | &dev->i2c_adap); |
1116 | if (dev->dvb.frontend) { | ||
1117 | dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; | ||
1118 | dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; | ||
1119 | dev->dvb.frontend->ops.tuner_ops.set_params = philips_tda827x_tuner_set_params; | ||
1120 | } | ||
1054 | break; | 1121 | break; |
1055 | case SAA7134_BOARD_FLYDVB_TRIO: | 1122 | case SAA7134_BOARD_FLYDVB_TRIO: |
1056 | dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, | 1123 | dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, |
1057 | &dev->i2c_adap); | 1124 | &dev->i2c_adap); |
1125 | if (dev->dvb.frontend) { | ||
1126 | dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep; | ||
1127 | dev->dvb.frontend->ops.tuner_ops.set_params = lifeview_trio_tuner_set_params; | ||
1128 | } | ||
1058 | break; | 1129 | break; |
1059 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 1130 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
1060 | dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, | 1131 | dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, |
1061 | &dev->i2c_adap); | 1132 | &dev->i2c_adap); |
1133 | if (dev->dvb.frontend) { | ||
1134 | dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; | ||
1135 | dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; | ||
1136 | dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; | ||
1137 | } | ||
1062 | break; | 1138 | break; |
1063 | case SAA7134_BOARD_TEVION_DVBT_220RF: | 1139 | case SAA7134_BOARD_TEVION_DVBT_220RF: |
1064 | dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, | 1140 | dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, |
1065 | &dev->i2c_adap); | 1141 | &dev->i2c_adap); |
1142 | if (dev->dvb.frontend) { | ||
1143 | dev->dvb.frontend->ops.tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; | ||
1144 | dev->dvb.frontend->ops.tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; | ||
1145 | } | ||
1066 | break; | 1146 | break; |
1067 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: | 1147 | case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: |
1068 | dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, | 1148 | dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, |
1069 | &dev->i2c_adap); | 1149 | &dev->i2c_adap); |
1150 | if (dev->dvb.frontend) { | ||
1151 | dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; | ||
1152 | dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; | ||
1153 | dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; | ||
1154 | } | ||
1070 | break; | 1155 | break; |
1071 | #endif | 1156 | #endif |
1072 | #ifdef HAVE_NXT200X | 1157 | #ifdef HAVE_NXT200X |
1073 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: | 1158 | case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: |
1074 | dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); | 1159 | dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); |
1160 | if (dev->dvb.frontend) { | ||
1161 | dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tdhu2); | ||
1162 | } | ||
1075 | break; | 1163 | break; |
1076 | case SAA7134_BOARD_KWORLD_ATSC110: | 1164 | case SAA7134_BOARD_KWORLD_ATSC110: |
1077 | dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap); | 1165 | dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap); |
1166 | if (dev->dvb.frontend) { | ||
1167 | dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tuv1236d); | ||
1168 | } | ||
1078 | break; | 1169 | break; |
1079 | #endif | 1170 | #endif |
1080 | default: | 1171 | default: |
@@ -1088,7 +1179,7 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1088 | } | 1179 | } |
1089 | 1180 | ||
1090 | /* register everything else */ | 1181 | /* register everything else */ |
1091 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev); | 1182 | return videobuf_dvb_register(&dev->dvb, THIS_MODULE, dev, &dev->pci->dev); |
1092 | } | 1183 | } |
1093 | 1184 | ||
1094 | static int dvb_fini(struct saa7134_dev *dev) | 1185 | static int dvb_fini(struct saa7134_dev *dev) |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 1d972edb3be6..65d044086ce9 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -64,8 +64,10 @@ static void ts_reset_encoder(struct saa7134_dev* dev) | |||
64 | 64 | ||
65 | static int ts_init_encoder(struct saa7134_dev* dev) | 65 | static int ts_init_encoder(struct saa7134_dev* dev) |
66 | { | 66 | { |
67 | struct v4l2_ext_controls ctrls = { V4L2_CTRL_CLASS_MPEG, 0 }; | ||
68 | |||
67 | ts_reset_encoder(dev); | 69 | ts_reset_encoder(dev); |
68 | saa7134_i2c_call_clients(dev, VIDIOC_S_MPEGCOMP, NULL); | 70 | saa7134_i2c_call_clients(dev, VIDIOC_S_EXT_CTRLS, &ctrls); |
69 | dev->empress_started = 1; | 71 | dev->empress_started = 1; |
70 | return 0; | 72 | return 0; |
71 | } | 73 | } |
@@ -162,6 +164,7 @@ static int ts_do_ioctl(struct inode *inode, struct file *file, | |||
162 | unsigned int cmd, void *arg) | 164 | unsigned int cmd, void *arg) |
163 | { | 165 | { |
164 | struct saa7134_dev *dev = file->private_data; | 166 | struct saa7134_dev *dev = file->private_data; |
167 | struct v4l2_ext_controls *ctrls = arg; | ||
165 | 168 | ||
166 | if (debug > 1) | 169 | if (debug > 1) |
167 | v4l_print_ioctl(dev->name,cmd); | 170 | v4l_print_ioctl(dev->name,cmd); |
@@ -278,12 +281,31 @@ static int ts_do_ioctl(struct inode *inode, struct file *file, | |||
278 | return saa7134_common_ioctl(dev, cmd, arg); | 281 | return saa7134_common_ioctl(dev, cmd, arg); |
279 | 282 | ||
280 | case VIDIOC_S_MPEGCOMP: | 283 | case VIDIOC_S_MPEGCOMP: |
284 | printk(KERN_WARNING "VIDIOC_S_MPEGCOMP is obsolete. " | ||
285 | "Replace with VIDIOC_S_EXT_CTRLS!"); | ||
281 | saa7134_i2c_call_clients(dev, VIDIOC_S_MPEGCOMP, arg); | 286 | saa7134_i2c_call_clients(dev, VIDIOC_S_MPEGCOMP, arg); |
282 | ts_init_encoder(dev); | 287 | ts_init_encoder(dev); |
283 | return 0; | 288 | return 0; |
284 | case VIDIOC_G_MPEGCOMP: | 289 | case VIDIOC_G_MPEGCOMP: |
290 | printk(KERN_WARNING "VIDIOC_G_MPEGCOMP is obsolete. " | ||
291 | "Replace with VIDIOC_G_EXT_CTRLS!"); | ||
285 | saa7134_i2c_call_clients(dev, VIDIOC_G_MPEGCOMP, arg); | 292 | saa7134_i2c_call_clients(dev, VIDIOC_G_MPEGCOMP, arg); |
286 | return 0; | 293 | return 0; |
294 | case VIDIOC_S_EXT_CTRLS: | ||
295 | /* count == 0 is abused in saa6752hs.c, so that special | ||
296 | case is handled here explicitly. */ | ||
297 | if (ctrls->count == 0) | ||
298 | return 0; | ||
299 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
300 | return -EINVAL; | ||
301 | saa7134_i2c_call_clients(dev, VIDIOC_S_EXT_CTRLS, arg); | ||
302 | ts_init_encoder(dev); | ||
303 | return 0; | ||
304 | case VIDIOC_G_EXT_CTRLS: | ||
305 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
306 | return -EINVAL; | ||
307 | saa7134_i2c_call_clients(dev, VIDIOC_G_EXT_CTRLS, arg); | ||
308 | return 0; | ||
287 | 309 | ||
288 | default: | 310 | default: |
289 | return -ENOIOCTLCMD; | 311 | return -ENOIOCTLCMD; |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 1426e4c8602f..7c595492c56b 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -37,6 +37,10 @@ static unsigned int ir_debug = 0; | |||
37 | module_param(ir_debug, int, 0644); | 37 | module_param(ir_debug, int, 0644); |
38 | MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); | 38 | MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]"); |
39 | 39 | ||
40 | static int pinnacle_remote = 0; | ||
41 | module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */ | ||
42 | MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)"); | ||
43 | |||
40 | #define dprintk(fmt, arg...) if (ir_debug) \ | 44 | #define dprintk(fmt, arg...) if (ir_debug) \ |
41 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) | 45 | printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg) |
42 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ | 46 | #define i2cdprintk(fmt, arg...) if (ir_debug) \ |
@@ -316,8 +320,13 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir) | |||
316 | switch (dev->board) { | 320 | switch (dev->board) { |
317 | case SAA7134_BOARD_PINNACLE_PCTV_110i: | 321 | case SAA7134_BOARD_PINNACLE_PCTV_110i: |
318 | snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); | 322 | snprintf(ir->c.name, sizeof(ir->c.name), "Pinnacle PCTV"); |
319 | ir->get_key = get_key_pinnacle; | 323 | if (pinnacle_remote == 0) { |
320 | ir->ir_codes = ir_codes_pinnacle; | 324 | ir->get_key = get_key_pinnacle_color; |
325 | ir->ir_codes = ir_codes_pinnacle_color; | ||
326 | } else { | ||
327 | ir->get_key = get_key_pinnacle_grey; | ||
328 | ir->ir_codes = ir_codes_pinnacle_grey; | ||
329 | } | ||
321 | break; | 330 | break; |
322 | case SAA7134_BOARD_UPMOST_PURPLE_TV: | 331 | case SAA7134_BOARD_UPMOST_PURPLE_TV: |
323 | snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); | 332 | snprintf(ir->c.name, sizeof(ir->c.name), "Purple TV"); |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 353af3a8b766..d5ee99c574cc 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | 35 | ||
36 | #include <media/v4l2-common.h> | ||
36 | #include <media/tuner.h> | 37 | #include <media/tuner.h> |
37 | #include <media/ir-common.h> | 38 | #include <media/ir-common.h> |
38 | #include <media/ir-kbd-i2c.h> | 39 | #include <media/ir-kbd-i2c.h> |
@@ -221,6 +222,7 @@ struct saa7134_format { | |||
221 | #define SAA7134_BOARD_AVERMEDIA_A169_B1 92 | 222 | #define SAA7134_BOARD_AVERMEDIA_A169_B1 92 |
222 | #define SAA7134_BOARD_MD7134_BRIDGE_2 93 | 223 | #define SAA7134_BOARD_MD7134_BRIDGE_2 93 |
223 | #define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 | 224 | #define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 |
225 | #define SAA7134_BOARD_FLYVIDEO3000_NTSC 95 | ||
224 | 226 | ||
225 | #define SAA7134_MAXBOARDS 8 | 227 | #define SAA7134_MAXBOARDS 8 |
226 | #define SAA7134_INPUT_MAX 8 | 228 | #define SAA7134_INPUT_MAX 8 |
@@ -531,6 +533,7 @@ struct saa7134_dev { | |||
531 | 533 | ||
532 | /* SAA7134_MPEG_DVB only */ | 534 | /* SAA7134_MPEG_DVB only */ |
533 | struct videobuf_dvb dvb; | 535 | struct videobuf_dvb dvb; |
536 | int (*original_demod_sleep)(struct dvb_frontend* fe); | ||
534 | }; | 537 | }; |
535 | 538 | ||
536 | /* ----------------------------------------------------------- */ | 539 | /* ----------------------------------------------------------- */ |