aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/v4l2-subdev.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-11-29 19:36:58 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:38:37 -0500
commit2a1fcdf08230522bd5024f91da24aaa6e8d81f59 (patch)
tree03781d767920d0569e6441ff9c74186d50f70a23 /drivers/media/video/v4l2-subdev.c
parent07b1747c8d0bb463311f9dd05d4c013765abe2eb (diff)
V4L/DVB (9820): v4l2: add v4l2_device and v4l2_subdev structs to the v4l2 framework.
Start implementing a proper v4l2 framework as discussed during the Linux Plumbers Conference 2008. Introduces v4l2_device (for device instances) and v4l2_subdev (representing sub-device instances). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@skynet.be> Reviewed-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviewed-by: Andy Walls <awalls@radix.net> Reviewed-by: David Brownell <david-b@pacbell.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/v4l2-subdev.c')
-rw-r--r--drivers/media/video/v4l2-subdev.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
new file mode 100644
index 000000000000..fe1f01c970ac
--- /dev/null
+++ b/drivers/media/video/v4l2-subdev.c
@@ -0,0 +1,108 @@
1/*
2 V4L2 sub-device support.
3
4 Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/types.h>
22#include <linux/ioctl.h>
23#include <linux/i2c.h>
24#include <linux/videodev2.h>
25#include <media/v4l2-subdev.h>
26
27int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
28{
29 switch (cmd) {
30 case VIDIOC_QUERYCTRL:
31 return v4l2_subdev_call(sd, core, querymenu, arg);
32 case VIDIOC_G_CTRL:
33 return v4l2_subdev_call(sd, core, g_ctrl, arg);
34 case VIDIOC_S_CTRL:
35 return v4l2_subdev_call(sd, core, s_ctrl, arg);
36 case VIDIOC_QUERYMENU:
37 return v4l2_subdev_call(sd, core, queryctrl, arg);
38 case VIDIOC_LOG_STATUS:
39 return v4l2_subdev_call(sd, core, log_status);
40 case VIDIOC_G_CHIP_IDENT:
41 return v4l2_subdev_call(sd, core, g_chip_ident, arg);
42 case VIDIOC_INT_S_STANDBY:
43 return v4l2_subdev_call(sd, core, s_standby, *(u32 *)arg);
44 case VIDIOC_INT_RESET:
45 return v4l2_subdev_call(sd, core, reset, *(u32 *)arg);
46 case VIDIOC_INT_S_GPIO:
47 return v4l2_subdev_call(sd, core, s_gpio, *(u32 *)arg);
48 case VIDIOC_INT_INIT:
49 return v4l2_subdev_call(sd, core, init, *(u32 *)arg);
50#ifdef CONFIG_VIDEO_ADV_DEBUG
51 case VIDIOC_DBG_G_REGISTER:
52 return v4l2_subdev_call(sd, core, g_register, arg);
53 case VIDIOC_DBG_S_REGISTER:
54 return v4l2_subdev_call(sd, core, s_register, arg);
55#endif
56
57 case VIDIOC_INT_S_TUNER_MODE:
58 return v4l2_subdev_call(sd, tuner, s_mode, *(enum v4l2_tuner_type *)arg);
59 case AUDC_SET_RADIO:
60 return v4l2_subdev_call(sd, tuner, s_radio);
61 case VIDIOC_S_TUNER:
62 return v4l2_subdev_call(sd, tuner, s_tuner, arg);
63 case VIDIOC_G_TUNER:
64 return v4l2_subdev_call(sd, tuner, g_tuner, arg);
65 case VIDIOC_S_STD:
66 return v4l2_subdev_call(sd, tuner, s_std, *(v4l2_std_id *)arg);
67 case VIDIOC_S_FREQUENCY:
68 return v4l2_subdev_call(sd, tuner, s_frequency, arg);
69 case VIDIOC_G_FREQUENCY:
70 return v4l2_subdev_call(sd, tuner, g_frequency, arg);
71 case TUNER_SET_TYPE_ADDR:
72 return v4l2_subdev_call(sd, tuner, s_type_addr, arg);
73 case TUNER_SET_CONFIG:
74 return v4l2_subdev_call(sd, tuner, s_config, arg);
75
76 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
77 return v4l2_subdev_call(sd, audio, s_clock_freq, *(u32 *)arg);
78 case VIDIOC_INT_S_AUDIO_ROUTING:
79 return v4l2_subdev_call(sd, audio, s_routing, arg);
80 case VIDIOC_INT_I2S_CLOCK_FREQ:
81 return v4l2_subdev_call(sd, audio, s_i2s_clock_freq, *(u32 *)arg);
82
83 case VIDIOC_INT_S_VIDEO_ROUTING:
84 return v4l2_subdev_call(sd, video, s_routing, arg);
85 case VIDIOC_INT_S_CRYSTAL_FREQ:
86 return v4l2_subdev_call(sd, video, s_crystal_freq, arg);
87 case VIDIOC_INT_DECODE_VBI_LINE:
88 return v4l2_subdev_call(sd, video, decode_vbi_line, arg);
89 case VIDIOC_INT_S_VBI_DATA:
90 return v4l2_subdev_call(sd, video, s_vbi_data, arg);
91 case VIDIOC_INT_G_VBI_DATA:
92 return v4l2_subdev_call(sd, video, g_vbi_data, arg);
93 case VIDIOC_S_FMT:
94 return v4l2_subdev_call(sd, video, s_fmt, arg);
95 case VIDIOC_G_FMT:
96 return v4l2_subdev_call(sd, video, g_fmt, arg);
97 case VIDIOC_INT_S_STD_OUTPUT:
98 return v4l2_subdev_call(sd, video, s_std_output, *(v4l2_std_id *)arg);
99 case VIDIOC_STREAMON:
100 return v4l2_subdev_call(sd, video, s_stream, 1);
101 case VIDIOC_STREAMOFF:
102 return v4l2_subdev_call(sd, video, s_stream, 0);
103
104 default:
105 return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
106 }
107}
108EXPORT_SYMBOL_GPL(v4l2_subdev_command);