aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tvp5150.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r--drivers/media/video/tvp5150.c140
1 files changed, 17 insertions, 123 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 69d0fe159f4d..dab4973bcf82 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -53,7 +53,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
53 .minimum = 0, 53 .minimum = 0,
54 .maximum = 255, 54 .maximum = 255,
55 .step = 1, 55 .step = 1,
56 .default_value = 0, 56 .default_value = 128,
57 .flags = 0, 57 .flags = 0,
58 }, { 58 }, {
59 .id = V4L2_CID_CONTRAST, 59 .id = V4L2_CID_CONTRAST,
@@ -62,7 +62,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
62 .minimum = 0, 62 .minimum = 0,
63 .maximum = 255, 63 .maximum = 255,
64 .step = 0x1, 64 .step = 0x1,
65 .default_value = 0x10, 65 .default_value = 128,
66 .flags = 0, 66 .flags = 0,
67 }, { 67 }, {
68 .id = V4L2_CID_SATURATION, 68 .id = V4L2_CID_SATURATION,
@@ -71,7 +71,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
71 .minimum = 0, 71 .minimum = 0,
72 .maximum = 255, 72 .maximum = 255,
73 .step = 0x1, 73 .step = 0x1,
74 .default_value = 0x10, 74 .default_value = 128,
75 .flags = 0, 75 .flags = 0,
76 }, { 76 }, {
77 .id = V4L2_CID_HUE, 77 .id = V4L2_CID_HUE,
@@ -80,7 +80,7 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
80 .minimum = -128, 80 .minimum = -128,
81 .maximum = 127, 81 .maximum = 127,
82 .step = 0x1, 82 .step = 0x1,
83 .default_value = 0x10, 83 .default_value = 0,
84 .flags = 0, 84 .flags = 0,
85 } 85 }
86}; 86};
@@ -500,16 +500,21 @@ struct i2c_vbi_ram_value {
500 500
501static struct i2c_vbi_ram_value vbi_ram_default[] = 501static struct i2c_vbi_ram_value vbi_ram_default[] =
502{ 502{
503 /* FIXME: Current api doesn't handle all VBI types, those not
504 yet supported are placed under #if 0 */
505#if 0
503 {0x010, /* Teletext, SECAM, WST System A */ 506 {0x010, /* Teletext, SECAM, WST System A */
504 {V4L2_SLICED_TELETEXT_SECAM,6,23,1}, 507 {V4L2_SLICED_TELETEXT_SECAM,6,23,1},
505 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26, 508 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
506 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 } 509 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
507 }, 510 },
511#endif
508 {0x030, /* Teletext, PAL, WST System B */ 512 {0x030, /* Teletext, PAL, WST System B */
509 {V4L2_SLICED_TELETEXT_PAL_B,6,22,1}, 513 {V4L2_SLICED_TELETEXT_B,6,22,1},
510 { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b, 514 { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
511 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 } 515 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
512 }, 516 },
517#if 0
513 {0x050, /* Teletext, PAL, WST System C */ 518 {0x050, /* Teletext, PAL, WST System C */
514 {V4L2_SLICED_TELETEXT_PAL_C,6,22,1}, 519 {V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
515 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22, 520 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
@@ -535,6 +540,7 @@ static struct i2c_vbi_ram_value vbi_ram_default[] =
535 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, 540 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
536 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } 541 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
537 }, 542 },
543#endif
538 {0x0f0, /* Closed Caption, NTSC */ 544 {0x0f0, /* Closed Caption, NTSC */
539 {V4L2_SLICED_CAPTION_525,21,21,1}, 545 {V4L2_SLICED_CAPTION_525,21,21,1},
540 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, 546 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
@@ -545,6 +551,7 @@ static struct i2c_vbi_ram_value vbi_ram_default[] =
545 { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, 551 { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
546 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } 552 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
547 }, 553 },
554#if 0
548 {0x130, /* Wide Screen Signal, NTSC C */ 555 {0x130, /* Wide Screen Signal, NTSC C */
549 {V4L2_SLICED_WSS_525,20,20,1}, 556 {V4L2_SLICED_WSS_525,20,20,1},
550 { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43, 557 { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
@@ -560,6 +567,7 @@ static struct i2c_vbi_ram_value vbi_ram_default[] =
560 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49, 567 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
561 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 } 568 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
562 }, 569 },
570#endif
563 {0x190, /* Video Program System (VPS), PAL */ 571 {0x190, /* Video Program System (VPS), PAL */
564 {V4L2_SLICED_VPS,16,16,0}, 572 {V4L2_SLICED_VPS,16,16,0},
565 { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d, 573 { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
@@ -850,7 +858,6 @@ static int tvp5150_command(struct i2c_client *c,
850 858
851 case 0: 859 case 0:
852 case VIDIOC_INT_RESET: 860 case VIDIOC_INT_RESET:
853 case DECODER_INIT:
854 tvp5150_reset(c); 861 tvp5150_reset(c);
855 break; 862 break;
856 case VIDIOC_S_STD: 863 case VIDIOC_S_STD:
@@ -949,99 +956,15 @@ static int tvp5150_command(struct i2c_client *c,
949#endif 956#endif
950 957
951 case VIDIOC_LOG_STATUS: 958 case VIDIOC_LOG_STATUS:
952 case DECODER_DUMP:
953 dump_reg(c); 959 dump_reg(c);
954 break; 960 break;
955 961
956 case DECODER_GET_CAPABILITIES: 962 case VIDIOC_G_TUNER:
957 { 963 {
958 struct video_decoder_capability *cap = arg; 964 struct v4l2_tuner *vt = arg;
959 965 int status = tvp5150_read(c, 0x88);
960 cap->flags = VIDEO_DECODER_PAL |
961 VIDEO_DECODER_NTSC |
962 VIDEO_DECODER_SECAM |
963 VIDEO_DECODER_AUTO | VIDEO_DECODER_CCIR;
964 cap->inputs = 3;
965 cap->outputs = 1;
966 break;
967 }
968 case DECODER_GET_STATUS:
969 {
970 int *iarg = arg;
971 int status;
972 int res=0;
973 status = tvp5150_read(c, 0x88);
974 if(status&0x08){
975 res |= DECODER_STATUS_COLOR;
976 }
977 if(status&0x04 && status&0x02){
978 res |= DECODER_STATUS_GOOD;
979 }
980 *iarg=res;
981 break;
982 }
983
984 case DECODER_SET_GPIO:
985 break;
986
987 case DECODER_SET_VBI_BYPASS:
988 break;
989
990 case DECODER_SET_NORM:
991 {
992 int *iarg = arg;
993
994 switch (*iarg) {
995
996 case VIDEO_MODE_NTSC:
997 break;
998
999 case VIDEO_MODE_PAL:
1000 break;
1001
1002 case VIDEO_MODE_SECAM:
1003 break;
1004
1005 case VIDEO_MODE_AUTO:
1006 break;
1007
1008 default:
1009 return -EINVAL;
1010
1011 }
1012 decoder->norm = *iarg;
1013 break;
1014 }
1015 case DECODER_SET_INPUT:
1016 {
1017 int *iarg = arg;
1018 if (*iarg < 0 || *iarg > 3) {
1019 return -EINVAL;
1020 }
1021
1022 decoder->input = *iarg;
1023 tvp5150_selmux(c, decoder->input);
1024
1025 break;
1026 }
1027 case DECODER_SET_OUTPUT:
1028 {
1029 int *iarg = arg;
1030
1031 /* not much choice of outputs */
1032 if (*iarg != 0) {
1033 return -EINVAL;
1034 }
1035 break;
1036 }
1037 case DECODER_ENABLE_OUTPUT:
1038 {
1039 int *iarg = arg;
1040
1041 decoder->enable = (*iarg != 0);
1042
1043 tvp5150_selmux(c, decoder->input);
1044 966
967 vt->signal = ((status & 0x04) && (status & 0x02)) ? 0xffff : 0x0;
1045 break; 968 break;
1046 } 969 }
1047 case VIDIOC_QUERYCTRL: 970 case VIDIOC_QUERYCTRL:
@@ -1087,35 +1010,6 @@ static int tvp5150_command(struct i2c_client *c,
1087 return -EINVAL; 1010 return -EINVAL;
1088 } 1011 }
1089 1012
1090 case DECODER_SET_PICTURE:
1091 {
1092 struct video_picture *pic = arg;
1093 if (decoder->bright != pic->brightness) {
1094 /* We want 0 to 255 we get 0-65535 */
1095 decoder->bright = pic->brightness;
1096 tvp5150_write(c, TVP5150_BRIGHT_CTL,
1097 decoder->bright >> 8);
1098 }
1099 if (decoder->contrast != pic->contrast) {
1100 /* We want 0 to 255 we get 0-65535 */
1101 decoder->contrast = pic->contrast;
1102 tvp5150_write(c, TVP5150_CONTRAST_CTL,
1103 decoder->contrast >> 8);
1104 }
1105 if (decoder->sat != pic->colour) {
1106 /* We want 0 to 255 we get 0-65535 */
1107 decoder->sat = pic->colour;
1108 tvp5150_write(c, TVP5150_SATURATION_CTL,
1109 decoder->contrast >> 8);
1110 }
1111 if (decoder->hue != pic->hue) {
1112 /* We want -128 to 127 we get 0-65535 */
1113 decoder->hue = pic->hue;
1114 tvp5150_write(c, TVP5150_HUE_CTL,
1115 (decoder->hue - 32768) >> 8);
1116 }
1117 break;
1118 }
1119 default: 1013 default:
1120 return -EINVAL; 1014 return -EINVAL;
1121 } 1015 }