From patchwork Fri Jan 4 20:59:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 1934711 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 92ACBDFABD for ; Fri, 4 Jan 2013 21:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755120Ab3ADVAJ (ORCPT ); Fri, 4 Jan 2013 16:00:09 -0500 Received: from mail-vb0-f44.google.com ([209.85.212.44]:33660 "EHLO mail-vb0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755028Ab3ADVAF (ORCPT ); Fri, 4 Jan 2013 16:00:05 -0500 Received: by mail-vb0-f44.google.com with SMTP id fc26so16901779vbb.17 for ; Fri, 04 Jan 2013 13:00:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=KeJW/PAU5+fBdQeMSEYFqDZZ2WZ37Wfn1kdm0ENqgyI=; b=LL7NmZOg66JCEreWZNXHusl5Ir3CL+Sbkhenkeih1tfz093XJvncvqVvyVPQc/wKnT jbPNuSuYat6Byy75DcyGJumXp+fx/dtQ0cssuQgUBVeCKJ3Jb4xrEuc9Jltrkj9PjdUb IbpI0niDlyOFeiJiJGLQeUzmgTUGOgCBkBlDUsrcBghnk6B53AanKXwK/6qXJ5RBp4qT wzlpGktvpMpDHsnXfK0KvY3tEB3zPbVUKvoh/ETUUgLFrk51/9Ihip6ew7B7ZI2auf5t IzxChzVPeriKb4+8q6iYdvwjauw92vRqIvUYHk6feMuJaJ/KwDkL6IuQ5vQ+4cf2zagf T4pw== X-Received: by 10.52.35.20 with SMTP id d20mr67640466vdj.50.1357333203900; Fri, 04 Jan 2013 13:00:03 -0800 (PST) Received: from devin-ubuntu2.home (pool-108-54-72-165.nycmny.fios.verizon.net. [108.54.72.165]) by mx.google.com with ESMTPS id z20sm47278440vds.12.2013.01.04.13.00.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Jan 2013 13:00:03 -0800 (PST) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller , Hans Verkuil Subject: [PATCH 12/15] em28xx: std fixes: don't implement in webcam mode, and fix std changes. Date: Fri, 4 Jan 2013 15:59:42 -0500 Message-Id: <1357333186-8466-13-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1357333186-8466-1-git-send-email-dheitmueller@kernellabs.com> References: <1357333186-8466-1-git-send-email-dheitmueller@kernellabs.com> X-Gm-Message-State: ALoCoQn6ER9Qejkd5jvrcDQHBBo/6AL9jByzOVnY+V2DL6n/hVpvcNy+CBdIp2plPyw6vLBElBgL Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org When in webcam mode the STD API shouldn't be implemented. When changing the standard the resolution wasn't updated, and there was no check against streaming-in-progress. Signed-off-by: Hans Verkuil Signed-off-by: Devin Heitmueller --- drivers/media/usb/em28xx/em28xx-video.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 7c09b55..ae713a0 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -909,6 +909,8 @@ static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm) struct em28xx *dev = fh->dev; int rc; + if (dev->board.is_webcam) + return -ENOTTY; rc = check_dev(dev); if (rc < 0) return rc; @@ -924,6 +926,8 @@ static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *norm) struct em28xx *dev = fh->dev; int rc; + if (dev->board.is_webcam) + return -ENOTTY; rc = check_dev(dev); if (rc < 0) return rc; @@ -940,15 +944,24 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm) struct v4l2_format f; int rc; + if (dev->board.is_webcam) + return -ENOTTY; + if (*norm == dev->norm) + return 0; rc = check_dev(dev); if (rc < 0) return rc; + if (videobuf_queue_is_busy(&fh->vb_vidq)) { + em28xx_errdev("%s queue busy\n", __func__); + return -EBUSY; + } + dev->norm = *norm; /* Adjusts width/height, if needed */ - f.fmt.pix.width = dev->width; - f.fmt.pix.height = dev->height; + f.fmt.pix.width = 720; + f.fmt.pix.height = (*norm & V4L2_STD_525_60) ? 480 : 576; vidioc_try_fmt_vid_cap(file, priv, &f); /* set new image size */ @@ -1034,6 +1047,9 @@ static int vidioc_enum_input(struct file *file, void *priv, i->type = V4L2_INPUT_TYPE_TUNER; i->std = dev->vdev->tvnorms; + /* webcams do not have the STD API */ + if (dev->board.is_webcam) + i->capabilities = 0; return 0; } @@ -2059,7 +2075,6 @@ static const struct video_device em28xx_video_template = { .ioctl_ops = &video_ioctl_ops, .tvnorms = V4L2_STD_ALL, - .current_norm = V4L2_STD_PAL, }; static const struct v4l2_file_operations radio_fops = { @@ -2109,6 +2124,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, vfd->debug = video_debug; vfd->lock = &dev->lock; set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); + if (dev->board.is_webcam) + vfd->tvnorms = 0; snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name); @@ -2127,7 +2144,7 @@ int em28xx_register_analog_devices(struct em28xx *dev) dev->name, EM28XX_VERSION); /* set default norm */ - dev->norm = em28xx_video_template.current_norm; + dev->norm = V4L2_STD_PAL; v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); dev->interlaced = EM28XX_INTERLACED_DEFAULT;