From patchwork Mon Jan 13 22:02:07 2014 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: 3481041 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32AAAC02DC for ; Mon, 13 Jan 2014 22:01:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 502B920166 for ; Mon, 13 Jan 2014 22:01:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7993B20165 for ; Mon, 13 Jan 2014 22:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752066AbaAMWBM (ORCPT ); Mon, 13 Jan 2014 17:01:12 -0500 Received: from mail-ea0-f177.google.com ([209.85.215.177]:38911 "EHLO mail-ea0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751785AbaAMWBK (ORCPT ); Mon, 13 Jan 2014 17:01:10 -0500 Received: by mail-ea0-f177.google.com with SMTP id n15so3619007ead.8 for ; Mon, 13 Jan 2014 14:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=7B+Xvws3MsqyCdpwjfNXd6p7M6KDsFKcsdbwLPZ+aRI=; b=Ol5kwcUyo3CNC3wUZsTcWyYmuMAyenFEEniizlKoTMDemNtwkezblRaMbmRn29qdET fpIOlBnn6fSqSlrTmFdz+zDMGfySaaWDtv5IhK2sNfIuC1XOWnZhssChvOcHJ+gxKS0o Lu+vRYSO4v0ldkXVE0j1QbtNI3BDXTEfbexMeASSbgdV/GprdWxvAjBSnLjbBD8drWDX P+rSaa/nNGtj/cYYHcSwrKwWU6oFqTTad8AwVBeJXkW4aiCDK7Ykl7Rtf7h50EO5VAUQ wpKNLSlvLRgdRL3ofz3VEbbNGNKXEwOftlyfq7B4Yme7h3R19bKqZS+kmGlc7JcC07Ej BzyA== X-Received: by 10.14.115.72 with SMTP id d48mr2671eeh.114.1389650469428; Mon, 13 Jan 2014 14:01:09 -0800 (PST) Received: from Athlon64X2-5000.site (ip-109-90-247-29.unitymediagroup.de. [109.90.247.29]) by mx.google.com with ESMTPSA id o47sm43386476eem.21.2014.01.13.14.01.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jan 2014 14:01:09 -0800 (PST) From: =?UTF-8?q?Frank=20Sch=C3=A4fer?= To: m.chehab@samsung.com Cc: linux-media@vger.kernel.org, =?UTF-8?q?Frank=20Sch=C3=A4fer?= Subject: [PATCH v2 2/2] em28xx: fix check for audio only usb interfaces when changing the usb alternate setting Date: Mon, 13 Jan 2014 23:02:07 +0100 Message-Id: <1389650527-3962-2-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1389650527-3962-1-git-send-email-fschaefer.oss@googlemail.com> References: <1389650527-3962-1-git-send-email-fschaefer.oss@googlemail.com> 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=-6.9 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 Previously, we've been assuming that the video endpoints are always at usb interface 0. Hence, if vendor audio endpoints are provided at a separate interface, they were supposed to be at interface number > 0. Instead of checking for (interface number > 0) to determine if an interface is a pure audio interface, dev->is_audio_only should be checked. Signed-off-by: Frank Schäfer --- drivers/media/usb/em28xx/em28xx-audio.c | 15 +++++++++++++-- 1 Datei geändert, 13 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index f80c3533..5bdf86c 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -266,7 +266,7 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) dprintk("opening device and trying to acquire exclusive lock\n"); runtime->hw = snd_em28xx_hw_capture; - if ((dev->alt == 0 || dev->ifnum) && dev->adev.users == 0) { + if ((dev->alt == 0 || dev->is_audio_only) && dev->adev.users == 0) { int nonblock = !!(substream->f_flags & O_NONBLOCK); if (nonblock) { @@ -274,10 +274,21 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) return -EAGAIN; } else mutex_lock(&dev->lock); - if (dev->ifnum) + if (dev->is_audio_only) + /* vendor audio is on a separate interface */ dev->alt = 1; else + /* vendor audio is on the same interface as video */ dev->alt = 7; + /* + * FIXME: The intention seems to be to select the alt + * setting with the largest wMaxPacketSize for the video + * endpoint. + * At least dev->alt should be used instead, but we + * should probably not touch it at all if it is + * already >0, because wMaxPacketSize of the audio + * endpoints seems to be the same for all. + */ dprintk("changing alternate number on interface %d to %d\n", dev->ifnum, dev->alt);