aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/soc_camera.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-31 12:34:22 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-31 12:34:22 -0400
commit6679ce6e5f519096612b480d255d9ca97be0c2be (patch)
treecce6814d3e7c62adf59e565fb6ae95fd409f86ab /drivers/media/video/soc_camera.c
parent2c3d103ba90827cfb478bf10464d9b5b9cea369c (diff)
parent6e86841d05f371b5b9b86ce76c02aaee83352298 (diff)
Merge branch 'linus' into sched/urgent
Diffstat (limited to 'drivers/media/video/soc_camera.c')
-rw-r--r--drivers/media/video/soc_camera.c68
1 files changed, 36 insertions, 32 deletions
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index e39b98f1eca4..b6be5ee678b6 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -25,6 +25,7 @@
25#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
26 26
27#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
28#include <media/v4l2-ioctl.h>
28#include <media/v4l2-dev.h> 29#include <media/v4l2-dev.h>
29#include <media/videobuf-core.h> 30#include <media/videobuf-core.h>
30#include <media/soc_camera.h> 31#include <media/soc_camera.h>
@@ -193,7 +194,7 @@ static int soc_camera_open(struct inode *inode, struct file *file)
193 mutex_lock(&video_lock); 194 mutex_lock(&video_lock);
194 195
195 vdev = video_devdata(file); 196 vdev = video_devdata(file);
196 icd = container_of(vdev->dev, struct soc_camera_device, dev); 197 icd = container_of(vdev->parent, struct soc_camera_device, dev);
197 ici = to_soc_camera_host(icd->dev.parent); 198 ici = to_soc_camera_host(icd->dev.parent);
198 199
199 if (!try_module_get(icd->ops->owner)) { 200 if (!try_module_get(icd->ops->owner)) {
@@ -258,7 +259,7 @@ static int soc_camera_close(struct inode *inode, struct file *file)
258 259
259 vfree(icf); 260 vfree(icf);
260 261
261 dev_dbg(vdev->dev, "camera device close\n"); 262 dev_dbg(vdev->parent, "camera device close\n");
262 263
263 return 0; 264 return 0;
264} 265}
@@ -271,7 +272,7 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf,
271 struct video_device *vdev = icd->vdev; 272 struct video_device *vdev = icd->vdev;
272 int err = -EINVAL; 273 int err = -EINVAL;
273 274
274 dev_err(vdev->dev, "camera device read not implemented\n"); 275 dev_err(vdev->parent, "camera device read not implemented\n");
275 276
276 return err; 277 return err;
277} 278}
@@ -861,6 +862,35 @@ void soc_camera_device_unregister(struct soc_camera_device *icd)
861} 862}
862EXPORT_SYMBOL(soc_camera_device_unregister); 863EXPORT_SYMBOL(soc_camera_device_unregister);
863 864
865static const struct v4l2_ioctl_ops soc_camera_ioctl_ops = {
866 .vidioc_querycap = soc_camera_querycap,
867 .vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap,
868 .vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap,
869 .vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap,
870 .vidioc_enum_input = soc_camera_enum_input,
871 .vidioc_g_input = soc_camera_g_input,
872 .vidioc_s_input = soc_camera_s_input,
873 .vidioc_s_std = soc_camera_s_std,
874 .vidioc_reqbufs = soc_camera_reqbufs,
875 .vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap,
876 .vidioc_querybuf = soc_camera_querybuf,
877 .vidioc_qbuf = soc_camera_qbuf,
878 .vidioc_dqbuf = soc_camera_dqbuf,
879 .vidioc_streamon = soc_camera_streamon,
880 .vidioc_streamoff = soc_camera_streamoff,
881 .vidioc_queryctrl = soc_camera_queryctrl,
882 .vidioc_g_ctrl = soc_camera_g_ctrl,
883 .vidioc_s_ctrl = soc_camera_s_ctrl,
884 .vidioc_cropcap = soc_camera_cropcap,
885 .vidioc_g_crop = soc_camera_g_crop,
886 .vidioc_s_crop = soc_camera_s_crop,
887 .vidioc_g_chip_ident = soc_camera_g_chip_ident,
888#ifdef CONFIG_VIDEO_ADV_DEBUG
889 .vidioc_g_register = soc_camera_g_register,
890 .vidioc_s_register = soc_camera_s_register,
891#endif
892};
893
864int soc_camera_video_start(struct soc_camera_device *icd) 894int soc_camera_video_start(struct soc_camera_device *icd)
865{ 895{
866 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); 896 struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
@@ -877,45 +907,19 @@ int soc_camera_video_start(struct soc_camera_device *icd)
877 907
878 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); 908 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name));
879 /* Maybe better &ici->dev */ 909 /* Maybe better &ici->dev */
880 vdev->dev = &icd->dev; 910 vdev->parent = &icd->dev;
881 vdev->type = VID_TYPE_CAPTURE;
882 vdev->current_norm = V4L2_STD_UNKNOWN; 911 vdev->current_norm = V4L2_STD_UNKNOWN;
883 vdev->fops = &soc_camera_fops; 912 vdev->fops = &soc_camera_fops;
913 vdev->ioctl_ops = &soc_camera_ioctl_ops;
884 vdev->release = video_device_release; 914 vdev->release = video_device_release;
885 vdev->minor = -1; 915 vdev->minor = -1;
886 vdev->tvnorms = V4L2_STD_UNKNOWN, 916 vdev->tvnorms = V4L2_STD_UNKNOWN,
887 vdev->vidioc_querycap = soc_camera_querycap;
888 vdev->vidioc_g_fmt_vid_cap = soc_camera_g_fmt_vid_cap;
889 vdev->vidioc_enum_fmt_vid_cap = soc_camera_enum_fmt_vid_cap;
890 vdev->vidioc_s_fmt_vid_cap = soc_camera_s_fmt_vid_cap;
891 vdev->vidioc_enum_input = soc_camera_enum_input;
892 vdev->vidioc_g_input = soc_camera_g_input;
893 vdev->vidioc_s_input = soc_camera_s_input;
894 vdev->vidioc_s_std = soc_camera_s_std;
895 vdev->vidioc_reqbufs = soc_camera_reqbufs;
896 vdev->vidioc_try_fmt_vid_cap = soc_camera_try_fmt_vid_cap;
897 vdev->vidioc_querybuf = soc_camera_querybuf;
898 vdev->vidioc_qbuf = soc_camera_qbuf;
899 vdev->vidioc_dqbuf = soc_camera_dqbuf;
900 vdev->vidioc_streamon = soc_camera_streamon;
901 vdev->vidioc_streamoff = soc_camera_streamoff;
902 vdev->vidioc_queryctrl = soc_camera_queryctrl;
903 vdev->vidioc_g_ctrl = soc_camera_g_ctrl;
904 vdev->vidioc_s_ctrl = soc_camera_s_ctrl;
905 vdev->vidioc_cropcap = soc_camera_cropcap;
906 vdev->vidioc_g_crop = soc_camera_g_crop;
907 vdev->vidioc_s_crop = soc_camera_s_crop;
908 vdev->vidioc_g_chip_ident = soc_camera_g_chip_ident;
909#ifdef CONFIG_VIDEO_ADV_DEBUG
910 vdev->vidioc_g_register = soc_camera_g_register;
911 vdev->vidioc_s_register = soc_camera_s_register;
912#endif
913 917
914 icd->current_fmt = &icd->formats[0]; 918 icd->current_fmt = &icd->formats[0];
915 919
916 err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor); 920 err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor);
917 if (err < 0) { 921 if (err < 0) {
918 dev_err(vdev->dev, "video_register_device failed\n"); 922 dev_err(vdev->parent, "video_register_device failed\n");
919 goto evidregd; 923 goto evidregd;
920 } 924 }
921 icd->vdev = vdev; 925 icd->vdev = vdev;