diff options
-rw-r--r-- | drivers/media/video/davinci/vpif_display.c | 49 |
1 files changed, 13 insertions, 36 deletions
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index a125a452d24b..c015da813dda 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -683,7 +683,7 @@ static int vpif_release(struct file *filep) | |||
683 | static int vpif_querycap(struct file *file, void *priv, | 683 | static int vpif_querycap(struct file *file, void *priv, |
684 | struct v4l2_capability *cap) | 684 | struct v4l2_capability *cap) |
685 | { | 685 | { |
686 | struct vpif_config *config = vpif_dev->platform_data; | 686 | struct vpif_display_config *config = vpif_dev->platform_data; |
687 | 687 | ||
688 | cap->version = VPIF_DISPLAY_VERSION_CODE; | 688 | cap->version = VPIF_DISPLAY_VERSION_CODE; |
689 | cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; | 689 | cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
@@ -1053,7 +1053,7 @@ static int vpif_streamon(struct file *file, void *priv, | |||
1053 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; | 1053 | struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; |
1054 | struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id]; | 1054 | struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id]; |
1055 | struct vpif_params *vpif = &ch->vpifparams; | 1055 | struct vpif_params *vpif = &ch->vpifparams; |
1056 | struct vpif_config *vpif_config_data = | 1056 | struct vpif_display_config *vpif_config_data = |
1057 | vpif_dev->platform_data; | 1057 | vpif_dev->platform_data; |
1058 | unsigned long addr = 0; | 1058 | unsigned long addr = 0; |
1059 | int ret = 0; | 1059 | int ret = 0; |
@@ -1239,7 +1239,7 @@ static int vpif_enum_output(struct file *file, void *fh, | |||
1239 | struct v4l2_output *output) | 1239 | struct v4l2_output *output) |
1240 | { | 1240 | { |
1241 | 1241 | ||
1242 | struct vpif_config *config = vpif_dev->platform_data; | 1242 | struct vpif_display_config *config = vpif_dev->platform_data; |
1243 | 1243 | ||
1244 | if (output->index >= config->output_count) { | 1244 | if (output->index >= config->output_count) { |
1245 | vpif_dbg(1, debug, "Invalid output index\n"); | 1245 | vpif_dbg(1, debug, "Invalid output index\n"); |
@@ -1422,7 +1422,8 @@ vpif_init_free_channel_objects: | |||
1422 | */ | 1422 | */ |
1423 | static __init int vpif_probe(struct platform_device *pdev) | 1423 | static __init int vpif_probe(struct platform_device *pdev) |
1424 | { | 1424 | { |
1425 | const struct vpif_subdev_info *subdevdata; | 1425 | struct vpif_subdev_info *subdevdata; |
1426 | struct vpif_display_config *config; | ||
1426 | int i, j = 0, k, q, m, err = 0; | 1427 | int i, j = 0, k, q, m, err = 0; |
1427 | struct i2c_adapter *i2c_adap; | 1428 | struct i2c_adapter *i2c_adap; |
1428 | struct vpif_config *config; | 1429 | struct vpif_config *config; |
@@ -1433,30 +1434,14 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1433 | int subdev_count; | 1434 | int subdev_count; |
1434 | 1435 | ||
1435 | vpif_dev = &pdev->dev; | 1436 | vpif_dev = &pdev->dev; |
1436 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1437 | if (!res) { | ||
1438 | v4l2_err(vpif_dev->driver, | ||
1439 | "Error getting platform resource\n"); | ||
1440 | return -ENOENT; | ||
1441 | } | ||
1442 | 1437 | ||
1443 | if (!request_mem_region(res->start, res->end - res->start + 1, | 1438 | err = initialize_vpif(); |
1444 | vpif_dev->driver->name)) { | ||
1445 | v4l2_err(vpif_dev->driver, "VPIF: failed request_mem_region\n"); | ||
1446 | return -ENXIO; | ||
1447 | } | ||
1448 | 1439 | ||
1449 | vpif_base = ioremap_nocache(res->start, res->end - res->start + 1); | 1440 | if (err) { |
1450 | if (!vpif_base) { | 1441 | v4l2_err(vpif_dev->driver, "Error initializing vpif\n"); |
1451 | v4l2_err(vpif_dev->driver, "Unable to ioremap VPIF reg\n"); | 1442 | return err; |
1452 | err = -ENXIO; | ||
1453 | goto resource_exit; | ||
1454 | } | 1443 | } |
1455 | 1444 | ||
1456 | vpif_base_addr_init(vpif_base); | ||
1457 | |||
1458 | initialize_vpif(); | ||
1459 | |||
1460 | err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev); | 1445 | err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev); |
1461 | if (err) { | 1446 | if (err) { |
1462 | v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n"); | 1447 | v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n"); |
@@ -1489,7 +1474,7 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1489 | video_device_release(ch->video_dev); | 1474 | video_device_release(ch->video_dev); |
1490 | } | 1475 | } |
1491 | err = -ENOMEM; | 1476 | err = -ENOMEM; |
1492 | goto video_dev_alloc_exit; | 1477 | goto vpif_int_err; |
1493 | } | 1478 | } |
1494 | 1479 | ||
1495 | /* Initialize field of video device */ | 1480 | /* Initialize field of video device */ |
@@ -1566,10 +1551,10 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1566 | } | 1551 | } |
1567 | 1552 | ||
1568 | for (i = 0; i < subdev_count; i++) { | 1553 | for (i = 0; i < subdev_count; i++) { |
1569 | vpif_obj.sd[i] = v4l2_i2c_new_subdev(&vpif_obj.v4l2_dev, | 1554 | vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, |
1570 | i2c_adap, subdevdata[i].name, | 1555 | i2c_adap, subdevdata[i].name, |
1571 | subdevdata[i].name, | 1556 | &subdevdata[i].board_info, |
1572 | 0, I2C_ADDRS(subdevdata[i].addr)); | 1557 | NULL); |
1573 | if (!vpif_obj.sd[i]) { | 1558 | if (!vpif_obj.sd[i]) { |
1574 | vpif_err("Error registering v4l2 subdevice\n"); | 1559 | vpif_err("Error registering v4l2 subdevice\n"); |
1575 | goto probe_subdev_out; | 1560 | goto probe_subdev_out; |
@@ -1599,11 +1584,6 @@ vpif_int_err: | |||
1599 | res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); | 1584 | res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); |
1600 | m = res->end; | 1585 | m = res->end; |
1601 | } | 1586 | } |
1602 | video_dev_alloc_exit: | ||
1603 | iounmap(vpif_base); | ||
1604 | resource_exit: | ||
1605 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1606 | release_mem_region(res->start, res->end - res->start + 1); | ||
1607 | 1587 | ||
1608 | return err; | 1588 | return err; |
1609 | } | 1589 | } |
@@ -1666,9 +1646,6 @@ static void vpif_cleanup(void) | |||
1666 | i++; | 1646 | i++; |
1667 | } | 1647 | } |
1668 | 1648 | ||
1669 | iounmap(vpif_base); | ||
1670 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1671 | release_mem_region(res->start, res->end - res->start + 1); | ||
1672 | platform_driver_unregister(&vpif_driver); | 1649 | platform_driver_unregister(&vpif_driver); |
1673 | kfree(vpif_obj.sd); | 1650 | kfree(vpif_obj.sd); |
1674 | for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) | 1651 | for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) |