diff options
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-cards.c')
-rw-r--r-- | drivers/media/usb/cx231xx/cx231xx-cards.c | 81 |
1 files changed, 33 insertions, 48 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 375fd85447f8..d59f483102d2 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c | |||
@@ -856,8 +856,7 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) | |||
856 | 856 | ||
857 | if (dev->tuner_type == TUNER_XC5000) { | 857 | if (dev->tuner_type == TUNER_XC5000) { |
858 | if (command == XC5000_TUNER_RESET) { | 858 | if (command == XC5000_TUNER_RESET) { |
859 | pr_info | 859 | pr_debug("Tuner CB: RESET: cmd %d : tuner type %d \n", |
860 | ("Tuner CB: RESET: cmd %d : tuner type %d \n", | ||
861 | command, dev->tuner_type); | 860 | command, dev->tuner_type); |
862 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, | 861 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, |
863 | 1); | 862 | 1); |
@@ -917,7 +916,7 @@ void cx231xx_pre_card_setup(struct cx231xx *dev) | |||
917 | cx231xx_set_model(dev); | 916 | cx231xx_set_model(dev); |
918 | 917 | ||
919 | pr_info("Identified as %s (card=%d)\n", | 918 | pr_info("Identified as %s (card=%d)\n", |
920 | dev->board.name, dev->model); | 919 | dev->board.name, dev->model); |
921 | 920 | ||
922 | /* set the direction for GPIO pins */ | 921 | /* set the direction for GPIO pins */ |
923 | if (dev->board.tuner_gpio) { | 922 | if (dev->board.tuner_gpio) { |
@@ -1008,7 +1007,7 @@ static int read_eeprom(struct cx231xx *dev, struct i2c_client *client, | |||
1008 | } | 1007 | } |
1009 | 1008 | ||
1010 | for (i = 0; i + 15 < len; i += 16) | 1009 | for (i = 0; i + 15 < len; i += 16) |
1011 | pr_info("i2c eeprom %02x: %*ph\n", i, 16, &eedata[i]); | 1010 | pr_debug("i2c eeprom %02x: %*ph\n", i, 16, &eedata[i]); |
1012 | 1011 | ||
1013 | return 0; | 1012 | return 0; |
1014 | } | 1013 | } |
@@ -1028,7 +1027,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
1028 | cx231xx_get_i2c_adap(dev, I2C_0), | 1027 | cx231xx_get_i2c_adap(dev, I2C_0), |
1029 | "cx25840", 0x88 >> 1, NULL); | 1028 | "cx25840", 0x88 >> 1, NULL); |
1030 | if (dev->sd_cx25840 == NULL) | 1029 | if (dev->sd_cx25840 == NULL) |
1031 | pr_info("cx25840 subdev registration failure\n"); | 1030 | pr_err("cx25840 subdev registration failure\n"); |
1032 | cx25840_call(dev, core, load_fw); | 1031 | cx25840_call(dev, core, load_fw); |
1033 | 1032 | ||
1034 | } | 1033 | } |
@@ -1042,7 +1041,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
1042 | "tuner", | 1041 | "tuner", |
1043 | dev->tuner_addr, NULL); | 1042 | dev->tuner_addr, NULL); |
1044 | if (dev->sd_tuner == NULL) | 1043 | if (dev->sd_tuner == NULL) |
1045 | pr_info("tuner subdev registration failure\n"); | 1044 | pr_err("tuner subdev registration failure\n"); |
1046 | else | 1045 | else |
1047 | cx231xx_config_tuner(dev); | 1046 | cx231xx_config_tuner(dev); |
1048 | } | 1047 | } |
@@ -1290,21 +1289,19 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, | |||
1290 | dev->video_mode.end_point_addr = uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress; | 1289 | dev->video_mode.end_point_addr = uif->altsetting[0].endpoint[isoc_pipe].desc.bEndpointAddress; |
1291 | dev->video_mode.num_alt = uif->num_altsetting; | 1290 | dev->video_mode.num_alt = uif->num_altsetting; |
1292 | 1291 | ||
1293 | pr_info("EndPoint Addr 0x%x, Alternate settings: %i\n", | 1292 | pr_info("video EndPoint Addr 0x%x, Alternate settings: %i\n", |
1294 | dev->video_mode.end_point_addr, | 1293 | dev->video_mode.end_point_addr, |
1295 | dev->video_mode.num_alt); | 1294 | dev->video_mode.num_alt); |
1296 | 1295 | ||
1297 | dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL); | 1296 | dev->video_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->video_mode.num_alt, GFP_KERNEL); |
1298 | if (dev->video_mode.alt_max_pkt_size == NULL) { | 1297 | if (dev->video_mode.alt_max_pkt_size == NULL) |
1299 | pr_err("out of memory!\n"); | ||
1300 | return -ENOMEM; | 1298 | return -ENOMEM; |
1301 | } | ||
1302 | 1299 | ||
1303 | for (i = 0; i < dev->video_mode.num_alt; i++) { | 1300 | for (i = 0; i < dev->video_mode.num_alt; i++) { |
1304 | u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize); | 1301 | u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.wMaxPacketSize); |
1305 | dev->video_mode.alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 1302 | dev->video_mode.alt_max_pkt_size[i] = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); |
1306 | pr_info("Alternate setting %i, max size= %i\n", i, | 1303 | pr_debug("Alternate setting %i, max size= %i\n", i, |
1307 | dev->video_mode.alt_max_pkt_size[i]); | 1304 | dev->video_mode.alt_max_pkt_size[i]); |
1308 | } | 1305 | } |
1309 | 1306 | ||
1310 | /* VBI Init */ | 1307 | /* VBI Init */ |
@@ -1321,16 +1318,14 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, | |||
1321 | bEndpointAddress; | 1318 | bEndpointAddress; |
1322 | 1319 | ||
1323 | dev->vbi_mode.num_alt = uif->num_altsetting; | 1320 | dev->vbi_mode.num_alt = uif->num_altsetting; |
1324 | pr_info("EndPoint Addr 0x%x, Alternate settings: %i\n", | 1321 | pr_info("VBI EndPoint Addr 0x%x, Alternate settings: %i\n", |
1325 | dev->vbi_mode.end_point_addr, | 1322 | dev->vbi_mode.end_point_addr, |
1326 | dev->vbi_mode.num_alt); | 1323 | dev->vbi_mode.num_alt); |
1327 | 1324 | ||
1328 | /* compute alternate max packet sizes for vbi */ | 1325 | /* compute alternate max packet sizes for vbi */ |
1329 | dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL); | 1326 | dev->vbi_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->vbi_mode.num_alt, GFP_KERNEL); |
1330 | if (dev->vbi_mode.alt_max_pkt_size == NULL) { | 1327 | if (dev->vbi_mode.alt_max_pkt_size == NULL) |
1331 | pr_err("out of memory!\n"); | ||
1332 | return -ENOMEM; | 1328 | return -ENOMEM; |
1333 | } | ||
1334 | 1329 | ||
1335 | for (i = 0; i < dev->vbi_mode.num_alt; i++) { | 1330 | for (i = 0; i < dev->vbi_mode.num_alt; i++) { |
1336 | u16 tmp = | 1331 | u16 tmp = |
@@ -1338,8 +1333,8 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, | |||
1338 | desc.wMaxPacketSize); | 1333 | desc.wMaxPacketSize); |
1339 | dev->vbi_mode.alt_max_pkt_size[i] = | 1334 | dev->vbi_mode.alt_max_pkt_size[i] = |
1340 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 1335 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); |
1341 | pr_info("Alternate setting %i, max size= %i\n", i, | 1336 | pr_debug("Alternate setting %i, max size= %i\n", i, |
1342 | dev->vbi_mode.alt_max_pkt_size[i]); | 1337 | dev->vbi_mode.alt_max_pkt_size[i]); |
1343 | } | 1338 | } |
1344 | 1339 | ||
1345 | /* Sliced CC VBI init */ | 1340 | /* Sliced CC VBI init */ |
@@ -1357,23 +1352,20 @@ static int cx231xx_init_v4l2(struct cx231xx *dev, | |||
1357 | bEndpointAddress; | 1352 | bEndpointAddress; |
1358 | 1353 | ||
1359 | dev->sliced_cc_mode.num_alt = uif->num_altsetting; | 1354 | dev->sliced_cc_mode.num_alt = uif->num_altsetting; |
1360 | pr_info("EndPoint Addr 0x%x, Alternate settings: %i\n", | 1355 | pr_info("sliced CC EndPoint Addr 0x%x, Alternate settings: %i\n", |
1361 | dev->sliced_cc_mode.end_point_addr, | 1356 | dev->sliced_cc_mode.end_point_addr, |
1362 | dev->sliced_cc_mode.num_alt); | 1357 | dev->sliced_cc_mode.num_alt); |
1363 | dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL); | 1358 | dev->sliced_cc_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->sliced_cc_mode.num_alt, GFP_KERNEL); |
1364 | 1359 | if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) | |
1365 | if (dev->sliced_cc_mode.alt_max_pkt_size == NULL) { | ||
1366 | pr_err("out of memory!\n"); | ||
1367 | return -ENOMEM; | 1360 | return -ENOMEM; |
1368 | } | ||
1369 | 1361 | ||
1370 | for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) { | 1362 | for (i = 0; i < dev->sliced_cc_mode.num_alt; i++) { |
1371 | u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe]. | 1363 | u16 tmp = le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe]. |
1372 | desc.wMaxPacketSize); | 1364 | desc.wMaxPacketSize); |
1373 | dev->sliced_cc_mode.alt_max_pkt_size[i] = | 1365 | dev->sliced_cc_mode.alt_max_pkt_size[i] = |
1374 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 1366 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); |
1375 | pr_info("Alternate setting %i, max size= %i\n", i, | 1367 | pr_debug("Alternate setting %i, max size= %i\n", i, |
1376 | dev->sliced_cc_mode.alt_max_pkt_size[i]); | 1368 | dev->sliced_cc_mode.alt_max_pkt_size[i]); |
1377 | } | 1369 | } |
1378 | 1370 | ||
1379 | return 0; | 1371 | return 0; |
@@ -1410,8 +1402,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1410 | nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); | 1402 | nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); |
1411 | if (nr >= CX231XX_MAXBOARDS) { | 1403 | if (nr >= CX231XX_MAXBOARDS) { |
1412 | /* No free device slots */ | 1404 | /* No free device slots */ |
1413 | pr_err(DRIVER_NAME ": Supports only %i devices.\n", | 1405 | pr_err("Supports only %i devices.\n", CX231XX_MAXBOARDS); |
1414 | CX231XX_MAXBOARDS); | ||
1415 | return -ENOMEM; | 1406 | return -ENOMEM; |
1416 | } | 1407 | } |
1417 | } while (test_and_set_bit(nr, &cx231xx_devused)); | 1408 | } while (test_and_set_bit(nr, &cx231xx_devused)); |
@@ -1421,7 +1412,6 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1421 | /* allocate memory for our device state and initialize it */ | 1412 | /* allocate memory for our device state and initialize it */ |
1422 | dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL); | 1413 | dev = devm_kzalloc(&udev->dev, sizeof(*dev), GFP_KERNEL); |
1423 | if (dev == NULL) { | 1414 | if (dev == NULL) { |
1424 | pr_err(DRIVER_NAME ": out of memory!\n"); | ||
1425 | clear_bit(nr, &cx231xx_devused); | 1415 | clear_bit(nr, &cx231xx_devused); |
1426 | return -ENOMEM; | 1416 | return -ENOMEM; |
1427 | } | 1417 | } |
@@ -1468,14 +1458,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1468 | speed = "unknown"; | 1458 | speed = "unknown"; |
1469 | } | 1459 | } |
1470 | 1460 | ||
1471 | pr_info("New device %s %s @ %s Mbps " | 1461 | pr_info("New device %s %s @ %s Mbps (%04x:%04x) with %d interfaces\n", |
1472 | "(%04x:%04x) with %d interfaces\n", | 1462 | udev->manufacturer ? udev->manufacturer : "", |
1473 | udev->manufacturer ? udev->manufacturer : "", | 1463 | udev->product ? udev->product : "", |
1474 | udev->product ? udev->product : "", | 1464 | speed, |
1475 | speed, | 1465 | le16_to_cpu(udev->descriptor.idVendor), |
1476 | le16_to_cpu(udev->descriptor.idVendor), | 1466 | le16_to_cpu(udev->descriptor.idProduct), |
1477 | le16_to_cpu(udev->descriptor.idProduct), | 1467 | dev->max_iad_interface_count); |
1478 | dev->max_iad_interface_count); | ||
1479 | 1468 | ||
1480 | /* increment interface count */ | 1469 | /* increment interface count */ |
1481 | dev->interface_count++; | 1470 | dev->interface_count++; |
@@ -1485,13 +1474,12 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1485 | 1474 | ||
1486 | assoc_desc = udev->actconfig->intf_assoc[0]; | 1475 | assoc_desc = udev->actconfig->intf_assoc[0]; |
1487 | if (assoc_desc->bFirstInterface != ifnum) { | 1476 | if (assoc_desc->bFirstInterface != ifnum) { |
1488 | pr_err(DRIVER_NAME ": Not found " | 1477 | pr_err("Not found matching IAD interface\n"); |
1489 | "matching IAD interface\n"); | ||
1490 | retval = -ENODEV; | 1478 | retval = -ENODEV; |
1491 | goto err_if; | 1479 | goto err_if; |
1492 | } | 1480 | } |
1493 | 1481 | ||
1494 | pr_info("registering interface %d\n", ifnum); | 1482 | pr_debug("registering interface %d\n", ifnum); |
1495 | 1483 | ||
1496 | /* save our data pointer in this interface device */ | 1484 | /* save our data pointer in this interface device */ |
1497 | usb_set_intfdata(interface, dev); | 1485 | usb_set_intfdata(interface, dev); |
@@ -1527,13 +1515,12 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1527 | desc.bEndpointAddress; | 1515 | desc.bEndpointAddress; |
1528 | 1516 | ||
1529 | dev->ts1_mode.num_alt = uif->num_altsetting; | 1517 | dev->ts1_mode.num_alt = uif->num_altsetting; |
1530 | pr_info("EndPoint Addr 0x%x, Alternate settings: %i\n", | 1518 | pr_info("TS EndPoint Addr 0x%x, Alternate settings: %i\n", |
1531 | dev->ts1_mode.end_point_addr, | 1519 | dev->ts1_mode.end_point_addr, |
1532 | dev->ts1_mode.num_alt); | 1520 | dev->ts1_mode.num_alt); |
1533 | 1521 | ||
1534 | dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL); | 1522 | dev->ts1_mode.alt_max_pkt_size = devm_kmalloc_array(&udev->dev, 32, dev->ts1_mode.num_alt, GFP_KERNEL); |
1535 | if (dev->ts1_mode.alt_max_pkt_size == NULL) { | 1523 | if (dev->ts1_mode.alt_max_pkt_size == NULL) { |
1536 | pr_err("out of memory!\n"); | ||
1537 | retval = -ENOMEM; | 1524 | retval = -ENOMEM; |
1538 | goto err_video_alt; | 1525 | goto err_video_alt; |
1539 | } | 1526 | } |
@@ -1544,7 +1531,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
1544 | wMaxPacketSize); | 1531 | wMaxPacketSize); |
1545 | dev->ts1_mode.alt_max_pkt_size[i] = | 1532 | dev->ts1_mode.alt_max_pkt_size[i] = |
1546 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 1533 | (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); |
1547 | pr_info("Alternate setting %i, max size= %i\n", i, | 1534 | pr_debug("Alternate setting %i, max size= %i\n", i, |
1548 | dev->ts1_mode.alt_max_pkt_size[i]); | 1535 | dev->ts1_mode.alt_max_pkt_size[i]); |
1549 | } | 1536 | } |
1550 | } | 1537 | } |
@@ -1609,10 +1596,8 @@ static void cx231xx_usb_disconnect(struct usb_interface *interface) | |||
1609 | wake_up_interruptible_all(&dev->open); | 1596 | wake_up_interruptible_all(&dev->open); |
1610 | 1597 | ||
1611 | if (dev->users) { | 1598 | if (dev->users) { |
1612 | pr_warn | 1599 | pr_warn("device %s is open! Deregistration and memory deallocation are deferred on close.\n", |
1613 | ("device %s is open! Deregistration and memory " | 1600 | video_device_node_name(dev->vdev)); |
1614 | "deallocation are deferred on close.\n", | ||
1615 | video_device_node_name(dev->vdev)); | ||
1616 | 1601 | ||
1617 | /* Even having users, it is safe to remove the RC i2c driver */ | 1602 | /* Even having users, it is safe to remove the RC i2c driver */ |
1618 | cx231xx_ir_exit(dev); | 1603 | cx231xx_ir_exit(dev); |