832 mutex_unlock(&dev->lock);
833 dprintk(1, "res: put\n");
834}
835
836
837static int vidioc_querycap(struct file *file, void *priv,
838 struct v4l2_capability *cap)
839{
840 struct s2255_fh *fh = file->private_data;
841 struct s2255_dev *dev = fh->dev;
842 strlcpy(cap->driver, "s2255", sizeof(cap->driver));
843 strlcpy(cap->card, "s2255", sizeof(cap->card));
844 strlcpy(cap->bus_info, dev_name(&dev->udev->dev),
845 sizeof(cap->bus_info));
846 cap->version = S2255_VERSION;
847 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
848 return 0;
849}
850
851static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
852 struct v4l2_fmtdesc *f)
853{
854 int index = 0;
855 if (f)
856 index = f->index;
857
858 if (index >= ARRAY_SIZE(formats))
859 return -EINVAL;
860
861 dprintk(4, "name %s\n", formats[index].name);
862 strlcpy(f->description, formats[index].name, sizeof(f->description));
863 f->pixelformat = formats[index].fourcc;
864 return 0;
865}
866
867static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
868 struct v4l2_format *f)
869{
870 struct s2255_fh *fh = priv;
871
872 f->fmt.pix.width = fh->width;