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.c81
1 files changed, 45 insertions, 36 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index a60442ea4f94..d62b2302af49 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -37,24 +37,24 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
37/* supported controls */ 37/* supported controls */
38static struct v4l2_queryctrl tvp5150_qctrl[] = { 38static struct v4l2_queryctrl tvp5150_qctrl[] = {
39 { 39 {
40 .id = V4L2_CID_BRIGHTNESS, 40 .id = V4L2_CID_BRIGHTNESS,
41 .type = V4L2_CTRL_TYPE_INTEGER, 41 .type = V4L2_CTRL_TYPE_INTEGER,
42 .name = "Brightness", 42 .name = "Brightness",
43 .minimum = 0, 43 .minimum = 0,
44 .maximum = 255, 44 .maximum = 255,
45 .step = 1, 45 .step = 1,
46 .default_value = 0, 46 .default_value = 0,
47 .flags = 0, 47 .flags = 0,
48 }, { 48 }, {
49 .id = V4L2_CID_CONTRAST, 49 .id = V4L2_CID_CONTRAST,
50 .type = V4L2_CTRL_TYPE_INTEGER, 50 .type = V4L2_CTRL_TYPE_INTEGER,
51 .name = "Contrast", 51 .name = "Contrast",
52 .minimum = 0, 52 .minimum = 0,
53 .maximum = 255, 53 .maximum = 255,
54 .step = 0x1, 54 .step = 0x1,
55 .default_value = 0x10, 55 .default_value = 0x10,
56 .flags = 0, 56 .flags = 0,
57 }, { 57 }, {
58 .id = V4L2_CID_SATURATION, 58 .id = V4L2_CID_SATURATION,
59 .type = V4L2_CTRL_TYPE_INTEGER, 59 .type = V4L2_CTRL_TYPE_INTEGER,
60 .name = "Saturation", 60 .name = "Saturation",
@@ -63,16 +63,16 @@ static struct v4l2_queryctrl tvp5150_qctrl[] = {
63 .step = 0x1, 63 .step = 0x1,
64 .default_value = 0x10, 64 .default_value = 0x10,
65 .flags = 0, 65 .flags = 0,
66 }, { 66 }, {
67 .id = V4L2_CID_HUE, 67 .id = V4L2_CID_HUE,
68 .type = V4L2_CTRL_TYPE_INTEGER, 68 .type = V4L2_CTRL_TYPE_INTEGER,
69 .name = "Hue", 69 .name = "Hue",
70 .minimum = -128, 70 .minimum = -128,
71 .maximum = 127, 71 .maximum = 127,
72 .step = 0x1, 72 .step = 0x1,
73 .default_value = 0x10, 73 .default_value = 0x10,
74 .flags = 0, 74 .flags = 0,
75 } 75 }
76}; 76};
77 77
78struct tvp5150 { 78struct tvp5150 {
@@ -437,11 +437,24 @@ enum tvp5150_input {
437static inline void tvp5150_selmux(struct i2c_client *c, 437static inline void tvp5150_selmux(struct i2c_client *c,
438 enum tvp5150_input input) 438 enum tvp5150_input input)
439{ 439{
440 int opmode=0;
441
440 struct tvp5150 *decoder = i2c_get_clientdata(c); 442 struct tvp5150 *decoder = i2c_get_clientdata(c);
441 443
442 if (!decoder->enable) 444 if (!decoder->enable)
443 input |= TVP5150_BLACK_SCREEN; 445 input |= TVP5150_BLACK_SCREEN;
444 446
447 switch (input) {
448 case TVP5150_ANALOG_CH0:
449 case TVP5150_ANALOG_CH1:
450 opmode=0x30; /* TV Mode */
451 break;
452 default:
453 opmode=0; /* Auto Mode */
454 break;
455 }
456
457 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
445 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); 458 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
446}; 459};
447 460
@@ -498,9 +511,8 @@ static int tvp5150_get_ctrl(struct i2c_client *c, struct v4l2_control *ctrl)
498 case V4L2_CID_HUE: 511 case V4L2_CID_HUE:
499 ctrl->value = tvp5150_read(c, TVP5150_HUE_CTL); 512 ctrl->value = tvp5150_read(c, TVP5150_HUE_CTL);
500 return 0; 513 return 0;
501 default:
502 return -EINVAL;
503 } 514 }
515 return -EINVAL;
504} 516}
505 517
506static int tvp5150_set_ctrl(struct i2c_client *c, struct v4l2_control *ctrl) 518static int tvp5150_set_ctrl(struct i2c_client *c, struct v4l2_control *ctrl)
@@ -520,9 +532,8 @@ static int tvp5150_set_ctrl(struct i2c_client *c, struct v4l2_control *ctrl)
520 case V4L2_CID_HUE: 532 case V4L2_CID_HUE:
521 tvp5150_write(c, TVP5150_HUE_CTL, ctrl->value); 533 tvp5150_write(c, TVP5150_HUE_CTL, ctrl->value);
522 return 0; 534 return 0;
523 default:
524 return -EINVAL;
525 } 535 }
536 return -EINVAL;
526} 537}
527 538
528/**************************************************************************** 539/****************************************************************************
@@ -627,12 +638,11 @@ static int tvp5150_command(struct i2c_client *client,
627 case VIDIOC_QUERYCTRL: 638 case VIDIOC_QUERYCTRL:
628 { 639 {
629 struct v4l2_queryctrl *qc = arg; 640 struct v4l2_queryctrl *qc = arg;
630 u8 i, n; 641 int i;
631 642
632 dprintk(1, KERN_DEBUG "VIDIOC_QUERYCTRL"); 643 dprintk(1, KERN_DEBUG "VIDIOC_QUERYCTRL");
633 644
634 n = sizeof(tvp5150_qctrl) / sizeof(tvp5150_qctrl[0]); 645 for (i = 0; i < ARRAY_SIZE(tvp5150_qctrl); i++)
635 for (i = 0; i < n; i++)
636 if (qc->id && qc->id == tvp5150_qctrl[i].id) { 646 if (qc->id && qc->id == tvp5150_qctrl[i].id) {
637 memcpy(qc, &(tvp5150_qctrl[i]), 647 memcpy(qc, &(tvp5150_qctrl[i]),
638 sizeof(*qc)); 648 sizeof(*qc));
@@ -648,7 +658,6 @@ static int tvp5150_command(struct i2c_client *client,
648 658
649 return tvp5150_get_ctrl(client, ctrl); 659 return tvp5150_get_ctrl(client, ctrl);
650 } 660 }
651 case VIDIOC_S_CTRL_OLD: /* ??? */
652 case VIDIOC_S_CTRL: 661 case VIDIOC_S_CTRL:
653 { 662 {
654 struct v4l2_control *ctrl = arg; 663 struct v4l2_control *ctrl = arg;