aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tvp5150.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-11-09 00:36:43 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:11 -0500
commit4c86f973ba0f49af1f4c54ff3d1935093c173450 (patch)
treea2aa739d81861e081f04aa9cd9514596a20efefd /drivers/media/video/tvp5150.c
parent83331624aac006b615f6853aacd28aef3111ef07 (diff)
[PATCH] v4l: 678: fixed input selection
- Fixed input selection. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r--drivers/media/video/tvp5150.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index bd1201d7adf1..6e3ba23104d2 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -397,6 +397,7 @@ enum tvp5150_input {
397static inline void tvp5150_selmux(struct i2c_client *c, 397static inline void tvp5150_selmux(struct i2c_client *c,
398 enum tvp5150_input input) 398 enum tvp5150_input input)
399{ 399{
400 struct tvp5150 *decoder = i2c_get_clientdata(c);
400 int tvp_input; 401 int tvp_input;
401 402
402 /* FIXME: It is dependent of basic driver */ 403 /* FIXME: It is dependent of basic driver */
@@ -415,11 +416,16 @@ static inline void tvp5150_selmux(struct i2c_client *c,
415 tvp_input=TVP5150_BLACK_SCREEN; 416 tvp_input=TVP5150_BLACK_SCREEN;
416 } 417 }
417 418
419 if (!decoder->enable)
420 tvp_input|=TVP5150_BLACK_SCREEN;
421
418 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input); 422 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, tvp_input);
419}; 423};
420 424
421static inline void tvp5150_reset(struct i2c_client *c) 425static inline void tvp5150_reset(struct i2c_client *c)
422{ 426{
427 struct tvp5150 *decoder = i2c_get_clientdata(c);
428
423 tvp5150_write(c, TVP5150_CONF_SHARED_PIN, 2); 429 tvp5150_write(c, TVP5150_CONF_SHARED_PIN, 2);
424 430
425 /* Automatic offset and AGC enabled */ 431 /* Automatic offset and AGC enabled */
@@ -431,13 +437,13 @@ static inline void tvp5150_reset(struct i2c_client *c)
431 /* Activate YCrCb output 0x9 or 0xd ? */ 437 /* Activate YCrCb output 0x9 or 0xd ? */
432 tvp5150_write(c, TVP5150_MISC_CTL, 0x6f); 438 tvp5150_write(c, TVP5150_MISC_CTL, 0x6f);
433 439
434 /* Activates video std autodetection for PAL/M and PAL/N */ 440 /* Activates video std autodetection for all standards */
435 tvp5150_write(c, TVP5150_AUTOSW_MSK, 0xf0); 441 tvp5150_write(c, TVP5150_AUTOSW_MSK, 0x0);
436 442
437 /* Default format: 0x47, 4:2:2: 0x40 */ 443 /* Default format: 0x47, 4:2:2: 0x40 */
438 tvp5150_write(c, TVP5150_DATA_RATE_SEL, 0x47); 444 tvp5150_write(c, TVP5150_DATA_RATE_SEL, 0x47);
439 445
440 tvp5150_selmux(c, TVP5150_ANALOG_CH0); 446 tvp5150_selmux(c, decoder->input);
441 447
442 tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_1, 0x0c); 448 tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_1, 0x0c);
443 tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_2, 0x54); 449 tvp5150_write(c, TVP5150_CHROMA_PROC_CTL_2, 0x54);
@@ -446,7 +452,10 @@ static inline void tvp5150_reset(struct i2c_client *c)
446 452
447 tvp5150_write(c, TVP5150_VIDEO_STD, 0x0); /* Auto switch */ 453 tvp5150_write(c, TVP5150_VIDEO_STD, 0x0); /* Auto switch */
448 454
449 tvp5150_write(c, TVP5150_HUE_CTL, 0x0); 455 tvp5150_write(c, TVP5150_BRIGHT_CTL, decoder->bright >> 8);
456 tvp5150_write(c, TVP5150_CONTRAST_CTL, decoder->contrast >> 8);
457 tvp5150_write(c, TVP5150_SATURATION_CTL, decoder->contrast >> 8);
458 tvp5150_write(c, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8);
450}; 459};
451 460
452/**************************************************************************** 461/****************************************************************************
@@ -523,7 +532,8 @@ static int tvp5150_command(struct i2c_client *client,
523 return -EINVAL; 532 return -EINVAL;
524 } 533 }
525 534
526 tvp5150_selmux(client, *iarg); 535 decoder->input=*iarg;
536 tvp5150_selmux(client, decoder->input);
527 537
528 break; 538 break;
529 } 539 }
@@ -538,12 +548,40 @@ static int tvp5150_command(struct i2c_client *client,
538 break; 548 break;
539 } 549 }
540 case DECODER_ENABLE_OUTPUT: 550 case DECODER_ENABLE_OUTPUT:
541// int *iarg = arg; 551 {
542// int enable = (*iarg != 0); 552 int *iarg = arg;
543 553
544 break; 554 decoder->enable = (*iarg != 0);
555
556 tvp5150_selmux(client, decoder->input);
545 557
558 break;
559 }
546 case DECODER_SET_PICTURE: 560 case DECODER_SET_PICTURE:
561 {
562 struct video_picture *pic = arg;
563 if (decoder->bright != pic->brightness) {
564 /* We want 0 to 255 we get 0-65535 */
565 decoder->bright = pic->brightness;
566 tvp5150_write(client, TVP5150_BRIGHT_CTL, decoder->bright >> 8);
567 }
568 if (decoder->contrast != pic->contrast) {
569 /* We want 0 to 255 we get 0-65535 */
570 decoder->contrast = pic->contrast;
571 tvp5150_write(client, TVP5150_CONTRAST_CTL, decoder->contrast >> 8);
572 }
573 if (decoder->sat != pic->colour) {
574 /* We want 0 to 255 we get 0-65535 */
575 decoder->sat = pic->colour;
576 tvp5150_write(client, TVP5150_SATURATION_CTL, decoder->contrast >> 8);
577 }
578 if (decoder->hue != pic->hue) {
579 /* We want -128 to 127 we get 0-65535 */
580 decoder->hue = pic->hue;
581 tvp5150_write(client, TVP5150_HUE_CTL, (decoder->hue - 32768) >> 8);
582 }
583 break;
584 }
547 default: 585 default:
548 return -EINVAL; 586 return -EINVAL;
549 } 587 }
@@ -599,6 +637,14 @@ static int tvp5150_detect_client (struct i2c_adapter *adapter,
599 637
600 rv = i2c_attach_client(client); 638 rv = i2c_attach_client(client);
601 639
640 core->norm = VIDEO_MODE_AUTO;
641 core->input = 2;
642 core->enable = 1;
643 core->bright = 32768;
644 core->contrast = 32768;
645 core->hue = 32768;
646 core->sat = 32768;
647
602 if (rv) { 648 if (rv) {
603 kfree(client); 649 kfree(client);
604 kfree(core); 650 kfree(core);