Commit fb29ab96982baba57b03636e2a894c0d0acd197e
Committed by
Mauro Carvalho Chehab
1 parent
184e769f93
Exists in
master
and in
7 other branches
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>
Showing 2 changed files with 25 additions and 12 deletions Side-by-side Diff
drivers/media/video/cx25840/cx25840-core.c
... | ... | @@ -703,6 +703,10 @@ |
703 | 703 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); |
704 | 704 | u8 is_composite = (vid_input >= CX25840_COMPOSITE1 && |
705 | 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 | 710 | u8 reg; |
707 | 711 | |
708 | 712 | v4l_dbg(1, cx25840_debug, client, |
709 | 713 | |
710 | 714 | |
... | ... | @@ -715,18 +719,14 @@ |
715 | 719 | reg = vid_input & 0xff; |
716 | 720 | if ((vid_input & CX25840_SVIDEO_ON) == CX25840_SVIDEO_ON) |
717 | 721 | is_composite = 0; |
718 | - else | |
722 | + else if ((vid_input & CX25840_COMPONENT_ON) == 0) | |
719 | 723 | is_composite = 1; |
720 | 724 | |
721 | 725 | v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n", |
722 | 726 | reg, is_composite); |
723 | - } else | |
724 | - if (is_composite) { | |
727 | + } else if (is_composite) { | |
725 | 728 | reg = 0xf0 + (vid_input - CX25840_COMPOSITE1); |
726 | 729 | } else { |
727 | - int luma = vid_input & 0xf0; | |
728 | - int chroma = vid_input & 0xf00; | |
729 | - | |
730 | 730 | if ((vid_input & ~0xff0) || |
731 | 731 | luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 || |
732 | 732 | chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) { |
... | ... | @@ -768,8 +768,11 @@ |
768 | 768 | |
769 | 769 | cx25840_write(client, 0x103, reg); |
770 | 770 | |
771 | - /* Set INPUT_MODE to Composite (0) or S-Video (1) */ | |
772 | - cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02); | |
771 | + /* Set INPUT_MODE to Composite, S-Video or Component */ | |
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 | 777 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
775 | 778 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ |
776 | 779 | |
... | ... | @@ -780,12 +783,21 @@ |
780 | 783 | else |
781 | 784 | cx25840_and_or(client, 0x102, ~0x4, 0); |
782 | 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 | 789 | /* ADC2 input select channel 2 */ |
785 | 790 | cx25840_and_or(client, 0x102, ~0x2, 0); |
786 | - else | |
787 | - /* ADC2 input select channel 3 */ | |
788 | - cx25840_and_or(client, 0x102, ~0x2, 2); | |
791 | + } else if (!is_component) { | |
792 | + /* S-Video */ | |
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 | 803 | state->vid_input = vid_input; |