From patchwork Fri Jun 17 10:36:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 583103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E613C433EF for ; Fri, 17 Jun 2022 10:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381847AbiFQKhB (ORCPT ); Fri, 17 Jun 2022 06:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381804AbiFQKgz (ORCPT ); Fri, 17 Jun 2022 06:36:55 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C8D46AA7E for ; Fri, 17 Jun 2022 03:36:54 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id fd6so2876323edb.5 for ; Fri, 17 Jun 2022 03:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WEnoe5l63wIa1jNma1QDgL58B8nnhb1HJqhp7b+Nz/Q=; b=fQh7eRXYbacxV0yL0hzxmropfe+B+joaDyx/Oa05t/HHbaMKwwGJDsUAvXJiv2gGu+ wyjOrYisi7WMSLb+GImWL/2ylIIH6JyM4GrOrghF1hyjZiDleDb177u0oiRVWx7AoRYg ahxkBj2zA/z93UWHz0I6KmOB33VquaZtkSXkk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WEnoe5l63wIa1jNma1QDgL58B8nnhb1HJqhp7b+Nz/Q=; b=FWeNQIk2pSA5JWrGBYcflTU9JUxn1wDHqoneDrEJgsHo0ZqEVokz7CSN29/LfbKf3B dC9r2rHWfpQKuVUXIk9sZ3wDlk7HeYzm27y1JOE0aWPPLtaCDO4FasuIk2skjDBEk+Si aUuTTS+n4PheRUzD/0fcuhNMK0F9zWn4w9jYyUjHC1yP8ZgjNv8RWFywKRm9lp1MSXi2 tptPvJ8B7Ao65PhFLKoVxDKDJ1FOlwKpjcQOcr30j8hJf36T6zWC+9IiCrIf0SGHyXEw t4psZ6PdCkx1+RJJWjsG0/U/Zakgzoyvvb/MxONfDyEYD5LSd9MP8un464dDmKbIV5VE FNAA== X-Gm-Message-State: AJIora8KTNDHa7XGhepIK5/65tm8iAelgDghZOIN5p3Xhgjrrx7tx0Sm Zmv4BTvQ5dyq365Ma2oSjatrSw== X-Google-Smtp-Source: AGRyM1thSlqusxo29lNjU+hskFWVRWRmhDl2DnbCA1Ubk1QGFGm2binC3Pbwn6GpBe4bdEDS6NbIgQ== X-Received: by 2002:a05:6402:1d48:b0:42d:d1a2:7c6d with SMTP id dz8-20020a0564021d4800b0042dd1a27c6dmr11588861edb.43.1655462212604; Fri, 17 Jun 2022 03:36:52 -0700 (PDT) Received: from alco.corp.google.com ([2620:0:1059:10:a86e:90:fb4:466e]) by smtp.gmail.com with ESMTPSA id z19-20020a056402275300b004319b12371asm3704340edd.47.2022.06.17.03.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:36:52 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, senozhatsky@chromium.org, yunkec@google.com Cc: Ricardo Ribalda Subject: [PATCH v7 2/8] media: uvcvideo: Add support for per-device control mapping overrides Date: Fri, 17 Jun 2022 12:36:39 +0200 Message-Id: <20220617103645.71560-3-ribalda@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220617103645.71560-1-ribalda@chromium.org> References: <20220617103645.71560-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Some devices do not implement all their controls in a way that complies with the UVC specification. This is for instance the case for several devices that do not support the disabled mode for the power line frequency control. Add a mechanism to allow per-device control mapping overrides to avoid errors when accessing non-compliant controls. Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_ctrl.c | 35 ++++++++++++++++++++++++++------ drivers/media/usb/uvc/uvcvideo.h | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index a709ebbb4d69..092decfdaa62 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -2403,9 +2403,8 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, { const struct uvc_control_info *info = uvc_ctrls; const struct uvc_control_info *iend = info + ARRAY_SIZE(uvc_ctrls); - const struct uvc_control_mapping *mapping = uvc_ctrl_mappings; - const struct uvc_control_mapping *mend = - mapping + ARRAY_SIZE(uvc_ctrl_mappings); + const struct uvc_control_mapping *mapping; + const struct uvc_control_mapping *mend; /* XU controls initialization requires querying the device for control * information. As some buggy UVC devices will crash when queried @@ -2433,14 +2432,38 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, if (!ctrl->initialized) return; - /* Process common mappings first. */ - for (; mapping < mend; ++mapping) { + /* + * First check if the device provides a custom mapping for this control, + * used to override standard mappings for non-conformant devices. Don't + * process standard mappings if a custom mapping is found. This + * mechanism doesn't support combining standard and custom mappings for + * a single control. + */ + if (chain->dev->info->mappings) { + bool custom = false; + unsigned int i; + + for (i = 0; (mapping = chain->dev->info->mappings[i]); ++i) { + if (uvc_entity_match_guid(ctrl->entity, mapping->entity) && + ctrl->info.selector == mapping->selector) { + __uvc_ctrl_add_mapping(chain, ctrl, mapping); + custom = true; + } + } + + if (custom) + return; + } + + /* Process common mappings next. */ + mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings); + for (mapping = uvc_ctrl_mappings; mapping < mend; ++mapping) { if (uvc_entity_match_guid(ctrl->entity, mapping->entity) && ctrl->info.selector == mapping->selector) __uvc_ctrl_add_mapping(chain, ctrl, mapping); } - /* And then version-specific mappings. */ + /* Finally process version-specific mappings. */ if (chain->dev->uvc_version < 0x0150) { mapping = uvc_ctrl_mappings_uvc11; mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings_uvc11); diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index c5b4febd2d94..fff5c5c99a3d 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -667,6 +667,7 @@ struct uvc_device_info { u32 quirks; u32 meta_format; u16 uvc_version; + const struct uvc_control_mapping **mappings; }; struct uvc_device { From patchwork Fri Jun 17 10:36:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 583102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D3D7C43334 for ; Fri, 17 Jun 2022 10:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381897AbiFQKhP (ORCPT ); Fri, 17 Jun 2022 06:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381836AbiFQKg7 (ORCPT ); Fri, 17 Jun 2022 06:36:59 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581836B004 for ; Fri, 17 Jun 2022 03:36:56 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id g7so5651429eda.3 for ; Fri, 17 Jun 2022 03:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nxHwUwUuK5U+dFx9/GDrIMCnRWc/PWyIrdKraztqqMs=; b=bKrBV0/MEMx50ydlkzLOhOZunA8jo2paFP4Qv58Yu6d+6ueqXJfA68/niCBEVCCGrd IdSiLARFSCEAevzaqhFBFtNGAOT/OLIkt89wIT8yVvb19YiVkCDkPz+KgdY/pBCQMspz uXE+mrhhkpz9kLTAqfmYVZ/c7UUyl2jzqRWF4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nxHwUwUuK5U+dFx9/GDrIMCnRWc/PWyIrdKraztqqMs=; b=Jud5MXRJFeqagXBytPqAeqnVrWSqFxVnGJl30EsXxqEbF24K/SWosteVS4N+cAAOTc P/jcDSXb8io8TfaK9FgebJdfrbQY5V7r5AtF7yn1jB7zgqFOfJHaYOpYt7OOXoqM9d4G xDECaMCwRBmT0AAnq0dpatI8WKGIB8ZEV9TJrBZWzRBue8T0zwqThzyl2sHqrrCf34j1 5QAax7aN8Zy0GUAbttPY3/UVpUAllynD5og/x0fklZ8BrX4cRnrj6OWwWs57Ynm5o12Q D8Isiptx8zV3nWOgq095b4ScFd4dpyKA50mRt7TorPNoBvolluPFDZ8yx77MApOXeqI2 VaYA== X-Gm-Message-State: AJIora+rinlwXUhZigBPVx3fMrYxO9tgLFkivr6K10waA3ORg0dCL+iZ cDZPb94dTFvn+Ga1ygYBhYx7Aw== X-Google-Smtp-Source: AGRyM1vbuV+JVTS15R79q5HUioNrVZfLZIK8XcOZSNVC+11xTLsFFl6xjlAn2w3q/w9ptbvbeKrUTg== X-Received: by 2002:a05:6402:4490:b0:435:640c:2abb with SMTP id er16-20020a056402449000b00435640c2abbmr1985034edb.301.1655462214730; Fri, 17 Jun 2022 03:36:54 -0700 (PDT) Received: from alco.corp.google.com ([2620:0:1059:10:a86e:90:fb4:466e]) by smtp.gmail.com with ESMTPSA id z19-20020a056402275300b004319b12371asm3704340edd.47.2022.06.17.03.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:36:54 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, senozhatsky@chromium.org, yunkec@google.com Cc: Ricardo Ribalda Subject: [PATCH v7 4/8] media: uvcvideo: Limit power line control for Quanta UVC Webcam Date: Fri, 17 Jun 2022 12:36:41 +0200 Message-Id: <20220617103645.71560-5-ribalda@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220617103645.71560-1-ribalda@chromium.org> References: <20220617103645.71560-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The device does not implement the power line control correctly. Add a corresponding control mapping override. Bus 001 Device 003: ID 0408:3090 Quanta Computer, Inc. USB2.0 HD UVC WebCam Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x0408 Quanta Computer, Inc. idProduct 0x3090 bcdDevice 0.04 iManufacturer 3 Quanta iProduct 1 USB2.0 HD UVC WebCam iSerial 2 0x0001 bNumConfigurations 1 Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 6c86faecbea2..4fb07084f1c0 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2643,6 +2643,32 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); * Driver initialization and cleanup */ +static const struct uvc_menu_info power_line_frequency_controls_limited[] = { + { 0, "Invalid" }, + { 1, "50 Hz" }, + { 2, "60 Hz" }, +}; + +static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_limited = { + .id = V4L2_CID_POWER_LINE_FREQUENCY, + .entity = UVC_GUID_UVC_PROCESSING, + .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL, + .size = 2, + .offset = 0, + .v4l2_type = V4L2_CTRL_TYPE_MENU, + .data_type = UVC_CTRL_DATA_TYPE_ENUM, + .menu_info = power_line_frequency_controls_limited, + .menu_min = 1, + .menu_count = ARRAY_SIZE(power_line_frequency_controls_limited), +}; + +static const struct uvc_device_info uvc_ctrl_power_line_limited = { + .mappings = (const struct uvc_control_mapping *[]) { + &uvc_ctrl_power_line_mapping_limited, + NULL, /* Sentinel */ + }, +}; + static const struct uvc_device_info uvc_quirk_probe_minmax = { .quirks = UVC_QUIRK_PROBE_MINMAX, }; @@ -2673,6 +2699,15 @@ static const struct uvc_device_info uvc_quirk_force_y8 = { * though they are compliant. */ static const struct usb_device_id uvc_ids[] = { + /* Quanta USB2.0 HD UVC Webcam */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x0408, + .idProduct = 0x3090, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, /* LogiLink Wireless Webcam */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, From patchwork Fri Jun 17 10:36:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 583101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD3A3C433EF for ; Fri, 17 Jun 2022 10:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381868AbiFQKhU (ORCPT ); Fri, 17 Jun 2022 06:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381835AbiFQKg7 (ORCPT ); Fri, 17 Jun 2022 06:36:59 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 277756B006 for ; Fri, 17 Jun 2022 03:36:57 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id fd6so2876323edb.5 for ; Fri, 17 Jun 2022 03:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eknO20DpjREAR8olUhraC51K66eHn6x17UHnd3DEaa8=; b=MS26u7DaOv6ziiY21jTHfyU7S//cZGKwdDT2kK3k0ryFpdvKTeXmsFywZ9AC/6ZR4Z At5YLy1D9Jk/f2lWDcg41xfF9DZcXJdOoToGabSeKiVDVh6Csf8yL2sr9/2IedqfDbv+ YMa3RDuJq9FnmBn+7hNFSA5wiCX6NLoyO28JI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eknO20DpjREAR8olUhraC51K66eHn6x17UHnd3DEaa8=; b=YIh/y4GQVwQBhx5Sid7su00sZQstfzFlXfy/J6LrVWndc+1gvxy0nxuZY33/FNq5zq pSwnLIO3qnGKEteWxuidZ+jH1StSZFBrwcMgHRXSDIUMkd/6L1mSIXVhByrse68dx3gV /Ynwx+mnN9hZcgaN9kzTjD6n3EJQB5Dkg10At4zglcprKefn6nJgbZxLhtfQdVJwRf/c 4aENJjc628/H7YbRg1KFRNAGX2kN3GzmiVADOZBpEYd1wTYEdLigHxi2dOCgYoFquvbP jovxtSvBx+cnsIFtvs7At74mD6U89iYjEGX/72lq0iw8AlxxPk7Jd86AM23HAYuxkKRD NNKQ== X-Gm-Message-State: AJIora8jeMSX7eUIaTJYTnboYCApXzCNni8pNsJL9UyhgXWBfgprJmHM UepiCGHEOHWz7iDkleAOkYhud99vDMr8qQ== X-Google-Smtp-Source: AGRyM1vjznye7jzu+nREIN9xuOIXLG5ykSqNy9VvlMGmXvqlr0uYc9Mrh7xJJaQnn5TKo5LopbhWqQ== X-Received: by 2002:a05:6402:2788:b0:431:3f86:1d4e with SMTP id b8-20020a056402278800b004313f861d4emr11857977ede.238.1655462216795; Fri, 17 Jun 2022 03:36:56 -0700 (PDT) Received: from alco.corp.google.com ([2620:0:1059:10:a86e:90:fb4:466e]) by smtp.gmail.com with ESMTPSA id z19-20020a056402275300b004319b12371asm3704340edd.47.2022.06.17.03.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:36:56 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, senozhatsky@chromium.org, yunkec@google.com Cc: Ricardo Ribalda Subject: [PATCH v7 6/8] media: uvcvideo: Limit power line control for Chicony Easycamera Date: Fri, 17 Jun 2022 12:36:43 +0200 Message-Id: <20220617103645.71560-7-ribalda@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220617103645.71560-1-ribalda@chromium.org> References: <20220617103645.71560-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Another Chicony camera device does not implement the power line control correctly. Add a corresponding control mapping override. Bus 001 Device 003: ID 04f2:b5eb Chicony Electronics Co., Ltd EasyCamera Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x04f2 Chicony Electronics Co., Ltd idProduct 0xb5eb bcdDevice 90.45 iManufacturer 3 Chicony Electronics Co.,Ltd. iProduct 1 EasyCamera iSerial 2 0001 bNumConfigurations 1 Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 5b8a71a9edfb..d21de83021f5 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2820,6 +2820,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_RESTRICT_FRAME_RATE) }, /* Chicony EasyCamera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x04f2, + .idProduct = 0xb5eb, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, + /* Chicony EasyCamera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, .idVendor = 0x04f2, From patchwork Fri Jun 17 10:36:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 583100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB36C433EF for ; Fri, 17 Jun 2022 10:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381920AbiFQKhW (ORCPT ); Fri, 17 Jun 2022 06:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381858AbiFQKhM (ORCPT ); Fri, 17 Jun 2022 06:37:12 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95D3C6B00A for ; Fri, 17 Jun 2022 03:37:00 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id kq6so7933013ejb.11 for ; Fri, 17 Jun 2022 03:37:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7CbeHNxpi9+s0qv2gIQi33L5PMDbofgWDLYkT2RlfqU=; b=H47yQCGCYQVV1o+mKCF4P4ZJ82sQp7QqRAXTucT/Cgnl/74uZxFHs1vnX1pjZQjjBe SFJJyJhRmmdwwkMuVcpw2DI1ym6bIg3kBry27+owFAYz5OOOMcSsd9Y6IFpleOseSLyW /uR5aY8aivbhLPENJl/3EVol5NHkBRxUtRgPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7CbeHNxpi9+s0qv2gIQi33L5PMDbofgWDLYkT2RlfqU=; b=bxKonkvRQdhu5ly4n5n4bfJWYpsdD9+9bzHyf6vWWTPM9KllL2OJ+T96kwM3IuKKEK NvGh99JyTcIfcCW98pHpgP4AXaVnyQlA/IbyE/UhDnEveGifd0cPqDxfI+ngEsEStTib RyRXc885FH+j72l5mGNDb0tdEmpQw8VpbrJOH+CxoQB1FIiq2f1RWlZlcD/3jMLRDfr2 UJdpS9/RyXZIrcNVihtuIytdO8OW4M/y7QfMmB4Ay73aDpvhhl9DwFlorkNyCQWMny4t 6veW2iZFLGQwljsk8hFfGp1w3n52vdhhfCjOyywHbEdt1vS7GpIbKsUtvNcLdAa5U+S/ xxng== X-Gm-Message-State: AJIora8jdf//Jxq9EQDlAUEAsxzI8fMhEQJKwdrphHnO4EQhSotyzJP5 tQjHgOF2R7Qlt19z6XRXIDeW4A== X-Google-Smtp-Source: AGRyM1vlbTH8+RBIK41fs93b7FZ1GsvD9UQCsPhpxe0YKUM6xZJ59ddoAWvGmBxVLczfKisqHPP1QA== X-Received: by 2002:a17:906:209:b0:712:12d8:b52b with SMTP id 9-20020a170906020900b0071212d8b52bmr8586607ejd.394.1655462219092; Fri, 17 Jun 2022 03:36:59 -0700 (PDT) Received: from alco.corp.google.com ([2620:0:1059:10:a86e:90:fb4:466e]) by smtp.gmail.com with ESMTPSA id z19-20020a056402275300b004319b12371asm3704340edd.47.2022.06.17.03.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:36:58 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, tfiga@chromium.org, senozhatsky@chromium.org, yunkec@google.com Cc: Ricardo Ribalda Subject: [PATCH v7 8/8] media: uvcvideo: Limit power line control for Acer EasyCamera Date: Fri, 17 Jun 2022 12:36:45 +0200 Message-Id: <20220617103645.71560-9-ribalda@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220617103645.71560-1-ribalda@chromium.org> References: <20220617103645.71560-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The device does not implement the power line control correctly. Add a corresponding control mapping override. Bus 001 Device 003: ID 5986:1172 Acer, Inc EasyCamera Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x5986 Acer, Inc idProduct 0x1172 bcdDevice 56.04 iManufacturer 3 Bison iProduct 1 EasyCamera iSerial 2 bNumConfigurations 1 Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index a862a9d6a2fd..6d34992032e6 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -3248,6 +3248,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) }, + /* Acer EasyCamera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x5986, + .idProduct = 0x1172, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = 0, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, /* Intel RealSense D4M */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,