diff options
-rw-r--r-- | drivers/media/video/saa7127.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index d6848f7a503b..05221d47dd4c 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
@@ -149,7 +149,7 @@ static const struct i2c_reg_value saa7127_init_config_common[] = { | |||
149 | { SAA7127_REG_COPYGEN_0, 0x77 }, | 149 | { SAA7127_REG_COPYGEN_0, 0x77 }, |
150 | { SAA7127_REG_COPYGEN_1, 0x41 }, | 150 | { SAA7127_REG_COPYGEN_1, 0x41 }, |
151 | { SAA7127_REG_COPYGEN_2, 0x00 }, /* Macrovision enable/disable */ | 151 | { SAA7127_REG_COPYGEN_2, 0x00 }, /* Macrovision enable/disable */ |
152 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0x9e }, | 152 | { SAA7127_REG_OUTPUT_PORT_CONTROL, 0xbf }, |
153 | { SAA7127_REG_GAIN_LUMINANCE_RGB, 0x00 }, | 153 | { SAA7127_REG_GAIN_LUMINANCE_RGB, 0x00 }, |
154 | { SAA7127_REG_GAIN_COLORDIFF_RGB, 0x00 }, | 154 | { SAA7127_REG_GAIN_COLORDIFF_RGB, 0x00 }, |
155 | { SAA7127_REG_INPUT_PORT_CONTROL_1, 0x80 }, /* for color bars */ | 155 | { SAA7127_REG_INPUT_PORT_CONTROL_1, 0x80 }, /* for color bars */ |
@@ -488,12 +488,18 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output) | |||
488 | break; | 488 | break; |
489 | 489 | ||
490 | case SAA7127_OUTPUT_TYPE_COMPOSITE: | 490 | case SAA7127_OUTPUT_TYPE_COMPOSITE: |
491 | state->reg_2d = 0x08; /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */ | 491 | if (state->ident == V4L2_IDENT_SAA7129) |
492 | state->reg_2d = 0x20; /* CVBS only */ | ||
493 | else | ||
494 | state->reg_2d = 0x08; /* 00001000 CVBS only, RGB DAC's off (high impedance mode) */ | ||
492 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ | 495 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ |
493 | break; | 496 | break; |
494 | 497 | ||
495 | case SAA7127_OUTPUT_TYPE_SVIDEO: | 498 | case SAA7127_OUTPUT_TYPE_SVIDEO: |
496 | state->reg_2d = 0xff; /* 11111111 croma -> R, luma -> CVBS + G + B */ | 499 | if (state->ident == V4L2_IDENT_SAA7129) |
500 | state->reg_2d = 0x18; /* Y + C */ | ||
501 | else | ||
502 | state->reg_2d = 0xff; /*11111111 croma -> R, luma -> CVBS + G + B */ | ||
497 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ | 503 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ |
498 | break; | 504 | break; |
499 | 505 | ||
@@ -508,7 +514,10 @@ static int saa7127_set_output_type(struct v4l2_subdev *sd, int output) | |||
508 | break; | 514 | break; |
509 | 515 | ||
510 | case SAA7127_OUTPUT_TYPE_BOTH: | 516 | case SAA7127_OUTPUT_TYPE_BOTH: |
511 | state->reg_2d = 0xbf; | 517 | if (state->ident == V4L2_IDENT_SAA7129) |
518 | state->reg_2d = 0x38; | ||
519 | else | ||
520 | state->reg_2d = 0xbf; | ||
512 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ | 521 | state->reg_3a = 0x13; /* by default switch YUV to RGB-matrix on */ |
513 | break; | 522 | break; |
514 | 523 | ||
@@ -731,24 +740,6 @@ static int saa7127_probe(struct i2c_client *client, | |||
731 | return -ENODEV; | 740 | return -ENODEV; |
732 | } | 741 | } |
733 | 742 | ||
734 | /* Configure Encoder */ | ||
735 | |||
736 | v4l2_dbg(1, debug, sd, "Configuring encoder\n"); | ||
737 | saa7127_write_inittab(sd, saa7127_init_config_common); | ||
738 | saa7127_set_std(sd, V4L2_STD_NTSC); | ||
739 | saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH); | ||
740 | saa7127_set_vps(sd, &vbi); | ||
741 | saa7127_set_wss(sd, &vbi); | ||
742 | saa7127_set_cc(sd, &vbi); | ||
743 | saa7127_set_xds(sd, &vbi); | ||
744 | if (test_image == 1) | ||
745 | /* The Encoder has an internal Colorbar generator */ | ||
746 | /* This can be used for debugging */ | ||
747 | saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE); | ||
748 | else | ||
749 | saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL); | ||
750 | saa7127_set_video_enable(sd, 1); | ||
751 | |||
752 | if (id->driver_data) { /* Chip type is already known */ | 743 | if (id->driver_data) { /* Chip type is already known */ |
753 | state->ident = id->driver_data; | 744 | state->ident = id->driver_data; |
754 | } else { /* Needs detection */ | 745 | } else { /* Needs detection */ |
@@ -770,6 +761,23 @@ static int saa7127_probe(struct i2c_client *client, | |||
770 | 761 | ||
771 | v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, | 762 | v4l2_info(sd, "%s found @ 0x%x (%s)\n", client->name, |
772 | client->addr << 1, client->adapter->name); | 763 | client->addr << 1, client->adapter->name); |
764 | |||
765 | v4l2_dbg(1, debug, sd, "Configuring encoder\n"); | ||
766 | saa7127_write_inittab(sd, saa7127_init_config_common); | ||
767 | saa7127_set_std(sd, V4L2_STD_NTSC); | ||
768 | saa7127_set_output_type(sd, SAA7127_OUTPUT_TYPE_BOTH); | ||
769 | saa7127_set_vps(sd, &vbi); | ||
770 | saa7127_set_wss(sd, &vbi); | ||
771 | saa7127_set_cc(sd, &vbi); | ||
772 | saa7127_set_xds(sd, &vbi); | ||
773 | if (test_image == 1) | ||
774 | /* The Encoder has an internal Colorbar generator */ | ||
775 | /* This can be used for debugging */ | ||
776 | saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_TEST_IMAGE); | ||
777 | else | ||
778 | saa7127_set_input_type(sd, SAA7127_INPUT_TYPE_NORMAL); | ||
779 | saa7127_set_video_enable(sd, 1); | ||
780 | |||
773 | if (state->ident == V4L2_IDENT_SAA7129) | 781 | if (state->ident == V4L2_IDENT_SAA7129) |
774 | saa7127_write_inittab(sd, saa7129_init_config_extra); | 782 | saa7127_write_inittab(sd, saa7129_init_config_extra); |
775 | return 0; | 783 | return 0; |