From patchwork Fri Oct 17 17:09:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38901 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A9E5202DB for ; Fri, 17 Oct 2014 17:10:32 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id m15sf714400wgh.7 for ; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=F3HOM8eCqOueHIp7BCNxb5B4/JJbM+rv/no4TmouWy0=; b=TCgFfAaC/3SQn6q4FJPR8tAjdQvrOt+8z3mIG2JVVniz6wpO+emPs58+0y76Z9MDZA kQ0JqRLMIllVAOXlUsFwjP1vcH2+jMVYwTcklqC2QxPA+bNynoxvF7DCxItaYXWroxSF M7+gC67cJVTtrjRbtgKouzgDbEPW4Cocx8mhvk+SEJ3zbm6dNkvSNgxrfJF5TobiE35D zfJVI59L5T2QrFyWISA7W+7DBDHvx4Zu0fTO4rUeOS8AlG0xPdJobBI4CfHOkg4shewR XpP5pJC5rXeRo4QLNx625XvRMzwWystS2cNP/73IIhe/Xx4Bwbl2f1OdybaKlG1MNTLz P0Bg== X-Gm-Message-State: ALoCoQkZj+F75aJpPAnWLE3e6Dr8p0bJMnOmG6agh47DpOld5F84tQXST4KN0LPz/QTg+KeCFtWG X-Received: by 10.180.75.133 with SMTP id c5mr48321wiw.3.1413565831444; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.178 with SMTP id az18ls263160lab.96.gmail; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) X-Received: by 10.152.115.131 with SMTP id jo3mr10256268lab.20.1413565831288; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id t1si2965172lbo.69.2014.10.17.10.10.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:10:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id u10so1008446lbd.20 for ; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) X-Received: by 10.152.87.98 with SMTP id w2mr10041238laz.27.1413565831200; Fri, 17 Oct 2014 10:10:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp266692lbz; Fri, 17 Oct 2014 10:10:30 -0700 (PDT) X-Received: by 10.68.213.170 with SMTP id nt10mr4865502pbc.149.1413565829391; Fri, 17 Oct 2014 10:10:29 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id po9si1732725pdb.3.2014.10.17.10.10.28 for ; Fri, 17 Oct 2014 10:10:29 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753519AbaJQRK1 (ORCPT + 3 others); Fri, 17 Oct 2014 13:10:27 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43998 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753502AbaJQRKZ (ORCPT ); Fri, 17 Oct 2014 13:10:25 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHAPMx007465 for ; Fri, 17 Oct 2014 12:10:25 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAP3f027778 for ; Fri, 17 Oct 2014 12:10:25 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:10:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHAO2h026964; Fri, 17 Oct 2014 12:10:25 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 10/28] usb: gadget: function: uvc: manage our video control endpoint Date: Fri, 17 Oct 2014 12:09:46 -0500 Message-ID: <1413565804-13061-11-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413565804-13061-1-git-send-email-balbi@ti.com> References: <1413565804-13061-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , just like any other endpoint, we must enable/disable our video control endpoint based on calls to our ->set_alt() method. Signed-off-by: Felipe Balbi --- drivers/usb/gadget/function/f_uvc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 4138ad5..413a09f 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -297,6 +297,19 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) if (alt) return -EINVAL; + if (uvc->control_ep->driver_data) { + INFO(cdev, "reset UVC Control\n"); + usb_ep_disable(uvc->control_ep); + uvc->control_ep->driver_data = NULL; + } + + if (!uvc->control_ep->desc) + if (config_ep_by_speed(cdev->gadget, f, uvc->control_ep)) + return -EINVAL; + + usb_ep_enable(uvc->control_ep); + uvc->control_ep->driver_data = uvc; + if (uvc->state == UVC_STATE_DISCONNECTED) { memset(&v4l2_event, 0, sizeof(v4l2_event)); v4l2_event.type = UVC_EVENT_CONNECT;