aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/vino.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-02-18 16:53:47 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:10 -0400
commit289596382e6aca005ca53ef20bbc44b9886cb0e0 (patch)
tree019cb12b023170eb2165ad47c80f484388c0feb5 /drivers/media/video/vino.c
parent8340ff43c49fe8e0cd049b65fbd2156bd651697e (diff)
V4L/DVB (10864): vino: introduce v4l2_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/vino.c')
-rw-r--r--drivers/media/video/vino.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index 0a5cd567bfb..308fa419ae0 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -36,7 +36,7 @@
36#include <linux/i2c-algo-sgi.h> 36#include <linux/i2c-algo-sgi.h>
37 37
38#include <linux/videodev2.h> 38#include <linux/videodev2.h>
39#include <media/v4l2-common.h> 39#include <media/v4l2-device.h>
40#include <media/v4l2-ioctl.h> 40#include <media/v4l2-ioctl.h>
41#include <linux/mutex.h> 41#include <linux/mutex.h>
42 42
@@ -295,6 +295,7 @@ struct vino_client {
295}; 295};
296 296
297struct vino_settings { 297struct vino_settings {
298 struct v4l2_device v4l2_dev;
298 struct vino_channel_settings a; 299 struct vino_channel_settings a;
299 struct vino_channel_settings b; 300 struct vino_channel_settings b;
300 301
@@ -3995,7 +3996,6 @@ over:
3995 ret = POLLIN | POLLRDNORM; 3996 ret = POLLIN | POLLRDNORM;
3996 3997
3997error: 3998error:
3998
3999 return ret; 3999 return ret;
4000} 4000}
4001 4001
@@ -4052,7 +4052,7 @@ static const struct v4l2_file_operations vino_fops = {
4052 .owner = THIS_MODULE, 4052 .owner = THIS_MODULE,
4053 .open = vino_open, 4053 .open = vino_open,
4054 .release = vino_close, 4054 .release = vino_close,
4055 .ioctl = vino_ioctl, 4055 .unlocked_ioctl = vino_ioctl,
4056 .mmap = vino_mmap, 4056 .mmap = vino_mmap,
4057 .poll = vino_poll, 4057 .poll = vino_poll,
4058}; 4058};
@@ -4068,27 +4068,27 @@ static struct video_device vdev_template = {
4068static void vino_module_cleanup(int stage) 4068static void vino_module_cleanup(int stage)
4069{ 4069{
4070 switch(stage) { 4070 switch(stage) {
4071 case 10: 4071 case 11:
4072 video_unregister_device(vino_drvdata->b.vdev); 4072 video_unregister_device(vino_drvdata->b.vdev);
4073 vino_drvdata->b.vdev = NULL; 4073 vino_drvdata->b.vdev = NULL;
4074 case 9: 4074 case 10:
4075 video_unregister_device(vino_drvdata->a.vdev); 4075 video_unregister_device(vino_drvdata->a.vdev);
4076 vino_drvdata->a.vdev = NULL; 4076 vino_drvdata->a.vdev = NULL;
4077 case 8: 4077 case 9:
4078 vino_i2c_del_bus(); 4078 vino_i2c_del_bus();
4079 case 7: 4079 case 8:
4080 free_irq(SGI_VINO_IRQ, NULL); 4080 free_irq(SGI_VINO_IRQ, NULL);
4081 case 6: 4081 case 7:
4082 if (vino_drvdata->b.vdev) { 4082 if (vino_drvdata->b.vdev) {
4083 video_device_release(vino_drvdata->b.vdev); 4083 video_device_release(vino_drvdata->b.vdev);
4084 vino_drvdata->b.vdev = NULL; 4084 vino_drvdata->b.vdev = NULL;
4085 } 4085 }
4086 case 5: 4086 case 6:
4087 if (vino_drvdata->a.vdev) { 4087 if (vino_drvdata->a.vdev) {
4088 video_device_release(vino_drvdata->a.vdev); 4088 video_device_release(vino_drvdata->a.vdev);
4089 vino_drvdata->a.vdev = NULL; 4089 vino_drvdata->a.vdev = NULL;
4090 } 4090 }
4091 case 4: 4091 case 5:
4092 /* all entries in dma_cpu dummy table have the same address */ 4092 /* all entries in dma_cpu dummy table have the same address */
4093 dma_unmap_single(NULL, 4093 dma_unmap_single(NULL,
4094 vino_drvdata->dummy_desc_table.dma_cpu[0], 4094 vino_drvdata->dummy_desc_table.dma_cpu[0],
@@ -4098,8 +4098,10 @@ static void vino_module_cleanup(int stage)
4098 (void *)vino_drvdata-> 4098 (void *)vino_drvdata->
4099 dummy_desc_table.dma_cpu, 4099 dummy_desc_table.dma_cpu,
4100 vino_drvdata->dummy_desc_table.dma); 4100 vino_drvdata->dummy_desc_table.dma);
4101 case 3: 4101 case 4:
4102 free_page(vino_drvdata->dummy_page); 4102 free_page(vino_drvdata->dummy_page);
4103 case 3:
4104 v4l2_device_unregister(&vino_drvdata->v4l2_dev);
4103 case 2: 4105 case 2:
4104 kfree(vino_drvdata); 4106 kfree(vino_drvdata);
4105 case 1: 4107 case 1:
@@ -4154,6 +4156,7 @@ static int vino_probe(void)
4154static int vino_init(void) 4156static int vino_init(void)
4155{ 4157{
4156 dma_addr_t dma_dummy_address; 4158 dma_addr_t dma_dummy_address;
4159 int err;
4157 int i; 4160 int i;
4158 4161
4159 vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL); 4162 vino_drvdata = kzalloc(sizeof(struct vino_settings), GFP_KERNEL);
@@ -4162,6 +4165,12 @@ static int vino_init(void)
4162 return -ENOMEM; 4165 return -ENOMEM;
4163 } 4166 }
4164 vino_init_stage++; 4167 vino_init_stage++;
4168 strlcpy(vino_drvdata->v4l2_dev.name, "vino",
4169 sizeof(vino_drvdata->v4l2_dev.name));
4170 err = v4l2_device_register(NULL, &vino_drvdata->v4l2_dev);
4171 if (err)
4172 return err;
4173 vino_init_stage++;
4165 4174
4166 /* create a dummy dma descriptor */ 4175 /* create a dummy dma descriptor */
4167 vino_drvdata->dummy_page = get_zeroed_page(GFP_KERNEL | GFP_DMA); 4176 vino_drvdata->dummy_page = get_zeroed_page(GFP_KERNEL | GFP_DMA);
@@ -4239,6 +4248,7 @@ static int vino_init_channel_settings(struct vino_channel_settings *vcs,
4239 sizeof(struct video_device)); 4248 sizeof(struct video_device));
4240 strcpy(vcs->vdev->name, name); 4249 strcpy(vcs->vdev->name, name);
4241 vcs->vdev->release = video_device_release; 4250 vcs->vdev->release = video_device_release;
4251 vcs->vdev->v4l2_dev = &vino_drvdata->v4l2_dev;
4242 4252
4243 video_set_drvdata(vcs->vdev, vcs); 4253 video_set_drvdata(vcs->vdev, vcs);
4244 4254
@@ -4293,6 +4303,7 @@ static int __init vino_module_init(void)
4293 vino_module_cleanup(vino_init_stage); 4303 vino_module_cleanup(vino_init_stage);
4294 return ret; 4304 return ret;
4295 } 4305 }
4306 i2c_set_adapdata(&vino_i2c_adapter, &vino_drvdata->v4l2_dev);
4296 vino_init_stage++; 4307 vino_init_stage++;
4297 4308
4298 ret = video_register_device(vino_drvdata->a.vdev, 4309 ret = video_register_device(vino_drvdata->a.vdev,