blob: 460b33697c9bbaf112e0a18119c57e390b699bc9 [file] [log] [blame]
Laurent Pinchart2096a5d2009-12-09 08:38:49 -03001/*
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -03002 * V4L2 sub-device
Laurent Pinchart2096a5d2009-12-09 08:38:49 -03003 *
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -03004 * Copyright (C) 2010 Nokia Corporation
Laurent Pinchart2096a5d2009-12-09 08:38:49 -03005 *
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -03006 * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7 * Sakari Ailus <sakari.ailus@iki.fi>
Laurent Pinchart2096a5d2009-12-09 08:38:49 -03008 *
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -03009 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
Laurent Pinchart2096a5d2009-12-09 08:38:49 -030012 *
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -030013 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Laurent Pinchart2096a5d2009-12-09 08:38:49 -030017 *
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -030018 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Laurent Pinchart2096a5d2009-12-09 08:38:49 -030021 */
22
23#include <linux/types.h>
24#include <linux/ioctl.h>
25#include <linux/videodev2.h>
26
27#include <media/v4l2-device.h>
28#include <media/v4l2-ioctl.h>
29
30static int subdev_open(struct file *file)
31{
32 return 0;
33}
34
35static int subdev_close(struct file *file)
36{
37 return 0;
38}
39
40static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
41{
42 switch (cmd) {
43 default:
44 return -ENOIOCTLCMD;
45 }
46
47 return 0;
48}
49
50static long subdev_ioctl(struct file *file, unsigned int cmd,
51 unsigned long arg)
52{
53 return video_usercopy(file, cmd, arg, subdev_do_ioctl);
54}
55
56const struct v4l2_file_operations v4l2_subdev_fops = {
57 .owner = THIS_MODULE,
58 .open = subdev_open,
59 .unlocked_ioctl = subdev_ioctl,
60 .release = subdev_close,
61};
Laurent Pinchart3dd5ee02009-12-09 08:38:52 -030062
63void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
64{
65 INIT_LIST_HEAD(&sd->list);
66 BUG_ON(!ops);
67 sd->ops = ops;
68 sd->v4l2_dev = NULL;
69 sd->flags = 0;
70 sd->name[0] = '\0';
71 sd->grp_id = 0;
72 sd->dev_priv = NULL;
73 sd->host_priv = NULL;
74}
75EXPORT_SYMBOL(v4l2_subdev_init);