From patchwork Thu Oct 10 19:20:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Frank_Sch=C3=A4fer?= X-Patchwork-Id: 3018361 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7D35E9F1E1 for ; Thu, 10 Oct 2013 19:20:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A6C3202FF for ; Thu, 10 Oct 2013 19:20:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A0E1202FE for ; Thu, 10 Oct 2013 19:20:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756314Ab3JJTUQ (ORCPT ); Thu, 10 Oct 2013 15:20:16 -0400 Received: from mail-ea0-f171.google.com ([209.85.215.171]:47773 "EHLO mail-ea0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755772Ab3JJTUP (ORCPT ); Thu, 10 Oct 2013 15:20:15 -0400 Received: by mail-ea0-f171.google.com with SMTP id n15so1399412ead.30 for ; Thu, 10 Oct 2013 12:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=0io3xI34XPYuexImQATAc1Ob5vRR4xCTEvr+ycQK6lY=; b=skfFxh1usQ/7uHZonB+hWeaEr8fbQZ+P6JfAonD4N053/IjFzH52cSWew6AlKWZyZo 7RgSsUv2aQoni2/c4GwdccN6P/CFFYBPlKM2cFj8Rld/+/XcG1kJhqV+LWTBefgEsmQo 46p7CTm1Z9SmjuJuWV4s30UHjysjo18XTgnoWYAuXKUvEU30oQLm6DAOsJey7bzKx6Oi xd3P+7dlqAmJ15oncKpS/2ISp+WC6160F/f1l5kyHKmE8dmQTCQYkXzUZosYDDLFJRmy 4PXBM7wOpgaNf5fnACPt11EgPN7NYfR5cy/EQ6rRIO5V4buhfZ++gIAbtNvLGOKerAmT SNFg== X-Received: by 10.15.31.12 with SMTP id x12mr118921eeu.83.1381432813233; Thu, 10 Oct 2013 12:20:13 -0700 (PDT) Received: from Athlon64X2-5000.site (ip-109-91-213-248.unitymediagroup.de. [109.91.213.248]) by mx.google.com with ESMTPSA id f49sm105020868eec.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Oct 2013 12:20:12 -0700 (PDT) From: =?UTF-8?q?Frank=20Sch=C3=A4fer?= To: m.chehab@samsung.com, hans.verkuil@cisco.com Cc: linux-media@vger.kernel.org, =?UTF-8?q?Frank=20Sch=C3=A4fer?= Subject: [RFC PATCH] em28xx: fix device initialization in em28xx_v4l2_open() for radio and VBI mode Date: Thu, 10 Oct 2013 21:20:24 +0200 Message-Id: <1381432824-7395-1-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - bail out on unsupported VFL_TYPE - em28xx_set_mode() needs to be called for VBI and radio mode, too - em28xx_wake_i2c() needs to be called for VBI and radio mode, too - em28xx_resolution_set() also needs to be called for VBI Compilation tested only and should be reviewed thoroughly ! Signed-off-by: Frank Schäfer --- drivers/media/usb/em28xx/em28xx-video.c | 17 +++++++++++------ 1 Datei geändert, 11 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index fc5d60e..962f4b2 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -1570,13 +1570,16 @@ static int em28xx_v4l2_open(struct file *filp) case VFL_TYPE_VBI: fh_type = V4L2_BUF_TYPE_VBI_CAPTURE; break; + case VFL_TYPE_RADIO: + break; + default: + return -EINVAL; } em28xx_videodbg("open dev=%s type=%s users=%d\n", video_device_node_name(vdev), v4l2_type_names[fh_type], dev->users); - if (mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; fh = kzalloc(sizeof(struct em28xx_fh), GFP_KERNEL); @@ -1590,15 +1593,17 @@ static int em28xx_v4l2_open(struct file *filp) fh->type = fh_type; filp->private_data = fh; - if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { + if (dev->users == 0) { em28xx_set_mode(dev, EM28XX_ANALOG_MODE); - em28xx_resolution_set(dev); - /* Needed, since GPIO might have disabled power of - some i2c device + if (vdev->vfl_type != VFL_TYPE_RADIO) + em28xx_resolution_set(dev); + + /* + * Needed, since GPIO might have disabled power of + * some i2c devices */ em28xx_wake_i2c(dev); - } if (vdev->vfl_type == VFL_TYPE_RADIO) {