diff options
author | David T.L. Wong <davidtlwong@gmail.com> | 2009-10-20 11:13:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:40:52 -0500 |
commit | fb29ab96982baba57b03636e2a894c0d0acd197e (patch) | |
tree | c035f1fc9b0f5ca9d0192b4861ce10d11367edf4 /drivers/media/video/cx25840 | |
parent | 184e769f93e734ced24c948ea02e3d541c45c766 (diff) |
V4L/DVB (13206): cx25840: add component support
Signed-off-by: David T.L. Wong <davidtlwong@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 904e9a5a9065..9702a9334b4a 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -703,6 +703,10 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
703 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); | 703 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); |
704 | u8 is_composite = (vid_input >= CX25840_COMPOSITE1 && | 704 | u8 is_composite = (vid_input >= CX25840_COMPOSITE1 && |
705 | vid_input <= CX25840_COMPOSITE8); | 705 | vid_input <= CX25840_COMPOSITE8); |
706 | u8 is_component = (vid_input & CX25840_COMPONENT_ON) == | ||
707 | CX25840_COMPONENT_ON; | ||
708 | int luma = vid_input & 0xf0; | ||
709 | int chroma = vid_input & 0xf00; | ||
706 | u8 reg; | 710 | u8 reg; |
707 | 711 | ||
708 | v4l_dbg(1, cx25840_debug, client, | 712 | v4l_dbg(1, cx25840_debug, client, |
@@ -715,18 +719,14 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
715 | reg = vid_input & 0xff; | 719 | reg = vid_input & 0xff; |
716 | if ((vid_input & CX25840_SVIDEO_ON) == CX25840_SVIDEO_ON) | 720 | if ((vid_input & CX25840_SVIDEO_ON) == CX25840_SVIDEO_ON) |
717 | is_composite = 0; | 721 | is_composite = 0; |
718 | else | 722 | else if ((vid_input & CX25840_COMPONENT_ON) == 0) |
719 | is_composite = 1; | 723 | is_composite = 1; |
720 | 724 | ||
721 | v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n", | 725 | v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n", |
722 | reg, is_composite); | 726 | reg, is_composite); |
723 | } else | 727 | } else if (is_composite) { |
724 | if (is_composite) { | ||
725 | reg = 0xf0 + (vid_input - CX25840_COMPOSITE1); | 728 | reg = 0xf0 + (vid_input - CX25840_COMPOSITE1); |
726 | } else { | 729 | } else { |
727 | int luma = vid_input & 0xf0; | ||
728 | int chroma = vid_input & 0xf00; | ||
729 | |||
730 | if ((vid_input & ~0xff0) || | 730 | if ((vid_input & ~0xff0) || |
731 | luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 || | 731 | luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 || |
732 | chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) { | 732 | chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) { |
@@ -768,8 +768,11 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
768 | 768 | ||
769 | cx25840_write(client, 0x103, reg); | 769 | cx25840_write(client, 0x103, reg); |
770 | 770 | ||
771 | /* Set INPUT_MODE to Composite (0) or S-Video (1) */ | 771 | /* Set INPUT_MODE to Composite, S-Video or Component */ |
772 | cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02); | 772 | if (is_component) |
773 | cx25840_and_or(client, 0x401, ~0x6, 0x6); | ||
774 | else | ||
775 | cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02); | ||
773 | 776 | ||
774 | if (!is_cx2388x(state) && !is_cx231xx(state)) { | 777 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
775 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ | 778 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ |
@@ -780,12 +783,21 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
780 | else | 783 | else |
781 | cx25840_and_or(client, 0x102, ~0x4, 0); | 784 | cx25840_and_or(client, 0x102, ~0x4, 0); |
782 | } else { | 785 | } else { |
783 | if (is_composite) | 786 | /* Set DUAL_MODE_ADC2 to 1 if component*/ |
787 | cx25840_and_or(client, 0x102, ~0x4, is_component ? 0x4 : 0x0); | ||
788 | if (is_composite) { | ||
784 | /* ADC2 input select channel 2 */ | 789 | /* ADC2 input select channel 2 */ |
785 | cx25840_and_or(client, 0x102, ~0x2, 0); | 790 | cx25840_and_or(client, 0x102, ~0x2, 0); |
786 | else | 791 | } else if (!is_component) { |
787 | /* ADC2 input select channel 3 */ | 792 | /* S-Video */ |
788 | cx25840_and_or(client, 0x102, ~0x2, 2); | 793 | if (chroma >= CX25840_SVIDEO_CHROMA7) { |
794 | /* ADC2 input select channel 3 */ | ||
795 | cx25840_and_or(client, 0x102, ~0x2, 2); | ||
796 | } else { | ||
797 | /* ADC2 input select channel 2 */ | ||
798 | cx25840_and_or(client, 0x102, ~0x2, 0); | ||
799 | } | ||
800 | } | ||
789 | } | 801 | } |
790 | 802 | ||
791 | state->vid_input = vid_input; | 803 | state->vid_input = vid_input; |