cap->version = KERNEL_VERSION(0, 9, 8);
- cap->capabilities = V4L2_CAP_VIDEO_CAPTURE |
- V4L2_CAP_STREAMING; /* | V4L2_CAP_AUDIO; */
+ cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
+ if (go->board_info->num_aud_inputs)
+ cap->device_caps |= V4L2_CAP_AUDIO;
if (go->board_info->flags & GO7007_BOARD_HAS_TUNER)
cap->capabilities |= V4L2_CAP_TUNER;
else
inp->type = V4L2_INPUT_TYPE_CAMERA;
- inp->audioset = 0;
+ if (go->board_info->num_aud_inputs)
+ inp->audioset = (1 << go->board_info->num_aud_inputs) - 1;
+ else
+ inp->audioset = 0;
inp->tuner = 0;
if (go->board_info->sensor_flags & GO7007_SENSOR_TV)
inp->std = V4L2_STD_NTSC | V4L2_STD_PAL |
return 0;
}
+static int vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+ struct go7007 *go = video_drvdata(file);
+
+ if (a->index >= go->board_info->num_aud_inputs)
+ return -EINVAL;
+ strlcpy(a->name, go->board_info->aud_inputs[a->index].name, sizeof(a->name));
+ a->capability = V4L2_AUDCAP_STEREO;
+ return 0;
+}
+
+static int vidioc_g_audio(struct file *file, void *fh, struct v4l2_audio *a)
+{
+ struct go7007 *go = video_drvdata(file);
+
+ a->index = go->aud_input;
+ strlcpy(a->name, go->board_info->aud_inputs[go->aud_input].name, sizeof(a->name));
+ a->capability = V4L2_AUDCAP_STEREO;
+ return 0;
+}
+
+static int vidioc_s_audio(struct file *file, void *fh, const struct v4l2_audio *a)
+{
+ struct go7007 *go = video_drvdata(file);
+
+ if (a->index >= go->board_info->num_aud_inputs)
+ return -EINVAL;
+ go->aud_input = a->index;
+ v4l2_subdev_call(go->sd_audio, audio, s_routing,
+ go->board_info->aud_inputs[go->aud_input].audio_input, 0, 0);
+ return 0;
+}
+
static int vidioc_s_input(struct file *file, void *priv, unsigned int input)
{
struct go7007 *go = ((struct go7007_file *) priv)->go;
.vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input,
+ .vidioc_enumaudio = vidioc_enumaudio,
+ .vidioc_g_audio = vidioc_g_audio,
+ .vidioc_s_audio = vidioc_s_audio,
.vidioc_queryctrl = vidioc_queryctrl,
.vidioc_g_ctrl = vidioc_g_ctrl,
.vidioc_s_ctrl = vidioc_s_ctrl,
go->video_dev = NULL;
return rv;
}
+ if (go->board_info->num_aud_inputs == 0) {
+ v4l2_disable_ioctl(go->video_dev, VIDIOC_G_AUDIO);
+ v4l2_disable_ioctl(go->video_dev, VIDIOC_S_AUDIO);
+ v4l2_disable_ioctl(go->video_dev, VIDIOC_ENUMAUDIO);
+ }
rv = v4l2_device_register(go->dev, &go->v4l2_dev);
if (rv < 0) {
video_device_release(go->video_dev);