Commit 317b2e2f authored by Muralidharan Karicheri's avatar Muralidharan Karicheri Committed by Mauro Carvalho Chehab

V4L/DVB (12906a): V4L : vpif display updates to support vpif capture

The structure name for vpif display driver changed since it was not unique. So this
update is done to reflect the same. Also removed the code related to register
address space iomap. Uses v4l2_i2c_new_subdev_board() instead of
v4l2_i2c_new_probed_subdev() so that platform data can be added for subdevice
configuration for polarities.

This has incorporated comments against version v0 of the patch series.

Resending the original patch for merge to V4L linux-next
Reviewed-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMuralidharan Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6b5270d2
...@@ -683,7 +683,7 @@ static int vpif_release(struct file *filep) ...@@ -683,7 +683,7 @@ static int vpif_release(struct file *filep)
static int vpif_querycap(struct file *file, void *priv, static int vpif_querycap(struct file *file, void *priv,
struct v4l2_capability *cap) struct v4l2_capability *cap)
{ {
struct vpif_config *config = vpif_dev->platform_data; struct vpif_display_config *config = vpif_dev->platform_data;
cap->version = VPIF_DISPLAY_VERSION_CODE; cap->version = VPIF_DISPLAY_VERSION_CODE;
cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; cap->capabilities = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
...@@ -1053,7 +1053,7 @@ static int vpif_streamon(struct file *file, void *priv, ...@@ -1053,7 +1053,7 @@ static int vpif_streamon(struct file *file, void *priv,
struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX]; struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id]; struct channel_obj *oth_ch = vpif_obj.dev[!ch->channel_id];
struct vpif_params *vpif = &ch->vpifparams; struct vpif_params *vpif = &ch->vpifparams;
struct vpif_config *vpif_config_data = struct vpif_display_config *vpif_config_data =
vpif_dev->platform_data; vpif_dev->platform_data;
unsigned long addr = 0; unsigned long addr = 0;
int ret = 0; int ret = 0;
...@@ -1239,7 +1239,7 @@ static int vpif_enum_output(struct file *file, void *fh, ...@@ -1239,7 +1239,7 @@ static int vpif_enum_output(struct file *file, void *fh,
struct v4l2_output *output) struct v4l2_output *output)
{ {
struct vpif_config *config = vpif_dev->platform_data; struct vpif_display_config *config = vpif_dev->platform_data;
if (output->index >= config->output_count) { if (output->index >= config->output_count) {
vpif_dbg(1, debug, "Invalid output index\n"); vpif_dbg(1, debug, "Invalid output index\n");
...@@ -1422,7 +1422,8 @@ static int initialize_vpif(void) ...@@ -1422,7 +1422,8 @@ static int initialize_vpif(void)
*/ */
static __init int vpif_probe(struct platform_device *pdev) static __init int vpif_probe(struct platform_device *pdev)
{ {
const struct vpif_subdev_info *subdevdata; struct vpif_subdev_info *subdevdata;
struct vpif_display_config *config;
int i, j = 0, k, q, m, err = 0; int i, j = 0, k, q, m, err = 0;
struct i2c_adapter *i2c_adap; struct i2c_adapter *i2c_adap;
struct vpif_config *config; struct vpif_config *config;
...@@ -1433,30 +1434,14 @@ static __init int vpif_probe(struct platform_device *pdev) ...@@ -1433,30 +1434,14 @@ static __init int vpif_probe(struct platform_device *pdev)
int subdev_count; int subdev_count;
vpif_dev = &pdev->dev; vpif_dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
v4l2_err(vpif_dev->driver,
"Error getting platform resource\n");
return -ENOENT;
}
if (!request_mem_region(res->start, res->end - res->start + 1, err = initialize_vpif();
vpif_dev->driver->name)) {
v4l2_err(vpif_dev->driver, "VPIF: failed request_mem_region\n");
return -ENXIO;
}
vpif_base = ioremap_nocache(res->start, res->end - res->start + 1); if (err) {
if (!vpif_base) { v4l2_err(vpif_dev->driver, "Error initializing vpif\n");
v4l2_err(vpif_dev->driver, "Unable to ioremap VPIF reg\n"); return err;
err = -ENXIO;
goto resource_exit;
} }
vpif_base_addr_init(vpif_base);
initialize_vpif();
err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev); err = v4l2_device_register(vpif_dev, &vpif_obj.v4l2_dev);
if (err) { if (err) {
v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n"); v4l2_err(vpif_dev->driver, "Error registering v4l2 device\n");
...@@ -1489,7 +1474,7 @@ static __init int vpif_probe(struct platform_device *pdev) ...@@ -1489,7 +1474,7 @@ static __init int vpif_probe(struct platform_device *pdev)
video_device_release(ch->video_dev); video_device_release(ch->video_dev);
} }
err = -ENOMEM; err = -ENOMEM;
goto video_dev_alloc_exit; goto vpif_int_err;
} }
/* Initialize field of video device */ /* Initialize field of video device */
...@@ -1566,10 +1551,10 @@ static __init int vpif_probe(struct platform_device *pdev) ...@@ -1566,10 +1551,10 @@ static __init int vpif_probe(struct platform_device *pdev)
} }
for (i = 0; i < subdev_count; i++) { for (i = 0; i < subdev_count; i++) {
vpif_obj.sd[i] = v4l2_i2c_new_subdev(&vpif_obj.v4l2_dev, vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev,
i2c_adap, subdevdata[i].name, i2c_adap, subdevdata[i].name,
subdevdata[i].name, &subdevdata[i].board_info,
0, I2C_ADDRS(subdevdata[i].addr)); NULL);
if (!vpif_obj.sd[i]) { if (!vpif_obj.sd[i]) {
vpif_err("Error registering v4l2 subdevice\n"); vpif_err("Error registering v4l2 subdevice\n");
goto probe_subdev_out; goto probe_subdev_out;
...@@ -1599,11 +1584,6 @@ static __init int vpif_probe(struct platform_device *pdev) ...@@ -1599,11 +1584,6 @@ static __init int vpif_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1); res = platform_get_resource(pdev, IORESOURCE_IRQ, k-1);
m = res->end; m = res->end;
} }
video_dev_alloc_exit:
iounmap(vpif_base);
resource_exit:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, res->end - res->start + 1);
return err; return err;
} }
...@@ -1666,9 +1646,6 @@ static void vpif_cleanup(void) ...@@ -1666,9 +1646,6 @@ static void vpif_cleanup(void)
i++; i++;
} }
iounmap(vpif_base);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, res->end - res->start + 1);
platform_driver_unregister(&vpif_driver); platform_driver_unregister(&vpif_driver);
kfree(vpif_obj.sd); kfree(vpif_obj.sd);
for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment