2 V4L2 sub-device support.
4 Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
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.
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.
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
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>
27 int v4l2_subdev_command(struct v4l2_subdev *sd, unsigned cmd, void *arg)
30 case VIDIOC_QUERYCTRL:
31 return v4l2_subdev_call(sd, core, queryctrl, arg);
33 return v4l2_subdev_call(sd, core, g_ctrl, arg);
35 return v4l2_subdev_call(sd, core, s_ctrl, arg);
36 case VIDIOC_G_EXT_CTRLS:
37 return v4l2_subdev_call(sd, core, g_ext_ctrls, arg);
38 case VIDIOC_S_EXT_CTRLS:
39 return v4l2_subdev_call(sd, core, s_ext_ctrls, arg);
40 case VIDIOC_TRY_EXT_CTRLS:
41 return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
42 case VIDIOC_QUERYMENU:
43 return v4l2_subdev_call(sd, core, querymenu, arg);
44 case VIDIOC_LOG_STATUS:
45 return v4l2_subdev_call(sd, core, log_status);
46 case VIDIOC_DBG_G_CHIP_IDENT:
47 return v4l2_subdev_call(sd, core, g_chip_ident, arg);
48 case VIDIOC_INT_S_STANDBY:
49 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
50 case VIDIOC_INT_RESET:
51 return v4l2_subdev_call(sd, core, reset, arg ? (*(u32 *)arg) : 0);
52 case VIDIOC_INT_S_GPIO:
53 return v4l2_subdev_call(sd, core, s_gpio, arg ? (*(u32 *)arg) : 0);
55 return v4l2_subdev_call(sd, core, init, arg ? (*(u32 *)arg) : 0);
56 #ifdef CONFIG_VIDEO_ADV_DEBUG
57 case VIDIOC_DBG_G_REGISTER:
58 return v4l2_subdev_call(sd, core, g_register, arg);
59 case VIDIOC_DBG_S_REGISTER:
60 return v4l2_subdev_call(sd, core, s_register, arg);
63 case VIDIOC_INT_S_TUNER_MODE:
64 return v4l2_subdev_call(sd, tuner, s_mode, *(enum v4l2_tuner_type *)arg);
66 return v4l2_subdev_call(sd, tuner, s_radio);
68 return v4l2_subdev_call(sd, tuner, s_tuner, arg);
70 return v4l2_subdev_call(sd, tuner, g_tuner, arg);
72 return v4l2_subdev_call(sd, tuner, s_std, *(v4l2_std_id *)arg);
73 case VIDIOC_S_FREQUENCY:
74 return v4l2_subdev_call(sd, tuner, s_frequency, arg);
75 case VIDIOC_G_FREQUENCY:
76 return v4l2_subdev_call(sd, tuner, g_frequency, arg);
77 case TUNER_SET_TYPE_ADDR:
78 return v4l2_subdev_call(sd, tuner, s_type_addr, arg);
79 case TUNER_SET_CONFIG:
80 return v4l2_subdev_call(sd, tuner, s_config, arg);
82 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
83 return v4l2_subdev_call(sd, audio, s_clock_freq, *(u32 *)arg);
84 case VIDIOC_INT_S_AUDIO_ROUTING:
85 return v4l2_subdev_call(sd, audio, s_routing, arg);
86 case VIDIOC_INT_I2S_CLOCK_FREQ:
87 return v4l2_subdev_call(sd, audio, s_i2s_clock_freq, *(u32 *)arg);
89 case VIDIOC_INT_S_VIDEO_ROUTING:
90 return v4l2_subdev_call(sd, video, s_routing, arg);
91 case VIDIOC_INT_S_CRYSTAL_FREQ:
92 return v4l2_subdev_call(sd, video, s_crystal_freq, arg);
93 case VIDIOC_INT_DECODE_VBI_LINE:
94 return v4l2_subdev_call(sd, video, decode_vbi_line, arg);
95 case VIDIOC_INT_S_VBI_DATA:
96 return v4l2_subdev_call(sd, video, s_vbi_data, arg);
97 case VIDIOC_INT_G_VBI_DATA:
98 return v4l2_subdev_call(sd, video, g_vbi_data, arg);
99 case VIDIOC_G_SLICED_VBI_CAP:
100 return v4l2_subdev_call(sd, video, g_sliced_vbi_cap, arg);
102 return v4l2_subdev_call(sd, video, s_fmt, arg);
104 return v4l2_subdev_call(sd, video, g_fmt, arg);
105 case VIDIOC_INT_S_STD_OUTPUT:
106 return v4l2_subdev_call(sd, video, s_std_output, *(v4l2_std_id *)arg);
107 case VIDIOC_STREAMON:
108 return v4l2_subdev_call(sd, video, s_stream, 1);
109 case VIDIOC_STREAMOFF:
110 return v4l2_subdev_call(sd, video, s_stream, 0);
113 return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
116 EXPORT_SYMBOL_GPL(v4l2_subdev_command);