Laurent Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 1 | /* |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 2 | * V4L2 sub-device |
Laurent Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 3 | * |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 4 | * Copyright (C) 2010 Nokia Corporation |
Laurent Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 5 | * |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 6 | * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
| 7 | * Sakari Ailus <sakari.ailus@iki.fi> |
Laurent Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 8 | * |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 9 | * 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 Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 12 | * |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 13 | * 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 Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 17 | * |
Laurent Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 18 | * 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 Pinchart | 2096a5d | 2009-12-09 08:38:49 -0300 | [diff] [blame] | 21 | */ |
| 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 | |
| 30 | static int subdev_open(struct file *file) |
| 31 | { |
| 32 | return 0; |
| 33 | } |
| 34 | |
| 35 | static int subdev_close(struct file *file) |
| 36 | { |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | static 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 | |
| 50 | static 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 | |
| 56 | const 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 Pinchart | 3dd5ee0 | 2009-12-09 08:38:52 -0300 | [diff] [blame^] | 62 | |
| 63 | void 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 | } |
| 75 | EXPORT_SYMBOL(v4l2_subdev_init); |