Message ID | 20240108-rallybar-v4-1-a7450641e41b@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp889765dyq; Mon, 8 Jan 2024 00:18:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2n0bAaiRvGSPUu2ePQ8kCsofqArKVM6SBFeNhNXJSQKgyD/t9KNcpFLus+rUumiuFvQk/ X-Received: by 2002:a05:620a:414b:b0:783:1beb:d9f7 with SMTP id k11-20020a05620a414b00b007831bebd9f7mr2607280qko.155.1704701897242; Mon, 08 Jan 2024 00:18:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704701897; cv=none; d=google.com; s=arc-20160816; b=LjucbpEwy7YDbrjhsEfYMwUmsAlqBCPODRgXLqhpWMhlyb2qhiuRxo1psJ6Thsx+gY Tf0szGX/3+IkTgsoznGmf4LAyHXt13T5XS0ojfe2vqBu3c+WUCe4I/gZ9s7+jT61nF/3 yPVxLiISDYrwz8rn9eMgHqk/e6Ks1sd/3sk8TZPOiDu0VYjYcAdEy4g2CMdJOYshbdml XFoWCgQ0W0jUo9skMjkubs8Sg2aNi6ANRXazhpX+dwgDeMZJBp/nhNz7glXCaPCQuJyz AweOpCxyGCN9u3tkGSES5hFs9mNQFXh3sJO1HzfHGB/mW7nbv57JXUBS1wXLtIVuy7xf kAFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=M7JX/XG4UeOfhBADs4/0tfMCsAlccOtRn7KjHfujLog=; fh=650D4OMt36suop10GksnLbUvDYpIBiNxH4cHP6lBgJU=; b=n2eWPpSIPfLwa9MZ/AvTpNzbe4B7vjyp0kBbmcqYKxvsVFFDMH4R8KWMDi36QngCG1 byccCi3VBfi/lurtHLSDB2wJBzNsfyYZ9u1OqdyP2afWG7TVqoXhnBeOixACfuqzrb9+ QA0K6UZZ2ecEl3WRJXRH0rshMpahnK+cx2cBE0RbkN3ouw7lR3/dOIO+YtMbUrWduw/R hEJQfq0VHcdyBadUIkNSyxwfOAb7SE3UcYs06HGwglt9e3nsBVWrvh0dVSLI+8fMxsgi Gy70g8BmnBtxnMcQEErKdPCoZ1PqIyXX+6CbcMRv/UUPDmOm2u/cpNf08nGokGg5J0Tx JezQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HoKSlezc; spf=pass (google.com: domain of linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w15-20020a05620a444f00b007831f64c9c0si2358351qkp.353.2024.01.08.00.18.17 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 00:18:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=HoKSlezc; spf=pass (google.com: domain of linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19175-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DFFB61C21B8D for <ouuuleilei@gmail.com>; Mon, 8 Jan 2024 08:18:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57C28C148; Mon, 8 Jan 2024 08:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HoKSlezc" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42E698F7D for <linux-kernel@vger.kernel.org>; Mon, 8 Jan 2024 08:17:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-680a13af19bso15554666d6.0 for <linux-kernel@vger.kernel.org>; Mon, 08 Jan 2024 00:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704701868; x=1705306668; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=M7JX/XG4UeOfhBADs4/0tfMCsAlccOtRn7KjHfujLog=; b=HoKSlezcTZcYFJPKYQX48MdyKiQtxELN1qz5OYZTT7/qfX+hWS0xWujR3rPkVHmHYE /mwhsuBZyt0WPRarjqrDajpbqIXqPpfAResAncDLpdBO6EU+qePU04ZhYlLuA3KtPSYQ SsAnZsAJe3x9eYqtmavq6NkTB653NVB47gfHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704701868; x=1705306668; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M7JX/XG4UeOfhBADs4/0tfMCsAlccOtRn7KjHfujLog=; b=lzLj4qI7hIDc2ORYkMeXllKZ/qeYjNwJAeHOS3OE+X5ENFW8t9ZmiOx4GTOdRZLHnR Iubcdg8MbUdevV8dX2FEvM8PnA3InVAxFCzLjmsqV+cb7SV1ZLuM6WNSwP/aOMMrJYfj l4qg9bALQ/kaULf/xC+S9L5aslV/xA8AMUviEvUVj5ebH7IDxguZeEdff9iWr+DJmDZm FZlL/0/8FvevgEsIKlZwsdq1LvjQ8jocpB++ly9T+LiDOUuDHQeK3aTvT/EIyyNl/cxs HWokapjFrlj8Di202+0Hk2XUZTvK/Ka5VudRR1jJEI/p+H3LkXfKJDWry1bi92GJcM8L QAgg== X-Gm-Message-State: AOJu0Yz1yqPIkK1/+K2MMIHc5zqPQtj2PVw4+yQ2HPZAjLVtOg277apn noapz34CfgQIB2s+Kkjdfb6lTpvnG3aB X-Received: by 2002:a05:6214:c4b:b0:680:c789:c4f2 with SMTP id r11-20020a0562140c4b00b00680c789c4f2mr4369988qvj.86.1704701868179; Mon, 08 Jan 2024 00:17:48 -0800 (PST) Received: from denia.c.googlers.com (204.246.236.35.bc.googleusercontent.com. [35.236.246.204]) by smtp.gmail.com with ESMTPSA id x12-20020ad4458c000000b00681034fbc9esm924919qvu.94.2024.01.08.00.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 00:17:47 -0800 (PST) From: Ricardo Ribalda <ribalda@chromium.org> Date: Mon, 08 Jan 2024 08:17:46 +0000 Subject: [PATCH v4] media: ucvideo: Add quirk for Logitech Rally Bar Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240108-rallybar-v4-1-a7450641e41b@chromium.org> X-B4-Tracking: v=1; b=H4sIAKqvm2UC/3XM0QqCMBTG8VeRXbfYOU7TrnqP6GJuUwfq4qwkE d+9KQQRdvkdzu8/s2DJ2cDOyczIji44P8QhDwnTrRoay52Jm6HAFBCRk+q6qVLEodRW6FyazOY svt/J1u61pa63uFsXHp6mrTzCet2JjMCBF1ihkiYFkdcX3ZLv3bM/emrY2hnxn8Vos0KWJkdVZ iB3bPqxUoD4tmm0QlVQnrSVSuGPXZblDVULOwUbAQAA To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Alan Stern <stern@rowland.harvard.edu>, Mauro Carvalho Chehab <mchehab@kernel.org> Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, stable@vger.kernel.org, Ricardo Ribalda <ribalda@chromium.org> X-Mailer: b4 0.12.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787509496578547834 X-GMAIL-MSGID: 1787509496578547834 |
Series |
[v4] media: ucvideo: Add quirk for Logitech Rally Bar
|
|
Commit Message
Ricardo Ribalda
Jan. 8, 2024, 8:17 a.m. UTC
Logitech Rally Bar devices, despite behaving as UVC cameras, have a different power management system that the other cameras from Logitech. USB_QUIRK_RESET_RESUME is applied to all the UVC cameras from Logitech at the usb core. Unfortunately, USB_QUIRK_RESET_RESUME causes undesired USB disconnects, that make them completely unusable. Instead of creating a list for this family of devices in the core, let's create a quirk in the UVC driver. Fixes: e387ef5c47dd ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams") Cc: stable@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Alan Stern <stern@rowland.harvard.edu> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> --- Tested with a Rallybar Mini with an Acer Chromebook Spin 513 --- Changes in v4: - Include Logi Rally Bar Huddle (Thanks Kyle!) - Link to v3: https://lore.kernel.org/r/20240102-rallybar-v3-1-0ab197ce4aa2@chromium.org Changes in v3: - Move quirk to uvc driver - Link to v2: https://lore.kernel.org/r/20231222-rallybar-v2-1-5849d62a9514@chromium.org Changes in v2: - Add Fixes tag - Add UVC maintainer as Cc - Link to v1: https://lore.kernel.org/r/20231222-rallybar-v1-1-82b2a4d3106f@chromium.org --- drivers/media/usb/uvc/uvc_driver.c | 30 ++++++++++++++++++++++++++++++ drivers/media/usb/uvc/uvcvideo.h | 1 + 2 files changed, 31 insertions(+) --- base-commit: c0f65a7c112b3cfa691cead54bcf24d6cc2182b5 change-id: 20231222-rallybar-19ce0c64d5e6 Best regards,
Comments
On (24/01/08 08:17), Ricardo Ribalda wrote: > Logitech Rally Bar devices, despite behaving as UVC cameras, have a > different power management system that the other cameras from Logitech. > > USB_QUIRK_RESET_RESUME is applied to all the UVC cameras from Logitech > at the usb core. Unfortunately, USB_QUIRK_RESET_RESUME causes undesired > USB disconnects, that make them completely unusable. > > Instead of creating a list for this family of devices in the core, let's > create a quirk in the UVC driver. > > Fixes: e387ef5c47dd ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams") > Cc: stable@vger.kernel.org > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Alan Stern <stern@rowland.harvard.edu> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Devinder Khroad <dkhroad@logitech.com>
Hi Ricardo, Thank you for the patch. On Mon, Jan 08, 2024 at 08:17:46AM +0000, Ricardo Ribalda wrote: > Logitech Rally Bar devices, despite behaving as UVC cameras, have a > different power management system that the other cameras from Logitech. > > USB_QUIRK_RESET_RESUME is applied to all the UVC cameras from Logitech > at the usb core. Unfortunately, USB_QUIRK_RESET_RESUME causes undesired > USB disconnects, that make them completely unusable. > > Instead of creating a list for this family of devices in the core, let's > create a quirk in the UVC driver. > > Fixes: e387ef5c47dd ("usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams") > Cc: stable@vger.kernel.org > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Alan Stern <stern@rowland.harvard.edu> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> > --- > Tested with a Rallybar Mini with an Acer Chromebook Spin 513 > --- > Changes in v4: > - Include Logi Rally Bar Huddle (Thanks Kyle!) > - Link to v3: https://lore.kernel.org/r/20240102-rallybar-v3-1-0ab197ce4aa2@chromium.org > > Changes in v3: > - Move quirk to uvc driver > - Link to v2: https://lore.kernel.org/r/20231222-rallybar-v2-1-5849d62a9514@chromium.org > > Changes in v2: > - Add Fixes tag > - Add UVC maintainer as Cc > - Link to v1: https://lore.kernel.org/r/20231222-rallybar-v1-1-82b2a4d3106f@chromium.org > --- > drivers/media/usb/uvc/uvc_driver.c | 30 ++++++++++++++++++++++++++++++ > drivers/media/usb/uvc/uvcvideo.h | 1 + > 2 files changed, 31 insertions(+) > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c > index 08fcd2ffa727..9663bcac6843 100644 > --- a/drivers/media/usb/uvc/uvc_driver.c > +++ b/drivers/media/usb/uvc/uvc_driver.c > @@ -14,6 +14,7 @@ > #include <linux/module.h> > #include <linux/slab.h> > #include <linux/usb.h> > +#include <linux/usb/quirks.h> > #include <linux/usb/uvc.h> > #include <linux/videodev2.h> > #include <linux/vmalloc.h> > @@ -2233,6 +2234,8 @@ static int uvc_probe(struct usb_interface *intf, > } > > uvc_dbg(dev, PROBE, "UVC device initialized\n"); > + if (dev->quirks & UVC_QUIRK_FORCE_RESUME) > + udev->quirks &= ~USB_QUIRK_RESET_RESUME; If you don't mind, I'll move this above the debug message. > usb_enable_autosuspend(udev); > return 0; > > @@ -2574,6 +2577,33 @@ static const struct usb_device_id uvc_ids[] = { > .bInterfaceSubClass = 1, > .bInterfaceProtocol = 0, > .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTORE_CTRLS_ON_INIT) }, > + /* Logitech Rally Bar Huddle */ > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > + | USB_DEVICE_ID_MATCH_INT_INFO, > + .idVendor = 0x046d, > + .idProduct = 0x087c, > + .bInterfaceClass = USB_CLASS_VIDEO, > + .bInterfaceSubClass = 1, > + .bInterfaceProtocol = 0, > + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, > + /* Logitech Rally Bar */ > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > + | USB_DEVICE_ID_MATCH_INT_INFO, > + .idVendor = 0x046d, > + .idProduct = 0x089b, > + .bInterfaceClass = USB_CLASS_VIDEO, > + .bInterfaceSubClass = 1, > + .bInterfaceProtocol = 0, > + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, > + /* Logitech Rally Bar Mini */ > + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > + | USB_DEVICE_ID_MATCH_INT_INFO, > + .idVendor = 0x046d, > + .idProduct = 0x08d3, > + .bInterfaceClass = USB_CLASS_VIDEO, > + .bInterfaceSubClass = 1, > + .bInterfaceProtocol = 0, > + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, In an ideal world we would get a list of all devices that require the reset resume quirk from Logitech, and restrict the quirk to those devices only in the USB core. In the real world, this seems fine for now, we'll worry about this approach not scaling when we'll need to make it scale. > /* Chicony CNF7129 (Asus EEE 100HE) */ > { .match_flags = USB_DEVICE_ID_MATCH_DEVICE > | USB_DEVICE_ID_MATCH_INT_INFO, > diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h > index 6fb0a78b1b00..fa59a21d2a28 100644 > --- a/drivers/media/usb/uvc/uvcvideo.h > +++ b/drivers/media/usb/uvc/uvcvideo.h > @@ -73,6 +73,7 @@ > #define UVC_QUIRK_FORCE_Y8 0x00000800 > #define UVC_QUIRK_FORCE_BPP 0x00001000 > #define UVC_QUIRK_WAKE_AUTOSUSPEND 0x00002000 > +#define UVC_QUIRK_FORCE_RESUME 0x00004000 Let's name this UVC_QUICK_NO_RESET_RESUME, as that's what the quirk does. I'll make these small changes when applying, no need to resend. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > /* Format flags */ > #define UVC_FMT_FLAG_COMPRESSED 0x00000001 >
On 04.02.24 11:52, Laurent Pinchart wrote: > Hi Ricardo, > > Thank you for the patch. Hi, sorry for commenting on this late, but this patch has a fundamental issue. In fact this issue is the reason the handling for quirks is in usbcore at all. If you leave the setting/clearing of this flag to a driver you are introducing a race condition. The driver may or may not be present at the time a device is enumerated. And you have no idea how long the autosuspend delay is on a system and what its default policy is regarding suspending devices. That means that a device can have been suspended and resumed before it is probed. On a device that needs RESET_RESUME, we are in trouble. The inverse issue will arise if a device does not react well to RESET_RESUME. You cannot rule out that a device that must not be reset will be reset. I am sorry, but it seems to me that the exceptions need to go into usbcore. Regards Oliver
On Mon, Feb 12, 2024 at 01:22:42PM +0100, Oliver Neukum wrote: > On 04.02.24 11:52, Laurent Pinchart wrote: > > Hi Ricardo, > > > > Thank you for the patch. > > Hi, > > sorry for commenting on this late, but this patch has > a fundamental issue. In fact this issue is the reason the > handling for quirks is in usbcore at all. > > If you leave the setting/clearing of this flag to a driver you > are introducing a race condition. The driver may or may not be > present at the time a device is enumerated. And you have > no idea how long the autosuspend delay is on a system > and what its default policy is regarding suspending > devices. > That means that a device can have been suspended and > resumed before it is probed. On a device that needs > RESET_RESUME, we are in trouble. Not necessarily. If the driver knows that one of these devices may already have been suspend and resumed, it can issue its own preemptive reset at probe time. > The inverse issue will arise if a device does not react > well to RESET_RESUME. You cannot rule out that a device > that must not be reset will be reset. That's a separate issue, with its own list of potential problems. > I am sorry, but it seems to me that the exceptions need > to go into usbcore. If we do then we may want to come up with a better scheme for seeing which devices need to have a quirk flag set. A static listing probably won't be good enough; the decision may have to be made dynamically. Alan Stern
On Mon, Feb 12, 2024 at 02:04:31PM -0500, Alan Stern wrote: > On Mon, Feb 12, 2024 at 01:22:42PM +0100, Oliver Neukum wrote: > > On 04.02.24 11:52, Laurent Pinchart wrote: > > > Hi Ricardo, > > > > > > Thank you for the patch. > > > > Hi, > > > > sorry for commenting on this late, but this patch has > > a fundamental issue. In fact this issue is the reason the > > handling for quirks is in usbcore at all. > > > > If you leave the setting/clearing of this flag to a driver you > > are introducing a race condition. The driver may or may not be > > present at the time a device is enumerated. And you have > > no idea how long the autosuspend delay is on a system > > and what its default policy is regarding suspending > > devices. > > That means that a device can have been suspended and > > resumed before it is probed. On a device that needs > > RESET_RESUME, we are in trouble. > > Not necessarily. If the driver knows that one of these devices may > already have been suspend and resumed, it can issue its own preemptive > reset at probe time. > > > The inverse issue will arise if a device does not react > > well to RESET_RESUME. You cannot rule out that a device > > that must not be reset will be reset. > > That's a separate issue, with its own list of potential problems. > > > I am sorry, but it seems to me that the exceptions need > > to go into usbcore. > > If we do then we may want to come up with a better scheme for seeing > which devices need to have a quirk flag set. A static listing probably > won't be good enough; the decision may have to be made dynamically. I don't mind either way personally. Oliver, could you try to find a good solution with Ricardo ? I'll merge the outcome.
Hi Oliver Would you prefer a version like this? https://lore.kernel.org/all/20231222-rallybar-v2-1-5849d62a9514@chromium.org/ If so I can re-submit a version with the 3 vid/pids. Alan, would you be happy with that? Regards! On Tue, 13 Feb 2024 at 11:47, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > > On Mon, Feb 12, 2024 at 02:04:31PM -0500, Alan Stern wrote: > > On Mon, Feb 12, 2024 at 01:22:42PM +0100, Oliver Neukum wrote: > > > On 04.02.24 11:52, Laurent Pinchart wrote: > > > > Hi Ricardo, > > > > > > > > Thank you for the patch. > > > > > > Hi, > > > > > > sorry for commenting on this late, but this patch has > > > a fundamental issue. In fact this issue is the reason the > > > handling for quirks is in usbcore at all. > > > > > > If you leave the setting/clearing of this flag to a driver you > > > are introducing a race condition. The driver may or may not be > > > present at the time a device is enumerated. And you have > > > no idea how long the autosuspend delay is on a system > > > and what its default policy is regarding suspending > > > devices. > > > That means that a device can have been suspended and > > > resumed before it is probed. On a device that needs > > > RESET_RESUME, we are in trouble. > > > > Not necessarily. If the driver knows that one of these devices may > > already have been suspend and resumed, it can issue its own preemptive > > reset at probe time. > > > > > The inverse issue will arise if a device does not react > > > well to RESET_RESUME. You cannot rule out that a device > > > that must not be reset will be reset. > > > > That's a separate issue, with its own list of potential problems. > > > > > I am sorry, but it seems to me that the exceptions need > > > to go into usbcore. > > > > If we do then we may want to come up with a better scheme for seeing > > which devices need to have a quirk flag set. A static listing probably > > won't be good enough; the decision may have to be made dynamically. > > I don't mind either way personally. Oliver, could you try to find a good > solution with Ricardo ? I'll merge the outcome. > > -- > Regards, > > Laurent Pinchart
Oliver, friendly ping On Mon, 19 Feb 2024 at 16:13, Ricardo Ribalda <ribalda@chromium.org> wrote: > > Hi Oliver > > Would you prefer a version like this? > > https://lore.kernel.org/all/20231222-rallybar-v2-1-5849d62a9514@chromium.org/ > > If so I can re-submit a version with the 3 vid/pids. Alan, would you > be happy with that? > > Regards! > > On Tue, 13 Feb 2024 at 11:47, Laurent Pinchart > <laurent.pinchart@ideasonboard.com> wrote: > > > > On Mon, Feb 12, 2024 at 02:04:31PM -0500, Alan Stern wrote: > > > On Mon, Feb 12, 2024 at 01:22:42PM +0100, Oliver Neukum wrote: > > > > On 04.02.24 11:52, Laurent Pinchart wrote: > > > > > Hi Ricardo, > > > > > > > > > > Thank you for the patch. > > > > > > > > Hi, > > > > > > > > sorry for commenting on this late, but this patch has > > > > a fundamental issue. In fact this issue is the reason the > > > > handling for quirks is in usbcore at all. > > > > > > > > If you leave the setting/clearing of this flag to a driver you > > > > are introducing a race condition. The driver may or may not be > > > > present at the time a device is enumerated. And you have > > > > no idea how long the autosuspend delay is on a system > > > > and what its default policy is regarding suspending > > > > devices. > > > > That means that a device can have been suspended and > > > > resumed before it is probed. On a device that needs > > > > RESET_RESUME, we are in trouble. > > > > > > Not necessarily. If the driver knows that one of these devices may > > > already have been suspend and resumed, it can issue its own preemptive > > > reset at probe time. > > > > > > > The inverse issue will arise if a device does not react > > > > well to RESET_RESUME. You cannot rule out that a device > > > > that must not be reset will be reset. > > > > > > That's a separate issue, with its own list of potential problems. > > > > > > > I am sorry, but it seems to me that the exceptions need > > > > to go into usbcore. > > > > > > If we do then we may want to come up with a better scheme for seeing > > > which devices need to have a quirk flag set. A static listing probably > > > won't be good enough; the decision may have to be made dynamically. > > > > I don't mind either way personally. Oliver, could you try to find a good > > solution with Ricardo ? I'll merge the outcome. > > > > -- > > Regards, > > > > Laurent Pinchart > > > > -- > Ricardo Ribalda
diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 08fcd2ffa727..9663bcac6843 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -14,6 +14,7 @@ #include <linux/module.h> #include <linux/slab.h> #include <linux/usb.h> +#include <linux/usb/quirks.h> #include <linux/usb/uvc.h> #include <linux/videodev2.h> #include <linux/vmalloc.h> @@ -2233,6 +2234,8 @@ static int uvc_probe(struct usb_interface *intf, } uvc_dbg(dev, PROBE, "UVC device initialized\n"); + if (dev->quirks & UVC_QUIRK_FORCE_RESUME) + udev->quirks &= ~USB_QUIRK_RESET_RESUME; usb_enable_autosuspend(udev); return 0; @@ -2574,6 +2577,33 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTORE_CTRLS_ON_INIT) }, + /* Logitech Rally Bar Huddle */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x046d, + .idProduct = 0x087c, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, + /* Logitech Rally Bar */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x046d, + .idProduct = 0x089b, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, + /* Logitech Rally Bar Mini */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x046d, + .idProduct = 0x08d3, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_RESUME) }, /* Chicony CNF7129 (Asus EEE 100HE) */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 6fb0a78b1b00..fa59a21d2a28 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -73,6 +73,7 @@ #define UVC_QUIRK_FORCE_Y8 0x00000800 #define UVC_QUIRK_FORCE_BPP 0x00001000 #define UVC_QUIRK_WAKE_AUTOSUSPEND 0x00002000 +#define UVC_QUIRK_FORCE_RESUME 0x00004000 /* Format flags */ #define UVC_FMT_FLAG_COMPRESSED 0x00000001