Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12014858rwl; Tue, 3 Jan 2023 07:53:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXu9mzH9A17B47GzVPt9eqjGV6CW0TNJVS+V74BJCA8QJ+vYjUcTOTR0l8r881VyZYxeYqhk X-Received: by 2002:a17:906:2a05:b0:7c1:e7a:62e6 with SMTP id j5-20020a1709062a0500b007c10e7a62e6mr9454688eje.71.1672761219587; Tue, 03 Jan 2023 07:53:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672761219; cv=none; d=google.com; s=arc-20160816; b=b4ErLKsl9xaL4upwi4yJggRLQ73I3PPTj2NlEJyua+KEetn1juOqwH017qOXGI0cyl wc/jtSdL0SNgvUWLjJddSwT0WrNt06h53L2pwOQIxaw+x9G9JP6FR4XZL+drNRWvuPcn 8ICQ9p3txxxoZ5Q8e+ZS9ELYCnYOlewdN5rKwtsJMCGKZV5ZPNBcp2YtUr5yBpcCQZDM J9DrB5rbINvOsH4erx+KzLjlJH2oB85gYgvHvFFODGUef8xUQ3eRp7o4SJ+yaDHvYFPd u/PyqS9xs/eYWTOpQmuBXKoxadKbLCDKnTRGq/PKVKz5z0IIxieei6ihHeRLqAKX3MBl ksGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zN43642gf6m2iJUfZd4fbuXcS7p5ZWKPgIXLavZJc80=; b=nD8hygnLJcVrDO724DNyIvip7MxqTzVUlzzzlcKso3JqmMQu/SJI5dsB1+5YKKmy3L tTPPw0zDUNjOwp2gkTkAtmSryjtqXOfer9VvVkO1d/N8iYV5/JwH6j/sZY7bq0rsQUZg Q3g7KMYmvrH4q86DX3YB54L5aFrG28zqWjiv6WvrO58mkbFzqEcsIajWgqWXESyIZpfh Aa8FPeV61Ckng+4MrurcVDVdkZjnFmkgBVi83qU8kyAh0/OMbFj0XyAayS4EHO9FqMw0 jZ2FIytlV8lvQfnnfzkHhQUJkoLMI6TbsYm8cuyNAbJdmwaHisQaP3sflbPydWQdM3eX 2rAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hAyKDVhX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb13-20020a170907070d00b007c146656546si28039233ejb.317.2023.01.03.07.53.25; Tue, 03 Jan 2023 07:53:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hAyKDVhX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbjACPlK (ORCPT + 60 others); Tue, 3 Jan 2023 10:41:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237551AbjACPlI (ORCPT ); Tue, 3 Jan 2023 10:41:08 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8CFC112F for ; Tue, 3 Jan 2023 07:41:02 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id 18so8630078pfx.7 for ; Tue, 03 Jan 2023 07:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zN43642gf6m2iJUfZd4fbuXcS7p5ZWKPgIXLavZJc80=; b=hAyKDVhXHfSe07gBZbIH52NGV52T983hzKY328Bsw3nN1xYmmbDMjL2CqNVsuahwkH YbUNBaLRZmVE7oQvdkWHmLSm3ho7lW8Xb3MdK/AG4oSzt/nhlVJio2QNYDRgwiK5YBJG xPjLinGQxV2EGm7l62yva+ajGQhGCMBoGKVT0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zN43642gf6m2iJUfZd4fbuXcS7p5ZWKPgIXLavZJc80=; b=CdstINpa6KZDFd2jufVetVQYp4f+Xvj+BTJl2oVKGymnxrtLACDjMSK3rgS0F59+75 v2EX8MZuDgU1oQJXR6mWJRm9UdQEuWeklEvzakDyhNPHjWMQ7PAq5s/A5XootM1xI7ck XSbGcExzXDm31SkXbHsUFgXZwRKuATlhesRfdOlR7jZ5QOKk7oi0WJpyrIYv9l8EzPsu Rv0ZCToLL61rTe3HSnWVDr8ofkmgnrjiB0GTZIrp1v0hxkGkadSzzMZ4cR8ITRU4JJ6Z PWBo/28O5DqgNfEHd5/EyfMC8wMuMOJmpGPOzaBS5YqagB5hSZpXst5aJHG9652QAov0 Mngg== X-Gm-Message-State: AFqh2kpilXrjVTKJd+Gt1hMQzBmEyj1POrHDtlB1dhomfN5Lvs/ezpyb iFFwmx3b86c11IlYnkRP2oKQVfgKpxKoKNluHiA= X-Received: by 2002:a62:5e04:0:b0:575:62f8:be3 with SMTP id s4-20020a625e04000000b0057562f80be3mr43373903pfb.23.1672760461586; Tue, 03 Jan 2023 07:41:01 -0800 (PST) Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com. [209.85.210.172]) by smtp.gmail.com with ESMTPSA id x128-20020a623186000000b0056283e2bdbdsm20633039pfx.138.2023.01.03.07.41.00 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Jan 2023 07:41:00 -0800 (PST) Received: by mail-pf1-f172.google.com with SMTP id k137so16027231pfd.8 for ; Tue, 03 Jan 2023 07:41:00 -0800 (PST) X-Received: by 2002:a65:5b88:0:b0:495:fb5f:4395 with SMTP id i8-20020a655b88000000b00495fb5f4395mr1805013pgr.63.1672760459505; Tue, 03 Jan 2023 07:40:59 -0800 (PST) MIME-Version: 1.0 References: <20220920-resend-hwtimestamp-v2-0-0d7978a817cc@chromium.org> <20220920-resend-hwtimestamp-v2-2-0d7978a817cc@chromium.org> In-Reply-To: From: Ricardo Ribalda Date: Tue, 3 Jan 2023 16:40:48 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RESEND v2 2/8] media: uvc: Allow quirking by entity guid To: Laurent Pinchart Cc: Mauro Carvalho Chehab , "hn.chen" , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomasz Figa Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Laurent On Fri, 30 Dec 2022 at 14:40, Laurent Pinchart wrote: > > Hi Ricardo, > > Thank you for the patch. > > > On Fri, Dec 02, 2022 at 06:02:42PM +0100, Ricardo Ribalda wrote: > > When an IP is shared by multiple devices its erratas will be shared by > > all of them. Instead of creating a long list of device quirks, or > > waiting for the users to report errors in their hardware lets add a > > routine to add quirks based on the entity guid. > > I'm not thrilled by this. An entity is not an "IP". Quirks are needed to > handle issues with particular firmware versions on particular devices. > The same entity GUID can be used by different devices running different > firmware versions, some that would require a quirk and some that > wouldn't. Unfortunately there are ISPs that do not support firmware upgrading that have an error on their firmware (or in this particular case a different interpretation of the standard). Those ISPs are mounted in different boards with a VID:PID that is chosen by the module manufacturer. In those cases we cannot get a list of the devices that are broken, we could only get a sublist that we will keep updating indefinitely as users keep reporting bugs (if they do so). We are lucky enough that SunplusIT has been very active and provided us a way to detect what hardware requires quirking. In those situations where the vendor is on board and there is no upgrade mechanism I think that this is a good compromise. > > > Tested-by: HungNien Chen > > Signed-off-by: Ricardo Ribalda > > --- > > drivers/media/usb/uvc/uvc_driver.c | 25 +++++++++++++++++++++++++ > > 1 file changed, 25 insertions(+) > > > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c > > index 9c05776f11d1..c63ecfd4617d 100644 > > --- a/drivers/media/usb/uvc/uvc_driver.c > > +++ b/drivers/media/usb/uvc/uvc_driver.c > > @@ -1493,6 +1493,28 @@ static int uvc_parse_control(struct uvc_device *dev) > > return 0; > > } > > > > +static const struct uvc_entity_quirk { > > + u8 guid[16]; > > + u32 quirks; > > +} uvc_entity_quirk[] = { > > +}; > > + > > +static void uvc_entity_quirks(struct uvc_device *dev) > > +{ > > + struct uvc_entity *entity; > > + int i; > > unsigned int > > > + > > + list_for_each_entry(entity, &dev->entities, list) { > > + for (i = 0; i < ARRAY_SIZE(uvc_entity_quirk); i++) { > > + if (memcmp(entity->guid, uvc_entity_quirk[i].guid, > > + sizeof(entity->guid)) == 0) { > > + dev->quirks |= uvc_entity_quirk[i].quirks; > > + break; > > + } > > + } > > + } > > +} > > + > > /* ----------------------------------------------------------------------------- > > * Privacy GPIO > > */ > > @@ -2452,6 +2474,9 @@ static int uvc_probe(struct usb_interface *intf, > > goto error; > > } > > > > + /* Apply entity based quirks */ > > + uvc_entity_quirks(dev); > > + > > dev_info(&dev->udev->dev, "Found UVC %u.%02x device %s (%04x:%04x)\n", > > dev->uvc_version >> 8, dev->uvc_version & 0xff, > > udev->product ? udev->product : "", > > > > -- > Regards, > > Laurent Pinchart -- Ricardo Ribalda