diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-18 15:26:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:57 -0400 |
commit | 107063c6156a0cbf055e771baafc28a3e3c0fb9b (patch) | |
tree | 813a2dc2c1426521167f2f289d7a106aaf2f24ec /drivers/media/video/bt856.c | |
parent | 84c1b09495ea366276726b0df2dcd7898cda9d0f (diff) |
V4L/DVB (10714): zoran et al: convert zoran i2c modules to V4L2.
The zoran i2c modules were still using V4L1 internally. Replace this
with V4L2. Also deleted saa7111.c and saa7114.c, we use saa7115.c instead.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[mchehab@redhat.com: fix v4l2_ctrl_query_fill_std merge conflict]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bt856.c')
-rw-r--r-- | drivers/media/video/bt856.c | 92 |
1 files changed, 19 insertions, 73 deletions
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 4213867507f8..3e042c5ddaa7 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -55,8 +55,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
55 | struct bt856 { | 55 | struct bt856 { |
56 | unsigned char reg[BT856_NR_REG]; | 56 | unsigned char reg[BT856_NR_REG]; |
57 | 57 | ||
58 | int norm; | 58 | v4l2_std_id norm; |
59 | int enable; | ||
60 | }; | 59 | }; |
61 | 60 | ||
62 | /* ----------------------------------------------------------------------- */ | 61 | /* ----------------------------------------------------------------------- */ |
@@ -96,7 +95,7 @@ static int bt856_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
96 | struct bt856 *encoder = i2c_get_clientdata(client); | 95 | struct bt856 *encoder = i2c_get_clientdata(client); |
97 | 96 | ||
98 | switch (cmd) { | 97 | switch (cmd) { |
99 | case 0: | 98 | case VIDIOC_INT_INIT: |
100 | /* This is just for testing!!! */ | 99 | /* This is just for testing!!! */ |
101 | v4l_dbg(1, debug, client, "init\n"); | 100 | v4l_dbg(1, debug, client, "init\n"); |
102 | bt856_write(client, 0xdc, 0x18); | 101 | bt856_write(client, 0xdc, 0x18); |
@@ -107,15 +106,10 @@ static int bt856_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
107 | //bt856_setbit(client, 0xdc, 6, 0); | 106 | //bt856_setbit(client, 0xdc, 6, 0); |
108 | bt856_setbit(client, 0xdc, 4, 1); | 107 | bt856_setbit(client, 0xdc, 4, 1); |
109 | 108 | ||
110 | switch (encoder->norm) { | 109 | if (encoder->norm & V4L2_STD_NTSC) |
111 | case VIDEO_MODE_NTSC: | ||
112 | bt856_setbit(client, 0xdc, 2, 0); | 110 | bt856_setbit(client, 0xdc, 2, 0); |
113 | break; | 111 | else |
114 | |||
115 | case VIDEO_MODE_PAL: | ||
116 | bt856_setbit(client, 0xdc, 2, 1); | 112 | bt856_setbit(client, 0xdc, 2, 1); |
117 | break; | ||
118 | } | ||
119 | 113 | ||
120 | bt856_setbit(client, 0xdc, 1, 1); | 114 | bt856_setbit(client, 0xdc, 1, 1); |
121 | bt856_setbit(client, 0xde, 4, 0); | 115 | bt856_setbit(client, 0xde, 4, 0); |
@@ -124,38 +118,19 @@ static int bt856_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
124 | bt856_dump(client); | 118 | bt856_dump(client); |
125 | break; | 119 | break; |
126 | 120 | ||
127 | case ENCODER_GET_CAPABILITIES: | 121 | case VIDIOC_INT_S_STD_OUTPUT: |
128 | { | 122 | { |
129 | struct video_encoder_capability *cap = arg; | 123 | v4l2_std_id *iarg = arg; |
130 | |||
131 | v4l_dbg(1, debug, client, "get capabilities\n"); | ||
132 | 124 | ||
133 | cap->flags = VIDEO_ENCODER_PAL | | 125 | v4l_dbg(1, debug, client, "set norm %llx\n", *iarg); |
134 | VIDEO_ENCODER_NTSC | | ||
135 | VIDEO_ENCODER_CCIR; | ||
136 | cap->inputs = 2; | ||
137 | cap->outputs = 1; | ||
138 | break; | ||
139 | } | ||
140 | |||
141 | case ENCODER_SET_NORM: | ||
142 | { | ||
143 | int *iarg = arg; | ||
144 | 126 | ||
145 | v4l_dbg(1, debug, client, "set norm %d\n", *iarg); | 127 | if (*iarg & V4L2_STD_NTSC) { |
146 | |||
147 | switch (*iarg) { | ||
148 | case VIDEO_MODE_NTSC: | ||
149 | bt856_setbit(client, 0xdc, 2, 0); | 128 | bt856_setbit(client, 0xdc, 2, 0); |
150 | break; | 129 | } else if (*iarg & V4L2_STD_PAL) { |
151 | |||
152 | case VIDEO_MODE_PAL: | ||
153 | bt856_setbit(client, 0xdc, 2, 1); | 130 | bt856_setbit(client, 0xdc, 2, 1); |
154 | bt856_setbit(client, 0xda, 0, 0); | 131 | bt856_setbit(client, 0xda, 0, 0); |
155 | //bt856_setbit(client, 0xda, 0, 1); | 132 | //bt856_setbit(client, 0xda, 0, 1); |
156 | break; | 133 | } else { |
157 | |||
158 | default: | ||
159 | return -EINVAL; | 134 | return -EINVAL; |
160 | } | 135 | } |
161 | encoder->norm = *iarg; | 136 | encoder->norm = *iarg; |
@@ -164,16 +139,16 @@ static int bt856_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
164 | break; | 139 | break; |
165 | } | 140 | } |
166 | 141 | ||
167 | case ENCODER_SET_INPUT: | 142 | case VIDIOC_INT_S_VIDEO_ROUTING: |
168 | { | 143 | { |
169 | int *iarg = arg; | 144 | struct v4l2_routing *route = arg; |
170 | 145 | ||
171 | v4l_dbg(1, debug, client, "set input %d\n", *iarg); | 146 | v4l_dbg(1, debug, client, "set input %d\n", route->input); |
172 | 147 | ||
173 | /* We only have video bus. | 148 | /* We only have video bus. |
174 | * iarg = 0: input is from bt819 | 149 | * route->input= 0: input is from bt819 |
175 | * iarg = 1: input is from ZR36060 */ | 150 | * route->input= 1: input is from ZR36060 */ |
176 | switch (*iarg) { | 151 | switch (route->input) { |
177 | case 0: | 152 | case 0: |
178 | bt856_setbit(client, 0xde, 4, 0); | 153 | bt856_setbit(client, 0xde, 4, 0); |
179 | bt856_setbit(client, 0xde, 3, 1); | 154 | bt856_setbit(client, 0xde, 3, 1); |
@@ -199,28 +174,6 @@ static int bt856_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
199 | break; | 174 | break; |
200 | } | 175 | } |
201 | 176 | ||
202 | case ENCODER_SET_OUTPUT: | ||
203 | { | ||
204 | int *iarg = arg; | ||
205 | |||
206 | v4l_dbg(1, debug, client, "set output %d\n", *iarg); | ||
207 | |||
208 | /* not much choice of outputs */ | ||
209 | if (*iarg != 0) | ||
210 | return -EINVAL; | ||
211 | break; | ||
212 | } | ||
213 | |||
214 | case ENCODER_ENABLE_OUTPUT: | ||
215 | { | ||
216 | int *iarg = arg; | ||
217 | |||
218 | encoder->enable = !!*iarg; | ||
219 | |||
220 | v4l_dbg(1, debug, client, "enable output %d\n", encoder->enable); | ||
221 | break; | ||
222 | } | ||
223 | |||
224 | default: | 177 | default: |
225 | return -EINVAL; | 178 | return -EINVAL; |
226 | } | 179 | } |
@@ -249,8 +202,7 @@ static int bt856_probe(struct i2c_client *client, | |||
249 | encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL); | 202 | encoder = kzalloc(sizeof(struct bt856), GFP_KERNEL); |
250 | if (encoder == NULL) | 203 | if (encoder == NULL) |
251 | return -ENOMEM; | 204 | return -ENOMEM; |
252 | encoder->norm = VIDEO_MODE_NTSC; | 205 | encoder->norm = V4L2_STD_NTSC; |
253 | encoder->enable = 1; | ||
254 | i2c_set_clientdata(client, encoder); | 206 | i2c_set_clientdata(client, encoder); |
255 | 207 | ||
256 | bt856_write(client, 0xdc, 0x18); | 208 | bt856_write(client, 0xdc, 0x18); |
@@ -261,16 +213,10 @@ static int bt856_probe(struct i2c_client *client, | |||
261 | //bt856_setbit(client, 0xdc, 6, 0); | 213 | //bt856_setbit(client, 0xdc, 6, 0); |
262 | bt856_setbit(client, 0xdc, 4, 1); | 214 | bt856_setbit(client, 0xdc, 4, 1); |
263 | 215 | ||
264 | switch (encoder->norm) { | 216 | if (encoder->norm & V4L2_STD_NTSC) |
265 | |||
266 | case VIDEO_MODE_NTSC: | ||
267 | bt856_setbit(client, 0xdc, 2, 0); | 217 | bt856_setbit(client, 0xdc, 2, 0); |
268 | break; | 218 | else |
269 | |||
270 | case VIDEO_MODE_PAL: | ||
271 | bt856_setbit(client, 0xdc, 2, 1); | 219 | bt856_setbit(client, 0xdc, 2, 1); |
272 | break; | ||
273 | } | ||
274 | 220 | ||
275 | bt856_setbit(client, 0xdc, 1, 1); | 221 | bt856_setbit(client, 0xdc, 1, 1); |
276 | bt856_setbit(client, 0xde, 4, 0); | 222 | bt856_setbit(client, 0xde, 4, 0); |