diff options
author | Andy Walls <awalls@radix.net> | 2010-03-13 14:40:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-17 23:47:13 -0400 |
commit | d9a325a865becc082d592d16a15f01a9684ef82e (patch) | |
tree | b3b7d192d19bd353c9eca8c48b20b59505ae489f /drivers/media/video/cx18 | |
parent | c6ebc6c4acbedcc766a8af147ccb9c39e77578ae (diff) |
V4L/DVB: cx18: Add support for component video inputs
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.c | 33 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-av-core.h | 19 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-cards.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-cards.h | 4 |
4 files changed, 51 insertions, 7 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c index 4392c76af5df..3ce45297e56a 100644 --- a/drivers/media/video/cx18/cx18-av-core.c +++ b/drivers/media/video/cx18/cx18-av-core.c | |||
@@ -579,6 +579,7 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
579 | 579 | ||
580 | u8 afe_mux_cfg; | 580 | u8 afe_mux_cfg; |
581 | u8 adc2_cfg; | 581 | u8 adc2_cfg; |
582 | u8 input_mode; | ||
582 | u32 afe_cfg; | 583 | u32 afe_cfg; |
583 | int i; | 584 | int i; |
584 | 585 | ||
@@ -589,6 +590,30 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
589 | vid_input <= CX18_AV_COMPOSITE8) { | 590 | vid_input <= CX18_AV_COMPOSITE8) { |
590 | afe_mux_cfg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); | 591 | afe_mux_cfg = 0xf0 + (vid_input - CX18_AV_COMPOSITE1); |
591 | ch[0] = CVBS; | 592 | ch[0] = CVBS; |
593 | input_mode = 0x0; | ||
594 | } else if (vid_input >= CX18_AV_COMPONENT_LUMA1) { | ||
595 | int luma = vid_input & 0xf000; | ||
596 | int r_chroma = vid_input & 0xf0000; | ||
597 | int b_chroma = vid_input & 0xf00000; | ||
598 | |||
599 | if ((vid_input & ~0xfff000) || | ||
600 | luma < CX18_AV_COMPONENT_LUMA1 || | ||
601 | luma > CX18_AV_COMPONENT_LUMA8 || | ||
602 | r_chroma < CX18_AV_COMPONENT_R_CHROMA4 || | ||
603 | r_chroma > CX18_AV_COMPONENT_R_CHROMA6 || | ||
604 | b_chroma < CX18_AV_COMPONENT_B_CHROMA7 || | ||
605 | b_chroma > CX18_AV_COMPONENT_B_CHROMA8) { | ||
606 | CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", | ||
607 | vid_input); | ||
608 | return -EINVAL; | ||
609 | } | ||
610 | afe_mux_cfg = (luma - CX18_AV_COMPONENT_LUMA1) >> 12; | ||
611 | ch[0] = Y; | ||
612 | afe_mux_cfg |= (r_chroma - CX18_AV_COMPONENT_R_CHROMA4) >> 12; | ||
613 | ch[1] = Pr; | ||
614 | afe_mux_cfg |= (b_chroma - CX18_AV_COMPONENT_B_CHROMA7) >> 14; | ||
615 | ch[2] = Pb; | ||
616 | input_mode = 0x6; | ||
592 | } else { | 617 | } else { |
593 | int luma = vid_input & 0xf0; | 618 | int luma = vid_input & 0xf0; |
594 | int chroma = vid_input & 0xf00; | 619 | int chroma = vid_input & 0xf00; |
@@ -598,7 +623,7 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
598 | luma > CX18_AV_SVIDEO_LUMA8 || | 623 | luma > CX18_AV_SVIDEO_LUMA8 || |
599 | chroma < CX18_AV_SVIDEO_CHROMA4 || | 624 | chroma < CX18_AV_SVIDEO_CHROMA4 || |
600 | chroma > CX18_AV_SVIDEO_CHROMA8) { | 625 | chroma > CX18_AV_SVIDEO_CHROMA8) { |
601 | CX18_ERR_DEV(sd, "0x%04x is not a valid video input!\n", | 626 | CX18_ERR_DEV(sd, "0x%06x is not a valid video input!\n", |
602 | vid_input); | 627 | vid_input); |
603 | return -EINVAL; | 628 | return -EINVAL; |
604 | } | 629 | } |
@@ -613,8 +638,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
613 | afe_mux_cfg |= (chroma - CX18_AV_SVIDEO_CHROMA4) >> 4; | 638 | afe_mux_cfg |= (chroma - CX18_AV_SVIDEO_CHROMA4) >> 4; |
614 | ch[1] = C; | 639 | ch[1] = C; |
615 | } | 640 | } |
641 | input_mode = 0x2; | ||
616 | } | 642 | } |
617 | /* TODO: LeadTek WinFast DVR3100 H & WinFast PVR2100 can do Y/Pb/Pr */ | ||
618 | 643 | ||
619 | switch (aud_input) { | 644 | switch (aud_input) { |
620 | case CX18_AV_AUDIO_SERIAL1: | 645 | case CX18_AV_AUDIO_SERIAL1: |
@@ -650,8 +675,8 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input, | |||
650 | 675 | ||
651 | /* Set up analog front end multiplexers */ | 676 | /* Set up analog front end multiplexers */ |
652 | cx18_av_write_expect(cx, 0x103, afe_mux_cfg, afe_mux_cfg, 0xf7); | 677 | cx18_av_write_expect(cx, 0x103, afe_mux_cfg, afe_mux_cfg, 0xf7); |
653 | /* Set INPUT_MODE to Composite (0) or S-Video (1) */ | 678 | /* Set INPUT_MODE to Composite, S-Video, or Component */ |
654 | cx18_av_and_or(cx, 0x401, ~0x6, ch[0] == CVBS ? 0 : 0x02); | 679 | cx18_av_and_or(cx, 0x401, ~0x6, input_mode); |
655 | 680 | ||
656 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ | 681 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ |
657 | adc2_cfg = cx18_av_read(cx, 0x102); | 682 | adc2_cfg = cx18_av_read(cx, 0x102); |
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h index cafb7e99b9a0..74546806b03f 100644 --- a/drivers/media/video/cx18/cx18-av-core.h +++ b/drivers/media/video/cx18/cx18-av-core.h | |||
@@ -61,6 +61,25 @@ enum cx18_av_video_input { | |||
61 | CX18_AV_SVIDEO2 = 0x620, | 61 | CX18_AV_SVIDEO2 = 0x620, |
62 | CX18_AV_SVIDEO3 = 0x730, | 62 | CX18_AV_SVIDEO3 = 0x730, |
63 | CX18_AV_SVIDEO4 = 0x840, | 63 | CX18_AV_SVIDEO4 = 0x840, |
64 | |||
65 | /* Component Video inputs consist of one luma input (In1-In8) ORed | ||
66 | with a red chroma (In4-In6) and blue chroma input (In7-In8) */ | ||
67 | CX18_AV_COMPONENT_LUMA1 = 0x1000, | ||
68 | CX18_AV_COMPONENT_LUMA2 = 0x2000, | ||
69 | CX18_AV_COMPONENT_LUMA3 = 0x3000, | ||
70 | CX18_AV_COMPONENT_LUMA4 = 0x4000, | ||
71 | CX18_AV_COMPONENT_LUMA5 = 0x5000, | ||
72 | CX18_AV_COMPONENT_LUMA6 = 0x6000, | ||
73 | CX18_AV_COMPONENT_LUMA7 = 0x7000, | ||
74 | CX18_AV_COMPONENT_LUMA8 = 0x8000, | ||
75 | CX18_AV_COMPONENT_R_CHROMA4 = 0x40000, | ||
76 | CX18_AV_COMPONENT_R_CHROMA5 = 0x50000, | ||
77 | CX18_AV_COMPONENT_R_CHROMA6 = 0x60000, | ||
78 | CX18_AV_COMPONENT_B_CHROMA7 = 0x700000, | ||
79 | CX18_AV_COMPONENT_B_CHROMA8 = 0x800000, | ||
80 | |||
81 | /* Component Video aliases for common combinations */ | ||
82 | CX18_AV_COMPONENT1 = 0x861000, | ||
64 | }; | 83 | }; |
65 | 84 | ||
66 | enum cx18_av_audio_input { | 85 | enum cx18_av_audio_input { |
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index f808fb6fc1c1..3d35f58e3119 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c | |||
@@ -480,7 +480,7 @@ int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input) | |||
480 | "S-Video 2", | 480 | "S-Video 2", |
481 | "Composite 1", | 481 | "Composite 1", |
482 | "Composite 2", | 482 | "Composite 2", |
483 | "Composite 3" | 483 | "Component 1" |
484 | }; | 484 | }; |
485 | 485 | ||
486 | memset(input, 0, sizeof(*input)); | 486 | memset(input, 0, sizeof(*input)); |
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h index af3d71607dc9..796e517300ac 100644 --- a/drivers/media/video/cx18/cx18-cards.h +++ b/drivers/media/video/cx18/cx18-cards.h | |||
@@ -43,7 +43,7 @@ | |||
43 | #define CX18_CARD_INPUT_SVIDEO2 3 | 43 | #define CX18_CARD_INPUT_SVIDEO2 3 |
44 | #define CX18_CARD_INPUT_COMPOSITE1 4 | 44 | #define CX18_CARD_INPUT_COMPOSITE1 4 |
45 | #define CX18_CARD_INPUT_COMPOSITE2 5 | 45 | #define CX18_CARD_INPUT_COMPOSITE2 5 |
46 | #define CX18_CARD_INPUT_COMPOSITE3 6 | 46 | #define CX18_CARD_INPUT_COMPONENT1 6 |
47 | 47 | ||
48 | /* audio inputs */ | 48 | /* audio inputs */ |
49 | #define CX18_CARD_INPUT_AUD_TUNER 1 | 49 | #define CX18_CARD_INPUT_AUD_TUNER 1 |
@@ -62,7 +62,7 @@ | |||
62 | struct cx18_card_video_input { | 62 | struct cx18_card_video_input { |
63 | u8 video_type; /* video input type */ | 63 | u8 video_type; /* video input type */ |
64 | u8 audio_index; /* index in cx18_card_audio_input array */ | 64 | u8 audio_index; /* index in cx18_card_audio_input array */ |
65 | u16 video_input; /* hardware video input */ | 65 | u32 video_input; /* hardware video input */ |
66 | }; | 66 | }; |
67 | 67 | ||
68 | struct cx18_card_audio_input { | 68 | struct cx18_card_audio_input { |