diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /drivers/media/video/cx23885 | |
parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'drivers/media/video/cx23885')
-rw-r--r-- | drivers/media/video/cx23885/Kconfig | 5 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-417.c | 729 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-cards.c | 281 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-core.c | 439 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-dvb.c | 307 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-i2c.c | 49 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-reg.h | 2 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-vbi.c | 14 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 109 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 31 |
10 files changed, 1206 insertions, 760 deletions
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index 7bf14c9a15c7..8c1b7fa47a41 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig | |||
@@ -1,20 +1,21 @@ | |||
1 | config VIDEO_CX23885 | 1 | config VIDEO_CX23885 |
2 | tristate "Conexant cx23885 (2388x successor) support" | 2 | tristate "Conexant cx23885 (2388x successor) support" |
3 | depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT | 3 | depends on DVB_CORE && VIDEO_DEV && PCI && I2C && INPUT |
4 | depends on HOTPLUG # due to FW_LOADER | ||
5 | select I2C_ALGOBIT | 4 | select I2C_ALGOBIT |
6 | select FW_LOADER | ||
7 | select VIDEO_BTCX | 5 | select VIDEO_BTCX |
8 | select VIDEO_TUNER | 6 | select VIDEO_TUNER |
9 | select VIDEO_TVEEPROM | 7 | select VIDEO_TVEEPROM |
10 | select VIDEO_IR | 8 | select VIDEO_IR |
11 | select VIDEOBUF_DVB | 9 | select VIDEOBUF_DVB |
10 | select VIDEOBUF_DMA_SG | ||
12 | select VIDEO_CX25840 | 11 | select VIDEO_CX25840 |
13 | select VIDEO_CX2341X | 12 | select VIDEO_CX2341X |
14 | select DVB_DIB7000P if !DVB_FE_CUSTOMISE | 13 | select DVB_DIB7000P if !DVB_FE_CUSTOMISE |
15 | select MEDIA_TUNER_MT2131 if !DVB_FE_CUSTOMISE | 14 | select MEDIA_TUNER_MT2131 if !DVB_FE_CUSTOMISE |
16 | select DVB_S5H1409 if !DVB_FE_CUSTOMISE | 15 | select DVB_S5H1409 if !DVB_FE_CUSTOMISE |
16 | select DVB_S5H1411 if !DVB_FE_CUSTOMISE | ||
17 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE | 17 | select DVB_LGDT330X if !DVB_FE_CUSTOMISE |
18 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE | ||
18 | select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMIZE | 19 | select MEDIA_TUNER_XC2028 if !DVB_FE_CUSTOMIZE |
19 | select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE | 20 | select MEDIA_TUNER_TDA8290 if !DVB_FE_CUSTOMIZE |
20 | select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE | 21 | select MEDIA_TUNER_TDA18271 if !DVB_FE_CUSTOMIZE |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index acdd3b6b3e7c..00831f3ef8f5 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * (c) 2004 Jelle Foks <jelle@foks.8m.com> | 5 | * (c) 2004 Jelle Foks <jelle@foks.8m.com> |
6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> | 6 | * (c) 2004 Gerd Knorr <kraxel@bytesex.org> |
7 | * (c) 2008 Steven Toth <stoth@hauppauge.com> | 7 | * (c) 2008 Steven Toth <stoth@linuxtv.org> |
8 | * - CX23885/7/8 support | 8 | * - CX23885/7/8 support |
9 | * | 9 | * |
10 | * Includes parts from the ivtv driver( http://ivtv.sourceforge.net/), | 10 | * Includes parts from the ivtv driver( http://ivtv.sourceforge.net/), |
@@ -32,10 +32,10 @@ | |||
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
35 | #include <media/v4l2-ioctl.h> | ||
35 | #include <media/cx2341x.h> | 36 | #include <media/cx2341x.h> |
36 | 37 | ||
37 | #include "cx23885.h" | 38 | #include "cx23885.h" |
38 | #include "media/cx2341x.h" | ||
39 | 39 | ||
40 | #define CX23885_FIRM_IMAGE_SIZE 376836 | 40 | #define CX23885_FIRM_IMAGE_SIZE 376836 |
41 | #define CX23885_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw" | 41 | #define CX23885_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw" |
@@ -631,7 +631,7 @@ int mc417_memory_read(struct cx23885_dev *dev, u32 address, u32 *value) | |||
631 | /* ------------------------------------------------------------------ */ | 631 | /* ------------------------------------------------------------------ */ |
632 | 632 | ||
633 | /* MPEG encoder API */ | 633 | /* MPEG encoder API */ |
634 | char *cmd_to_str(int cmd) | 634 | static char *cmd_to_str(int cmd) |
635 | { | 635 | { |
636 | switch (cmd) { | 636 | switch (cmd) { |
637 | case CX2341X_ENC_PING_FW: | 637 | case CX2341X_ENC_PING_FW: |
@@ -1173,379 +1173,404 @@ static int cx23885_querymenu(struct cx23885_dev *dev, | |||
1173 | qctrl.id = qmenu->id; | 1173 | qctrl.id = qmenu->id; |
1174 | cx23885_queryctrl(dev, &qctrl); | 1174 | cx23885_queryctrl(dev, &qctrl); |
1175 | return v4l2_ctrl_query_menu(qmenu, &qctrl, | 1175 | return v4l2_ctrl_query_menu(qmenu, &qctrl, |
1176 | cx2341x_ctrl_get_menu(qmenu->id)); | 1176 | cx2341x_ctrl_get_menu(&dev->mpeg_params, qmenu->id)); |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | int cx23885_do_ioctl(struct inode *inode, struct file *file, int radio, | 1179 | static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *id) |
1180 | struct cx23885_dev *dev, unsigned int cmd, void *arg, | ||
1181 | v4l2_kioctl driver_ioctl) | ||
1182 | { | 1180 | { |
1183 | int err; | 1181 | struct cx23885_fh *fh = file->private_data; |
1182 | struct cx23885_dev *dev = fh->dev; | ||
1183 | unsigned int i; | ||
1184 | 1184 | ||
1185 | switch (cmd) { | 1185 | for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++) |
1186 | /* ---------- tv norms ---------- */ | 1186 | if (*id & cx23885_tvnorms[i].id) |
1187 | case VIDIOC_ENUMSTD: | 1187 | break; |
1188 | { | 1188 | if (i == ARRAY_SIZE(cx23885_tvnorms)) |
1189 | struct v4l2_standard *e = arg; | 1189 | return -EINVAL; |
1190 | unsigned int i; | 1190 | dev->encodernorm = cx23885_tvnorms[i]; |
1191 | 1191 | return 0; | |
1192 | i = e->index; | 1192 | } |
1193 | if (i >= ARRAY_SIZE(cx23885_tvnorms)) | ||
1194 | return -EINVAL; | ||
1195 | err = v4l2_video_std_construct(e, | ||
1196 | cx23885_tvnorms[e->index].id, | ||
1197 | cx23885_tvnorms[e->index].name); | ||
1198 | e->index = i; | ||
1199 | if (err < 0) | ||
1200 | return err; | ||
1201 | return 0; | ||
1202 | } | ||
1203 | case VIDIOC_G_STD: | ||
1204 | { | ||
1205 | v4l2_std_id *id = arg; | ||
1206 | 1193 | ||
1207 | *id = dev->encodernorm.id; | 1194 | static int vidioc_enum_input(struct file *file, void *priv, |
1208 | return 0; | 1195 | struct v4l2_input *i) |
1209 | } | 1196 | { |
1210 | case VIDIOC_S_STD: | 1197 | struct cx23885_fh *fh = file->private_data; |
1211 | { | 1198 | struct cx23885_dev *dev = fh->dev; |
1212 | v4l2_std_id *id = arg; | 1199 | struct cx23885_input *input; |
1213 | unsigned int i; | 1200 | unsigned int n; |
1214 | 1201 | ||
1215 | for (i = 0; i < ARRAY_SIZE(cx23885_tvnorms); i++) | 1202 | n = i->index; |
1216 | if (*id & cx23885_tvnorms[i].id) | ||
1217 | break; | ||
1218 | if (i == ARRAY_SIZE(cx23885_tvnorms)) | ||
1219 | return -EINVAL; | ||
1220 | dev->encodernorm = cx23885_tvnorms[i]; | ||
1221 | 1203 | ||
1222 | return 0; | 1204 | if (n >= 4) |
1223 | } | 1205 | return -EINVAL; |
1224 | 1206 | ||
1225 | /* ------ input switching ---------- */ | 1207 | input = &cx23885_boards[dev->board].input[n]; |
1226 | case VIDIOC_ENUMINPUT: | ||
1227 | { | ||
1228 | struct cx23885_input *input; | ||
1229 | struct v4l2_input *i = arg; | ||
1230 | unsigned int n; | ||
1231 | |||
1232 | n = i->index; | ||
1233 | if (n >= 4) | ||
1234 | return -EINVAL; | ||
1235 | input = &cx23885_boards[dev->board].input[n]; | ||
1236 | if (input->type == 0) | ||
1237 | return -EINVAL; | ||
1238 | memset(i, 0, sizeof(*i)); | ||
1239 | i->index = n; | ||
1240 | /* FIXME | ||
1241 | * strcpy(i->name, input->name); */ | ||
1242 | strcpy(i->name, "unset"); | ||
1243 | if (input->type == CX23885_VMUX_TELEVISION || | ||
1244 | input->type == CX23885_VMUX_CABLE) | ||
1245 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
1246 | else | ||
1247 | i->type = V4L2_INPUT_TYPE_CAMERA; | ||
1248 | 1208 | ||
1249 | for (n = 0; n < ARRAY_SIZE(cx23885_tvnorms); n++) | 1209 | if (input->type == 0) |
1250 | i->std |= cx23885_tvnorms[n].id; | 1210 | return -EINVAL; |
1251 | return 0; | ||
1252 | } | ||
1253 | case VIDIOC_G_INPUT: | ||
1254 | { | ||
1255 | unsigned int *i = arg; | ||
1256 | 1211 | ||
1257 | *i = dev->input; | 1212 | memset(i, 0, sizeof(*i)); |
1258 | return 0; | 1213 | i->index = n; |
1259 | } | ||
1260 | case VIDIOC_S_INPUT: | ||
1261 | { | ||
1262 | unsigned int *i = arg; | ||
1263 | 1214 | ||
1264 | if (*i >= 4) | 1215 | /* FIXME |
1265 | return -EINVAL; | 1216 | * strcpy(i->name, input->name); */ |
1217 | strcpy(i->name, "unset"); | ||
1266 | 1218 | ||
1267 | return 0; | 1219 | if (input->type == CX23885_VMUX_TELEVISION || |
1268 | } | 1220 | input->type == CX23885_VMUX_CABLE) |
1221 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
1222 | else | ||
1223 | i->type = V4L2_INPUT_TYPE_CAMERA; | ||
1269 | 1224 | ||
1270 | /* --- tuner ioctls ------------------------------------------ */ | 1225 | for (n = 0; n < ARRAY_SIZE(cx23885_tvnorms); n++) |
1271 | case VIDIOC_G_TUNER: | 1226 | i->std |= cx23885_tvnorms[n].id; |
1272 | { | 1227 | return 0; |
1273 | struct v4l2_tuner *t = arg; | 1228 | } |
1274 | 1229 | ||
1275 | if (UNSET == dev->tuner_type) | 1230 | static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) |
1276 | return -EINVAL; | 1231 | { |
1277 | if (0 != t->index) | 1232 | struct cx23885_fh *fh = file->private_data; |
1278 | return -EINVAL; | 1233 | struct cx23885_dev *dev = fh->dev; |
1279 | memset(t, 0, sizeof(*t)); | ||
1280 | strcpy(t->name, "Television"); | ||
1281 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_TUNER, t); | ||
1282 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_G_TUNER, t); | ||
1283 | 1234 | ||
1284 | dprintk(1, "VIDIOC_G_TUNER: tuner type %d\n", t->type); | 1235 | *i = dev->input; |
1236 | return 0; | ||
1237 | } | ||
1285 | 1238 | ||
1286 | return 0; | 1239 | static int vidioc_s_input(struct file *file, void *priv, unsigned int i) |
1287 | } | 1240 | { |
1288 | case VIDIOC_S_TUNER: | 1241 | if (i >= 4) |
1289 | { | 1242 | return -EINVAL; |
1290 | struct v4l2_tuner *t = arg; | ||
1291 | 1243 | ||
1292 | if (UNSET == dev->tuner_type) | 1244 | return 0; |
1293 | return -EINVAL; | 1245 | } |
1294 | 1246 | ||
1295 | /* Update the A/V core */ | 1247 | static int vidioc_g_tuner(struct file *file, void *priv, |
1296 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_TUNER, t); | 1248 | struct v4l2_tuner *t) |
1249 | { | ||
1250 | struct cx23885_fh *fh = file->private_data; | ||
1251 | struct cx23885_dev *dev = fh->dev; | ||
1297 | 1252 | ||
1298 | return 0; | 1253 | if (UNSET == dev->tuner_type) |
1299 | } | 1254 | return -EINVAL; |
1300 | case VIDIOC_G_FREQUENCY: | 1255 | if (0 != t->index) |
1301 | { | 1256 | return -EINVAL; |
1302 | struct v4l2_frequency *f = arg; | 1257 | memset(t, 0, sizeof(*t)); |
1258 | strcpy(t->name, "Television"); | ||
1259 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_TUNER, t); | ||
1260 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_G_TUNER, t); | ||
1303 | 1261 | ||
1304 | memset(f, 0, sizeof(*f)); | 1262 | dprintk(1, "VIDIOC_G_TUNER: tuner type %d\n", t->type); |
1305 | if (UNSET == dev->tuner_type) | ||
1306 | return -EINVAL; | ||
1307 | f->type = V4L2_TUNER_ANALOG_TV; | ||
1308 | f->frequency = dev->freq; | ||
1309 | 1263 | ||
1310 | /* Assumption that tuner is always on bus 1 */ | 1264 | return 0; |
1311 | cx23885_call_i2c_clients(&dev->i2c_bus[1], | 1265 | } |
1312 | VIDIOC_G_FREQUENCY, f); | ||
1313 | 1266 | ||
1314 | return 0; | 1267 | static int vidioc_s_tuner(struct file *file, void *priv, |
1315 | } | 1268 | struct v4l2_tuner *t) |
1316 | case VIDIOC_S_FREQUENCY: | 1269 | { |
1317 | { | 1270 | struct cx23885_fh *fh = file->private_data; |
1318 | struct v4l2_frequency *f = arg; | 1271 | struct cx23885_dev *dev = fh->dev; |
1319 | 1272 | ||
1320 | dprintk(1, "VIDIOC_S_FREQUENCY: dev type %d, f\n", | 1273 | if (UNSET == dev->tuner_type) |
1321 | dev->tuner_type); | 1274 | return -EINVAL; |
1322 | dprintk(1, "VIDIOC_S_FREQUENCY: f tuner %d, f type %d\n", | 1275 | |
1323 | f->tuner, f->type); | 1276 | /* Update the A/V core */ |
1324 | if (UNSET == dev->tuner_type) | 1277 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_TUNER, t); |
1325 | return -EINVAL; | 1278 | |
1326 | if (f->tuner != 0) | 1279 | return 0; |
1327 | return -EINVAL; | 1280 | } |
1328 | if (f->type != V4L2_TUNER_ANALOG_TV) | 1281 | |
1329 | return -EINVAL; | 1282 | static int vidioc_g_frequency(struct file *file, void *priv, |
1330 | dev->freq = f->frequency; | 1283 | struct v4l2_frequency *f) |
1331 | 1284 | { | |
1332 | /* Assumption that tuner is always on bus 1 */ | 1285 | struct cx23885_fh *fh = file->private_data; |
1333 | cx23885_call_i2c_clients(&dev->i2c_bus[1], | 1286 | struct cx23885_dev *dev = fh->dev; |
1334 | VIDIOC_S_FREQUENCY, f); | 1287 | |
1335 | return 0; | 1288 | memset(f, 0, sizeof(*f)); |
1336 | } | 1289 | if (UNSET == dev->tuner_type) |
1337 | case VIDIOC_S_CTRL: | 1290 | return -EINVAL; |
1338 | { | 1291 | f->type = V4L2_TUNER_ANALOG_TV; |
1339 | /* Update the A/V core */ | 1292 | f->frequency = dev->freq; |
1340 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_CTRL, arg); | 1293 | |
1341 | return 0; | 1294 | /* Assumption that tuner is always on bus 1 */ |
1342 | } | 1295 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_G_FREQUENCY, f); |
1343 | default: | ||
1344 | /* Convert V4L ioctl to V4L2 and call mpeg_do_ioctl | ||
1345 | * (driver_ioctl) */ | ||
1346 | return v4l_compat_translate_ioctl(inode, file, cmd, arg, | ||
1347 | driver_ioctl); | ||
1348 | } | ||
1349 | 1296 | ||
1350 | return 0; | 1297 | return 0; |
1351 | } | 1298 | } |
1352 | 1299 | ||
1353 | static int mpeg_do_ioctl(struct inode *inode, struct file *file, | 1300 | static int vidioc_s_frequency(struct file *file, void *priv, |
1354 | unsigned int cmd, void *arg) | 1301 | struct v4l2_frequency *f) |
1302 | { | ||
1303 | struct cx23885_fh *fh = file->private_data; | ||
1304 | struct cx23885_dev *dev = fh->dev; | ||
1305 | |||
1306 | cx23885_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, | ||
1307 | CX23885_END_NOW, CX23885_MPEG_CAPTURE, | ||
1308 | CX23885_RAW_BITS_NONE); | ||
1309 | |||
1310 | dprintk(1, "VIDIOC_S_FREQUENCY: dev type %d, f\n", | ||
1311 | dev->tuner_type); | ||
1312 | dprintk(1, "VIDIOC_S_FREQUENCY: f tuner %d, f type %d\n", | ||
1313 | f->tuner, f->type); | ||
1314 | if (UNSET == dev->tuner_type) | ||
1315 | return -EINVAL; | ||
1316 | if (f->tuner != 0) | ||
1317 | return -EINVAL; | ||
1318 | if (f->type != V4L2_TUNER_ANALOG_TV) | ||
1319 | return -EINVAL; | ||
1320 | dev->freq = f->frequency; | ||
1321 | |||
1322 | /* Assumption that tuner is always on bus 1 */ | ||
1323 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, f); | ||
1324 | |||
1325 | cx23885_initialize_codec(dev); | ||
1326 | |||
1327 | return 0; | ||
1328 | } | ||
1329 | |||
1330 | static int vidioc_s_ctrl(struct file *file, void *priv, | ||
1331 | struct v4l2_control *ctl) | ||
1332 | { | ||
1333 | struct cx23885_fh *fh = file->private_data; | ||
1334 | struct cx23885_dev *dev = fh->dev; | ||
1335 | |||
1336 | /* Update the A/V core */ | ||
1337 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_S_CTRL, ctl); | ||
1338 | return 0; | ||
1339 | } | ||
1340 | |||
1341 | static int vidioc_querycap(struct file *file, void *priv, | ||
1342 | struct v4l2_capability *cap) | ||
1355 | { | 1343 | { |
1356 | struct cx23885_fh *fh = file->private_data; | 1344 | struct cx23885_fh *fh = file->private_data; |
1357 | struct cx23885_dev *dev = fh->dev; | 1345 | struct cx23885_dev *dev = fh->dev; |
1358 | struct cx23885_tsport *tsport = &dev->ts1; | 1346 | struct cx23885_tsport *tsport = &dev->ts1; |
1359 | 1347 | ||
1360 | if (v4l_debug > 1) | 1348 | memset(cap, 0, sizeof(*cap)); |
1361 | v4l_print_ioctl(dev->name, cmd); | 1349 | strcpy(cap->driver, dev->name); |
1350 | strlcpy(cap->card, cx23885_boards[tsport->dev->board].name, | ||
1351 | sizeof(cap->card)); | ||
1352 | sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); | ||
1353 | cap->version = CX23885_VERSION_CODE; | ||
1354 | cap->capabilities = | ||
1355 | V4L2_CAP_VIDEO_CAPTURE | | ||
1356 | V4L2_CAP_READWRITE | | ||
1357 | V4L2_CAP_STREAMING | | ||
1358 | 0; | ||
1359 | if (UNSET != dev->tuner_type) | ||
1360 | cap->capabilities |= V4L2_CAP_TUNER; | ||
1362 | 1361 | ||
1363 | switch (cmd) { | 1362 | return 0; |
1363 | } | ||
1364 | 1364 | ||
1365 | /* --- capabilities ------------------------------------------ */ | 1365 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
1366 | case VIDIOC_QUERYCAP: | 1366 | struct v4l2_fmtdesc *f) |
1367 | { | 1367 | { |
1368 | struct v4l2_capability *cap = arg; | 1368 | int index; |
1369 | |||
1370 | memset(cap, 0, sizeof(*cap)); | ||
1371 | strcpy(cap->driver, dev->name); | ||
1372 | strlcpy(cap->card, cx23885_boards[tsport->dev->board].name, | ||
1373 | sizeof(cap->card)); | ||
1374 | sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci)); | ||
1375 | cap->version = CX23885_VERSION_CODE; | ||
1376 | cap->capabilities = | ||
1377 | V4L2_CAP_VIDEO_CAPTURE | | ||
1378 | V4L2_CAP_READWRITE | | ||
1379 | V4L2_CAP_STREAMING | | ||
1380 | 0; | ||
1381 | if (UNSET != dev->tuner_type) | ||
1382 | cap->capabilities |= V4L2_CAP_TUNER; | ||
1383 | |||
1384 | return 0; | ||
1385 | } | ||
1386 | 1369 | ||
1387 | /* --- capture ioctls ---------------------------------------- */ | 1370 | index = f->index; |
1388 | case VIDIOC_ENUM_FMT: | 1371 | if (index != 0) |
1389 | { | 1372 | return -EINVAL; |
1390 | struct v4l2_fmtdesc *f = arg; | ||
1391 | int index; | ||
1392 | |||
1393 | index = f->index; | ||
1394 | if (index != 0) | ||
1395 | return -EINVAL; | ||
1396 | |||
1397 | memset(f, 0, sizeof(*f)); | ||
1398 | f->index = index; | ||
1399 | strlcpy(f->description, "MPEG", sizeof(f->description)); | ||
1400 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1401 | f->pixelformat = V4L2_PIX_FMT_MPEG; | ||
1402 | return 0; | ||
1403 | } | ||
1404 | case VIDIOC_G_FMT: | ||
1405 | { | ||
1406 | struct v4l2_format *f = arg; | ||
1407 | |||
1408 | memset(f, 0, sizeof(*f)); | ||
1409 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1410 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | ||
1411 | f->fmt.pix.bytesperline = 0; | ||
1412 | f->fmt.pix.sizeimage = | ||
1413 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | ||
1414 | f->fmt.pix.colorspace = 0; | ||
1415 | f->fmt.pix.width = dev->ts1.width; | ||
1416 | f->fmt.pix.height = dev->ts1.height; | ||
1417 | f->fmt.pix.field = fh->mpegq.field; | ||
1418 | dprintk(1, "VIDIOC_G_FMT: w: %d, h: %d, f: %d\n", | ||
1419 | dev->ts1.width, dev->ts1.height, fh->mpegq.field); | ||
1420 | return 0; | ||
1421 | } | ||
1422 | case VIDIOC_TRY_FMT: | ||
1423 | { | ||
1424 | struct v4l2_format *f = arg; | ||
1425 | |||
1426 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1427 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | ||
1428 | f->fmt.pix.bytesperline = 0; | ||
1429 | f->fmt.pix.sizeimage = | ||
1430 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | ||
1431 | f->fmt.pix.sizeimage = | ||
1432 | f->fmt.pix.colorspace = 0; | ||
1433 | dprintk(1, "VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n", | ||
1434 | dev->ts1.width, dev->ts1.height, fh->mpegq.field); | ||
1435 | return 0; | ||
1436 | } | ||
1437 | case VIDIOC_S_FMT: | ||
1438 | { | ||
1439 | struct v4l2_format *f = arg; | ||
1440 | |||
1441 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1442 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; | ||
1443 | f->fmt.pix.bytesperline = 0; | ||
1444 | f->fmt.pix.sizeimage = | ||
1445 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | ||
1446 | f->fmt.pix.colorspace = 0; | ||
1447 | dprintk(1, "VIDIOC_S_FMT: w: %d, h: %d, f: %d\n", | ||
1448 | f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field); | ||
1449 | return 0; | ||
1450 | } | ||
1451 | 1373 | ||
1452 | /* --- streaming capture ------------------------------------- */ | 1374 | memset(f, 0, sizeof(*f)); |
1453 | case VIDIOC_REQBUFS: | 1375 | f->index = index; |
1454 | return videobuf_reqbufs(&fh->mpegq, arg); | 1376 | strlcpy(f->description, "MPEG", sizeof(f->description)); |
1377 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1378 | f->pixelformat = V4L2_PIX_FMT_MPEG; | ||
1455 | 1379 | ||
1456 | case VIDIOC_QUERYBUF: | 1380 | return 0; |
1457 | return videobuf_querybuf(&fh->mpegq, arg); | 1381 | } |
1458 | 1382 | ||
1459 | case VIDIOC_QBUF: | 1383 | static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, |
1460 | return videobuf_qbuf(&fh->mpegq, arg); | 1384 | struct v4l2_format *f) |
1385 | { | ||
1386 | struct cx23885_fh *fh = file->private_data; | ||
1387 | struct cx23885_dev *dev = fh->dev; | ||
1461 | 1388 | ||
1462 | case VIDIOC_DQBUF: | 1389 | memset(f, 0, sizeof(*f)); |
1463 | return videobuf_dqbuf(&fh->mpegq, arg, | 1390 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1464 | file->f_flags & O_NONBLOCK); | 1391 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
1392 | f->fmt.pix.bytesperline = 0; | ||
1393 | f->fmt.pix.sizeimage = | ||
1394 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | ||
1395 | f->fmt.pix.colorspace = 0; | ||
1396 | f->fmt.pix.width = dev->ts1.width; | ||
1397 | f->fmt.pix.height = dev->ts1.height; | ||
1398 | f->fmt.pix.field = fh->mpegq.field; | ||
1399 | dprintk(1, "VIDIOC_G_FMT: w: %d, h: %d, f: %d\n", | ||
1400 | dev->ts1.width, dev->ts1.height, fh->mpegq.field); | ||
1401 | return 0; | ||
1402 | } | ||
1465 | 1403 | ||
1466 | case VIDIOC_STREAMON: | 1404 | static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, |
1467 | return videobuf_streamon(&fh->mpegq); | 1405 | struct v4l2_format *f) |
1406 | { | ||
1407 | struct cx23885_fh *fh = file->private_data; | ||
1408 | struct cx23885_dev *dev = fh->dev; | ||
1468 | 1409 | ||
1469 | case VIDIOC_STREAMOFF: | 1410 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1470 | return videobuf_streamoff(&fh->mpegq); | 1411 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
1412 | f->fmt.pix.bytesperline = 0; | ||
1413 | f->fmt.pix.sizeimage = | ||
1414 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; | ||
1415 | f->fmt.pix.sizeimage = | ||
1416 | f->fmt.pix.colorspace = 0; | ||
1417 | dprintk(1, "VIDIOC_TRY_FMT: w: %d, h: %d, f: %d\n", | ||
1418 | dev->ts1.width, dev->ts1.height, fh->mpegq.field); | ||
1419 | return 0; | ||
1420 | } | ||
1471 | 1421 | ||
1472 | case VIDIOC_G_EXT_CTRLS: | 1422 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
1473 | { | 1423 | struct v4l2_format *f) |
1474 | struct v4l2_ext_controls *f = arg; | 1424 | { |
1425 | struct cx23885_fh *fh = file->private_data; | ||
1426 | struct cx23885_dev *dev = fh->dev; | ||
1475 | 1427 | ||
1476 | if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) | 1428 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1477 | return -EINVAL; | 1429 | f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG; |
1478 | return cx2341x_ext_ctrls(&dev->mpeg_params, 0, f, cmd); | 1430 | f->fmt.pix.bytesperline = 0; |
1479 | } | 1431 | f->fmt.pix.sizeimage = |
1480 | case VIDIOC_S_EXT_CTRLS: | 1432 | dev->ts1.ts_packet_size * dev->ts1.ts_packet_count; |
1481 | case VIDIOC_TRY_EXT_CTRLS: | 1433 | f->fmt.pix.colorspace = 0; |
1482 | { | 1434 | dprintk(1, "VIDIOC_S_FMT: w: %d, h: %d, f: %d\n", |
1483 | struct v4l2_ext_controls *f = arg; | 1435 | f->fmt.pix.width, f->fmt.pix.height, f->fmt.pix.field); |
1484 | struct cx2341x_mpeg_params p; | 1436 | return 0; |
1485 | int err; | 1437 | } |
1486 | |||
1487 | if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
1488 | return -EINVAL; | ||
1489 | p = dev->mpeg_params; | ||
1490 | err = cx2341x_ext_ctrls(&p, 0, f, cmd); | ||
1491 | if (err == 0 && cmd == VIDIOC_S_EXT_CTRLS) { | ||
1492 | err = cx2341x_update(dev, cx23885_mbox_func, | ||
1493 | &dev->mpeg_params, &p); | ||
1494 | dev->mpeg_params = p; | ||
1495 | } | ||
1496 | return err; | ||
1497 | } | ||
1498 | case VIDIOC_S_FREQUENCY: | ||
1499 | { | ||
1500 | cx23885_api_cmd(fh->dev, CX2341X_ENC_STOP_CAPTURE, 3, 0, | ||
1501 | CX23885_END_NOW, CX23885_MPEG_CAPTURE, | ||
1502 | CX23885_RAW_BITS_NONE); | ||
1503 | cx23885_do_ioctl(inode, file, 0, dev, cmd, arg, | ||
1504 | mpeg_do_ioctl); | ||
1505 | cx23885_initialize_codec(dev); | ||
1506 | |||
1507 | return 0; | ||
1508 | } | ||
1509 | case VIDIOC_LOG_STATUS: | ||
1510 | { | ||
1511 | char name[32 + 2]; | ||
1512 | |||
1513 | snprintf(name, sizeof(name), "%s/2", dev->name); | ||
1514 | printk(KERN_INFO | ||
1515 | "%s/2: ============ START LOG STATUS ============\n", | ||
1516 | dev->name); | ||
1517 | cx23885_call_i2c_clients(&dev->i2c_bus[0], VIDIOC_LOG_STATUS, | ||
1518 | NULL); | ||
1519 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_LOG_STATUS, | ||
1520 | NULL); | ||
1521 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_LOG_STATUS, | ||
1522 | NULL); | ||
1523 | cx2341x_log_status(&dev->mpeg_params, name); | ||
1524 | printk(KERN_INFO | ||
1525 | "%s/2: ============= END LOG STATUS =============\n", | ||
1526 | dev->name); | ||
1527 | return 0; | ||
1528 | } | ||
1529 | case VIDIOC_QUERYMENU: | ||
1530 | return cx23885_querymenu(dev, arg); | ||
1531 | case VIDIOC_QUERYCTRL: | ||
1532 | { | ||
1533 | struct v4l2_queryctrl *c = arg; | ||
1534 | 1438 | ||
1535 | return cx23885_queryctrl(dev, c); | 1439 | static int vidioc_reqbufs(struct file *file, void *priv, |
1536 | } | 1440 | struct v4l2_requestbuffers *p) |
1441 | { | ||
1442 | struct cx23885_fh *fh = file->private_data; | ||
1537 | 1443 | ||
1538 | default: | 1444 | return videobuf_reqbufs(&fh->mpegq, p); |
1539 | return cx23885_do_ioctl(inode, file, 0, dev, cmd, arg, | 1445 | } |
1540 | mpeg_do_ioctl); | 1446 | |
1447 | static int vidioc_querybuf(struct file *file, void *priv, | ||
1448 | struct v4l2_buffer *p) | ||
1449 | { | ||
1450 | struct cx23885_fh *fh = file->private_data; | ||
1451 | |||
1452 | return videobuf_querybuf(&fh->mpegq, p); | ||
1453 | } | ||
1454 | |||
1455 | static int vidioc_qbuf(struct file *file, void *priv, | ||
1456 | struct v4l2_buffer *p) | ||
1457 | { | ||
1458 | struct cx23885_fh *fh = file->private_data; | ||
1459 | |||
1460 | return videobuf_qbuf(&fh->mpegq, p); | ||
1461 | } | ||
1462 | |||
1463 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | ||
1464 | { | ||
1465 | struct cx23885_fh *fh = priv; | ||
1466 | |||
1467 | return videobuf_dqbuf(&fh->mpegq, b, file->f_flags & O_NONBLOCK); | ||
1468 | } | ||
1469 | |||
1470 | |||
1471 | static int vidioc_streamon(struct file *file, void *priv, | ||
1472 | enum v4l2_buf_type i) | ||
1473 | { | ||
1474 | struct cx23885_fh *fh = file->private_data; | ||
1475 | |||
1476 | return videobuf_streamon(&fh->mpegq); | ||
1477 | } | ||
1478 | |||
1479 | static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) | ||
1480 | { | ||
1481 | struct cx23885_fh *fh = file->private_data; | ||
1482 | |||
1483 | return videobuf_streamoff(&fh->mpegq); | ||
1484 | } | ||
1485 | |||
1486 | static int vidioc_g_ext_ctrls(struct file *file, void *priv, | ||
1487 | struct v4l2_ext_controls *f) | ||
1488 | { | ||
1489 | struct cx23885_fh *fh = priv; | ||
1490 | struct cx23885_dev *dev = fh->dev; | ||
1491 | |||
1492 | if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
1493 | return -EINVAL; | ||
1494 | return cx2341x_ext_ctrls(&dev->mpeg_params, 0, f, VIDIOC_G_EXT_CTRLS); | ||
1495 | } | ||
1496 | |||
1497 | static int vidioc_s_ext_ctrls(struct file *file, void *priv, | ||
1498 | struct v4l2_ext_controls *f) | ||
1499 | { | ||
1500 | struct cx23885_fh *fh = priv; | ||
1501 | struct cx23885_dev *dev = fh->dev; | ||
1502 | struct cx2341x_mpeg_params p; | ||
1503 | int err; | ||
1504 | |||
1505 | if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
1506 | return -EINVAL; | ||
1507 | |||
1508 | p = dev->mpeg_params; | ||
1509 | err = cx2341x_ext_ctrls(&p, 0, f, VIDIOC_S_EXT_CTRLS); | ||
1510 | |||
1511 | if (err == 0) { | ||
1512 | err = cx2341x_update(dev, cx23885_mbox_func, | ||
1513 | &dev->mpeg_params, &p); | ||
1514 | dev->mpeg_params = p; | ||
1541 | } | 1515 | } |
1516 | return err; | ||
1517 | } | ||
1518 | |||
1519 | static int vidioc_try_ext_ctrls(struct file *file, void *priv, | ||
1520 | struct v4l2_ext_controls *f) | ||
1521 | { | ||
1522 | struct cx23885_fh *fh = priv; | ||
1523 | struct cx23885_dev *dev = fh->dev; | ||
1524 | struct cx2341x_mpeg_params p; | ||
1525 | int err; | ||
1526 | |||
1527 | if (f->ctrl_class != V4L2_CTRL_CLASS_MPEG) | ||
1528 | return -EINVAL; | ||
1529 | |||
1530 | p = dev->mpeg_params; | ||
1531 | err = cx2341x_ext_ctrls(&p, 0, f, VIDIOC_TRY_EXT_CTRLS); | ||
1532 | return err; | ||
1533 | } | ||
1534 | |||
1535 | static int vidioc_log_status(struct file *file, void *priv) | ||
1536 | { | ||
1537 | struct cx23885_fh *fh = priv; | ||
1538 | struct cx23885_dev *dev = fh->dev; | ||
1539 | char name[32 + 2]; | ||
1540 | |||
1541 | snprintf(name, sizeof(name), "%s/2", dev->name); | ||
1542 | printk(KERN_INFO | ||
1543 | "%s/2: ============ START LOG STATUS ============\n", | ||
1544 | dev->name); | ||
1545 | cx23885_call_i2c_clients(&dev->i2c_bus[0], VIDIOC_LOG_STATUS, | ||
1546 | NULL); | ||
1547 | cx23885_call_i2c_clients(&dev->i2c_bus[1], VIDIOC_LOG_STATUS, | ||
1548 | NULL); | ||
1549 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_LOG_STATUS, | ||
1550 | NULL); | ||
1551 | cx2341x_log_status(&dev->mpeg_params, name); | ||
1552 | printk(KERN_INFO | ||
1553 | "%s/2: ============= END LOG STATUS =============\n", | ||
1554 | dev->name); | ||
1542 | return 0; | 1555 | return 0; |
1543 | } | 1556 | } |
1544 | 1557 | ||
1545 | static int mpeg_ioctl(struct inode *inode, struct file *file, | 1558 | static int vidioc_querymenu(struct file *file, void *priv, |
1546 | unsigned int cmd, unsigned long arg) | 1559 | struct v4l2_querymenu *a) |
1560 | { | ||
1561 | struct cx23885_fh *fh = priv; | ||
1562 | struct cx23885_dev *dev = fh->dev; | ||
1563 | |||
1564 | return cx23885_querymenu(dev, a); | ||
1565 | } | ||
1566 | |||
1567 | static int vidioc_queryctrl(struct file *file, void *priv, | ||
1568 | struct v4l2_queryctrl *c) | ||
1547 | { | 1569 | { |
1548 | return video_usercopy(inode, file, cmd, arg, mpeg_do_ioctl); | 1570 | struct cx23885_fh *fh = priv; |
1571 | struct cx23885_dev *dev = fh->dev; | ||
1572 | |||
1573 | return cx23885_queryctrl(dev, c); | ||
1549 | } | 1574 | } |
1550 | 1575 | ||
1551 | static int mpeg_open(struct inode *inode, struct file *file) | 1576 | static int mpeg_open(struct inode *inode, struct file *file) |
@@ -1557,6 +1582,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1557 | 1582 | ||
1558 | dprintk(2, "%s()\n", __func__); | 1583 | dprintk(2, "%s()\n", __func__); |
1559 | 1584 | ||
1585 | lock_kernel(); | ||
1560 | list_for_each(list, &cx23885_devlist) { | 1586 | list_for_each(list, &cx23885_devlist) { |
1561 | h = list_entry(list, struct cx23885_dev, devlist); | 1587 | h = list_entry(list, struct cx23885_dev, devlist); |
1562 | if (h->v4l_device->minor == minor) { | 1588 | if (h->v4l_device->minor == minor) { |
@@ -1565,13 +1591,17 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1565 | } | 1591 | } |
1566 | } | 1592 | } |
1567 | 1593 | ||
1568 | if (dev == NULL) | 1594 | if (dev == NULL) { |
1595 | unlock_kernel(); | ||
1569 | return -ENODEV; | 1596 | return -ENODEV; |
1597 | } | ||
1570 | 1598 | ||
1571 | /* allocate + initialize per filehandle data */ | 1599 | /* allocate + initialize per filehandle data */ |
1572 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1600 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1573 | if (NULL == fh) | 1601 | if (NULL == fh) { |
1602 | unlock_kernel(); | ||
1574 | return -ENOMEM; | 1603 | return -ENOMEM; |
1604 | } | ||
1575 | 1605 | ||
1576 | file->private_data = fh; | 1606 | file->private_data = fh; |
1577 | fh->dev = dev; | 1607 | fh->dev = dev; |
@@ -1582,6 +1612,7 @@ static int mpeg_open(struct inode *inode, struct file *file) | |||
1582 | V4L2_FIELD_INTERLACED, | 1612 | V4L2_FIELD_INTERLACED, |
1583 | sizeof(struct cx23885_buffer), | 1613 | sizeof(struct cx23885_buffer), |
1584 | fh); | 1614 | fh); |
1615 | unlock_kernel(); | ||
1585 | 1616 | ||
1586 | return 0; | 1617 | return 0; |
1587 | } | 1618 | } |
@@ -1670,17 +1701,43 @@ static struct file_operations mpeg_fops = { | |||
1670 | .read = mpeg_read, | 1701 | .read = mpeg_read, |
1671 | .poll = mpeg_poll, | 1702 | .poll = mpeg_poll, |
1672 | .mmap = mpeg_mmap, | 1703 | .mmap = mpeg_mmap, |
1673 | .ioctl = mpeg_ioctl, | 1704 | .ioctl = video_ioctl2, |
1674 | .llseek = no_llseek, | 1705 | .llseek = no_llseek, |
1675 | }; | 1706 | }; |
1676 | 1707 | ||
1708 | static const struct v4l2_ioctl_ops mpeg_ioctl_ops = { | ||
1709 | .vidioc_s_std = vidioc_s_std, | ||
1710 | .vidioc_enum_input = vidioc_enum_input, | ||
1711 | .vidioc_g_input = vidioc_g_input, | ||
1712 | .vidioc_s_input = vidioc_s_input, | ||
1713 | .vidioc_g_tuner = vidioc_g_tuner, | ||
1714 | .vidioc_s_tuner = vidioc_s_tuner, | ||
1715 | .vidioc_g_frequency = vidioc_g_frequency, | ||
1716 | .vidioc_s_frequency = vidioc_s_frequency, | ||
1717 | .vidioc_s_ctrl = vidioc_s_ctrl, | ||
1718 | .vidioc_querycap = vidioc_querycap, | ||
1719 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, | ||
1720 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, | ||
1721 | .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, | ||
1722 | .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, | ||
1723 | .vidioc_reqbufs = vidioc_reqbufs, | ||
1724 | .vidioc_querybuf = vidioc_querybuf, | ||
1725 | .vidioc_qbuf = vidioc_qbuf, | ||
1726 | .vidioc_dqbuf = vidioc_dqbuf, | ||
1727 | .vidioc_streamon = vidioc_streamon, | ||
1728 | .vidioc_streamoff = vidioc_streamoff, | ||
1729 | .vidioc_g_ext_ctrls = vidioc_g_ext_ctrls, | ||
1730 | .vidioc_s_ext_ctrls = vidioc_s_ext_ctrls, | ||
1731 | .vidioc_try_ext_ctrls = vidioc_try_ext_ctrls, | ||
1732 | .vidioc_log_status = vidioc_log_status, | ||
1733 | .vidioc_querymenu = vidioc_querymenu, | ||
1734 | .vidioc_queryctrl = vidioc_queryctrl, | ||
1735 | }; | ||
1736 | |||
1677 | static struct video_device cx23885_mpeg_template = { | 1737 | static struct video_device cx23885_mpeg_template = { |
1678 | .name = "cx23885", | 1738 | .name = "cx23885", |
1679 | .type = VID_TYPE_CAPTURE | | ||
1680 | VID_TYPE_TUNER | | ||
1681 | VID_TYPE_SCALES | | ||
1682 | VID_TYPE_MPEG_ENCODER, | ||
1683 | .fops = &mpeg_fops, | 1739 | .fops = &mpeg_fops, |
1740 | .ioctl_ops = &mpeg_ioctl_ops, | ||
1684 | .minor = -1, | 1741 | .minor = -1, |
1685 | }; | 1742 | }; |
1686 | 1743 | ||
@@ -1715,7 +1772,7 @@ static struct video_device *cx23885_video_dev_alloc( | |||
1715 | vfd->minor = -1; | 1772 | vfd->minor = -1; |
1716 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, | 1773 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, |
1717 | type, cx23885_boards[tsport->dev->board].name); | 1774 | type, cx23885_boards[tsport->dev->board].name); |
1718 | vfd->dev = &pci->dev; | 1775 | vfd->parent = &pci->dev; |
1719 | vfd->release = video_device_release; | 1776 | vfd->release = video_device_release; |
1720 | return vfd; | 1777 | return vfd; |
1721 | } | 1778 | } |
@@ -1758,7 +1815,7 @@ int cx23885_417_register(struct cx23885_dev *dev) | |||
1758 | cx23885_mc417_init(dev); | 1815 | cx23885_mc417_init(dev); |
1759 | 1816 | ||
1760 | printk(KERN_INFO "%s: registered device video%d [mpeg]\n", | 1817 | printk(KERN_INFO "%s: registered device video%d [mpeg]\n", |
1761 | dev->name, dev->v4l_device->minor & 0x1f); | 1818 | dev->name, dev->v4l_device->num); |
1762 | 1819 | ||
1763 | return 0; | 1820 | return 0; |
1764 | } | 1821 | } |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 20e05f230546..dac5ccc9ba72 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -26,6 +26,7 @@ | |||
26 | #include <media/cx25840.h> | 26 | #include <media/cx25840.h> |
27 | 27 | ||
28 | #include "cx23885.h" | 28 | #include "cx23885.h" |
29 | #include "tuner-xc2028.h" | ||
29 | 30 | ||
30 | /* ------------------------------------------------------------------ */ | 31 | /* ------------------------------------------------------------------ */ |
31 | /* board config info */ | 32 | /* board config info */ |
@@ -38,16 +39,16 @@ struct cx23885_board cx23885_boards[] = { | |||
38 | .input = {{ | 39 | .input = {{ |
39 | .type = CX23885_VMUX_COMPOSITE1, | 40 | .type = CX23885_VMUX_COMPOSITE1, |
40 | .vmux = 0, | 41 | .vmux = 0, |
41 | },{ | 42 | }, { |
42 | .type = CX23885_VMUX_COMPOSITE2, | 43 | .type = CX23885_VMUX_COMPOSITE2, |
43 | .vmux = 1, | 44 | .vmux = 1, |
44 | },{ | 45 | }, { |
45 | .type = CX23885_VMUX_COMPOSITE3, | 46 | .type = CX23885_VMUX_COMPOSITE3, |
46 | .vmux = 2, | 47 | .vmux = 2, |
47 | },{ | 48 | }, { |
48 | .type = CX23885_VMUX_COMPOSITE4, | 49 | .type = CX23885_VMUX_COMPOSITE4, |
49 | .vmux = 3, | 50 | .vmux = 3, |
50 | }}, | 51 | } }, |
51 | }, | 52 | }, |
52 | [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { | 53 | [CX23885_BOARD_HAUPPAUGE_HVR1800lp] = { |
53 | .name = "Hauppauge WinTV-HVR1800lp", | 54 | .name = "Hauppauge WinTV-HVR1800lp", |
@@ -56,19 +57,19 @@ struct cx23885_board cx23885_boards[] = { | |||
56 | .type = CX23885_VMUX_TELEVISION, | 57 | .type = CX23885_VMUX_TELEVISION, |
57 | .vmux = 0, | 58 | .vmux = 0, |
58 | .gpio0 = 0xff00, | 59 | .gpio0 = 0xff00, |
59 | },{ | 60 | }, { |
60 | .type = CX23885_VMUX_DEBUG, | 61 | .type = CX23885_VMUX_DEBUG, |
61 | .vmux = 0, | 62 | .vmux = 0, |
62 | .gpio0 = 0xff01, | 63 | .gpio0 = 0xff01, |
63 | },{ | 64 | }, { |
64 | .type = CX23885_VMUX_COMPOSITE1, | 65 | .type = CX23885_VMUX_COMPOSITE1, |
65 | .vmux = 1, | 66 | .vmux = 1, |
66 | .gpio0 = 0xff02, | 67 | .gpio0 = 0xff02, |
67 | },{ | 68 | }, { |
68 | .type = CX23885_VMUX_SVIDEO, | 69 | .type = CX23885_VMUX_SVIDEO, |
69 | .vmux = 2, | 70 | .vmux = 2, |
70 | .gpio0 = 0xff02, | 71 | .gpio0 = 0xff02, |
71 | }}, | 72 | } }, |
72 | }, | 73 | }, |
73 | [CX23885_BOARD_HAUPPAUGE_HVR1800] = { | 74 | [CX23885_BOARD_HAUPPAUGE_HVR1800] = { |
74 | .name = "Hauppauge WinTV-HVR1800", | 75 | .name = "Hauppauge WinTV-HVR1800", |
@@ -83,20 +84,20 @@ struct cx23885_board cx23885_boards[] = { | |||
83 | CX25840_VIN5_CH2 | | 84 | CX25840_VIN5_CH2 | |
84 | CX25840_VIN2_CH1, | 85 | CX25840_VIN2_CH1, |
85 | .gpio0 = 0, | 86 | .gpio0 = 0, |
86 | },{ | 87 | }, { |
87 | .type = CX23885_VMUX_COMPOSITE1, | 88 | .type = CX23885_VMUX_COMPOSITE1, |
88 | .vmux = CX25840_VIN7_CH3 | | 89 | .vmux = CX25840_VIN7_CH3 | |
89 | CX25840_VIN4_CH2 | | 90 | CX25840_VIN4_CH2 | |
90 | CX25840_VIN6_CH1, | 91 | CX25840_VIN6_CH1, |
91 | .gpio0 = 0, | 92 | .gpio0 = 0, |
92 | },{ | 93 | }, { |
93 | .type = CX23885_VMUX_SVIDEO, | 94 | .type = CX23885_VMUX_SVIDEO, |
94 | .vmux = CX25840_VIN7_CH3 | | 95 | .vmux = CX25840_VIN7_CH3 | |
95 | CX25840_VIN4_CH2 | | 96 | CX25840_VIN4_CH2 | |
96 | CX25840_VIN8_CH1 | | 97 | CX25840_VIN8_CH1 | |
97 | CX25840_SVIDEO_ON, | 98 | CX25840_SVIDEO_ON, |
98 | .gpio0 = 0, | 99 | .gpio0 = 0, |
99 | }}, | 100 | } }, |
100 | }, | 101 | }, |
101 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { | 102 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { |
102 | .name = "Hauppauge WinTV-HVR1250", | 103 | .name = "Hauppauge WinTV-HVR1250", |
@@ -105,19 +106,19 @@ struct cx23885_board cx23885_boards[] = { | |||
105 | .type = CX23885_VMUX_TELEVISION, | 106 | .type = CX23885_VMUX_TELEVISION, |
106 | .vmux = 0, | 107 | .vmux = 0, |
107 | .gpio0 = 0xff00, | 108 | .gpio0 = 0xff00, |
108 | },{ | 109 | }, { |
109 | .type = CX23885_VMUX_DEBUG, | 110 | .type = CX23885_VMUX_DEBUG, |
110 | .vmux = 0, | 111 | .vmux = 0, |
111 | .gpio0 = 0xff01, | 112 | .gpio0 = 0xff01, |
112 | },{ | 113 | }, { |
113 | .type = CX23885_VMUX_COMPOSITE1, | 114 | .type = CX23885_VMUX_COMPOSITE1, |
114 | .vmux = 1, | 115 | .vmux = 1, |
115 | .gpio0 = 0xff02, | 116 | .gpio0 = 0xff02, |
116 | },{ | 117 | }, { |
117 | .type = CX23885_VMUX_SVIDEO, | 118 | .type = CX23885_VMUX_SVIDEO, |
118 | .vmux = 2, | 119 | .vmux = 2, |
119 | .gpio0 = 0xff02, | 120 | .gpio0 = 0xff02, |
120 | }}, | 121 | } }, |
121 | }, | 122 | }, |
122 | [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { | 123 | [CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP] = { |
123 | .name = "DViCO FusionHDTV5 Express", | 124 | .name = "DViCO FusionHDTV5 Express", |
@@ -143,6 +144,20 @@ struct cx23885_board cx23885_boards[] = { | |||
143 | .name = "Hauppauge WinTV-HVR1400", | 144 | .name = "Hauppauge WinTV-HVR1400", |
144 | .portc = CX23885_MPEG_DVB, | 145 | .portc = CX23885_MPEG_DVB, |
145 | }, | 146 | }, |
147 | [CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP] = { | ||
148 | .name = "DViCO FusionHDTV7 Dual Express", | ||
149 | .portb = CX23885_MPEG_DVB, | ||
150 | .portc = CX23885_MPEG_DVB, | ||
151 | }, | ||
152 | [CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP] = { | ||
153 | .name = "DViCO FusionHDTV DVB-T Dual Express", | ||
154 | .portb = CX23885_MPEG_DVB, | ||
155 | .portc = CX23885_MPEG_DVB, | ||
156 | }, | ||
157 | [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H] = { | ||
158 | .name = "Leadtek Winfast PxDVR3200 H", | ||
159 | .portc = CX23885_MPEG_DVB, | ||
160 | }, | ||
146 | }; | 161 | }; |
147 | const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); | 162 | const unsigned int cx23885_bcount = ARRAY_SIZE(cx23885_boards); |
148 | 163 | ||
@@ -154,43 +169,43 @@ struct cx23885_subid cx23885_subids[] = { | |||
154 | .subvendor = 0x0070, | 169 | .subvendor = 0x0070, |
155 | .subdevice = 0x3400, | 170 | .subdevice = 0x3400, |
156 | .card = CX23885_BOARD_UNKNOWN, | 171 | .card = CX23885_BOARD_UNKNOWN, |
157 | },{ | 172 | }, { |
158 | .subvendor = 0x0070, | 173 | .subvendor = 0x0070, |
159 | .subdevice = 0x7600, | 174 | .subdevice = 0x7600, |
160 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, | 175 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800lp, |
161 | },{ | 176 | }, { |
162 | .subvendor = 0x0070, | 177 | .subvendor = 0x0070, |
163 | .subdevice = 0x7800, | 178 | .subdevice = 0x7800, |
164 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, | 179 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
165 | },{ | 180 | }, { |
166 | .subvendor = 0x0070, | 181 | .subvendor = 0x0070, |
167 | .subdevice = 0x7801, | 182 | .subdevice = 0x7801, |
168 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, | 183 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
169 | },{ | 184 | }, { |
170 | .subvendor = 0x0070, | 185 | .subvendor = 0x0070, |
171 | .subdevice = 0x7809, | 186 | .subdevice = 0x7809, |
172 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, | 187 | .card = CX23885_BOARD_HAUPPAUGE_HVR1800, |
173 | },{ | 188 | }, { |
174 | .subvendor = 0x0070, | 189 | .subvendor = 0x0070, |
175 | .subdevice = 0x7911, | 190 | .subdevice = 0x7911, |
176 | .card = CX23885_BOARD_HAUPPAUGE_HVR1250, | 191 | .card = CX23885_BOARD_HAUPPAUGE_HVR1250, |
177 | },{ | 192 | }, { |
178 | .subvendor = 0x18ac, | 193 | .subvendor = 0x18ac, |
179 | .subdevice = 0xd500, | 194 | .subdevice = 0xd500, |
180 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, | 195 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP, |
181 | },{ | 196 | }, { |
182 | .subvendor = 0x0070, | 197 | .subvendor = 0x0070, |
183 | .subdevice = 0x7790, | 198 | .subdevice = 0x7790, |
184 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, | 199 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
185 | },{ | 200 | }, { |
186 | .subvendor = 0x0070, | 201 | .subvendor = 0x0070, |
187 | .subdevice = 0x7797, | 202 | .subdevice = 0x7797, |
188 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, | 203 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500Q, |
189 | },{ | 204 | }, { |
190 | .subvendor = 0x0070, | 205 | .subvendor = 0x0070, |
191 | .subdevice = 0x7710, | 206 | .subdevice = 0x7710, |
192 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, | 207 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
193 | },{ | 208 | }, { |
194 | .subvendor = 0x0070, | 209 | .subvendor = 0x0070, |
195 | .subdevice = 0x7717, | 210 | .subdevice = 0x7717, |
196 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, | 211 | .card = CX23885_BOARD_HAUPPAUGE_HVR1500, |
@@ -210,6 +225,18 @@ struct cx23885_subid cx23885_subids[] = { | |||
210 | .subvendor = 0x0070, | 225 | .subvendor = 0x0070, |
211 | .subdevice = 0x8010, | 226 | .subdevice = 0x8010, |
212 | .card = CX23885_BOARD_HAUPPAUGE_HVR1400, | 227 | .card = CX23885_BOARD_HAUPPAUGE_HVR1400, |
228 | }, { | ||
229 | .subvendor = 0x18ac, | ||
230 | .subdevice = 0xd618, | ||
231 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP, | ||
232 | }, { | ||
233 | .subvendor = 0x18ac, | ||
234 | .subdevice = 0xdb78, | ||
235 | .card = CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP, | ||
236 | }, { | ||
237 | .subvendor = 0x107d, | ||
238 | .subdevice = 0x6681, | ||
239 | .card = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H, | ||
213 | }, | 240 | }, |
214 | }; | 241 | }; |
215 | const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); | 242 | const unsigned int cx23885_idcount = ARRAY_SIZE(cx23885_subids); |
@@ -220,23 +247,25 @@ void cx23885_card_list(struct cx23885_dev *dev) | |||
220 | 247 | ||
221 | if (0 == dev->pci->subsystem_vendor && | 248 | if (0 == dev->pci->subsystem_vendor && |
222 | 0 == dev->pci->subsystem_device) { | 249 | 0 == dev->pci->subsystem_device) { |
223 | printk("%s: Your board has no valid PCIe Subsystem ID and thus can't\n" | 250 | printk(KERN_INFO |
224 | "%s: be autodetected. Please pass card=<n> insmod option to\n" | 251 | "%s: Board has no valid PCIe Subsystem ID and can't\n" |
225 | "%s: workaround that. Redirect complaints to the vendor of\n" | 252 | "%s: be autodetected. Pass card=<n> insmod option\n" |
226 | "%s: the TV card. Best regards,\n" | 253 | "%s: to workaround that. Redirect complaints to the\n" |
254 | "%s: vendor of the TV card. Best regards,\n" | ||
227 | "%s: -- tux\n", | 255 | "%s: -- tux\n", |
228 | dev->name, dev->name, dev->name, dev->name, dev->name); | 256 | dev->name, dev->name, dev->name, dev->name, dev->name); |
229 | } else { | 257 | } else { |
230 | printk("%s: Your board isn't known (yet) to the driver. You can\n" | 258 | printk(KERN_INFO |
231 | "%s: try to pick one of the existing card configs via\n" | 259 | "%s: Your board isn't known (yet) to the driver.\n" |
260 | "%s: Try to pick one of the existing card configs via\n" | ||
232 | "%s: card=<n> insmod option. Updating to the latest\n" | 261 | "%s: card=<n> insmod option. Updating to the latest\n" |
233 | "%s: version might help as well.\n", | 262 | "%s: version might help as well.\n", |
234 | dev->name, dev->name, dev->name, dev->name); | 263 | dev->name, dev->name, dev->name, dev->name); |
235 | } | 264 | } |
236 | printk("%s: Here is a list of valid choices for the card=<n> insmod option:\n", | 265 | printk(KERN_INFO "%s: Here is a list of valid choices for the card=<n> insmod option:\n", |
237 | dev->name); | 266 | dev->name); |
238 | for (i = 0; i < cx23885_bcount; i++) | 267 | for (i = 0; i < cx23885_bcount; i++) |
239 | printk("%s: card=%d -> %s\n", | 268 | printk(KERN_INFO "%s: card=%d -> %s\n", |
240 | dev->name, i, cx23885_boards[i].name); | 269 | dev->name, i, cx23885_boards[i].name); |
241 | } | 270 | } |
242 | 271 | ||
@@ -244,11 +273,11 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) | |||
244 | { | 273 | { |
245 | struct tveeprom tv; | 274 | struct tveeprom tv; |
246 | 275 | ||
247 | tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, eeprom_data); | 276 | tveeprom_hauppauge_analog(&dev->i2c_bus[0].i2c_client, &tv, |
277 | eeprom_data); | ||
248 | 278 | ||
249 | /* Make sure we support the board model */ | 279 | /* Make sure we support the board model */ |
250 | switch (tv.model) | 280 | switch (tv.model) { |
251 | { | ||
252 | case 71009: | 281 | case 71009: |
253 | /* WinTV-HVR1200 (PCIe, Retail, full height) | 282 | /* WinTV-HVR1200 (PCIe, Retail, full height) |
254 | * DVB-T and basic analog */ | 283 | * DVB-T and basic analog */ |
@@ -276,21 +305,51 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) | |||
276 | case 71999: | 305 | case 71999: |
277 | /* WinTV-HVR1200 (PCIe, OEM, full height) | 306 | /* WinTV-HVR1200 (PCIe, OEM, full height) |
278 | * DVB-T and basic analog */ | 307 | * DVB-T and basic analog */ |
279 | case 76601: /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual channel ATSC and MPEG2 HW Encoder */ | 308 | case 76601: |
280 | case 77001: /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC and Basic analog */ | 309 | /* WinTV-HVR1800lp (PCIe, Retail, No IR, Dual |
281 | case 77011: /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC and Basic analog */ | 310 | channel ATSC and MPEG2 HW Encoder */ |
282 | case 77041: /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM and Basic analog */ | 311 | case 77001: |
283 | case 77051: /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM and Basic analog */ | 312 | /* WinTV-HVR1500 (Express Card, OEM, No IR, ATSC |
284 | case 78011: /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ | 313 | and Basic analog */ |
285 | case 78501: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ | 314 | case 77011: |
286 | case 78521: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, Dual channel ATSC and MPEG2 HW Encoder */ | 315 | /* WinTV-HVR1500 (Express Card, Retail, No IR, ATSC |
287 | case 78531: /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ | 316 | and Basic analog */ |
288 | case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */ | 317 | case 77041: |
289 | case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */ | 318 | /* WinTV-HVR1500Q (Express Card, OEM, No IR, ATSC/QAM |
290 | case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */ | 319 | and Basic analog */ |
291 | case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ | 320 | case 77051: |
292 | case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */ | 321 | /* WinTV-HVR1500Q (Express Card, Retail, No IR, ATSC/QAM |
293 | case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */ | 322 | and Basic analog */ |
323 | case 78011: | ||
324 | /* WinTV-HVR1800 (PCIe, Retail, 3.5mm in, IR, No FM, | ||
325 | Dual channel ATSC and MPEG2 HW Encoder */ | ||
326 | case 78501: | ||
327 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, | ||
328 | Dual channel ATSC and MPEG2 HW Encoder */ | ||
329 | case 78521: | ||
330 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, FM, | ||
331 | Dual channel ATSC and MPEG2 HW Encoder */ | ||
332 | case 78531: | ||
333 | /* WinTV-HVR1800 (PCIe, OEM, RCA in, No IR, No FM, | ||
334 | Dual channel ATSC and MPEG2 HW Encoder */ | ||
335 | case 78631: | ||
336 | /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, | ||
337 | Dual channel ATSC and MPEG2 HW Encoder */ | ||
338 | case 79001: | ||
339 | /* WinTV-HVR1250 (PCIe, Retail, IR, full height, | ||
340 | ATSC and Basic analog */ | ||
341 | case 79101: | ||
342 | /* WinTV-HVR1250 (PCIe, Retail, IR, half height, | ||
343 | ATSC and Basic analog */ | ||
344 | case 79561: | ||
345 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, | ||
346 | ATSC and Basic analog */ | ||
347 | case 79571: | ||
348 | /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, | ||
349 | ATSC and Basic analog */ | ||
350 | case 79671: | ||
351 | /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, | ||
352 | ATSC and Basic analog */ | ||
294 | case 80019: | 353 | case 80019: |
295 | /* WinTV-HVR1400 (Express Card, Retail, IR, | 354 | /* WinTV-HVR1400 (Express Card, Retail, IR, |
296 | * DVB-T and Basic analog */ | 355 | * DVB-T and Basic analog */ |
@@ -302,7 +361,8 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) | |||
302 | * DVB-T and MPEG2 HW Encoder */ | 361 | * DVB-T and MPEG2 HW Encoder */ |
303 | break; | 362 | break; |
304 | default: | 363 | default: |
305 | printk("%s: warning: unknown hauppauge model #%d\n", dev->name, tv.model); | 364 | printk(KERN_WARNING "%s: warning: unknown hauppauge model #%d\n", |
365 | dev->name, tv.model); | ||
306 | break; | 366 | break; |
307 | } | 367 | } |
308 | 368 | ||
@@ -310,37 +370,53 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) | |||
310 | dev->name, tv.model); | 370 | dev->name, tv.model); |
311 | } | 371 | } |
312 | 372 | ||
313 | /* Tuner callback function for cx23885 boards. Currently only needed | 373 | int cx23885_tuner_callback(void *priv, int component, int command, int arg) |
314 | * for HVR1500Q, which has an xc5000 tuner. | ||
315 | */ | ||
316 | int cx23885_tuner_callback(void *priv, int command, int arg) | ||
317 | { | 374 | { |
318 | struct cx23885_i2c *bus = priv; | 375 | struct cx23885_tsport *port = priv; |
319 | struct cx23885_dev *dev = bus->dev; | 376 | struct cx23885_dev *dev = port->dev; |
377 | u32 bitmask = 0; | ||
320 | 378 | ||
321 | switch(dev->board) { | 379 | if (command == XC2028_RESET_CLK) |
380 | return 0; | ||
381 | |||
382 | if (command != 0) { | ||
383 | printk(KERN_ERR "%s(): Unknown command 0x%x.\n", | ||
384 | __func__, command); | ||
385 | return -EINVAL; | ||
386 | } | ||
387 | |||
388 | switch (dev->board) { | ||
389 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | ||
390 | case CX23885_BOARD_HAUPPAUGE_HVR1500: | ||
322 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: | 391 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
323 | if(command == 0) { /* Tuner Reset Command from xc5000 */ | 392 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: |
324 | /* Drive the tuner into reset and out */ | 393 | /* Tuner Reset Command */ |
325 | cx_clear(GP0_IO, 0x00000004); | 394 | bitmask = 0x04; |
326 | mdelay(200); | 395 | break; |
327 | cx_set(GP0_IO, 0x00000004); | 396 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: |
328 | return 0; | 397 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: |
329 | } | 398 | /* Two identical tuners on two different i2c buses, |
330 | else { | 399 | * we need to reset the correct gpio. */ |
331 | printk(KERN_ERR | 400 | if (port->nr == 0) |
332 | "%s(): Unknow command.\n", __func__); | 401 | bitmask = 0x01; |
333 | return -EINVAL; | 402 | else if (port->nr == 1) |
334 | } | 403 | bitmask = 0x04; |
335 | break; | 404 | break; |
336 | } | 405 | } |
337 | 406 | ||
338 | return 0; /* Should never be here */ | 407 | if (bitmask) { |
408 | /* Drive the tuner into reset and back out */ | ||
409 | cx_clear(GP0_IO, bitmask); | ||
410 | mdelay(200); | ||
411 | cx_set(GP0_IO, bitmask); | ||
412 | } | ||
413 | |||
414 | return 0; | ||
339 | } | 415 | } |
340 | 416 | ||
341 | void cx23885_gpio_setup(struct cx23885_dev *dev) | 417 | void cx23885_gpio_setup(struct cx23885_dev *dev) |
342 | { | 418 | { |
343 | switch(dev->board) { | 419 | switch (dev->board) { |
344 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | 420 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
345 | /* GPIO-0 cx24227 demodulator reset */ | 421 | /* GPIO-0 cx24227 demodulator reset */ |
346 | cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ | 422 | cx_set(GP0_IO, 0x00010001); /* Bring the part out of reset */ |
@@ -427,6 +503,45 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) | |||
427 | mdelay(20); | 503 | mdelay(20); |
428 | cx_set(GP0_IO, 0x00050005); | 504 | cx_set(GP0_IO, 0x00050005); |
429 | break; | 505 | break; |
506 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: | ||
507 | /* GPIO-0 xc5000 tuner reset i2c bus 0 */ | ||
508 | /* GPIO-1 s5h1409 demod reset i2c bus 0 */ | ||
509 | /* GPIO-2 xc5000 tuner reset i2c bus 1 */ | ||
510 | /* GPIO-3 s5h1409 demod reset i2c bus 0 */ | ||
511 | |||
512 | /* Put the parts into reset and back */ | ||
513 | cx_set(GP0_IO, 0x000f0000); | ||
514 | mdelay(20); | ||
515 | cx_clear(GP0_IO, 0x0000000f); | ||
516 | mdelay(20); | ||
517 | cx_set(GP0_IO, 0x000f000f); | ||
518 | break; | ||
519 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: | ||
520 | /* GPIO-0 portb xc3028 reset */ | ||
521 | /* GPIO-1 portb zl10353 reset */ | ||
522 | /* GPIO-2 portc xc3028 reset */ | ||
523 | /* GPIO-3 portc zl10353 reset */ | ||
524 | |||
525 | /* Put the parts into reset and back */ | ||
526 | cx_set(GP0_IO, 0x000f0000); | ||
527 | mdelay(20); | ||
528 | cx_clear(GP0_IO, 0x0000000f); | ||
529 | mdelay(20); | ||
530 | cx_set(GP0_IO, 0x000f000f); | ||
531 | break; | ||
532 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: | ||
533 | /* GPIO-2 xc3028 tuner reset */ | ||
534 | |||
535 | /* The following GPIO's are on the internal AVCore (cx25840) */ | ||
536 | /* GPIO-? zl10353 demod reset */ | ||
537 | |||
538 | /* Put the parts into reset and back */ | ||
539 | cx_set(GP0_IO, 0x00040000); | ||
540 | mdelay(20); | ||
541 | cx_clear(GP0_IO, 0x00000004); | ||
542 | mdelay(20); | ||
543 | cx_set(GP0_IO, 0x00040004); | ||
544 | break; | ||
430 | } | 545 | } |
431 | } | 546 | } |
432 | 547 | ||
@@ -441,6 +556,9 @@ int cx23885_ir_init(struct cx23885_dev *dev) | |||
441 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | 556 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
442 | /* FIXME: Implement me */ | 557 | /* FIXME: Implement me */ |
443 | break; | 558 | break; |
559 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: | ||
560 | request_module("ir-kbd-i2c"); | ||
561 | break; | ||
444 | } | 562 | } |
445 | 563 | ||
446 | return 0; | 564 | return 0; |
@@ -477,6 +595,12 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
477 | } | 595 | } |
478 | 596 | ||
479 | switch (dev->board) { | 597 | switch (dev->board) { |
598 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: | ||
599 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: | ||
600 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ | ||
601 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ | ||
602 | ts2->src_sel_val = CX23885_SRC_SEL_PARALLEL_MPEG_VIDEO; | ||
603 | /* break omitted intentionally */ | ||
480 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: | 604 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
481 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ | 605 | ts1->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
482 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ | 606 | ts1->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
@@ -505,6 +629,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
505 | case CX23885_BOARD_HAUPPAUGE_HVR1200: | 629 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
506 | case CX23885_BOARD_HAUPPAUGE_HVR1700: | 630 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
507 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | 631 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
632 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: | ||
508 | default: | 633 | default: |
509 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ | 634 | ts2->gen_ctrl_val = 0xc; /* Serial bus + punctured clock */ |
510 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ | 635 | ts2->ts_clk_en_val = 0x1; /* Enable TS_CLK */ |
@@ -518,16 +643,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
518 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 643 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
519 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 644 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
520 | case CX23885_BOARD_HAUPPAUGE_HVR1700: | 645 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
646 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: | ||
521 | request_module("cx25840"); | 647 | request_module("cx25840"); |
522 | break; | 648 | break; |
523 | } | 649 | } |
524 | } | 650 | } |
525 | 651 | ||
526 | /* ------------------------------------------------------------------ */ | 652 | /* ------------------------------------------------------------------ */ |
527 | |||
528 | /* | ||
529 | * Local variables: | ||
530 | * c-basic-offset: 8 | ||
531 | * End: | ||
532 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
533 | */ | ||
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index c4cc2f3b8876..8f6fb2add7de 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -33,16 +33,16 @@ | |||
33 | #include "cx23885.h" | 33 | #include "cx23885.h" |
34 | 34 | ||
35 | MODULE_DESCRIPTION("Driver for cx23885 based TV cards"); | 35 | MODULE_DESCRIPTION("Driver for cx23885 based TV cards"); |
36 | MODULE_AUTHOR("Steven Toth <stoth@hauppauge.com>"); | 36 | MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); |
37 | MODULE_LICENSE("GPL"); | 37 | MODULE_LICENSE("GPL"); |
38 | 38 | ||
39 | static unsigned int debug; | 39 | static unsigned int debug; |
40 | module_param(debug,int,0644); | 40 | module_param(debug, int, 0644); |
41 | MODULE_PARM_DESC(debug,"enable debug messages"); | 41 | MODULE_PARM_DESC(debug, "enable debug messages"); |
42 | 42 | ||
43 | static unsigned int card[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; | 43 | static unsigned int card[] = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET }; |
44 | module_param_array(card, int, NULL, 0444); | 44 | module_param_array(card, int, NULL, 0444); |
45 | MODULE_PARM_DESC(card,"card type"); | 45 | MODULE_PARM_DESC(card, "card type"); |
46 | 46 | ||
47 | #define dprintk(level, fmt, arg...)\ | 47 | #define dprintk(level, fmt, arg...)\ |
48 | do { if (debug >= level)\ | 48 | do { if (debug >= level)\ |
@@ -76,6 +76,117 @@ LIST_HEAD(cx23885_devlist); | |||
76 | * 0x00010ea0 0x00010xxx Free | 76 | * 0x00010ea0 0x00010xxx Free |
77 | */ | 77 | */ |
78 | 78 | ||
79 | static struct sram_channel cx23885_sram_channels[] = { | ||
80 | [SRAM_CH01] = { | ||
81 | .name = "VID A", | ||
82 | .cmds_start = 0x10000, | ||
83 | .ctrl_start = 0x10380, | ||
84 | .cdt = 0x104c0, | ||
85 | .fifo_start = 0x40, | ||
86 | .fifo_size = 0x2800, | ||
87 | .ptr1_reg = DMA1_PTR1, | ||
88 | .ptr2_reg = DMA1_PTR2, | ||
89 | .cnt1_reg = DMA1_CNT1, | ||
90 | .cnt2_reg = DMA1_CNT2, | ||
91 | }, | ||
92 | [SRAM_CH02] = { | ||
93 | .name = "ch2", | ||
94 | .cmds_start = 0x0, | ||
95 | .ctrl_start = 0x0, | ||
96 | .cdt = 0x0, | ||
97 | .fifo_start = 0x0, | ||
98 | .fifo_size = 0x0, | ||
99 | .ptr1_reg = DMA2_PTR1, | ||
100 | .ptr2_reg = DMA2_PTR2, | ||
101 | .cnt1_reg = DMA2_CNT1, | ||
102 | .cnt2_reg = DMA2_CNT2, | ||
103 | }, | ||
104 | [SRAM_CH03] = { | ||
105 | .name = "TS1 B", | ||
106 | .cmds_start = 0x100A0, | ||
107 | .ctrl_start = 0x10400, | ||
108 | .cdt = 0x10580, | ||
109 | .fifo_start = 0x5000, | ||
110 | .fifo_size = 0x1000, | ||
111 | .ptr1_reg = DMA3_PTR1, | ||
112 | .ptr2_reg = DMA3_PTR2, | ||
113 | .cnt1_reg = DMA3_CNT1, | ||
114 | .cnt2_reg = DMA3_CNT2, | ||
115 | }, | ||
116 | [SRAM_CH04] = { | ||
117 | .name = "ch4", | ||
118 | .cmds_start = 0x0, | ||
119 | .ctrl_start = 0x0, | ||
120 | .cdt = 0x0, | ||
121 | .fifo_start = 0x0, | ||
122 | .fifo_size = 0x0, | ||
123 | .ptr1_reg = DMA4_PTR1, | ||
124 | .ptr2_reg = DMA4_PTR2, | ||
125 | .cnt1_reg = DMA4_CNT1, | ||
126 | .cnt2_reg = DMA4_CNT2, | ||
127 | }, | ||
128 | [SRAM_CH05] = { | ||
129 | .name = "ch5", | ||
130 | .cmds_start = 0x0, | ||
131 | .ctrl_start = 0x0, | ||
132 | .cdt = 0x0, | ||
133 | .fifo_start = 0x0, | ||
134 | .fifo_size = 0x0, | ||
135 | .ptr1_reg = DMA5_PTR1, | ||
136 | .ptr2_reg = DMA5_PTR2, | ||
137 | .cnt1_reg = DMA5_CNT1, | ||
138 | .cnt2_reg = DMA5_CNT2, | ||
139 | }, | ||
140 | [SRAM_CH06] = { | ||
141 | .name = "TS2 C", | ||
142 | .cmds_start = 0x10140, | ||
143 | .ctrl_start = 0x10440, | ||
144 | .cdt = 0x105e0, | ||
145 | .fifo_start = 0x6000, | ||
146 | .fifo_size = 0x1000, | ||
147 | .ptr1_reg = DMA5_PTR1, | ||
148 | .ptr2_reg = DMA5_PTR2, | ||
149 | .cnt1_reg = DMA5_CNT1, | ||
150 | .cnt2_reg = DMA5_CNT2, | ||
151 | }, | ||
152 | [SRAM_CH07] = { | ||
153 | .name = "ch7", | ||
154 | .cmds_start = 0x0, | ||
155 | .ctrl_start = 0x0, | ||
156 | .cdt = 0x0, | ||
157 | .fifo_start = 0x0, | ||
158 | .fifo_size = 0x0, | ||
159 | .ptr1_reg = DMA6_PTR1, | ||
160 | .ptr2_reg = DMA6_PTR2, | ||
161 | .cnt1_reg = DMA6_CNT1, | ||
162 | .cnt2_reg = DMA6_CNT2, | ||
163 | }, | ||
164 | [SRAM_CH08] = { | ||
165 | .name = "ch8", | ||
166 | .cmds_start = 0x0, | ||
167 | .ctrl_start = 0x0, | ||
168 | .cdt = 0x0, | ||
169 | .fifo_start = 0x0, | ||
170 | .fifo_size = 0x0, | ||
171 | .ptr1_reg = DMA7_PTR1, | ||
172 | .ptr2_reg = DMA7_PTR2, | ||
173 | .cnt1_reg = DMA7_CNT1, | ||
174 | .cnt2_reg = DMA7_CNT2, | ||
175 | }, | ||
176 | [SRAM_CH09] = { | ||
177 | .name = "ch9", | ||
178 | .cmds_start = 0x0, | ||
179 | .ctrl_start = 0x0, | ||
180 | .cdt = 0x0, | ||
181 | .fifo_start = 0x0, | ||
182 | .fifo_size = 0x0, | ||
183 | .ptr1_reg = DMA8_PTR1, | ||
184 | .ptr2_reg = DMA8_PTR2, | ||
185 | .cnt1_reg = DMA8_CNT1, | ||
186 | .cnt2_reg = DMA8_CNT2, | ||
187 | }, | ||
188 | }; | ||
189 | |||
79 | static struct sram_channel cx23887_sram_channels[] = { | 190 | static struct sram_channel cx23887_sram_channels[] = { |
80 | [SRAM_CH01] = { | 191 | [SRAM_CH01] = { |
81 | .name = "VID A", | 192 | .name = "VID A", |
@@ -104,8 +215,8 @@ static struct sram_channel cx23887_sram_channels[] = { | |||
104 | [SRAM_CH03] = { | 215 | [SRAM_CH03] = { |
105 | .name = "TS1 B", | 216 | .name = "TS1 B", |
106 | .cmds_start = 0x100A0, | 217 | .cmds_start = 0x100A0, |
107 | .ctrl_start = 0x10780, | 218 | .ctrl_start = 0x10630, |
108 | .cdt = 0x10400, | 219 | .cdt = 0x10870, |
109 | .fifo_start = 0x5000, | 220 | .fifo_start = 0x5000, |
110 | .fifo_size = 0x1000, | 221 | .fifo_size = 0x1000, |
111 | .ptr1_reg = DMA3_PTR1, | 222 | .ptr1_reg = DMA3_PTR1, |
@@ -140,7 +251,7 @@ static struct sram_channel cx23887_sram_channels[] = { | |||
140 | [SRAM_CH06] = { | 251 | [SRAM_CH06] = { |
141 | .name = "TS2 C", | 252 | .name = "TS2 C", |
142 | .cmds_start = 0x10140, | 253 | .cmds_start = 0x10140, |
143 | .ctrl_start = 0x10680, | 254 | .ctrl_start = 0x10670, |
144 | .cdt = 0x108d0, | 255 | .cdt = 0x108d0, |
145 | .fifo_start = 0x6000, | 256 | .fifo_start = 0x6000, |
146 | .fifo_size = 0x1000, | 257 | .fifo_size = 0x1000, |
@@ -253,13 +364,12 @@ void cx23885_wakeup(struct cx23885_tsport *port, | |||
253 | list_del(&buf->vb.queue); | 364 | list_del(&buf->vb.queue); |
254 | wake_up(&buf->vb.done); | 365 | wake_up(&buf->vb.done); |
255 | } | 366 | } |
256 | if (list_empty(&q->active)) { | 367 | if (list_empty(&q->active)) |
257 | del_timer(&q->timeout); | 368 | del_timer(&q->timeout); |
258 | } else { | 369 | else |
259 | mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); | 370 | mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); |
260 | } | ||
261 | if (bc != 1) | 371 | if (bc != 1) |
262 | printk("%s: %d buffers handled (should be 1)\n", | 372 | printk(KERN_WARNING "%s: %d buffers handled (should be 1)\n", |
263 | __func__, bc); | 373 | __func__, bc); |
264 | } | 374 | } |
265 | 375 | ||
@@ -270,8 +380,7 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
270 | unsigned int i, lines; | 380 | unsigned int i, lines; |
271 | u32 cdt; | 381 | u32 cdt; |
272 | 382 | ||
273 | if (ch->cmds_start == 0) | 383 | if (ch->cmds_start == 0) { |
274 | { | ||
275 | dprintk(1, "%s() Erasing channel [%s]\n", __func__, | 384 | dprintk(1, "%s() Erasing channel [%s]\n", __func__, |
276 | ch->name); | 385 | ch->name); |
277 | cx_write(ch->ptr1_reg, 0); | 386 | cx_write(ch->ptr1_reg, 0); |
@@ -291,9 +400,9 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
291 | lines = 6; | 400 | lines = 6; |
292 | BUG_ON(lines < 2); | 401 | BUG_ON(lines < 2); |
293 | 402 | ||
294 | cx_write(8 + 0, cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC) ); | 403 | cx_write(8 + 0, RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
295 | cx_write(8 + 4, cpu_to_le32(8) ); | 404 | cx_write(8 + 4, 8); |
296 | cx_write(8 + 8, cpu_to_le32(0) ); | 405 | cx_write(8 + 8, 0); |
297 | 406 | ||
298 | /* write CDT */ | 407 | /* write CDT */ |
299 | for (i = 0; i < lines; i++) { | 408 | for (i = 0; i < lines; i++) { |
@@ -307,15 +416,15 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
307 | 416 | ||
308 | /* write CMDS */ | 417 | /* write CMDS */ |
309 | if (ch->jumponly) | 418 | if (ch->jumponly) |
310 | cx_write(ch->cmds_start + 0, 8); | 419 | cx_write(ch->cmds_start + 0, 8); |
311 | else | 420 | else |
312 | cx_write(ch->cmds_start + 0, risc); | 421 | cx_write(ch->cmds_start + 0, risc); |
313 | cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ | 422 | cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ |
314 | cx_write(ch->cmds_start + 8, cdt); | 423 | cx_write(ch->cmds_start + 8, cdt); |
315 | cx_write(ch->cmds_start + 12, (lines*16) >> 3); | 424 | cx_write(ch->cmds_start + 12, (lines*16) >> 3); |
316 | cx_write(ch->cmds_start + 16, ch->ctrl_start); | 425 | cx_write(ch->cmds_start + 16, ch->ctrl_start); |
317 | if (ch->jumponly) | 426 | if (ch->jumponly) |
318 | cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2) ); | 427 | cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2)); |
319 | else | 428 | else |
320 | cx_write(ch->cmds_start + 20, 64 >> 2); | 429 | cx_write(ch->cmds_start + 20, 64 >> 2); |
321 | for (i = 24; i < 80; i += 4) | 430 | for (i = 24; i < 80; i += 4) |
@@ -325,9 +434,9 @@ int cx23885_sram_channel_setup(struct cx23885_dev *dev, | |||
325 | cx_write(ch->ptr1_reg, ch->fifo_start); | 434 | cx_write(ch->ptr1_reg, ch->fifo_start); |
326 | cx_write(ch->ptr2_reg, cdt); | 435 | cx_write(ch->ptr2_reg, cdt); |
327 | cx_write(ch->cnt2_reg, (lines*16) >> 3); | 436 | cx_write(ch->cnt2_reg, (lines*16) >> 3); |
328 | cx_write(ch->cnt1_reg, (bpl >> 3) -1); | 437 | cx_write(ch->cnt1_reg, (bpl >> 3) - 1); |
329 | 438 | ||
330 | dprintk(2,"[bridge %d] sram setup %s: bpl=%d lines=%d\n", | 439 | dprintk(2, "[bridge %d] sram setup %s: bpl=%d lines=%d\n", |
331 | dev->bridge, | 440 | dev->bridge, |
332 | ch->name, | 441 | ch->name, |
333 | bpl, | 442 | bpl, |
@@ -358,43 +467,43 @@ void cx23885_sram_channel_dump(struct cx23885_dev *dev, | |||
358 | u32 risc; | 467 | u32 risc; |
359 | unsigned int i, j, n; | 468 | unsigned int i, j, n; |
360 | 469 | ||
361 | printk("%s: %s - dma channel status dump\n", | 470 | printk(KERN_WARNING "%s: %s - dma channel status dump\n", |
362 | dev->name, ch->name); | 471 | dev->name, ch->name); |
363 | for (i = 0; i < ARRAY_SIZE(name); i++) | 472 | for (i = 0; i < ARRAY_SIZE(name); i++) |
364 | printk("%s: cmds: %-15s: 0x%08x\n", | 473 | printk(KERN_WARNING "%s: cmds: %-15s: 0x%08x\n", |
365 | dev->name, name[i], | 474 | dev->name, name[i], |
366 | cx_read(ch->cmds_start + 4*i)); | 475 | cx_read(ch->cmds_start + 4*i)); |
367 | 476 | ||
368 | for (i = 0; i < 4; i++) { | 477 | for (i = 0; i < 4; i++) { |
369 | risc = cx_read(ch->cmds_start + 4 * (i + 14)); | 478 | risc = cx_read(ch->cmds_start + 4 * (i + 14)); |
370 | printk("%s: risc%d: ", dev->name, i); | 479 | printk(KERN_WARNING "%s: risc%d: ", dev->name, i); |
371 | cx23885_risc_decode(risc); | 480 | cx23885_risc_decode(risc); |
372 | } | 481 | } |
373 | for (i = 0; i < (64 >> 2); i += n) { | 482 | for (i = 0; i < (64 >> 2); i += n) { |
374 | risc = cx_read(ch->ctrl_start + 4 * i); | 483 | risc = cx_read(ch->ctrl_start + 4 * i); |
375 | /* No consideration for bits 63-32 */ | 484 | /* No consideration for bits 63-32 */ |
376 | 485 | ||
377 | printk("%s: (0x%08x) iq %x: ", dev->name, | 486 | printk(KERN_WARNING "%s: (0x%08x) iq %x: ", dev->name, |
378 | ch->ctrl_start + 4 * i, i); | 487 | ch->ctrl_start + 4 * i, i); |
379 | n = cx23885_risc_decode(risc); | 488 | n = cx23885_risc_decode(risc); |
380 | for (j = 1; j < n; j++) { | 489 | for (j = 1; j < n; j++) { |
381 | risc = cx_read(ch->ctrl_start + 4 * (i + j)); | 490 | risc = cx_read(ch->ctrl_start + 4 * (i + j)); |
382 | printk("%s: iq %x: 0x%08x [ arg #%d ]\n", | 491 | printk(KERN_WARNING "%s: iq %x: 0x%08x [ arg #%d ]\n", |
383 | dev->name, i+j, risc, j); | 492 | dev->name, i+j, risc, j); |
384 | } | 493 | } |
385 | } | 494 | } |
386 | 495 | ||
387 | printk("%s: fifo: 0x%08x -> 0x%x\n", | 496 | printk(KERN_WARNING "%s: fifo: 0x%08x -> 0x%x\n", |
388 | dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); | 497 | dev->name, ch->fifo_start, ch->fifo_start+ch->fifo_size); |
389 | printk("%s: ctrl: 0x%08x -> 0x%x\n", | 498 | printk(KERN_WARNING "%s: ctrl: 0x%08x -> 0x%x\n", |
390 | dev->name, ch->ctrl_start, ch->ctrl_start + 6*16); | 499 | dev->name, ch->ctrl_start, ch->ctrl_start + 6*16); |
391 | printk("%s: ptr1_reg: 0x%08x\n", | 500 | printk(KERN_WARNING "%s: ptr1_reg: 0x%08x\n", |
392 | dev->name, cx_read(ch->ptr1_reg)); | 501 | dev->name, cx_read(ch->ptr1_reg)); |
393 | printk("%s: ptr2_reg: 0x%08x\n", | 502 | printk(KERN_WARNING "%s: ptr2_reg: 0x%08x\n", |
394 | dev->name, cx_read(ch->ptr2_reg)); | 503 | dev->name, cx_read(ch->ptr2_reg)); |
395 | printk("%s: cnt1_reg: 0x%08x\n", | 504 | printk(KERN_WARNING "%s: cnt1_reg: 0x%08x\n", |
396 | dev->name, cx_read(ch->cnt1_reg)); | 505 | dev->name, cx_read(ch->cnt1_reg)); |
397 | printk("%s: cnt2_reg: 0x%08x\n", | 506 | printk(KERN_WARNING "%s: cnt2_reg: 0x%08x\n", |
398 | dev->name, cx_read(ch->cnt2_reg)); | 507 | dev->name, cx_read(ch->cnt2_reg)); |
399 | } | 508 | } |
400 | 509 | ||
@@ -404,15 +513,15 @@ static void cx23885_risc_disasm(struct cx23885_tsport *port, | |||
404 | struct cx23885_dev *dev = port->dev; | 513 | struct cx23885_dev *dev = port->dev; |
405 | unsigned int i, j, n; | 514 | unsigned int i, j, n; |
406 | 515 | ||
407 | printk("%s: risc disasm: %p [dma=0x%08lx]\n", | 516 | printk(KERN_INFO "%s: risc disasm: %p [dma=0x%08lx]\n", |
408 | dev->name, risc->cpu, (unsigned long)risc->dma); | 517 | dev->name, risc->cpu, (unsigned long)risc->dma); |
409 | for (i = 0; i < (risc->size >> 2); i += n) { | 518 | for (i = 0; i < (risc->size >> 2); i += n) { |
410 | printk("%s: %04d: ", dev->name, i); | 519 | printk(KERN_INFO "%s: %04d: ", dev->name, i); |
411 | n = cx23885_risc_decode(risc->cpu[i]); | 520 | n = cx23885_risc_decode(le32_to_cpu(risc->cpu[i])); |
412 | for (j = 1; j < n; j++) | 521 | for (j = 1; j < n; j++) |
413 | printk("%s: %04d: 0x%08x [ arg #%d ]\n", | 522 | printk(KERN_INFO "%s: %04d: 0x%08x [ arg #%d ]\n", |
414 | dev->name, i + j, risc->cpu[i + j], j); | 523 | dev->name, i + j, risc->cpu[i + j], j); |
415 | if (risc->cpu[i] == RISC_JUMP) | 524 | if (risc->cpu[i] == cpu_to_le32(RISC_JUMP)) |
416 | break; | 525 | break; |
417 | } | 526 | } |
418 | } | 527 | } |
@@ -460,6 +569,7 @@ static void cx23885_reset(struct cx23885_dev *dev) | |||
460 | cx_write(AUDIO_INT_INT_STAT, 0xffffffff); | 569 | cx_write(AUDIO_INT_INT_STAT, 0xffffffff); |
461 | cx_write(AUDIO_EXT_INT_STAT, 0xffffffff); | 570 | cx_write(AUDIO_EXT_INT_STAT, 0xffffffff); |
462 | cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000); | 571 | cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000); |
572 | cx_write(PAD_CTRL, 0x00500300); | ||
463 | 573 | ||
464 | mdelay(100); | 574 | mdelay(100); |
465 | 575 | ||
@@ -488,7 +598,7 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) | |||
488 | * when DMA begins if RDR_TLCTL0 bit4 is not cleared. It does not | 598 | * when DMA begins if RDR_TLCTL0 bit4 is not cleared. It does not |
489 | * occur on the cx23887 bridge. | 599 | * occur on the cx23887 bridge. |
490 | */ | 600 | */ |
491 | if(dev->bridge == CX23885_BRIDGE_885) | 601 | if (dev->bridge == CX23885_BRIDGE_885) |
492 | cx_clear(RDR_TLCTL0, 1 << 4); | 602 | cx_clear(RDR_TLCTL0, 1 << 4); |
493 | 603 | ||
494 | return 0; | 604 | return 0; |
@@ -496,13 +606,13 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) | |||
496 | 606 | ||
497 | static int get_resources(struct cx23885_dev *dev) | 607 | static int get_resources(struct cx23885_dev *dev) |
498 | { | 608 | { |
499 | if (request_mem_region(pci_resource_start(dev->pci,0), | 609 | if (request_mem_region(pci_resource_start(dev->pci, 0), |
500 | pci_resource_len(dev->pci,0), | 610 | pci_resource_len(dev->pci, 0), |
501 | dev->name)) | 611 | dev->name)) |
502 | return 0; | 612 | return 0; |
503 | 613 | ||
504 | printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", | 614 | printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", |
505 | dev->name, (unsigned long long)pci_resource_start(dev->pci,0)); | 615 | dev->name, (unsigned long long)pci_resource_start(dev->pci, 0)); |
506 | 616 | ||
507 | return -EBUSY; | 617 | return -EBUSY; |
508 | } | 618 | } |
@@ -511,7 +621,8 @@ static void cx23885_timeout(unsigned long data); | |||
511 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 621 | int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
512 | u32 reg, u32 mask, u32 value); | 622 | u32 reg, u32 mask, u32 value); |
513 | 623 | ||
514 | static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *port, int portno) | 624 | static int cx23885_init_tsport(struct cx23885_dev *dev, |
625 | struct cx23885_tsport *port, int portno) | ||
515 | { | 626 | { |
516 | dprintk(1, "%s(portno=%d)\n", __func__, portno); | 627 | dprintk(1, "%s(portno=%d)\n", __func__, portno); |
517 | 628 | ||
@@ -531,7 +642,18 @@ static int cx23885_init_tsport(struct cx23885_dev *dev, struct cx23885_tsport *p | |||
531 | port->mpegq.timeout.data = (unsigned long)port; | 642 | port->mpegq.timeout.data = (unsigned long)port; |
532 | init_timer(&port->mpegq.timeout); | 643 | init_timer(&port->mpegq.timeout); |
533 | 644 | ||
534 | switch(portno) { | 645 | mutex_init(&port->frontends.lock); |
646 | INIT_LIST_HEAD(&port->frontends.felist); | ||
647 | port->frontends.active_fe_id = 0; | ||
648 | |||
649 | /* This should be hardcoded allow a single frontend | ||
650 | * attachment to this tsport, keeping the -dvb.c | ||
651 | * code clean and safe. | ||
652 | */ | ||
653 | if (!port->num_frontends) | ||
654 | port->num_frontends = 1; | ||
655 | |||
656 | switch (portno) { | ||
535 | case 1: | 657 | case 1: |
536 | port->reg_gpcnt = VID_B_GPCNT; | 658 | port->reg_gpcnt = VID_B_GPCNT; |
537 | port->reg_gpcnt_ctl = VID_B_GPCNT_CTL; | 659 | port->reg_gpcnt_ctl = VID_B_GPCNT_CTL; |
@@ -625,7 +747,6 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
625 | atomic_inc(&dev->refcount); | 747 | atomic_inc(&dev->refcount); |
626 | 748 | ||
627 | dev->nr = cx23885_devcount++; | 749 | dev->nr = cx23885_devcount++; |
628 | dev->sram_channels = cx23887_sram_channels; | ||
629 | sprintf(dev->name, "cx23885[%d]", dev->nr); | 750 | sprintf(dev->name, "cx23885[%d]", dev->nr); |
630 | 751 | ||
631 | mutex_lock(&devlist); | 752 | mutex_lock(&devlist); |
@@ -633,15 +754,17 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
633 | mutex_unlock(&devlist); | 754 | mutex_unlock(&devlist); |
634 | 755 | ||
635 | /* Configure the internal memory */ | 756 | /* Configure the internal memory */ |
636 | if(dev->pci->device == 0x8880) { | 757 | if (dev->pci->device == 0x8880) { |
637 | dev->bridge = CX23885_BRIDGE_887; | 758 | dev->bridge = CX23885_BRIDGE_887; |
638 | /* Apply a sensible clock frequency for the PCIe bridge */ | 759 | /* Apply a sensible clock frequency for the PCIe bridge */ |
639 | dev->clk_freq = 25000000; | 760 | dev->clk_freq = 25000000; |
761 | dev->sram_channels = cx23887_sram_channels; | ||
640 | } else | 762 | } else |
641 | if(dev->pci->device == 0x8852) { | 763 | if (dev->pci->device == 0x8852) { |
642 | dev->bridge = CX23885_BRIDGE_885; | 764 | dev->bridge = CX23885_BRIDGE_885; |
643 | /* Apply a sensible clock frequency for the PCIe bridge */ | 765 | /* Apply a sensible clock frequency for the PCIe bridge */ |
644 | dev->clk_freq = 28000000; | 766 | dev->clk_freq = 28000000; |
767 | dev->sram_channels = cx23885_sram_channels; | ||
645 | } else | 768 | } else |
646 | BUG(); | 769 | BUG(); |
647 | 770 | ||
@@ -718,8 +841,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
718 | } | 841 | } |
719 | 842 | ||
720 | /* PCIe stuff */ | 843 | /* PCIe stuff */ |
721 | dev->lmmio = ioremap(pci_resource_start(dev->pci,0), | 844 | dev->lmmio = ioremap(pci_resource_start(dev->pci, 0), |
722 | pci_resource_len(dev->pci,0)); | 845 | pci_resource_len(dev->pci, 0)); |
723 | 846 | ||
724 | dev->bmmio = (u8 __iomem *)dev->lmmio; | 847 | dev->bmmio = (u8 __iomem *)dev->lmmio; |
725 | 848 | ||
@@ -749,7 +872,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
749 | cx23885_i2c_register(&dev->i2c_bus[1]); | 872 | cx23885_i2c_register(&dev->i2c_bus[1]); |
750 | cx23885_i2c_register(&dev->i2c_bus[2]); | 873 | cx23885_i2c_register(&dev->i2c_bus[2]); |
751 | cx23885_card_setup(dev); | 874 | cx23885_card_setup(dev); |
752 | cx23885_call_i2c_clients (&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); | 875 | cx23885_call_i2c_clients(&dev->i2c_bus[0], TUNER_SET_STANDBY, NULL); |
753 | cx23885_ir_init(dev); | 876 | cx23885_ir_init(dev); |
754 | 877 | ||
755 | if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) { | 878 | if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) { |
@@ -795,8 +918,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev) | |||
795 | 918 | ||
796 | static void cx23885_dev_unregister(struct cx23885_dev *dev) | 919 | static void cx23885_dev_unregister(struct cx23885_dev *dev) |
797 | { | 920 | { |
798 | release_mem_region(pci_resource_start(dev->pci,0), | 921 | release_mem_region(pci_resource_start(dev->pci, 0), |
799 | pci_resource_len(dev->pci,0)); | 922 | pci_resource_len(dev->pci, 0)); |
800 | 923 | ||
801 | if (!atomic_dec_and_test(&dev->refcount)) | 924 | if (!atomic_dec_and_test(&dev->refcount)) |
802 | return; | 925 | return; |
@@ -823,7 +946,7 @@ static void cx23885_dev_unregister(struct cx23885_dev *dev) | |||
823 | iounmap(dev->lmmio); | 946 | iounmap(dev->lmmio); |
824 | } | 947 | } |
825 | 948 | ||
826 | static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, | 949 | static __le32 *cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, |
827 | unsigned int offset, u32 sync_line, | 950 | unsigned int offset, u32 sync_line, |
828 | unsigned int bpl, unsigned int padding, | 951 | unsigned int bpl, unsigned int padding, |
829 | unsigned int lines) | 952 | unsigned int lines) |
@@ -844,31 +967,31 @@ static __le32* cx23885_risc_field(__le32 *rp, struct scatterlist *sglist, | |||
844 | } | 967 | } |
845 | if (bpl <= sg_dma_len(sg)-offset) { | 968 | if (bpl <= sg_dma_len(sg)-offset) { |
846 | /* fits into current chunk */ | 969 | /* fits into current chunk */ |
847 | *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); | 970 | *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL|RISC_EOL|bpl); |
848 | *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); | 971 | *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); |
849 | *(rp++)=cpu_to_le32(0); /* bits 63-32 */ | 972 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
850 | offset+=bpl; | 973 | offset += bpl; |
851 | } else { | 974 | } else { |
852 | /* scanline needs to be split */ | 975 | /* scanline needs to be split */ |
853 | todo = bpl; | 976 | todo = bpl; |
854 | *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| | 977 | *(rp++) = cpu_to_le32(RISC_WRITE|RISC_SOL| |
855 | (sg_dma_len(sg)-offset)); | 978 | (sg_dma_len(sg)-offset)); |
856 | *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); | 979 | *(rp++) = cpu_to_le32(sg_dma_address(sg)+offset); |
857 | *(rp++)=cpu_to_le32(0); /* bits 63-32 */ | 980 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
858 | todo -= (sg_dma_len(sg)-offset); | 981 | todo -= (sg_dma_len(sg)-offset); |
859 | offset = 0; | 982 | offset = 0; |
860 | sg++; | 983 | sg++; |
861 | while (todo > sg_dma_len(sg)) { | 984 | while (todo > sg_dma_len(sg)) { |
862 | *(rp++)=cpu_to_le32(RISC_WRITE| | 985 | *(rp++) = cpu_to_le32(RISC_WRITE| |
863 | sg_dma_len(sg)); | 986 | sg_dma_len(sg)); |
864 | *(rp++)=cpu_to_le32(sg_dma_address(sg)); | 987 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); |
865 | *(rp++)=cpu_to_le32(0); /* bits 63-32 */ | 988 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
866 | todo -= sg_dma_len(sg); | 989 | todo -= sg_dma_len(sg); |
867 | sg++; | 990 | sg++; |
868 | } | 991 | } |
869 | *(rp++)=cpu_to_le32(RISC_WRITE|RISC_EOL|todo); | 992 | *(rp++) = cpu_to_le32(RISC_WRITE|RISC_EOL|todo); |
870 | *(rp++)=cpu_to_le32(sg_dma_address(sg)); | 993 | *(rp++) = cpu_to_le32(sg_dma_address(sg)); |
871 | *(rp++)=cpu_to_le32(0); /* bits 63-32 */ | 994 | *(rp++) = cpu_to_le32(0); /* bits 63-32 */ |
872 | offset += todo; | 995 | offset += todo; |
873 | } | 996 | } |
874 | offset += padding; | 997 | offset += padding; |
@@ -897,9 +1020,11 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
897 | can cause next bpl to start close to a page border. First DMA | 1020 | can cause next bpl to start close to a page border. First DMA |
898 | region may be smaller than PAGE_SIZE */ | 1021 | region may be smaller than PAGE_SIZE */ |
899 | /* write and jump need and extra dword */ | 1022 | /* write and jump need and extra dword */ |
900 | instructions = fields * (1 + ((bpl + padding) * lines) / PAGE_SIZE + lines); | 1023 | instructions = fields * (1 + ((bpl + padding) * lines) |
1024 | / PAGE_SIZE + lines); | ||
901 | instructions += 2; | 1025 | instructions += 2; |
902 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) | 1026 | rc = btcx_riscmem_alloc(pci, risc, instructions*12); |
1027 | if (rc < 0) | ||
903 | return rc; | 1028 | return rc; |
904 | 1029 | ||
905 | /* write risc instructions */ | 1030 | /* write risc instructions */ |
@@ -913,7 +1038,7 @@ int cx23885_risc_buffer(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
913 | 1038 | ||
914 | /* save pointer to jmp instruction address */ | 1039 | /* save pointer to jmp instruction address */ |
915 | risc->jmp = rp; | 1040 | risc->jmp = rp; |
916 | BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); | 1041 | BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); |
917 | return 0; | 1042 | return 0; |
918 | } | 1043 | } |
919 | 1044 | ||
@@ -935,7 +1060,8 @@ static int cx23885_risc_databuffer(struct pci_dev *pci, | |||
935 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; | 1060 | instructions = 1 + (bpl * lines) / PAGE_SIZE + lines; |
936 | instructions += 1; | 1061 | instructions += 1; |
937 | 1062 | ||
938 | if ((rc = btcx_riscmem_alloc(pci,risc,instructions*12)) < 0) | 1063 | rc = btcx_riscmem_alloc(pci, risc, instructions*12); |
1064 | if (rc < 0) | ||
939 | return rc; | 1065 | return rc; |
940 | 1066 | ||
941 | /* write risc instructions */ | 1067 | /* write risc instructions */ |
@@ -944,7 +1070,7 @@ static int cx23885_risc_databuffer(struct pci_dev *pci, | |||
944 | 1070 | ||
945 | /* save pointer to jmp instruction address */ | 1071 | /* save pointer to jmp instruction address */ |
946 | risc->jmp = rp; | 1072 | risc->jmp = rp; |
947 | BUG_ON((risc->jmp - risc->cpu + 2) * sizeof (*risc->cpu) > risc->size); | 1073 | BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); |
948 | return 0; | 1074 | return 0; |
949 | } | 1075 | } |
950 | 1076 | ||
@@ -954,7 +1080,8 @@ int cx23885_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
954 | __le32 *rp; | 1080 | __le32 *rp; |
955 | int rc; | 1081 | int rc; |
956 | 1082 | ||
957 | if ((rc = btcx_riscmem_alloc(pci, risc, 4*16)) < 0) | 1083 | rc = btcx_riscmem_alloc(pci, risc, 4*16); |
1084 | if (rc < 0) | ||
958 | return rc; | 1085 | return rc; |
959 | 1086 | ||
960 | /* write risc instructions */ | 1087 | /* write risc instructions */ |
@@ -1010,8 +1137,9 @@ static void cx23885_tsport_reg_dump(struct cx23885_tsport *port) | |||
1010 | port->reg_gpcnt_ctl, cx_read(port->reg_gpcnt_ctl)); | 1137 | port->reg_gpcnt_ctl, cx_read(port->reg_gpcnt_ctl)); |
1011 | dprintk(1, "%s() dma_ctl(0x%08X) 0x%08x\n", __func__, | 1138 | dprintk(1, "%s() dma_ctl(0x%08X) 0x%08x\n", __func__, |
1012 | port->reg_dma_ctl, cx_read(port->reg_dma_ctl)); | 1139 | port->reg_dma_ctl, cx_read(port->reg_dma_ctl)); |
1013 | dprintk(1, "%s() src_sel(0x%08X) 0x%08x\n", __func__, | 1140 | if (port->reg_src_sel) |
1014 | port->reg_src_sel, cx_read(port->reg_src_sel)); | 1141 | dprintk(1, "%s() src_sel(0x%08X) 0x%08x\n", __func__, |
1142 | port->reg_src_sel, cx_read(port->reg_src_sel)); | ||
1015 | dprintk(1, "%s() lngth(0x%08X) 0x%08x\n", __func__, | 1143 | dprintk(1, "%s() lngth(0x%08X) 0x%08x\n", __func__, |
1016 | port->reg_lngth, cx_read(port->reg_lngth)); | 1144 | port->reg_lngth, cx_read(port->reg_lngth)); |
1017 | dprintk(1, "%s() hw_sop_ctrl(0x%08X) 0x%08x\n", __func__, | 1145 | dprintk(1, "%s() hw_sop_ctrl(0x%08X) 0x%08x\n", __func__, |
@@ -1042,24 +1170,28 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
1042 | dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__, | 1170 | dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__, |
1043 | buf->vb.width, buf->vb.height, buf->vb.field); | 1171 | buf->vb.width, buf->vb.height, buf->vb.field); |
1044 | 1172 | ||
1173 | /* Stop the fifo and risc engine for this port */ | ||
1174 | cx_clear(port->reg_dma_ctl, port->dma_ctl_val); | ||
1175 | |||
1045 | /* setup fifo + format */ | 1176 | /* setup fifo + format */ |
1046 | cx23885_sram_channel_setup(dev, | 1177 | cx23885_sram_channel_setup(dev, |
1047 | &dev->sram_channels[ port->sram_chno ], | 1178 | &dev->sram_channels[port->sram_chno], |
1048 | port->ts_packet_size, buf->risc.dma); | 1179 | port->ts_packet_size, buf->risc.dma); |
1049 | if(debug > 5) { | 1180 | if (debug > 5) { |
1050 | cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ] ); | 1181 | cx23885_sram_channel_dump(dev, |
1182 | &dev->sram_channels[port->sram_chno]); | ||
1051 | cx23885_risc_disasm(port, &buf->risc); | 1183 | cx23885_risc_disasm(port, &buf->risc); |
1052 | } | 1184 | } |
1053 | 1185 | ||
1054 | /* write TS length to chip */ | 1186 | /* write TS length to chip */ |
1055 | cx_write(port->reg_lngth, buf->vb.width); | 1187 | cx_write(port->reg_lngth, buf->vb.width); |
1056 | 1188 | ||
1057 | if ( (!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) && | 1189 | if ((!(cx23885_boards[dev->board].portb & CX23885_MPEG_DVB)) && |
1058 | (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB)) ) { | 1190 | (!(cx23885_boards[dev->board].portc & CX23885_MPEG_DVB))) { |
1059 | printk( "%s() Failed. Unsupported value in .portb/c (0x%08x)/(0x%08x)\n", | 1191 | printk("%s() Unsupported .portb/c (0x%08x)/(0x%08x)\n", |
1060 | __func__, | 1192 | __func__, |
1061 | cx23885_boards[dev->board].portb, | 1193 | cx23885_boards[dev->board].portb, |
1062 | cx23885_boards[dev->board].portc ); | 1194 | cx23885_boards[dev->board].portc); |
1063 | return -EINVAL; | 1195 | return -EINVAL; |
1064 | } | 1196 | } |
1065 | 1197 | ||
@@ -1069,7 +1201,7 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
1069 | udelay(100); | 1201 | udelay(100); |
1070 | 1202 | ||
1071 | /* If the port supports SRC SELECT, configure it */ | 1203 | /* If the port supports SRC SELECT, configure it */ |
1072 | if(port->reg_src_sel) | 1204 | if (port->reg_src_sel) |
1073 | cx_write(port->reg_src_sel, port->src_sel_val); | 1205 | cx_write(port->reg_src_sel, port->src_sel_val); |
1074 | 1206 | ||
1075 | cx_write(port->reg_hw_sop_ctrl, port->hw_sop_ctrl_val); | 1207 | cx_write(port->reg_hw_sop_ctrl, port->hw_sop_ctrl_val); |
@@ -1078,12 +1210,26 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
1078 | cx_write(port->reg_gen_ctrl, port->gen_ctrl_val); | 1210 | cx_write(port->reg_gen_ctrl, port->gen_ctrl_val); |
1079 | udelay(100); | 1211 | udelay(100); |
1080 | 1212 | ||
1081 | // NOTE: this is 2 (reserved) for portb, does it matter? | 1213 | /* NOTE: this is 2 (reserved) for portb, does it matter? */ |
1082 | /* reset counter to zero */ | 1214 | /* reset counter to zero */ |
1083 | cx_write(port->reg_gpcnt_ctl, 3); | 1215 | cx_write(port->reg_gpcnt_ctl, 3); |
1084 | q->count = 1; | 1216 | q->count = 1; |
1085 | 1217 | ||
1086 | if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) { | 1218 | /* Set VIDB pins to input */ |
1219 | if (cx23885_boards[dev->board].portb == CX23885_MPEG_DVB) { | ||
1220 | reg = cx_read(PAD_CTRL); | ||
1221 | reg &= ~0x3; /* Clear TS1_OE & TS1_SOP_OE */ | ||
1222 | cx_write(PAD_CTRL, reg); | ||
1223 | } | ||
1224 | |||
1225 | /* Set VIDC pins to input */ | ||
1226 | if (cx23885_boards[dev->board].portc == CX23885_MPEG_DVB) { | ||
1227 | reg = cx_read(PAD_CTRL); | ||
1228 | reg &= ~0x4; /* Clear TS2_SOP_OE */ | ||
1229 | cx_write(PAD_CTRL, reg); | ||
1230 | } | ||
1231 | |||
1232 | if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER) { | ||
1087 | 1233 | ||
1088 | reg = cx_read(PAD_CTRL); | 1234 | reg = cx_read(PAD_CTRL); |
1089 | reg = reg & ~0x1; /* Clear TS1_OE */ | 1235 | reg = reg & ~0x1; /* Clear TS1_OE */ |
@@ -1098,11 +1244,11 @@ static int cx23885_start_dma(struct cx23885_tsport *port, | |||
1098 | cx_write(ALT_PIN_OUT_SEL, 0x10100045); | 1244 | cx_write(ALT_PIN_OUT_SEL, 0x10100045); |
1099 | } | 1245 | } |
1100 | 1246 | ||
1101 | switch(dev->bridge) { | 1247 | switch (dev->bridge) { |
1102 | case CX23885_BRIDGE_885: | 1248 | case CX23885_BRIDGE_885: |
1103 | case CX23885_BRIDGE_887: | 1249 | case CX23885_BRIDGE_887: |
1104 | /* enable irqs */ | 1250 | /* enable irqs */ |
1105 | dprintk(1, "%s() enabling TS int's and DMA\n", __func__ ); | 1251 | dprintk(1, "%s() enabling TS int's and DMA\n", __func__); |
1106 | cx_set(port->reg_ts_int_msk, port->ts_int_msk_val); | 1252 | cx_set(port->reg_ts_int_msk, port->ts_int_msk_val); |
1107 | cx_set(port->reg_dma_ctl, port->dma_ctl_val); | 1253 | cx_set(port->reg_dma_ctl, port->dma_ctl_val); |
1108 | cx_set(PCI_INT_MSK, dev->pci_irqmask | port->pci_irqmask); | 1254 | cx_set(PCI_INT_MSK, dev->pci_irqmask | port->pci_irqmask); |
@@ -1133,7 +1279,7 @@ static int cx23885_stop_dma(struct cx23885_tsport *port) | |||
1133 | cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val); | 1279 | cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val); |
1134 | cx_clear(port->reg_dma_ctl, port->dma_ctl_val); | 1280 | cx_clear(port->reg_dma_ctl, port->dma_ctl_val); |
1135 | 1281 | ||
1136 | if (cx23885_boards[dev->board].portb & CX23885_MPEG_ENCODER) { | 1282 | if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER) { |
1137 | 1283 | ||
1138 | reg = cx_read(PAD_CTRL); | 1284 | reg = cx_read(PAD_CTRL); |
1139 | 1285 | ||
@@ -1161,8 +1307,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, | |||
1161 | struct cx23885_buffer *buf; | 1307 | struct cx23885_buffer *buf; |
1162 | 1308 | ||
1163 | dprintk(5, "%s()\n", __func__); | 1309 | dprintk(5, "%s()\n", __func__); |
1164 | if (list_empty(&q->active)) | 1310 | if (list_empty(&q->active)) { |
1165 | { | ||
1166 | struct cx23885_buffer *prev; | 1311 | struct cx23885_buffer *prev; |
1167 | prev = NULL; | 1312 | prev = NULL; |
1168 | 1313 | ||
@@ -1180,7 +1325,7 @@ int cx23885_restart_queue(struct cx23885_tsport *port, | |||
1180 | buf->vb.state = VIDEOBUF_ACTIVE; | 1325 | buf->vb.state = VIDEOBUF_ACTIVE; |
1181 | buf->count = q->count++; | 1326 | buf->count = q->count++; |
1182 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 1327 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
1183 | dprintk(5, "[%p/%d] restart_queue - first active\n", | 1328 | dprintk(5, "[%p/%d] restart_queue - f/active\n", |
1184 | buf, buf->vb.i); | 1329 | buf, buf->vb.i); |
1185 | 1330 | ||
1186 | } else if (prev->vb.width == buf->vb.width && | 1331 | } else if (prev->vb.width == buf->vb.width && |
@@ -1191,8 +1336,9 @@ int cx23885_restart_queue(struct cx23885_tsport *port, | |||
1191 | buf->vb.state = VIDEOBUF_ACTIVE; | 1336 | buf->vb.state = VIDEOBUF_ACTIVE; |
1192 | buf->count = q->count++; | 1337 | buf->count = q->count++; |
1193 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 1338 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
1194 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ | 1339 | /* 64 bit bits 63-32 */ |
1195 | dprintk(5,"[%p/%d] restart_queue - move to active\n", | 1340 | prev->risc.jmp[2] = cpu_to_le32(0); |
1341 | dprintk(5, "[%p/%d] restart_queue - m/active\n", | ||
1196 | buf, buf->vb.i); | 1342 | buf, buf->vb.i); |
1197 | } else { | 1343 | } else { |
1198 | return 0; | 1344 | return 0; |
@@ -1231,7 +1377,8 @@ int cx23885_buf_prepare(struct videobuf_queue *q, struct cx23885_tsport *port, | |||
1231 | buf->vb.size = size; | 1377 | buf->vb.size = size; |
1232 | buf->vb.field = field /*V4L2_FIELD_TOP*/; | 1378 | buf->vb.field = field /*V4L2_FIELD_TOP*/; |
1233 | 1379 | ||
1234 | if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) | 1380 | rc = videobuf_iolock(q, &buf->vb, NULL); |
1381 | if (0 != rc) | ||
1235 | goto fail; | 1382 | goto fail; |
1236 | cx23885_risc_databuffer(dev->pci, &buf->risc, | 1383 | cx23885_risc_databuffer(dev->pci, &buf->risc, |
1237 | videobuf_to_dma(&buf->vb)->sglist, | 1384 | videobuf_to_dma(&buf->vb)->sglist, |
@@ -1257,7 +1404,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) | |||
1257 | buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */ | 1404 | buf->risc.jmp[2] = cpu_to_le32(0); /* bits 63-32 */ |
1258 | 1405 | ||
1259 | if (list_empty(&cx88q->active)) { | 1406 | if (list_empty(&cx88q->active)) { |
1260 | dprintk( 1, "queue is empty - first active\n" ); | 1407 | dprintk(1, "queue is empty - first active\n"); |
1261 | list_add_tail(&buf->vb.queue, &cx88q->active); | 1408 | list_add_tail(&buf->vb.queue, &cx88q->active); |
1262 | cx23885_start_dma(port, cx88q, buf); | 1409 | cx23885_start_dma(port, cx88q, buf); |
1263 | buf->vb.state = VIDEOBUF_ACTIVE; | 1410 | buf->vb.state = VIDEOBUF_ACTIVE; |
@@ -1266,7 +1413,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) | |||
1266 | dprintk(1, "[%p/%d] %s - first active\n", | 1413 | dprintk(1, "[%p/%d] %s - first active\n", |
1267 | buf, buf->vb.i, __func__); | 1414 | buf, buf->vb.i, __func__); |
1268 | } else { | 1415 | } else { |
1269 | dprintk( 1, "queue is not empty - append to active\n" ); | 1416 | dprintk(1, "queue is not empty - append to active\n"); |
1270 | prev = list_entry(cx88q->active.prev, struct cx23885_buffer, | 1417 | prev = list_entry(cx88q->active.prev, struct cx23885_buffer, |
1271 | vb.queue); | 1418 | vb.queue); |
1272 | list_add_tail(&buf->vb.queue, &cx88q->active); | 1419 | list_add_tail(&buf->vb.queue, &cx88q->active); |
@@ -1274,7 +1421,7 @@ void cx23885_buf_queue(struct cx23885_tsport *port, struct cx23885_buffer *buf) | |||
1274 | buf->count = cx88q->count++; | 1421 | buf->count = cx88q->count++; |
1275 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 1422 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
1276 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ | 1423 | prev->risc.jmp[2] = cpu_to_le32(0); /* 64 bit bits 63-32 */ |
1277 | dprintk( 1, "[%p/%d] %s - append to active\n", | 1424 | dprintk(1, "[%p/%d] %s - append to active\n", |
1278 | buf, buf->vb.i, __func__); | 1425 | buf, buf->vb.i, __func__); |
1279 | } | 1426 | } |
1280 | } | 1427 | } |
@@ -1300,7 +1447,7 @@ static void do_cancel_buffers(struct cx23885_tsport *port, char *reason, | |||
1300 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); | 1447 | buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); |
1301 | } | 1448 | } |
1302 | if (restart) { | 1449 | if (restart) { |
1303 | dprintk(1, "restarting queue\n" ); | 1450 | dprintk(1, "restarting queue\n"); |
1304 | cx23885_restart_queue(port, q); | 1451 | cx23885_restart_queue(port, q); |
1305 | } | 1452 | } |
1306 | spin_unlock_irqrestore(&port->slock, flags); | 1453 | spin_unlock_irqrestore(&port->slock, flags); |
@@ -1311,7 +1458,7 @@ void cx23885_cancel_buffers(struct cx23885_tsport *port) | |||
1311 | struct cx23885_dev *dev = port->dev; | 1458 | struct cx23885_dev *dev = port->dev; |
1312 | struct cx23885_dmaqueue *q = &port->mpegq; | 1459 | struct cx23885_dmaqueue *q = &port->mpegq; |
1313 | 1460 | ||
1314 | dprintk(1, "%s()\n", __FUNCTION__); | 1461 | dprintk(1, "%s()\n", __func__); |
1315 | del_timer_sync(&q->timeout); | 1462 | del_timer_sync(&q->timeout); |
1316 | cx23885_stop_dma(port); | 1463 | cx23885_stop_dma(port); |
1317 | do_cancel_buffers(port, "cancel", 0); | 1464 | do_cancel_buffers(port, "cancel", 0); |
@@ -1322,10 +1469,11 @@ static void cx23885_timeout(unsigned long data) | |||
1322 | struct cx23885_tsport *port = (struct cx23885_tsport *)data; | 1469 | struct cx23885_tsport *port = (struct cx23885_tsport *)data; |
1323 | struct cx23885_dev *dev = port->dev; | 1470 | struct cx23885_dev *dev = port->dev; |
1324 | 1471 | ||
1325 | dprintk(1, "%s()\n",__func__); | 1472 | dprintk(1, "%s()\n", __func__); |
1326 | 1473 | ||
1327 | if (debug > 5) | 1474 | if (debug > 5) |
1328 | cx23885_sram_channel_dump(dev, &dev->sram_channels[ port->sram_chno ]); | 1475 | cx23885_sram_channel_dump(dev, |
1476 | &dev->sram_channels[port->sram_chno]); | ||
1329 | 1477 | ||
1330 | cx23885_stop_dma(port); | 1478 | cx23885_stop_dma(port); |
1331 | do_cancel_buffers(port, "timeout", 1); | 1479 | do_cancel_buffers(port, "timeout", 1); |
@@ -1401,16 +1549,23 @@ static int cx23885_irq_ts(struct cx23885_tsport *port, u32 status) | |||
1401 | if ((status & VID_BC_MSK_OPC_ERR) || | 1549 | if ((status & VID_BC_MSK_OPC_ERR) || |
1402 | (status & VID_BC_MSK_BAD_PKT) || | 1550 | (status & VID_BC_MSK_BAD_PKT) || |
1403 | (status & VID_BC_MSK_SYNC) || | 1551 | (status & VID_BC_MSK_SYNC) || |
1404 | (status & VID_BC_MSK_OF)) | 1552 | (status & VID_BC_MSK_OF)) { |
1405 | { | 1553 | |
1406 | if (status & VID_BC_MSK_OPC_ERR) | 1554 | if (status & VID_BC_MSK_OPC_ERR) |
1407 | dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n", VID_BC_MSK_OPC_ERR); | 1555 | dprintk(7, " (VID_BC_MSK_OPC_ERR 0x%08x)\n", |
1556 | VID_BC_MSK_OPC_ERR); | ||
1557 | |||
1408 | if (status & VID_BC_MSK_BAD_PKT) | 1558 | if (status & VID_BC_MSK_BAD_PKT) |
1409 | dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n", VID_BC_MSK_BAD_PKT); | 1559 | dprintk(7, " (VID_BC_MSK_BAD_PKT 0x%08x)\n", |
1560 | VID_BC_MSK_BAD_PKT); | ||
1561 | |||
1410 | if (status & VID_BC_MSK_SYNC) | 1562 | if (status & VID_BC_MSK_SYNC) |
1411 | dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n", VID_BC_MSK_SYNC); | 1563 | dprintk(7, " (VID_BC_MSK_SYNC 0x%08x)\n", |
1564 | VID_BC_MSK_SYNC); | ||
1565 | |||
1412 | if (status & VID_BC_MSK_OF) | 1566 | if (status & VID_BC_MSK_OF) |
1413 | dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n", VID_BC_MSK_OF); | 1567 | dprintk(7, " (VID_BC_MSK_OF 0x%08x)\n", |
1568 | VID_BC_MSK_OF); | ||
1414 | 1569 | ||
1415 | printk(KERN_ERR "%s: mpeg risc op code error\n", dev->name); | 1570 | printk(KERN_ERR "%s: mpeg risc op code error\n", dev->name); |
1416 | 1571 | ||
@@ -1464,7 +1619,7 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) | |||
1464 | ts2_status = cx_read(VID_C_INT_STAT); | 1619 | ts2_status = cx_read(VID_C_INT_STAT); |
1465 | ts2_mask = cx_read(VID_C_INT_MSK); | 1620 | ts2_mask = cx_read(VID_C_INT_MSK); |
1466 | 1621 | ||
1467 | if ( (pci_status == 0) && (ts2_status == 0) && (ts1_status == 0) ) | 1622 | if ((pci_status == 0) && (ts2_status == 0) && (ts1_status == 0)) |
1468 | goto out; | 1623 | goto out; |
1469 | 1624 | ||
1470 | vida_count = cx_read(VID_A_GPCNT); | 1625 | vida_count = cx_read(VID_A_GPCNT); |
@@ -1479,38 +1634,56 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) | |||
1479 | dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", | 1634 | dprintk(7, "ts2_status: 0x%08x ts2_mask: 0x%08x count: 0x%x\n", |
1480 | ts2_status, ts2_mask, ts2_count); | 1635 | ts2_status, ts2_mask, ts2_count); |
1481 | 1636 | ||
1482 | if ( (pci_status & PCI_MSK_RISC_RD) || | 1637 | if ((pci_status & PCI_MSK_RISC_RD) || |
1483 | (pci_status & PCI_MSK_RISC_WR) || | 1638 | (pci_status & PCI_MSK_RISC_WR) || |
1484 | (pci_status & PCI_MSK_AL_RD) || | 1639 | (pci_status & PCI_MSK_AL_RD) || |
1485 | (pci_status & PCI_MSK_AL_WR) || | 1640 | (pci_status & PCI_MSK_AL_WR) || |
1486 | (pci_status & PCI_MSK_APB_DMA) || | 1641 | (pci_status & PCI_MSK_APB_DMA) || |
1487 | (pci_status & PCI_MSK_VID_C) || | 1642 | (pci_status & PCI_MSK_VID_C) || |
1488 | (pci_status & PCI_MSK_VID_B) || | 1643 | (pci_status & PCI_MSK_VID_B) || |
1489 | (pci_status & PCI_MSK_VID_A) || | 1644 | (pci_status & PCI_MSK_VID_A) || |
1490 | (pci_status & PCI_MSK_AUD_INT) || | 1645 | (pci_status & PCI_MSK_AUD_INT) || |
1491 | (pci_status & PCI_MSK_AUD_EXT) ) | 1646 | (pci_status & PCI_MSK_AUD_EXT)) { |
1492 | { | ||
1493 | 1647 | ||
1494 | if (pci_status & PCI_MSK_RISC_RD) | 1648 | if (pci_status & PCI_MSK_RISC_RD) |
1495 | dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n", PCI_MSK_RISC_RD); | 1649 | dprintk(7, " (PCI_MSK_RISC_RD 0x%08x)\n", |
1650 | PCI_MSK_RISC_RD); | ||
1651 | |||
1496 | if (pci_status & PCI_MSK_RISC_WR) | 1652 | if (pci_status & PCI_MSK_RISC_WR) |
1497 | dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n", PCI_MSK_RISC_WR); | 1653 | dprintk(7, " (PCI_MSK_RISC_WR 0x%08x)\n", |
1654 | PCI_MSK_RISC_WR); | ||
1655 | |||
1498 | if (pci_status & PCI_MSK_AL_RD) | 1656 | if (pci_status & PCI_MSK_AL_RD) |
1499 | dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n", PCI_MSK_AL_RD); | 1657 | dprintk(7, " (PCI_MSK_AL_RD 0x%08x)\n", |
1658 | PCI_MSK_AL_RD); | ||
1659 | |||
1500 | if (pci_status & PCI_MSK_AL_WR) | 1660 | if (pci_status & PCI_MSK_AL_WR) |
1501 | dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n", PCI_MSK_AL_WR); | 1661 | dprintk(7, " (PCI_MSK_AL_WR 0x%08x)\n", |
1662 | PCI_MSK_AL_WR); | ||
1663 | |||
1502 | if (pci_status & PCI_MSK_APB_DMA) | 1664 | if (pci_status & PCI_MSK_APB_DMA) |
1503 | dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n", PCI_MSK_APB_DMA); | 1665 | dprintk(7, " (PCI_MSK_APB_DMA 0x%08x)\n", |
1666 | PCI_MSK_APB_DMA); | ||
1667 | |||
1504 | if (pci_status & PCI_MSK_VID_C) | 1668 | if (pci_status & PCI_MSK_VID_C) |
1505 | dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n", PCI_MSK_VID_C); | 1669 | dprintk(7, " (PCI_MSK_VID_C 0x%08x)\n", |
1670 | PCI_MSK_VID_C); | ||
1671 | |||
1506 | if (pci_status & PCI_MSK_VID_B) | 1672 | if (pci_status & PCI_MSK_VID_B) |
1507 | dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n", PCI_MSK_VID_B); | 1673 | dprintk(7, " (PCI_MSK_VID_B 0x%08x)\n", |
1674 | PCI_MSK_VID_B); | ||
1675 | |||
1508 | if (pci_status & PCI_MSK_VID_A) | 1676 | if (pci_status & PCI_MSK_VID_A) |
1509 | dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n", PCI_MSK_VID_A); | 1677 | dprintk(7, " (PCI_MSK_VID_A 0x%08x)\n", |
1678 | PCI_MSK_VID_A); | ||
1679 | |||
1510 | if (pci_status & PCI_MSK_AUD_INT) | 1680 | if (pci_status & PCI_MSK_AUD_INT) |
1511 | dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n", PCI_MSK_AUD_INT); | 1681 | dprintk(7, " (PCI_MSK_AUD_INT 0x%08x)\n", |
1682 | PCI_MSK_AUD_INT); | ||
1683 | |||
1512 | if (pci_status & PCI_MSK_AUD_EXT) | 1684 | if (pci_status & PCI_MSK_AUD_EXT) |
1513 | dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n", PCI_MSK_AUD_EXT); | 1685 | dprintk(7, " (PCI_MSK_AUD_EXT 0x%08x)\n", |
1686 | PCI_MSK_AUD_EXT); | ||
1514 | 1687 | ||
1515 | } | 1688 | } |
1516 | 1689 | ||
@@ -1622,13 +1795,13 @@ static struct pci_device_id cx23885_pci_tbl[] = { | |||
1622 | .device = 0x8852, | 1795 | .device = 0x8852, |
1623 | .subvendor = PCI_ANY_ID, | 1796 | .subvendor = PCI_ANY_ID, |
1624 | .subdevice = PCI_ANY_ID, | 1797 | .subdevice = PCI_ANY_ID, |
1625 | },{ | 1798 | }, { |
1626 | /* CX23887 Rev 2 */ | 1799 | /* CX23887 Rev 2 */ |
1627 | .vendor = 0x14f1, | 1800 | .vendor = 0x14f1, |
1628 | .device = 0x8880, | 1801 | .device = 0x8880, |
1629 | .subvendor = PCI_ANY_ID, | 1802 | .subvendor = PCI_ANY_ID, |
1630 | .subdevice = PCI_ANY_ID, | 1803 | .subdevice = PCI_ANY_ID, |
1631 | },{ | 1804 | }, { |
1632 | /* --- end of list --- */ | 1805 | /* --- end of list --- */ |
1633 | } | 1806 | } |
1634 | }; | 1807 | }; |
@@ -1666,9 +1839,3 @@ module_init(cx23885_init); | |||
1666 | module_exit(cx23885_fini); | 1839 | module_exit(cx23885_fini); |
1667 | 1840 | ||
1668 | /* ----------------------------------------------------------- */ | 1841 | /* ----------------------------------------------------------- */ |
1669 | /* | ||
1670 | * Local variables: | ||
1671 | * c-basic-offset: 8 | ||
1672 | * End: | ||
1673 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
1674 | */ | ||
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 022aa391937a..e1aac07b3158 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -31,6 +31,7 @@ | |||
31 | #include <media/v4l2-common.h> | 31 | #include <media/v4l2-common.h> |
32 | 32 | ||
33 | #include "s5h1409.h" | 33 | #include "s5h1409.h" |
34 | #include "s5h1411.h" | ||
34 | #include "mt2131.h" | 35 | #include "mt2131.h" |
35 | #include "tda8290.h" | 36 | #include "tda8290.h" |
36 | #include "tda18271.h" | 37 | #include "tda18271.h" |
@@ -41,6 +42,7 @@ | |||
41 | #include "tuner-simple.h" | 42 | #include "tuner-simple.h" |
42 | #include "dib7000p.h" | 43 | #include "dib7000p.h" |
43 | #include "dibx000_common.h" | 44 | #include "dibx000_common.h" |
45 | #include "zl10353.h" | ||
44 | 46 | ||
45 | static unsigned int debug; | 47 | static unsigned int debug; |
46 | 48 | ||
@@ -76,19 +78,19 @@ static int dvb_buf_prepare(struct videobuf_queue *q, | |||
76 | struct videobuf_buffer *vb, enum v4l2_field field) | 78 | struct videobuf_buffer *vb, enum v4l2_field field) |
77 | { | 79 | { |
78 | struct cx23885_tsport *port = q->priv_data; | 80 | struct cx23885_tsport *port = q->priv_data; |
79 | return cx23885_buf_prepare(q, port, (struct cx23885_buffer*)vb, field); | 81 | return cx23885_buf_prepare(q, port, (struct cx23885_buffer *)vb, field); |
80 | } | 82 | } |
81 | 83 | ||
82 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | 84 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
83 | { | 85 | { |
84 | struct cx23885_tsport *port = q->priv_data; | 86 | struct cx23885_tsport *port = q->priv_data; |
85 | cx23885_buf_queue(port, (struct cx23885_buffer*)vb); | 87 | cx23885_buf_queue(port, (struct cx23885_buffer *)vb); |
86 | } | 88 | } |
87 | 89 | ||
88 | static void dvb_buf_release(struct videobuf_queue *q, | 90 | static void dvb_buf_release(struct videobuf_queue *q, |
89 | struct videobuf_buffer *vb) | 91 | struct videobuf_buffer *vb) |
90 | { | 92 | { |
91 | cx23885_free_buffer(q, (struct cx23885_buffer*)vb); | 93 | cx23885_free_buffer(q, (struct cx23885_buffer *)vb); |
92 | } | 94 | } |
93 | 95 | ||
94 | static struct videobuf_queue_ops dvb_qops = { | 96 | static struct videobuf_queue_ops dvb_qops = { |
@@ -164,10 +166,34 @@ static struct s5h1409_config hauppauge_hvr1500q_config = { | |||
164 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, | 166 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, |
165 | }; | 167 | }; |
166 | 168 | ||
169 | static struct s5h1409_config dvico_s5h1409_config = { | ||
170 | .demod_address = 0x32 >> 1, | ||
171 | .output_mode = S5H1409_SERIAL_OUTPUT, | ||
172 | .gpio = S5H1409_GPIO_ON, | ||
173 | .qam_if = 44000, | ||
174 | .inversion = S5H1409_INVERSION_OFF, | ||
175 | .status_mode = S5H1409_DEMODLOCKING, | ||
176 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, | ||
177 | }; | ||
178 | |||
179 | static struct s5h1411_config dvico_s5h1411_config = { | ||
180 | .output_mode = S5H1411_SERIAL_OUTPUT, | ||
181 | .gpio = S5H1411_GPIO_ON, | ||
182 | .qam_if = S5H1411_IF_44000, | ||
183 | .vsb_if = S5H1411_IF_44000, | ||
184 | .inversion = S5H1411_INVERSION_OFF, | ||
185 | .status_mode = S5H1411_DEMODLOCKING, | ||
186 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, | ||
187 | }; | ||
188 | |||
167 | static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { | 189 | static struct xc5000_config hauppauge_hvr1500q_tunerconfig = { |
168 | .i2c_address = 0x61, | 190 | .i2c_address = 0x61, |
169 | .if_khz = 5380, | 191 | .if_khz = 5380, |
170 | .tuner_callback = cx23885_tuner_callback | 192 | }; |
193 | |||
194 | static struct xc5000_config dvico_xc5000_tunerconfig = { | ||
195 | .i2c_address = 0x64, | ||
196 | .if_khz = 5380, | ||
171 | }; | 197 | }; |
172 | 198 | ||
173 | static struct tda829x_config tda829x_no_probe = { | 199 | static struct tda829x_config tda829x_no_probe = { |
@@ -276,53 +302,35 @@ static struct dib7000p_config hauppauge_hvr1400_dib7000_config = { | |||
276 | .output_mode = OUTMODE_MPEG2_SERIAL, | 302 | .output_mode = OUTMODE_MPEG2_SERIAL, |
277 | }; | 303 | }; |
278 | 304 | ||
279 | static int cx23885_hvr1500_xc3028_callback(void *ptr, int command, int arg) | 305 | static struct zl10353_config dvico_fusionhdtv_xc3028 = { |
280 | { | 306 | .demod_address = 0x0f, |
281 | struct cx23885_tsport *port = ptr; | 307 | .if2 = 45600, |
282 | struct cx23885_dev *dev = port->dev; | 308 | .no_tuner = 1, |
283 | 309 | }; | |
284 | switch (command) { | ||
285 | case XC2028_TUNER_RESET: | ||
286 | /* Send the tuner in then out of reset */ | ||
287 | /* GPIO-2 xc3028 tuner */ | ||
288 | dprintk(1, "%s: XC2028_TUNER_RESET %d\n", __func__, arg); | ||
289 | |||
290 | cx_set(GP0_IO, 0x00040000); | ||
291 | cx_clear(GP0_IO, 0x00000004); | ||
292 | msleep(5); | ||
293 | |||
294 | cx_set(GP0_IO, 0x00040004); | ||
295 | msleep(5); | ||
296 | break; | ||
297 | case XC2028_RESET_CLK: | ||
298 | dprintk(1, "%s: XC2028_RESET_CLK %d\n", __func__, arg); | ||
299 | break; | ||
300 | default: | ||
301 | dprintk(1, "%s: unknown command %d, arg %d\n", __func__, | ||
302 | command, arg); | ||
303 | return -EINVAL; | ||
304 | } | ||
305 | |||
306 | return 0; | ||
307 | } | ||
308 | 310 | ||
309 | static int dvb_register(struct cx23885_tsport *port) | 311 | static int dvb_register(struct cx23885_tsport *port) |
310 | { | 312 | { |
311 | struct cx23885_dev *dev = port->dev; | 313 | struct cx23885_dev *dev = port->dev; |
312 | struct cx23885_i2c *i2c_bus = NULL; | 314 | struct cx23885_i2c *i2c_bus = NULL; |
315 | struct videobuf_dvb_frontend *fe0; | ||
316 | |||
317 | /* Get the first frontend */ | ||
318 | fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); | ||
319 | if (!fe0) | ||
320 | return -EINVAL; | ||
313 | 321 | ||
314 | /* init struct videobuf_dvb */ | 322 | /* init struct videobuf_dvb */ |
315 | port->dvb.name = dev->name; | 323 | fe0->dvb.name = dev->name; |
316 | 324 | ||
317 | /* init frontend */ | 325 | /* init frontend */ |
318 | switch (dev->board) { | 326 | switch (dev->board) { |
319 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | 327 | case CX23885_BOARD_HAUPPAUGE_HVR1250: |
320 | i2c_bus = &dev->i2c_bus[0]; | 328 | i2c_bus = &dev->i2c_bus[0]; |
321 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 329 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
322 | &hauppauge_generic_config, | 330 | &hauppauge_generic_config, |
323 | &i2c_bus->i2c_adap); | 331 | &i2c_bus->i2c_adap); |
324 | if (port->dvb.frontend != NULL) { | 332 | if (fe0->dvb.frontend != NULL) { |
325 | dvb_attach(mt2131_attach, port->dvb.frontend, | 333 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
326 | &i2c_bus->i2c_adap, | 334 | &i2c_bus->i2c_adap, |
327 | &hauppauge_generic_tunerconfig, 0); | 335 | &hauppauge_generic_tunerconfig, 0); |
328 | } | 336 | } |
@@ -331,27 +339,27 @@ static int dvb_register(struct cx23885_tsport *port) | |||
331 | i2c_bus = &dev->i2c_bus[0]; | 339 | i2c_bus = &dev->i2c_bus[0]; |
332 | switch (alt_tuner) { | 340 | switch (alt_tuner) { |
333 | case 1: | 341 | case 1: |
334 | port->dvb.frontend = | 342 | fe0->dvb.frontend = |
335 | dvb_attach(s5h1409_attach, | 343 | dvb_attach(s5h1409_attach, |
336 | &hauppauge_ezqam_config, | 344 | &hauppauge_ezqam_config, |
337 | &i2c_bus->i2c_adap); | 345 | &i2c_bus->i2c_adap); |
338 | if (port->dvb.frontend != NULL) { | 346 | if (fe0->dvb.frontend != NULL) { |
339 | dvb_attach(tda829x_attach, port->dvb.frontend, | 347 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
340 | &dev->i2c_bus[1].i2c_adap, 0x42, | 348 | &dev->i2c_bus[1].i2c_adap, 0x42, |
341 | &tda829x_no_probe); | 349 | &tda829x_no_probe); |
342 | dvb_attach(tda18271_attach, port->dvb.frontend, | 350 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
343 | 0x60, &dev->i2c_bus[1].i2c_adap, | 351 | 0x60, &dev->i2c_bus[1].i2c_adap, |
344 | &hauppauge_tda18271_config); | 352 | &hauppauge_tda18271_config); |
345 | } | 353 | } |
346 | break; | 354 | break; |
347 | case 0: | 355 | case 0: |
348 | default: | 356 | default: |
349 | port->dvb.frontend = | 357 | fe0->dvb.frontend = |
350 | dvb_attach(s5h1409_attach, | 358 | dvb_attach(s5h1409_attach, |
351 | &hauppauge_generic_config, | 359 | &hauppauge_generic_config, |
352 | &i2c_bus->i2c_adap); | 360 | &i2c_bus->i2c_adap); |
353 | if (port->dvb.frontend != NULL) | 361 | if (fe0->dvb.frontend != NULL) |
354 | dvb_attach(mt2131_attach, port->dvb.frontend, | 362 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
355 | &i2c_bus->i2c_adap, | 363 | &i2c_bus->i2c_adap, |
356 | &hauppauge_generic_tunerconfig, 0); | 364 | &hauppauge_generic_tunerconfig, 0); |
357 | break; | 365 | break; |
@@ -359,56 +367,55 @@ static int dvb_register(struct cx23885_tsport *port) | |||
359 | break; | 367 | break; |
360 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 368 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
361 | i2c_bus = &dev->i2c_bus[0]; | 369 | i2c_bus = &dev->i2c_bus[0]; |
362 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 370 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
363 | &hauppauge_hvr1800lp_config, | 371 | &hauppauge_hvr1800lp_config, |
364 | &i2c_bus->i2c_adap); | 372 | &i2c_bus->i2c_adap); |
365 | if (port->dvb.frontend != NULL) { | 373 | if (fe0->dvb.frontend != NULL) { |
366 | dvb_attach(mt2131_attach, port->dvb.frontend, | 374 | dvb_attach(mt2131_attach, fe0->dvb.frontend, |
367 | &i2c_bus->i2c_adap, | 375 | &i2c_bus->i2c_adap, |
368 | &hauppauge_generic_tunerconfig, 0); | 376 | &hauppauge_generic_tunerconfig, 0); |
369 | } | 377 | } |
370 | break; | 378 | break; |
371 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: | 379 | case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP: |
372 | i2c_bus = &dev->i2c_bus[0]; | 380 | i2c_bus = &dev->i2c_bus[0]; |
373 | port->dvb.frontend = dvb_attach(lgdt330x_attach, | 381 | fe0->dvb.frontend = dvb_attach(lgdt330x_attach, |
374 | &fusionhdtv_5_express, | 382 | &fusionhdtv_5_express, |
375 | &i2c_bus->i2c_adap); | 383 | &i2c_bus->i2c_adap); |
376 | if (port->dvb.frontend != NULL) { | 384 | if (fe0->dvb.frontend != NULL) { |
377 | dvb_attach(simple_tuner_attach, port->dvb.frontend, | 385 | dvb_attach(simple_tuner_attach, fe0->dvb.frontend, |
378 | &i2c_bus->i2c_adap, 0x61, | 386 | &i2c_bus->i2c_adap, 0x61, |
379 | TUNER_LG_TDVS_H06XF); | 387 | TUNER_LG_TDVS_H06XF); |
380 | } | 388 | } |
381 | break; | 389 | break; |
382 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: | 390 | case CX23885_BOARD_HAUPPAUGE_HVR1500Q: |
383 | i2c_bus = &dev->i2c_bus[1]; | 391 | i2c_bus = &dev->i2c_bus[1]; |
384 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 392 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
385 | &hauppauge_hvr1500q_config, | 393 | &hauppauge_hvr1500q_config, |
386 | &dev->i2c_bus[0].i2c_adap); | 394 | &dev->i2c_bus[0].i2c_adap); |
387 | if (port->dvb.frontend != NULL) | 395 | if (fe0->dvb.frontend != NULL) |
388 | dvb_attach(xc5000_attach, port->dvb.frontend, | 396 | dvb_attach(xc5000_attach, fe0->dvb.frontend, |
389 | &i2c_bus->i2c_adap, | 397 | &i2c_bus->i2c_adap, |
390 | &hauppauge_hvr1500q_tunerconfig, i2c_bus); | 398 | &hauppauge_hvr1500q_tunerconfig); |
391 | break; | 399 | break; |
392 | case CX23885_BOARD_HAUPPAUGE_HVR1500: | 400 | case CX23885_BOARD_HAUPPAUGE_HVR1500: |
393 | i2c_bus = &dev->i2c_bus[1]; | 401 | i2c_bus = &dev->i2c_bus[1]; |
394 | port->dvb.frontend = dvb_attach(s5h1409_attach, | 402 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, |
395 | &hauppauge_hvr1500_config, | 403 | &hauppauge_hvr1500_config, |
396 | &dev->i2c_bus[0].i2c_adap); | 404 | &dev->i2c_bus[0].i2c_adap); |
397 | if (port->dvb.frontend != NULL) { | 405 | if (fe0->dvb.frontend != NULL) { |
398 | struct dvb_frontend *fe; | 406 | struct dvb_frontend *fe; |
399 | struct xc2028_config cfg = { | 407 | struct xc2028_config cfg = { |
400 | .i2c_adap = &i2c_bus->i2c_adap, | 408 | .i2c_adap = &i2c_bus->i2c_adap, |
401 | .i2c_addr = 0x61, | 409 | .i2c_addr = 0x61, |
402 | .callback = cx23885_hvr1500_xc3028_callback, | ||
403 | }; | 410 | }; |
404 | static struct xc2028_ctrl ctl = { | 411 | static struct xc2028_ctrl ctl = { |
405 | .fname = "xc3028-v27.fw", | 412 | .fname = XC2028_DEFAULT_FIRMWARE, |
406 | .max_len = 64, | 413 | .max_len = 64, |
407 | .scode_table = XC3028_FE_OREN538, | 414 | .scode_table = XC3028_FE_OREN538, |
408 | }; | 415 | }; |
409 | 416 | ||
410 | fe = dvb_attach(xc2028_attach, | 417 | fe = dvb_attach(xc2028_attach, |
411 | port->dvb.frontend, &cfg); | 418 | fe0->dvb.frontend, &cfg); |
412 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | 419 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
413 | fe->ops.tuner_ops.set_config(fe, &ctl); | 420 | fe->ops.tuner_ops.set_config(fe, &ctl); |
414 | } | 421 | } |
@@ -416,102 +423,204 @@ static int dvb_register(struct cx23885_tsport *port) | |||
416 | case CX23885_BOARD_HAUPPAUGE_HVR1200: | 423 | case CX23885_BOARD_HAUPPAUGE_HVR1200: |
417 | case CX23885_BOARD_HAUPPAUGE_HVR1700: | 424 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
418 | i2c_bus = &dev->i2c_bus[0]; | 425 | i2c_bus = &dev->i2c_bus[0]; |
419 | port->dvb.frontend = dvb_attach(tda10048_attach, | 426 | fe0->dvb.frontend = dvb_attach(tda10048_attach, |
420 | &hauppauge_hvr1200_config, | 427 | &hauppauge_hvr1200_config, |
421 | &i2c_bus->i2c_adap); | 428 | &i2c_bus->i2c_adap); |
422 | if (port->dvb.frontend != NULL) { | 429 | if (fe0->dvb.frontend != NULL) { |
423 | dvb_attach(tda829x_attach, port->dvb.frontend, | 430 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
424 | &dev->i2c_bus[1].i2c_adap, 0x42, | 431 | &dev->i2c_bus[1].i2c_adap, 0x42, |
425 | &tda829x_no_probe); | 432 | &tda829x_no_probe); |
426 | dvb_attach(tda18271_attach, port->dvb.frontend, | 433 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
427 | 0x60, &dev->i2c_bus[1].i2c_adap, | 434 | 0x60, &dev->i2c_bus[1].i2c_adap, |
428 | &hauppauge_hvr1200_tuner_config); | 435 | &hauppauge_hvr1200_tuner_config); |
429 | } | 436 | } |
430 | break; | 437 | break; |
431 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | 438 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
432 | i2c_bus = &dev->i2c_bus[0]; | 439 | i2c_bus = &dev->i2c_bus[0]; |
433 | port->dvb.frontend = dvb_attach(dib7000p_attach, | 440 | fe0->dvb.frontend = dvb_attach(dib7000p_attach, |
434 | &i2c_bus->i2c_adap, | 441 | &i2c_bus->i2c_adap, |
435 | 0x12, &hauppauge_hvr1400_dib7000_config); | 442 | 0x12, &hauppauge_hvr1400_dib7000_config); |
436 | if (port->dvb.frontend != NULL) { | 443 | if (fe0->dvb.frontend != NULL) { |
437 | struct dvb_frontend *fe; | 444 | struct dvb_frontend *fe; |
438 | struct xc2028_config cfg = { | 445 | struct xc2028_config cfg = { |
439 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, | 446 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, |
440 | .i2c_addr = 0x64, | 447 | .i2c_addr = 0x64, |
441 | .callback = cx23885_hvr1500_xc3028_callback, | ||
442 | }; | 448 | }; |
443 | static struct xc2028_ctrl ctl = { | 449 | static struct xc2028_ctrl ctl = { |
444 | .fname = "xc3028L-v36.fw", | 450 | .fname = XC3028L_DEFAULT_FIRMWARE, |
445 | .max_len = 64, | 451 | .max_len = 64, |
446 | .demod = 5000, | 452 | .demod = 5000, |
447 | .d2633 = 1 | 453 | /* This is true for all demods with |
454 | v36 firmware? */ | ||
455 | .type = XC2028_D2633, | ||
448 | }; | 456 | }; |
449 | 457 | ||
450 | fe = dvb_attach(xc2028_attach, | 458 | fe = dvb_attach(xc2028_attach, |
451 | port->dvb.frontend, &cfg); | 459 | fe0->dvb.frontend, &cfg); |
460 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | ||
461 | fe->ops.tuner_ops.set_config(fe, &ctl); | ||
462 | } | ||
463 | break; | ||
464 | case CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP: | ||
465 | i2c_bus = &dev->i2c_bus[port->nr - 1]; | ||
466 | |||
467 | fe0->dvb.frontend = dvb_attach(s5h1409_attach, | ||
468 | &dvico_s5h1409_config, | ||
469 | &i2c_bus->i2c_adap); | ||
470 | if (fe0->dvb.frontend == NULL) | ||
471 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, | ||
472 | &dvico_s5h1411_config, | ||
473 | &i2c_bus->i2c_adap); | ||
474 | if (fe0->dvb.frontend != NULL) | ||
475 | dvb_attach(xc5000_attach, fe0->dvb.frontend, | ||
476 | &i2c_bus->i2c_adap, | ||
477 | &dvico_xc5000_tunerconfig); | ||
478 | break; | ||
479 | case CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP: { | ||
480 | i2c_bus = &dev->i2c_bus[port->nr - 1]; | ||
481 | |||
482 | fe0->dvb.frontend = dvb_attach(zl10353_attach, | ||
483 | &dvico_fusionhdtv_xc3028, | ||
484 | &i2c_bus->i2c_adap); | ||
485 | if (fe0->dvb.frontend != NULL) { | ||
486 | struct dvb_frontend *fe; | ||
487 | struct xc2028_config cfg = { | ||
488 | .i2c_adap = &i2c_bus->i2c_adap, | ||
489 | .i2c_addr = 0x61, | ||
490 | }; | ||
491 | static struct xc2028_ctrl ctl = { | ||
492 | .fname = XC2028_DEFAULT_FIRMWARE, | ||
493 | .max_len = 64, | ||
494 | .demod = XC3028_FE_ZARLINK456, | ||
495 | }; | ||
496 | |||
497 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, | ||
498 | &cfg); | ||
499 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | ||
500 | fe->ops.tuner_ops.set_config(fe, &ctl); | ||
501 | } | ||
502 | break; | ||
503 | } | ||
504 | case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H: | ||
505 | i2c_bus = &dev->i2c_bus[0]; | ||
506 | |||
507 | fe0->dvb.frontend = dvb_attach(zl10353_attach, | ||
508 | &dvico_fusionhdtv_xc3028, | ||
509 | &i2c_bus->i2c_adap); | ||
510 | if (fe0->dvb.frontend != NULL) { | ||
511 | struct dvb_frontend *fe; | ||
512 | struct xc2028_config cfg = { | ||
513 | .i2c_adap = &dev->i2c_bus[1].i2c_adap, | ||
514 | .i2c_addr = 0x61, | ||
515 | }; | ||
516 | static struct xc2028_ctrl ctl = { | ||
517 | .fname = XC2028_DEFAULT_FIRMWARE, | ||
518 | .max_len = 64, | ||
519 | .demod = XC3028_FE_ZARLINK456, | ||
520 | }; | ||
521 | |||
522 | fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, | ||
523 | &cfg); | ||
452 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | 524 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) |
453 | fe->ops.tuner_ops.set_config(fe, &ctl); | 525 | fe->ops.tuner_ops.set_config(fe, &ctl); |
454 | } | 526 | } |
455 | break; | 527 | break; |
456 | default: | 528 | default: |
457 | printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", | 529 | printk(KERN_INFO "%s: The frontend of your DVB/ATSC card " |
530 | " isn't supported yet\n", | ||
458 | dev->name); | 531 | dev->name); |
459 | break; | 532 | break; |
460 | } | 533 | } |
461 | if (NULL == port->dvb.frontend) { | 534 | if (NULL == fe0->dvb.frontend) { |
462 | printk("%s: frontend initialization failed\n", dev->name); | 535 | printk(KERN_ERR "%s: frontend initialization failed\n", |
536 | dev->name); | ||
463 | return -1; | 537 | return -1; |
464 | } | 538 | } |
539 | /* define general-purpose callback pointer */ | ||
540 | fe0->dvb.frontend->callback = cx23885_tuner_callback; | ||
465 | 541 | ||
466 | /* Put the analog decoder in standby to keep it quiet */ | 542 | /* Put the analog decoder in standby to keep it quiet */ |
467 | cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); | 543 | cx23885_call_i2c_clients(i2c_bus, TUNER_SET_STANDBY, NULL); |
468 | 544 | ||
469 | if (port->dvb.frontend->ops.analog_ops.standby) | 545 | if (fe0->dvb.frontend->ops.analog_ops.standby) |
470 | port->dvb.frontend->ops.analog_ops.standby(port->dvb.frontend); | 546 | fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend); |
471 | 547 | ||
472 | /* register everything */ | 548 | /* register everything */ |
473 | return videobuf_dvb_register(&port->dvb, THIS_MODULE, port, | 549 | return videobuf_dvb_register_bus(&port->frontends, THIS_MODULE, port, |
474 | &dev->pci->dev, adapter_nr); | 550 | &dev->pci->dev, adapter_nr, 0); |
551 | |||
475 | } | 552 | } |
476 | 553 | ||
477 | int cx23885_dvb_register(struct cx23885_tsport *port) | 554 | int cx23885_dvb_register(struct cx23885_tsport *port) |
478 | { | 555 | { |
556 | |||
557 | struct videobuf_dvb_frontend *fe0; | ||
479 | struct cx23885_dev *dev = port->dev; | 558 | struct cx23885_dev *dev = port->dev; |
480 | int err; | 559 | int err, i; |
560 | |||
561 | /* Here we need to allocate the correct number of frontends, | ||
562 | * as reflected in the cards struct. The reality is that currrently | ||
563 | * no cx23885 boards support this - yet. But, if we don't modify this | ||
564 | * code then the second frontend would never be allocated (later) | ||
565 | * and fail with error before the attach in dvb_register(). | ||
566 | * Without these changes we risk an OOPS later. The changes here | ||
567 | * are for safety, and should provide a good foundation for the | ||
568 | * future addition of any multi-frontend cx23885 based boards. | ||
569 | */ | ||
570 | printk(KERN_INFO "%s() allocating %d frontend(s)\n", __func__, | ||
571 | port->num_frontends); | ||
572 | |||
573 | for (i = 1; i <= port->num_frontends; i++) { | ||
574 | if (videobuf_dvb_alloc_frontend( | ||
575 | &port->frontends, i) == NULL) { | ||
576 | printk(KERN_ERR "%s() failed to alloc\n", __func__); | ||
577 | return -ENOMEM; | ||
578 | } | ||
481 | 579 | ||
482 | dprintk(1, "%s\n", __func__); | 580 | fe0 = videobuf_dvb_get_frontend(&port->frontends, i); |
483 | dprintk(1, " ->being probed by Card=%d Name=%s, PCI %02x:%02x\n", | 581 | if (!fe0) |
484 | dev->board, | 582 | err = -EINVAL; |
485 | dev->name, | ||
486 | dev->pci_bus, | ||
487 | dev->pci_slot); | ||
488 | 583 | ||
489 | err = -ENODEV; | 584 | dprintk(1, "%s\n", __func__); |
585 | dprintk(1, " ->probed by Card=%d Name=%s, PCI %02x:%02x\n", | ||
586 | dev->board, | ||
587 | dev->name, | ||
588 | dev->pci_bus, | ||
589 | dev->pci_slot); | ||
490 | 590 | ||
491 | /* dvb stuff */ | 591 | err = -ENODEV; |
492 | printk("%s: cx23885 based dvb card\n", dev->name); | 592 | |
493 | videobuf_queue_sg_init(&port->dvb.dvbq, &dvb_qops, &dev->pci->dev, &port->slock, | 593 | /* dvb stuff */ |
594 | /* We have to init the queue for each frontend on a port. */ | ||
595 | printk(KERN_INFO "%s: cx23885 based dvb card\n", dev->name); | ||
596 | videobuf_queue_sg_init(&fe0->dvb.dvbq, &dvb_qops, | ||
597 | &dev->pci->dev, &port->slock, | ||
494 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, | 598 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_TOP, |
495 | sizeof(struct cx23885_buffer), port); | 599 | sizeof(struct cx23885_buffer), port); |
600 | } | ||
496 | err = dvb_register(port); | 601 | err = dvb_register(port); |
497 | if (err != 0) | 602 | if (err != 0) |
498 | printk("%s() dvb_register failed err = %d\n", __func__, err); | 603 | printk(KERN_ERR "%s() dvb_register failed err = %d\n", |
604 | __func__, err); | ||
499 | 605 | ||
500 | return err; | 606 | return err; |
501 | } | 607 | } |
502 | 608 | ||
503 | int cx23885_dvb_unregister(struct cx23885_tsport *port) | 609 | int cx23885_dvb_unregister(struct cx23885_tsport *port) |
504 | { | 610 | { |
505 | /* dvb */ | 611 | struct videobuf_dvb_frontend *fe0; |
506 | if(port->dvb.frontend) | 612 | |
507 | videobuf_dvb_unregister(&port->dvb); | 613 | /* FIXME: in an error condition where the we have |
614 | * an expected number of frontends (attach problem) | ||
615 | * then this might not clean up correctly, if 1 | ||
616 | * is invalid. | ||
617 | * This comment only applies to future boards IF they | ||
618 | * implement MFE support. | ||
619 | */ | ||
620 | fe0 = videobuf_dvb_get_frontend(&port->frontends, 1); | ||
621 | if (fe0->dvb.frontend) | ||
622 | videobuf_dvb_unregister_bus(&port->frontends); | ||
508 | 623 | ||
509 | return 0; | 624 | return 0; |
510 | } | 625 | } |
511 | 626 | ||
512 | /* | ||
513 | * Local variables: | ||
514 | * c-basic-offset: 8 | ||
515 | * End: | ||
516 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
517 | */ | ||
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index c6bb0a05bc1c..bb7f71a1fcbe 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -131,7 +131,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
131 | printk(" >\n"); | 131 | printk(" >\n"); |
132 | } | 132 | } |
133 | 133 | ||
134 | for (cnt = 1; cnt < msg->len; cnt++ ) { | 134 | for (cnt = 1; cnt < msg->len; cnt++) { |
135 | /* following bytes */ | 135 | /* following bytes */ |
136 | wdata = msg->buf[cnt]; | 136 | wdata = msg->buf[cnt]; |
137 | ctrl = bus->i2c_period | (1 << 12) | (1 << 2); | 137 | ctrl = bus->i2c_period | (1 << 12) | (1 << 2); |
@@ -151,9 +151,9 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
151 | if (retval == 0) | 151 | if (retval == 0) |
152 | goto eio; | 152 | goto eio; |
153 | if (i2c_debug) { | 153 | if (i2c_debug) { |
154 | printk(" %02x", msg->buf[cnt]); | 154 | dprintk(1, " %02x", msg->buf[cnt]); |
155 | if (!(ctrl & I2C_NOSTOP)) | 155 | if (!(ctrl & I2C_NOSTOP)) |
156 | printk(" >\n"); | 156 | dprintk(1, " >\n"); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | return msg->len; | 159 | return msg->len; |
@@ -162,7 +162,7 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
162 | retval = -EIO; | 162 | retval = -EIO; |
163 | err: | 163 | err: |
164 | if (i2c_debug) | 164 | if (i2c_debug) |
165 | printk(" ERR: %d\n", retval); | 165 | printk(KERN_ERR " ERR: %d\n", retval); |
166 | return retval; | 166 | return retval; |
167 | } | 167 | } |
168 | 168 | ||
@@ -194,12 +194,12 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
194 | 194 | ||
195 | if (i2c_debug) { | 195 | if (i2c_debug) { |
196 | if (joined) | 196 | if (joined) |
197 | printk(" R"); | 197 | dprintk(1, " R"); |
198 | else | 198 | else |
199 | printk(" <R %02x", (msg->addr << 1) + 1); | 199 | dprintk(1, " <R %02x", (msg->addr << 1) + 1); |
200 | } | 200 | } |
201 | 201 | ||
202 | for(cnt = 0; cnt < msg->len; cnt++) { | 202 | for (cnt = 0; cnt < msg->len; cnt++) { |
203 | 203 | ||
204 | ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; | 204 | ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; |
205 | 205 | ||
@@ -216,9 +216,9 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
216 | goto eio; | 216 | goto eio; |
217 | msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; | 217 | msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; |
218 | if (i2c_debug) { | 218 | if (i2c_debug) { |
219 | printk(" %02x", msg->buf[cnt]); | 219 | dprintk(1, " %02x", msg->buf[cnt]); |
220 | if (!(ctrl & I2C_NOSTOP)) | 220 | if (!(ctrl & I2C_NOSTOP)) |
221 | printk(" >\n"); | 221 | dprintk(1, " >\n"); |
222 | } | 222 | } |
223 | } | 223 | } |
224 | return msg->len; | 224 | return msg->len; |
@@ -227,7 +227,7 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
227 | retval = -EIO; | 227 | retval = -EIO; |
228 | err: | 228 | err: |
229 | if (i2c_debug) | 229 | if (i2c_debug) |
230 | printk(" ERR: %d\n", retval); | 230 | printk(KERN_ERR " ERR: %d\n", retval); |
231 | return retval; | 231 | return retval; |
232 | } | 232 | } |
233 | 233 | ||
@@ -353,17 +353,17 @@ static struct i2c_client cx23885_i2c_client_template = { | |||
353 | }; | 353 | }; |
354 | 354 | ||
355 | static char *i2c_devs[128] = { | 355 | static char *i2c_devs[128] = { |
356 | [0x10 >> 1] = "tda10048", | 356 | [0x10 >> 1] = "tda10048", |
357 | [0x12 >> 1] = "dib7000pc", | 357 | [0x12 >> 1] = "dib7000pc", |
358 | [ 0x1c >> 1 ] = "lgdt3303", | 358 | [0x1c >> 1] = "lgdt3303", |
359 | [ 0x86 >> 1 ] = "tda9887", | 359 | [0x86 >> 1] = "tda9887", |
360 | [ 0x32 >> 1 ] = "cx24227", | 360 | [0x32 >> 1] = "cx24227", |
361 | [ 0x88 >> 1 ] = "cx25837", | 361 | [0x88 >> 1] = "cx25837", |
362 | [ 0x84 >> 1 ] = "tda8295", | 362 | [0x84 >> 1] = "tda8295", |
363 | [ 0xa0 >> 1 ] = "eeprom", | 363 | [0xa0 >> 1] = "eeprom", |
364 | [ 0xc0 >> 1 ] = "tuner/mt2131/tda8275", | 364 | [0xc0 >> 1] = "tuner/mt2131/tda8275", |
365 | [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028", | 365 | [0xc2 >> 1] = "tuner/mt2131/tda8275/xc5000/xc3028", |
366 | [0xc8 >> 1] = "tuner/xc3028L", | 366 | [0xc8 >> 1] = "tuner/xc3028L", |
367 | }; | 367 | }; |
368 | 368 | ||
369 | static void do_i2c_scan(char *name, struct i2c_client *c) | 369 | static void do_i2c_scan(char *name, struct i2c_client *c) |
@@ -376,7 +376,7 @@ static void do_i2c_scan(char *name, struct i2c_client *c) | |||
376 | rc = i2c_master_recv(c, &buf, 0); | 376 | rc = i2c_master_recv(c, &buf, 0); |
377 | if (rc < 0) | 377 | if (rc < 0) |
378 | continue; | 378 | continue; |
379 | printk("%s: i2c scan: found device @ 0x%x [%s]\n", | 379 | printk(KERN_INFO "%s: i2c scan: found device @ 0x%x [%s]\n", |
380 | name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); | 380 | name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); |
381 | } | 381 | } |
382 | } | 382 | } |
@@ -408,11 +408,12 @@ int cx23885_i2c_register(struct cx23885_i2c *bus) | |||
408 | bus->i2c_client.adapter = &bus->i2c_adap; | 408 | bus->i2c_client.adapter = &bus->i2c_adap; |
409 | 409 | ||
410 | if (0 == bus->i2c_rc) { | 410 | if (0 == bus->i2c_rc) { |
411 | printk("%s: i2c bus %d registered\n", dev->name, bus->nr); | 411 | dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr); |
412 | if (i2c_scan) | 412 | if (i2c_scan) |
413 | do_i2c_scan(dev->name, &bus->i2c_client); | 413 | do_i2c_scan(dev->name, &bus->i2c_client); |
414 | } else | 414 | } else |
415 | printk("%s: i2c bus %d register FAILED\n", dev->name, bus->nr); | 415 | printk(KERN_WARNING "%s: i2c bus %d register FAILED\n", |
416 | dev->name, bus->nr); | ||
416 | 417 | ||
417 | return bus->i2c_rc; | 418 | return bus->i2c_rc; |
418 | } | 419 | } |
diff --git a/drivers/media/video/cx23885/cx23885-reg.h b/drivers/media/video/cx23885/cx23885-reg.h index bdd11bc513ad..20b68a236260 100644 --- a/drivers/media/video/cx23885/cx23885-reg.h +++ b/drivers/media/video/cx23885/cx23885-reg.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
diff --git a/drivers/media/video/cx23885/cx23885-vbi.c b/drivers/media/video/cx23885/cx23885-vbi.c index e36e3fcae2fb..5b297f0323b6 100644 --- a/drivers/media/video/cx23885/cx23885-vbi.c +++ b/drivers/media/video/cx23885/cx23885-vbi.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -85,18 +85,8 @@ static int cx23885_start_vbi_dma(struct cx23885_dev *dev, | |||
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | int cx23885_stop_vbi_dma(struct cx23885_dev *dev) | ||
89 | { | ||
90 | /* stop dma */ | ||
91 | cx_clear(VID_A_DMA_CTL, 0x00000022); | ||
92 | |||
93 | /* disable irqs */ | ||
94 | cx_clear(PCI_INT_MSK, 0x000001); | ||
95 | cx_clear(VID_A_INT_MSK, 0x00000022); | ||
96 | return 0; | ||
97 | } | ||
98 | 88 | ||
99 | int cx23885_restart_vbi_queue(struct cx23885_dev *dev, | 89 | static int cx23885_restart_vbi_queue(struct cx23885_dev *dev, |
100 | struct cx23885_dmaqueue *q) | 90 | struct cx23885_dmaqueue *q) |
101 | { | 91 | { |
102 | struct cx23885_buffer *buf; | 92 | struct cx23885_buffer *buf; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 84652210a28c..c742a10be5cb 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2007 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2007 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include "cx23885.h" | 34 | #include "cx23885.h" |
35 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
36 | #include <media/v4l2-ioctl.h> | ||
36 | 37 | ||
37 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 38 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
38 | /* Include V4L1 specific functions. Should be removed soon */ | 39 | /* Include V4L1 specific functions. Should be removed soon */ |
@@ -40,7 +41,7 @@ | |||
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | MODULE_DESCRIPTION("v4l2 driver module for cx23885 based TV cards"); | 43 | MODULE_DESCRIPTION("v4l2 driver module for cx23885 based TV cards"); |
43 | MODULE_AUTHOR("Steven Toth <stoth@hauppauge.com>"); | 44 | MODULE_AUTHOR("Steven Toth <stoth@linuxtv.org>"); |
44 | MODULE_LICENSE("GPL"); | 45 | MODULE_LICENSE("GPL"); |
45 | 46 | ||
46 | /* ------------------------------------------------------------------ */ | 47 | /* ------------------------------------------------------------------ */ |
@@ -243,7 +244,7 @@ static struct cx23885_ctrl cx23885_ctls[] = { | |||
243 | }; | 244 | }; |
244 | static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls); | 245 | static const int CX23885_CTLS = ARRAY_SIZE(cx23885_ctls); |
245 | 246 | ||
246 | const u32 cx23885_user_ctrls[] = { | 247 | static const u32 cx23885_user_ctrls[] = { |
247 | V4L2_CID_USER_CLASS, | 248 | V4L2_CID_USER_CLASS, |
248 | V4L2_CID_BRIGHTNESS, | 249 | V4L2_CID_BRIGHTNESS, |
249 | V4L2_CID_CONTRAST, | 250 | V4L2_CID_CONTRAST, |
@@ -253,14 +254,13 @@ const u32 cx23885_user_ctrls[] = { | |||
253 | V4L2_CID_AUDIO_MUTE, | 254 | V4L2_CID_AUDIO_MUTE, |
254 | 0 | 255 | 0 |
255 | }; | 256 | }; |
256 | EXPORT_SYMBOL(cx23885_user_ctrls); | ||
257 | 257 | ||
258 | static const u32 *ctrl_classes[] = { | 258 | static const u32 *ctrl_classes[] = { |
259 | cx23885_user_ctrls, | 259 | cx23885_user_ctrls, |
260 | NULL | 260 | NULL |
261 | }; | 261 | }; |
262 | 262 | ||
263 | void cx23885_video_wakeup(struct cx23885_dev *dev, | 263 | static void cx23885_video_wakeup(struct cx23885_dev *dev, |
264 | struct cx23885_dmaqueue *q, u32 count) | 264 | struct cx23885_dmaqueue *q, u32 count) |
265 | { | 265 | { |
266 | struct cx23885_buffer *buf; | 266 | struct cx23885_buffer *buf; |
@@ -285,17 +285,16 @@ void cx23885_video_wakeup(struct cx23885_dev *dev, | |||
285 | list_del(&buf->vb.queue); | 285 | list_del(&buf->vb.queue); |
286 | wake_up(&buf->vb.done); | 286 | wake_up(&buf->vb.done); |
287 | } | 287 | } |
288 | if (list_empty(&q->active)) { | 288 | if (list_empty(&q->active)) |
289 | del_timer(&q->timeout); | 289 | del_timer(&q->timeout); |
290 | } else { | 290 | else |
291 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 291 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); |
292 | } | ||
293 | if (bc != 1) | 292 | if (bc != 1) |
294 | printk(KERN_ERR "%s: %d buffers handled (should be 1)\n", | 293 | printk(KERN_ERR "%s: %d buffers handled (should be 1)\n", |
295 | __func__, bc); | 294 | __func__, bc); |
296 | } | 295 | } |
297 | 296 | ||
298 | int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm) | 297 | static int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm) |
299 | { | 298 | { |
300 | dprintk(1, "%s(norm = 0x%08x) name: [%s]\n", | 299 | dprintk(1, "%s(norm = 0x%08x) name: [%s]\n", |
301 | __func__, | 300 | __func__, |
@@ -313,7 +312,7 @@ int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm) | |||
313 | return 0; | 312 | return 0; |
314 | } | 313 | } |
315 | 314 | ||
316 | struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, | 315 | static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, |
317 | struct pci_dev *pci, | 316 | struct pci_dev *pci, |
318 | struct video_device *template, | 317 | struct video_device *template, |
319 | char *type) | 318 | char *type) |
@@ -326,14 +325,14 @@ struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, | |||
326 | return NULL; | 325 | return NULL; |
327 | *vfd = *template; | 326 | *vfd = *template; |
328 | vfd->minor = -1; | 327 | vfd->minor = -1; |
329 | vfd->dev = &pci->dev; | 328 | vfd->parent = &pci->dev; |
330 | vfd->release = video_device_release; | 329 | vfd->release = video_device_release; |
331 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", | 330 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", |
332 | dev->name, type, cx23885_boards[dev->board].name); | 331 | dev->name, type, cx23885_boards[dev->board].name); |
333 | return vfd; | 332 | return vfd; |
334 | } | 333 | } |
335 | 334 | ||
336 | int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl) | 335 | static int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl) |
337 | { | 336 | { |
338 | int i; | 337 | int i; |
339 | 338 | ||
@@ -350,7 +349,6 @@ int cx23885_ctrl_query(struct v4l2_queryctrl *qctrl) | |||
350 | *qctrl = cx23885_ctls[i].v; | 349 | *qctrl = cx23885_ctls[i].v; |
351 | return 0; | 350 | return 0; |
352 | } | 351 | } |
353 | EXPORT_SYMBOL(cx23885_ctrl_query); | ||
354 | 352 | ||
355 | /* ------------------------------------------------------------------- */ | 353 | /* ------------------------------------------------------------------- */ |
356 | /* resource management */ | 354 | /* resource management */ |
@@ -380,12 +378,12 @@ static int res_get(struct cx23885_dev *dev, struct cx23885_fh *fh, | |||
380 | 378 | ||
381 | static int res_check(struct cx23885_fh *fh, unsigned int bit) | 379 | static int res_check(struct cx23885_fh *fh, unsigned int bit) |
382 | { | 380 | { |
383 | return (fh->resources & bit); | 381 | return fh->resources & bit; |
384 | } | 382 | } |
385 | 383 | ||
386 | static int res_locked(struct cx23885_dev *dev, unsigned int bit) | 384 | static int res_locked(struct cx23885_dev *dev, unsigned int bit) |
387 | { | 385 | { |
388 | return (dev->resources & bit); | 386 | return dev->resources & bit; |
389 | } | 387 | } |
390 | 388 | ||
391 | static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, | 389 | static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, |
@@ -401,7 +399,7 @@ static void res_free(struct cx23885_dev *dev, struct cx23885_fh *fh, | |||
401 | mutex_unlock(&dev->lock); | 399 | mutex_unlock(&dev->lock); |
402 | } | 400 | } |
403 | 401 | ||
404 | int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) | 402 | static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) |
405 | { | 403 | { |
406 | struct v4l2_routing route; | 404 | struct v4l2_routing route; |
407 | memset(&route, 0, sizeof(route)); | 405 | memset(&route, 0, sizeof(route)); |
@@ -421,10 +419,9 @@ int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) | |||
421 | 419 | ||
422 | return 0; | 420 | return 0; |
423 | } | 421 | } |
424 | EXPORT_SYMBOL(cx23885_video_mux); | ||
425 | 422 | ||
426 | /* ------------------------------------------------------------------ */ | 423 | /* ------------------------------------------------------------------ */ |
427 | int cx23885_set_scale(struct cx23885_dev *dev, unsigned int width, | 424 | static int cx23885_set_scale(struct cx23885_dev *dev, unsigned int width, |
428 | unsigned int height, enum v4l2_field field) | 425 | unsigned int height, enum v4l2_field field) |
429 | { | 426 | { |
430 | dprintk(1, "%s()\n", __func__); | 427 | dprintk(1, "%s()\n", __func__); |
@@ -730,6 +727,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
730 | enum v4l2_buf_type type = 0; | 727 | enum v4l2_buf_type type = 0; |
731 | int radio = 0; | 728 | int radio = 0; |
732 | 729 | ||
730 | lock_kernel(); | ||
733 | list_for_each(list, &cx23885_devlist) { | 731 | list_for_each(list, &cx23885_devlist) { |
734 | h = list_entry(list, struct cx23885_dev, devlist); | 732 | h = list_entry(list, struct cx23885_dev, devlist); |
735 | if (h->video_dev->minor == minor) { | 733 | if (h->video_dev->minor == minor) { |
@@ -747,16 +745,20 @@ static int video_open(struct inode *inode, struct file *file) | |||
747 | dev = h; | 745 | dev = h; |
748 | } | 746 | } |
749 | } | 747 | } |
750 | if (NULL == dev) | 748 | if (NULL == dev) { |
749 | unlock_kernel(); | ||
751 | return -ENODEV; | 750 | return -ENODEV; |
751 | } | ||
752 | 752 | ||
753 | dprintk(1, "open minor=%d radio=%d type=%s\n", | 753 | dprintk(1, "open minor=%d radio=%d type=%s\n", |
754 | minor, radio, v4l2_type_names[type]); | 754 | minor, radio, v4l2_type_names[type]); |
755 | 755 | ||
756 | /* allocate + initialize per filehandle data */ | 756 | /* allocate + initialize per filehandle data */ |
757 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 757 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
758 | if (NULL == fh) | 758 | if (NULL == fh) { |
759 | unlock_kernel(); | ||
759 | return -ENOMEM; | 760 | return -ENOMEM; |
761 | } | ||
760 | file->private_data = fh; | 762 | file->private_data = fh; |
761 | fh->dev = dev; | 763 | fh->dev = dev; |
762 | fh->radio = radio; | 764 | fh->radio = radio; |
@@ -774,6 +776,7 @@ static int video_open(struct inode *inode, struct file *file) | |||
774 | 776 | ||
775 | dprintk(1, "post videobuf_queue_init()\n"); | 777 | dprintk(1, "post videobuf_queue_init()\n"); |
776 | 778 | ||
779 | unlock_kernel(); | ||
777 | 780 | ||
778 | return 0; | 781 | return 0; |
779 | } | 782 | } |
@@ -883,21 +886,21 @@ static int video_mmap(struct file *file, struct vm_area_struct *vma) | |||
883 | /* ------------------------------------------------------------------ */ | 886 | /* ------------------------------------------------------------------ */ |
884 | /* VIDEO CTRL IOCTLS */ | 887 | /* VIDEO CTRL IOCTLS */ |
885 | 888 | ||
886 | int cx23885_get_control(struct cx23885_dev *dev, struct v4l2_control *ctl) | 889 | static int cx23885_get_control(struct cx23885_dev *dev, |
890 | struct v4l2_control *ctl) | ||
887 | { | 891 | { |
888 | dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__); | 892 | dprintk(1, "%s() calling cx25840(VIDIOC_G_CTRL)\n", __func__); |
889 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl); | 893 | cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_G_CTRL, ctl); |
890 | return 0; | 894 | return 0; |
891 | } | 895 | } |
892 | EXPORT_SYMBOL(cx23885_get_control); | ||
893 | 896 | ||
894 | int cx23885_set_control(struct cx23885_dev *dev, struct v4l2_control *ctl) | 897 | static int cx23885_set_control(struct cx23885_dev *dev, |
898 | struct v4l2_control *ctl) | ||
895 | { | 899 | { |
896 | dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)" | 900 | dprintk(1, "%s() calling cx25840(VIDIOC_S_CTRL)" |
897 | " (disabled - no action)\n", __func__); | 901 | " (disabled - no action)\n", __func__); |
898 | return 0; | 902 | return 0; |
899 | } | 903 | } |
900 | EXPORT_SYMBOL(cx23885_set_control); | ||
901 | 904 | ||
902 | static void init_controls(struct cx23885_dev *dev) | 905 | static void init_controls(struct cx23885_dev *dev) |
903 | { | 906 | { |
@@ -915,7 +918,7 @@ static void init_controls(struct cx23885_dev *dev) | |||
915 | /* ------------------------------------------------------------------ */ | 918 | /* ------------------------------------------------------------------ */ |
916 | /* VIDEO IOCTLS */ | 919 | /* VIDEO IOCTLS */ |
917 | 920 | ||
918 | static int vidioc_g_fmt_cap(struct file *file, void *priv, | 921 | static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, |
919 | struct v4l2_format *f) | 922 | struct v4l2_format *f) |
920 | { | 923 | { |
921 | struct cx23885_fh *fh = priv; | 924 | struct cx23885_fh *fh = priv; |
@@ -932,7 +935,7 @@ static int vidioc_g_fmt_cap(struct file *file, void *priv, | |||
932 | return 0; | 935 | return 0; |
933 | } | 936 | } |
934 | 937 | ||
935 | static int vidioc_try_fmt_cap(struct file *file, void *priv, | 938 | static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, |
936 | struct v4l2_format *f) | 939 | struct v4l2_format *f) |
937 | { | 940 | { |
938 | struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; | 941 | struct cx23885_dev *dev = ((struct cx23885_fh *)priv)->dev; |
@@ -983,7 +986,7 @@ static int vidioc_try_fmt_cap(struct file *file, void *priv, | |||
983 | return 0; | 986 | return 0; |
984 | } | 987 | } |
985 | 988 | ||
986 | static int vidioc_s_fmt_cap(struct file *file, void *priv, | 989 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
987 | struct v4l2_format *f) | 990 | struct v4l2_format *f) |
988 | { | 991 | { |
989 | struct cx23885_fh *fh = priv; | 992 | struct cx23885_fh *fh = priv; |
@@ -991,7 +994,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, | |||
991 | int err; | 994 | int err; |
992 | 995 | ||
993 | dprintk(2, "%s()\n", __func__); | 996 | dprintk(2, "%s()\n", __func__); |
994 | err = vidioc_try_fmt_cap(file, priv, f); | 997 | err = vidioc_try_fmt_vid_cap(file, priv, f); |
995 | 998 | ||
996 | if (0 != err) | 999 | if (0 != err) |
997 | return err; | 1000 | return err; |
@@ -1025,7 +1028,7 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
1025 | return 0; | 1028 | return 0; |
1026 | } | 1029 | } |
1027 | 1030 | ||
1028 | static int vidioc_enum_fmt_cap(struct file *file, void *priv, | 1031 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
1029 | struct v4l2_fmtdesc *f) | 1032 | struct v4l2_fmtdesc *f) |
1030 | { | 1033 | { |
1031 | if (unlikely(f->index >= ARRAY_SIZE(formats))) | 1034 | if (unlikely(f->index >= ARRAY_SIZE(formats))) |
@@ -1071,29 +1074,29 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1071 | struct v4l2_requestbuffers *p) | 1074 | struct v4l2_requestbuffers *p) |
1072 | { | 1075 | { |
1073 | struct cx23885_fh *fh = priv; | 1076 | struct cx23885_fh *fh = priv; |
1074 | return (videobuf_reqbufs(get_queue(fh), p)); | 1077 | return videobuf_reqbufs(get_queue(fh), p); |
1075 | } | 1078 | } |
1076 | 1079 | ||
1077 | static int vidioc_querybuf(struct file *file, void *priv, | 1080 | static int vidioc_querybuf(struct file *file, void *priv, |
1078 | struct v4l2_buffer *p) | 1081 | struct v4l2_buffer *p) |
1079 | { | 1082 | { |
1080 | struct cx23885_fh *fh = priv; | 1083 | struct cx23885_fh *fh = priv; |
1081 | return (videobuf_querybuf(get_queue(fh), p)); | 1084 | return videobuf_querybuf(get_queue(fh), p); |
1082 | } | 1085 | } |
1083 | 1086 | ||
1084 | static int vidioc_qbuf(struct file *file, void *priv, | 1087 | static int vidioc_qbuf(struct file *file, void *priv, |
1085 | struct v4l2_buffer *p) | 1088 | struct v4l2_buffer *p) |
1086 | { | 1089 | { |
1087 | struct cx23885_fh *fh = priv; | 1090 | struct cx23885_fh *fh = priv; |
1088 | return (videobuf_qbuf(get_queue(fh), p)); | 1091 | return videobuf_qbuf(get_queue(fh), p); |
1089 | } | 1092 | } |
1090 | 1093 | ||
1091 | static int vidioc_dqbuf(struct file *file, void *priv, | 1094 | static int vidioc_dqbuf(struct file *file, void *priv, |
1092 | struct v4l2_buffer *p) | 1095 | struct v4l2_buffer *p) |
1093 | { | 1096 | { |
1094 | struct cx23885_fh *fh = priv; | 1097 | struct cx23885_fh *fh = priv; |
1095 | return (videobuf_dqbuf(get_queue(fh), p, | 1098 | return videobuf_dqbuf(get_queue(fh), p, |
1096 | file->f_flags & O_NONBLOCK)); | 1099 | file->f_flags & O_NONBLOCK); |
1097 | } | 1100 | } |
1098 | 1101 | ||
1099 | static int vidioc_streamon(struct file *file, void *priv, | 1102 | static int vidioc_streamon(struct file *file, void *priv, |
@@ -1145,7 +1148,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *tvnorms) | |||
1145 | return 0; | 1148 | return 0; |
1146 | } | 1149 | } |
1147 | 1150 | ||
1148 | int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) | 1151 | static int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) |
1149 | { | 1152 | { |
1150 | static const char *iname[] = { | 1153 | static const char *iname[] = { |
1151 | [CX23885_VMUX_COMPOSITE1] = "Composite1", | 1154 | [CX23885_VMUX_COMPOSITE1] = "Composite1", |
@@ -1178,7 +1181,6 @@ int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i) | |||
1178 | i->std = CX23885_NORMS; | 1181 | i->std = CX23885_NORMS; |
1179 | return 0; | 1182 | return 0; |
1180 | } | 1183 | } |
1181 | EXPORT_SYMBOL(cx23885_enum_input); | ||
1182 | 1184 | ||
1183 | static int vidioc_enum_input(struct file *file, void *priv, | 1185 | static int vidioc_enum_input(struct file *file, void *priv, |
1184 | struct v4l2_input *i) | 1186 | struct v4l2_input *i) |
@@ -1287,7 +1289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, | |||
1287 | return 0; | 1289 | return 0; |
1288 | } | 1290 | } |
1289 | 1291 | ||
1290 | int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f) | 1292 | static int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f) |
1291 | { | 1293 | { |
1292 | if (unlikely(UNSET == dev->tuner_type)) | 1294 | if (unlikely(UNSET == dev->tuner_type)) |
1293 | return -EINVAL; | 1295 | return -EINVAL; |
@@ -1306,7 +1308,6 @@ int cx23885_set_freq(struct cx23885_dev *dev, struct v4l2_frequency *f) | |||
1306 | 1308 | ||
1307 | return 0; | 1309 | return 0; |
1308 | } | 1310 | } |
1309 | EXPORT_SYMBOL(cx23885_set_freq); | ||
1310 | 1311 | ||
1311 | static int vidioc_s_frequency(struct file *file, void *priv, | 1312 | static int vidioc_s_frequency(struct file *file, void *priv, |
1312 | struct v4l2_frequency *f) | 1313 | struct v4l2_frequency *f) |
@@ -1433,20 +1434,15 @@ static const struct file_operations video_fops = { | |||
1433 | .llseek = no_llseek, | 1434 | .llseek = no_llseek, |
1434 | }; | 1435 | }; |
1435 | 1436 | ||
1436 | static struct video_device cx23885_vbi_template; | 1437 | static const struct v4l2_ioctl_ops video_ioctl_ops = { |
1437 | static struct video_device cx23885_video_template = { | ||
1438 | .name = "cx23885-video", | ||
1439 | .type = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES, | ||
1440 | .fops = &video_fops, | ||
1441 | .minor = -1, | ||
1442 | .vidioc_querycap = vidioc_querycap, | 1438 | .vidioc_querycap = vidioc_querycap, |
1443 | .vidioc_enum_fmt_cap = vidioc_enum_fmt_cap, | 1439 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, |
1444 | .vidioc_g_fmt_cap = vidioc_g_fmt_cap, | 1440 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, |
1445 | .vidioc_try_fmt_cap = vidioc_try_fmt_cap, | 1441 | .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, |
1446 | .vidioc_s_fmt_cap = vidioc_s_fmt_cap, | 1442 | .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, |
1447 | .vidioc_g_fmt_vbi = cx23885_vbi_fmt, | 1443 | .vidioc_g_fmt_vbi_cap = cx23885_vbi_fmt, |
1448 | .vidioc_try_fmt_vbi = cx23885_vbi_fmt, | 1444 | .vidioc_try_fmt_vbi_cap = cx23885_vbi_fmt, |
1449 | .vidioc_s_fmt_vbi = cx23885_vbi_fmt, | 1445 | .vidioc_s_fmt_vbi_cap = cx23885_vbi_fmt, |
1450 | .vidioc_reqbufs = vidioc_reqbufs, | 1446 | .vidioc_reqbufs = vidioc_reqbufs, |
1451 | .vidioc_querybuf = vidioc_querybuf, | 1447 | .vidioc_querybuf = vidioc_querybuf, |
1452 | .vidioc_qbuf = vidioc_qbuf, | 1448 | .vidioc_qbuf = vidioc_qbuf, |
@@ -1471,6 +1467,14 @@ static struct video_device cx23885_video_template = { | |||
1471 | .vidioc_g_register = vidioc_g_register, | 1467 | .vidioc_g_register = vidioc_g_register, |
1472 | .vidioc_s_register = vidioc_s_register, | 1468 | .vidioc_s_register = vidioc_s_register, |
1473 | #endif | 1469 | #endif |
1470 | }; | ||
1471 | |||
1472 | static struct video_device cx23885_vbi_template; | ||
1473 | static struct video_device cx23885_video_template = { | ||
1474 | .name = "cx23885-video", | ||
1475 | .fops = &video_fops, | ||
1476 | .minor = -1, | ||
1477 | .ioctl_ops = &video_ioctl_ops, | ||
1474 | .tvnorms = CX23885_NORMS, | 1478 | .tvnorms = CX23885_NORMS, |
1475 | .current_norm = V4L2_STD_NTSC_M, | 1479 | .current_norm = V4L2_STD_NTSC_M, |
1476 | }; | 1480 | }; |
@@ -1512,7 +1516,6 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1512 | memcpy(&cx23885_vbi_template, &cx23885_video_template, | 1516 | memcpy(&cx23885_vbi_template, &cx23885_video_template, |
1513 | sizeof(cx23885_vbi_template)); | 1517 | sizeof(cx23885_vbi_template)); |
1514 | strcpy(cx23885_vbi_template.name, "cx23885-vbi"); | 1518 | strcpy(cx23885_vbi_template.name, "cx23885-vbi"); |
1515 | cx23885_vbi_template.type = VID_TYPE_TELETEXT|VID_TYPE_TUNER; | ||
1516 | 1519 | ||
1517 | dev->tvnorm = cx23885_video_template.current_norm; | 1520 | dev->tvnorm = cx23885_video_template.current_norm; |
1518 | 1521 | ||
@@ -1540,7 +1543,7 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1540 | goto fail_unreg; | 1543 | goto fail_unreg; |
1541 | } | 1544 | } |
1542 | printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", | 1545 | printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n", |
1543 | dev->name, dev->video_dev->minor & 0x1f); | 1546 | dev->name, dev->video_dev->num); |
1544 | /* initial device configuration */ | 1547 | /* initial device configuration */ |
1545 | mutex_lock(&dev->lock); | 1548 | mutex_lock(&dev->lock); |
1546 | cx23885_set_tvnorm(dev, dev->tvnorm); | 1549 | cx23885_set_tvnorm(dev, dev->tvnorm); |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 32af87f25e7b..1d53f54cd943 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for the Conexant CX23885 PCIe bridge | 2 | * Driver for the Conexant CX23885 PCIe bridge |
3 | * | 3 | * |
4 | * Copyright (c) 2006 Steven Toth <stoth@hauppauge.com> | 4 | * Copyright (c) 2006 Steven Toth <stoth@linuxtv.org> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -37,7 +37,7 @@ | |||
37 | #include <linux/version.h> | 37 | #include <linux/version.h> |
38 | #include <linux/mutex.h> | 38 | #include <linux/mutex.h> |
39 | 39 | ||
40 | #define CX23885_VERSION_CODE KERNEL_VERSION(0,0,1) | 40 | #define CX23885_VERSION_CODE KERNEL_VERSION(0, 0, 1) |
41 | 41 | ||
42 | #define UNSET (-1U) | 42 | #define UNSET (-1U) |
43 | 43 | ||
@@ -63,6 +63,9 @@ | |||
63 | #define CX23885_BOARD_HAUPPAUGE_HVR1200 7 | 63 | #define CX23885_BOARD_HAUPPAUGE_HVR1200 7 |
64 | #define CX23885_BOARD_HAUPPAUGE_HVR1700 8 | 64 | #define CX23885_BOARD_HAUPPAUGE_HVR1700 8 |
65 | #define CX23885_BOARD_HAUPPAUGE_HVR1400 9 | 65 | #define CX23885_BOARD_HAUPPAUGE_HVR1400 9 |
66 | #define CX23885_BOARD_DVICO_FUSIONHDTV_7_DUAL_EXP 10 | ||
67 | #define CX23885_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL_EXP 11 | ||
68 | #define CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H 12 | ||
66 | 69 | ||
67 | /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */ | 70 | /* Currently unsupported by the driver: PAL/H, NTSC/Kr, SECAM B/G/H/LC */ |
68 | #define CX23885_NORMS (\ | 71 | #define CX23885_NORMS (\ |
@@ -222,7 +225,7 @@ struct cx23885_tsport { | |||
222 | int nr; | 225 | int nr; |
223 | int sram_chno; | 226 | int sram_chno; |
224 | 227 | ||
225 | struct videobuf_dvb dvb; | 228 | struct videobuf_dvb_frontends frontends; |
226 | 229 | ||
227 | /* dma queues */ | 230 | /* dma queues */ |
228 | struct cx23885_dmaqueue mpegq; | 231 | struct cx23885_dmaqueue mpegq; |
@@ -259,6 +262,9 @@ struct cx23885_tsport { | |||
259 | u32 src_sel_val; | 262 | u32 src_sel_val; |
260 | u32 vld_misc_val; | 263 | u32 vld_misc_val; |
261 | u32 hw_sop_ctrl_val; | 264 | u32 hw_sop_ctrl_val; |
265 | |||
266 | /* Allow a single tsport to have multiple frontends */ | ||
267 | u32 num_frontends; | ||
262 | }; | 268 | }; |
263 | 269 | ||
264 | struct cx23885_dev { | 270 | struct cx23885_dev { |
@@ -364,14 +370,14 @@ struct sram_channel { | |||
364 | /* ----------------------------------------------------------- */ | 370 | /* ----------------------------------------------------------- */ |
365 | 371 | ||
366 | #define cx_read(reg) readl(dev->lmmio + ((reg)>>2)) | 372 | #define cx_read(reg) readl(dev->lmmio + ((reg)>>2)) |
367 | #define cx_write(reg,value) writel((value), dev->lmmio + ((reg)>>2)) | 373 | #define cx_write(reg, value) writel((value), dev->lmmio + ((reg)>>2)) |
368 | 374 | ||
369 | #define cx_andor(reg,mask,value) \ | 375 | #define cx_andor(reg, mask, value) \ |
370 | writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ | 376 | writel((readl(dev->lmmio+((reg)>>2)) & ~(mask)) |\ |
371 | ((value) & (mask)), dev->lmmio+((reg)>>2)) | 377 | ((value) & (mask)), dev->lmmio+((reg)>>2)) |
372 | 378 | ||
373 | #define cx_set(reg,bit) cx_andor((reg),(bit),(bit)) | 379 | #define cx_set(reg, bit) cx_andor((reg), (bit), (bit)) |
374 | #define cx_clear(reg,bit) cx_andor((reg),(bit),0) | 380 | #define cx_clear(reg, bit) cx_andor((reg), (bit), 0) |
375 | 381 | ||
376 | /* ----------------------------------------------------------- */ | 382 | /* ----------------------------------------------------------- */ |
377 | /* cx23885-core.c */ | 383 | /* cx23885-core.c */ |
@@ -408,7 +414,8 @@ extern const unsigned int cx23885_bcount; | |||
408 | extern struct cx23885_subid cx23885_subids[]; | 414 | extern struct cx23885_subid cx23885_subids[]; |
409 | extern const unsigned int cx23885_idcount; | 415 | extern const unsigned int cx23885_idcount; |
410 | 416 | ||
411 | extern int cx23885_tuner_callback(void *priv, int command, int arg); | 417 | extern int cx23885_tuner_callback(void *priv, int component, |
418 | int command, int arg); | ||
412 | extern void cx23885_card_list(struct cx23885_dev *dev); | 419 | extern void cx23885_card_list(struct cx23885_dev *dev); |
413 | extern int cx23885_ir_init(struct cx23885_dev *dev); | 420 | extern int cx23885_ir_init(struct cx23885_dev *dev); |
414 | extern void cx23885_gpio_setup(struct cx23885_dev *dev); | 421 | extern void cx23885_gpio_setup(struct cx23885_dev *dev); |
@@ -476,11 +483,3 @@ static inline unsigned int norm_swidth(v4l2_std_id norm) | |||
476 | { | 483 | { |
477 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; | 484 | return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922; |
478 | } | 485 | } |
479 | |||
480 | |||
481 | /* | ||
482 | * Local variables: | ||
483 | * c-basic-offset: 8 | ||
484 | * End: | ||
485 | * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off | ||
486 | */ | ||