]>
Commit | Line | Data |
---|---|---|
1c1e45d1 HV |
1 | /* |
2 | * cx18 functions to query card hardware | |
3 | * | |
4 | * Derived from ivtv-cards.c | |
5 | * | |
6 | * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> | |
7 | * | |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | */ | |
22 | ||
23 | /* hardware flags */ | |
24 | #define CX18_HW_TUNER (1 << 0) | |
25 | #define CX18_HW_TVEEPROM (1 << 1) | |
26 | #define CX18_HW_CS5345 (1 << 2) | |
27 | #define CX18_HW_GPIO (1 << 3) | |
28 | #define CX18_HW_CX23418 (1 << 4) | |
29 | #define CX18_HW_DVB (1 << 5) | |
30 | ||
31 | /* video inputs */ | |
32 | #define CX18_CARD_INPUT_VID_TUNER 1 | |
33 | #define CX18_CARD_INPUT_SVIDEO1 2 | |
34 | #define CX18_CARD_INPUT_SVIDEO2 3 | |
35 | #define CX18_CARD_INPUT_COMPOSITE1 4 | |
36 | #define CX18_CARD_INPUT_COMPOSITE2 5 | |
37 | #define CX18_CARD_INPUT_COMPOSITE3 6 | |
38 | ||
39 | enum cx34180_video_input { | |
40 | /* Composite video inputs In1-In8 */ | |
41 | CX23418_COMPOSITE1 = 1, | |
42 | CX23418_COMPOSITE2, | |
43 | CX23418_COMPOSITE3, | |
44 | CX23418_COMPOSITE4, | |
45 | CX23418_COMPOSITE5, | |
46 | CX23418_COMPOSITE6, | |
47 | CX23418_COMPOSITE7, | |
48 | CX23418_COMPOSITE8, | |
49 | ||
50 | /* S-Video inputs consist of one luma input (In1-In4) ORed with one | |
51 | chroma input (In5-In8) */ | |
52 | CX23418_SVIDEO_LUMA1 = 0x10, | |
53 | CX23418_SVIDEO_LUMA2 = 0x20, | |
54 | CX23418_SVIDEO_LUMA3 = 0x30, | |
55 | CX23418_SVIDEO_LUMA4 = 0x40, | |
56 | CX23418_SVIDEO_CHROMA4 = 0x400, | |
57 | CX23418_SVIDEO_CHROMA5 = 0x500, | |
58 | CX23418_SVIDEO_CHROMA6 = 0x600, | |
59 | CX23418_SVIDEO_CHROMA7 = 0x700, | |
60 | CX23418_SVIDEO_CHROMA8 = 0x800, | |
61 | ||
62 | /* S-Video aliases for common luma/chroma combinations */ | |
63 | CX23418_SVIDEO1 = 0x510, | |
64 | CX23418_SVIDEO2 = 0x620, | |
65 | CX23418_SVIDEO3 = 0x730, | |
66 | CX23418_SVIDEO4 = 0x840, | |
67 | }; | |
68 | ||
69 | /* audio inputs */ | |
70 | #define CX18_CARD_INPUT_AUD_TUNER 1 | |
71 | #define CX18_CARD_INPUT_LINE_IN1 2 | |
72 | #define CX18_CARD_INPUT_LINE_IN2 3 | |
73 | ||
74 | #define CX18_CARD_MAX_VIDEO_INPUTS 6 | |
75 | #define CX18_CARD_MAX_AUDIO_INPUTS 3 | |
76 | #define CX18_CARD_MAX_TUNERS 2 | |
77 | ||
78 | enum cx23418_audio_input { | |
79 | /* Audio inputs: serial or In4-In8 */ | |
80 | CX23418_AUDIO_SERIAL, | |
81 | CX23418_AUDIO4 = 4, | |
82 | CX23418_AUDIO5, | |
83 | CX23418_AUDIO6, | |
84 | CX23418_AUDIO7, | |
85 | CX23418_AUDIO8, | |
86 | }; | |
87 | ||
88 | /* V4L2 capability aliases */ | |
89 | #define CX18_CAP_ENCODER (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | \ | |
90 | V4L2_CAP_AUDIO | V4L2_CAP_READWRITE) | |
91 | /* | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_SLICED_VBI_CAPTURE) not yet */ | |
92 | ||
93 | struct cx18_card_video_input { | |
94 | u8 video_type; /* video input type */ | |
95 | u8 audio_index; /* index in cx18_card_audio_input array */ | |
96 | u16 video_input; /* hardware video input */ | |
97 | }; | |
98 | ||
99 | struct cx18_card_audio_input { | |
100 | u8 audio_type; /* audio input type */ | |
101 | u32 audio_input; /* hardware audio input */ | |
102 | u16 muxer_input; /* hardware muxer input for boards with a | |
103 | multiplexer chip */ | |
104 | }; | |
105 | ||
106 | struct cx18_card_pci_info { | |
107 | u16 device; | |
108 | u16 subsystem_vendor; | |
109 | u16 subsystem_device; | |
110 | }; | |
111 | ||
112 | /* GPIO definitions */ | |
113 | ||
114 | /* The mask is the set of bits used by the operation */ | |
115 | ||
116 | struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */ | |
117 | u16 direction; /* DIR setting. Leave to 0 if no init is needed */ | |
118 | u16 initial_value; | |
119 | }; | |
120 | ||
121 | struct cx18_card_tuner { | |
122 | v4l2_std_id std; /* standard for which the tuner is suitable */ | |
123 | int tuner; /* tuner ID (from tuner.h) */ | |
124 | }; | |
125 | ||
126 | struct cx18_card_tuner_i2c { | |
127 | unsigned short radio[2];/* radio tuner i2c address to probe */ | |
128 | unsigned short demod[2];/* demodulator i2c address to probe */ | |
129 | unsigned short tv[4]; /* tv tuner i2c addresses to probe */ | |
130 | }; | |
131 | ||
132 | struct cx18_ddr { /* DDR config data */ | |
133 | u32 chip_config; | |
134 | u32 refresh; | |
135 | u32 timing1; | |
136 | u32 timing2; | |
137 | u32 tune_lane; | |
138 | u32 initial_emrs; | |
139 | }; | |
140 | ||
141 | /* for card information/parameters */ | |
142 | struct cx18_card { | |
143 | int type; | |
144 | char *name; | |
145 | char *comment; | |
146 | u32 v4l2_capabilities; | |
147 | u32 hw_audio_ctrl; /* hardware used for the V4L2 controls (only | |
148 | 1 dev allowed) */ | |
149 | u32 hw_muxer; /* hardware used to multiplex audio input */ | |
150 | u32 hw_all; /* all hardware used by the board */ | |
151 | struct cx18_card_video_input video_inputs[CX18_CARD_MAX_VIDEO_INPUTS]; | |
152 | struct cx18_card_audio_input audio_inputs[CX18_CARD_MAX_AUDIO_INPUTS]; | |
153 | struct cx18_card_audio_input radio_input; | |
154 | ||
155 | /* GPIO card-specific settings */ | |
156 | struct cx18_gpio_init gpio_init; | |
157 | ||
158 | struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS]; | |
159 | struct cx18_card_tuner_i2c *i2c; | |
160 | ||
161 | struct cx18_ddr ddr; | |
162 | ||
163 | /* list of device and subsystem vendor/devices that | |
164 | correspond to this card type. */ | |
165 | const struct cx18_card_pci_info *pci_list; | |
166 | }; | |
167 | ||
168 | int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input); | |
169 | int cx18_get_audio_input(struct cx18 *cx, u16 index, struct v4l2_audio *input); | |
170 | const struct cx18_card *cx18_get_card(u16 index); |