From patchwork Fri Nov 4 09:42:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 621967 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 8F436C433FE for ; Fri, 4 Nov 2022 09:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231146AbiKDJnP (ORCPT ); Fri, 4 Nov 2022 05:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiKDJnN (ORCPT ); Fri, 4 Nov 2022 05:43:13 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C4B326AD7 for ; Fri, 4 Nov 2022 02:43:11 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id x2so6801600edd.2 for ; Fri, 04 Nov 2022 02:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Q2Rj7oXeRCyveRfch3/Fx7c6AIRiPDkNQdj+nNAZunY=; b=J6DehIQ+t0c6xRVWAsjD/274gbzh90pS2iMg0Nyhw5utxaEe7PO1a8JmVlqpkgqoZt PR3qcMo0Q5SvxqhC3esdrNoiRL7YQjyVe9mgngfwvudYc6GKHJw+huZ09Z1ChEPccshY WB2taB/gmU0O5JOFXuWDBJ5o53QdEQ4EDZQnE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q2Rj7oXeRCyveRfch3/Fx7c6AIRiPDkNQdj+nNAZunY=; b=5xt07BoyJu408FGi+phhY0Co7imiDhq2BPSNV0xvk4UYKnVAnhw7uPZInAIl7qQMBr ZDYUVN/G2+Salu90oIULMgZVEDWSAei0oU7qzYRBeNGKRh8qb0aBT8Rck2/vTSSpWxT9 ls+ggN+s3bfmc1OOmOOIfpZ9kUbEpOiSkAR2wTo7Bft8hO99coUYWFvOXs2bo4fpuGqp WXIecgcnxHwaXmvDICXdRtk7fAve530XIYGVjLvIhGh/1quBJ5MHGcmboYUCG3HyXojb 670UvEXqmreowplZ3XVjMmNFiD0dYI+liH4nzjuu0nv7bfJHVgFEyZGtk2W3OQ2Od2o4 sCpg== X-Gm-Message-State: ACrzQf3xIkkDCgdtUENWBaJSs0jQcP1qA1apI55EmDziY2jRpTLYdtxH yoYtGER7hkGnQ0KDjU3NgP7rzw== X-Google-Smtp-Source: AMsMyM76XLEnDCNl4o1OhzzXxknOqcX+Ro2CY517yEDpFaxw3sg3j4ubowxK7Fw7Ea+Fa01B7D8tFQ== X-Received: by 2002:a05:6402:3223:b0:461:8635:e5c with SMTP id g35-20020a056402322300b0046186350e5cmr34923977eda.303.1667554990152; Fri, 04 Nov 2022 02:43:10 -0700 (PDT) Received: from alco.roam.corp.google.com ([2620:0:1059:10:943d:d0b8:228:b5e0]) by smtp.gmail.com with ESMTPSA id y14-20020a17090668ce00b0078b03d57fa7sm1561653ejr.34.2022.11.04.02.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 02:43:09 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 04 Nov 2022 10:42:49 +0100 Subject: [PATCH v2 1/2] media: uvcvideo: Limit power line control for Acer EasyCamera MIME-Version: 1.0 Message-Id: <20221101-easycam-v2-1-5956414a608c@chromium.org> References: <20221101-easycam-v2-0-5956414a608c@chromium.org> In-Reply-To: <20221101-easycam-v2-0-5956414a608c@chromium.org> To: Mauro Carvalho Chehab , Laurent Pinchart Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, Ricardo Ribalda , linux-media@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1673; i=ribalda@chromium.org; h=from:subject:message-id; bh=WAXYaKlS+U0BAisoNzFRqw7KfOhvLdljPgk5tEiOIao=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjZN6lWo0x/AZhYJZ6S+ONUrKArm+vMID97q/2XRSD mTTVNWWJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY2TepQAKCRDRN9E+zzrEiFTeEA CSAYYHN/OtETAgjViXi7g5y0eOzD6L5FmshWWgpgWZus64ShD1PKEkhS64B4EAP1zcQrPMoTosnihh l8P/8wJhoF+lj1ZBe12xeYki0FTzyCgF62jplS3XRBMT7hgiZzWEZOBa4qHE9gJH8RvpQaMmvUokAI xB3UJF1Y9iH3qbw6ox0C+C6m9fJ3N1U1EDz4qZcMcH2wqaZkVdNvmvycMzAFWJDAzNipMwp9/rupNg QsxxiQqoDCCURk/Qe/URwyX3v9EDgn0qV3CPJtsSQ8KXVZSnByJGibxmgY4Iz3fJ8ifyW6D2PtXPjN hDlEBfrwCoNRgEhmeHdXooD7ORy9k3je5mHlI3eP3mR0X6+mYxFJk5TOzi2pzoQpnoBafaMv/fWLwl OYq5vaoOgCMyQIdqm3ZOr5ZwhzTriXoSE++8DFQQRTl1Rv8iXmuM4KBiAsKSIrndYAzJ6IqLhmxnLk SglAwvG0aW1fl9oLgNgQTjqXgzzBVChGILd2R6+lINJ2FXPY+mebQIi8TePMGDLn+1Gsqb+bfYDpwe F4P6BEs8j1ZG4L5WS/ABRH7oWaXOs0wgcqPg3LU31z+okroHJAEubwXpAN4L9AHqFDzmWnlRPJrVpP T4jrt7QzOQxu4OtIwWCThXQOZPYIpVOveueKcECvS/G/otBKzZ87vKAnd1WA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 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 003 Device 002: ID 5986:1180 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 0x1180 bcdDevice 56.04 iManufacturer 3 Bison iProduct 1 EasyCamera iSerial 2 bNumConfigurations 1 Signed-off-by: Ricardo Ribalda Reviewed-by: Sergey Senozhatsky diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 215fb483efb0..cca3012c8912 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2994,6 +2994,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_limited }, + /* Acer EasyCamera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x5986, + .idProduct = 0x1180, + .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, From patchwork Fri Nov 4 09:42:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 621575 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 5C798C4332F for ; Fri, 4 Nov 2022 09:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231244AbiKDJnR (ORCPT ); Fri, 4 Nov 2022 05:43:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230222AbiKDJnN (ORCPT ); Fri, 4 Nov 2022 05:43:13 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7187B2A72A for ; Fri, 4 Nov 2022 02:43:12 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id v17so6773500edc.8 for ; Fri, 04 Nov 2022 02:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RbBORJC/QmgbxjRF25o4c3oE3vegMXT7XiOqsa/2p68=; b=d8NwF73cq9OrTXtvWBqjXMUJ+pCc6djNWNosDnjKINdA1it3r0UloyR+bPgBbceod0 6rkwJoYqRiIrnfgWBU+jSpiBSMCRltxwI/fWDcVF9xpFp1t5a46ESuSdwNRkKhA4CX8E RNSIy9PQMp/DiR3nUH1AyyhhLC6leC4u/MwYs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RbBORJC/QmgbxjRF25o4c3oE3vegMXT7XiOqsa/2p68=; b=Aa1UsOGXkcsdYMvOV4v6Y/4dBxRAr2oi3IBQ4/C00jPHKVhIJ2SivixAGpJUywvTp9 2AP41BFxfHb5xMaobKROYyV97Y8eDekW4+aCBCgBd/1bm4MIvX+8nBdWOBeEmSGOnbUp WzOudfLFQcVCVh/XkRnN6QK4EPhaF62wU/RibFRNS+skA7yAQe2UdJkxTEI9cpajeNNf AwdOvUQ9auKxqSaExA4fK7TFtifUQfjy7wWUQewvUj/+R5K8en2A2V5YviUBKPlNyt/B kbmDXDBzvnbXbiDaNMWCCQYCiM8ggyb/QP6x0wb1SZZEoaFC1jLlyWVGElc5w/OMejVy VyRA== X-Gm-Message-State: ACrzQf2s41JnYXYrtbtQLxa3k4UheyBkRUF6INi12m+/emFgU0xFzxkG JUeoB2qeXKGuc2I5z54LVUNytg== X-Google-Smtp-Source: AMsMyM4m0LZEwm1C7vBNwy00IzC1yqMr/NYB8Ckci64mGFfdTMQsibc97hSMhS5MGfOJFpKttVzjHw== X-Received: by 2002:aa7:c504:0:b0:461:122b:882b with SMTP id o4-20020aa7c504000000b00461122b882bmr35524938edq.14.1667554991051; Fri, 04 Nov 2022 02:43:11 -0700 (PDT) Received: from alco.roam.corp.google.com ([2620:0:1059:10:943d:d0b8:228:b5e0]) by smtp.gmail.com with ESMTPSA id y14-20020a17090668ce00b0078b03d57fa7sm1561653ejr.34.2022.11.04.02.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 02:43:10 -0700 (PDT) From: Ricardo Ribalda Date: Fri, 04 Nov 2022 10:42:50 +0100 Subject: [PATCH v2 2/2] media: uvcvideo: Limit power line control for Lenovo Integrated Camera MIME-Version: 1.0 Message-Id: <20221101-easycam-v2-2-5956414a608c@chromium.org> References: <20221101-easycam-v2-0-5956414a608c@chromium.org> In-Reply-To: <20221101-easycam-v2-0-5956414a608c@chromium.org> To: Mauro Carvalho Chehab , Laurent Pinchart Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, Ricardo Ribalda , linux-media@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2716; i=ribalda@chromium.org; h=from:subject:message-id; bh=ENmfc6jAlhgXvRiJulSIDkbijiA6A6+oFRVAvaXy2YQ=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjZN6oqnAn+oJ0JgZTMLmDhSl7uGi90MI3cMVSxTqC BqyC6fKJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY2TeqAAKCRDRN9E+zzrEiOQrD/ 9looNaSwrLKepZCEVbLZamnX+Xf83gJvQvVHf7IOsXs+zi10VEl3pFqZYC4sf0jJz2xUxiQtjLwjFK VIci6Ztaet8qZcToLsHwNUM0cauB6aF2skIYHaERxhYX0SvE3NbkncEh4JcK/NY68ikvwwwSTzyn/O phYXwGe47SZNbUioN7rRIBzidScZ3FNI/X0/mCLVPMJJ4xt/zKuZxWfaYWwdPF2nyVL779dTcmAfFt 7rz/ggZmuH9n6Y2JwW+CkszUaGm2ewFX6MkKfG6JNVWwOlLjmQl69DcqWPC8F7DXiYP2tg7dYoc+i8 24Zq4tKh0qjq+/JcsRzZk7Xwe89FIqnSfHch205+qdrwY0Y8gU8Sm8Mizi+EIJrCAs1y0jKpHn2cgn ErBC+K1ZGTHsEwyUOaL6LcQQwDw58YNSyJFWX6ABvuGN5qwOUWJvtfE7mPvRIHOgrYNXMdZiI++tzE RsU7htBM4Kyl+g2p8iZWB5KkrIfvcKIkREm/1hk/BWI6BcpJhw8L0kUQ0AWUUuA7lQ1Vm8OXsV7dRF i1hxv9eCY/GnrWhwkee55NnRI5iB0pEWAwaJsMFdfcqGn87scee0snKmsvQ0K8PfG52hCfwE+mNtaP mC05jeJreBwqSTtpuFtGIhB1IJ9CEAjr6+V0KgqzP3x3G1dgLY3VSovX10WA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 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 003 Device 002: ID 30c9:0093 Lenovo Integrated Camera Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.01 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x30c9 idProduct 0x0093 bcdDevice 0.07 iManufacturer 3 Lenovo iProduct 1 Integrated Camera iSerial 2 8SSC21J75356V1SR2830069 bNumConfigurations 1 Signed-off-by: Ricardo Ribalda diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index cca3012c8912..e0bb21f2e133 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2373,6 +2373,30 @@ MODULE_PARM_DESC(timeout, "Streaming control requests timeout"); * Driver initialization and cleanup */ +static const struct uvc_menu_info power_line_frequency_controls_uvc11[] = { + { 0, "Disabled" }, + { 1, "50 Hz" }, + { 2, "60 Hz" }, +}; + +static const struct uvc_control_mapping uvc_ctrl_power_line_mapping_uvc11 = { + .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_uvc11, + .menu_count = ARRAY_SIZE(power_line_frequency_controls_uvc11), +}; + +static const struct uvc_device_info uvc_ctrl_power_line_uvc11 = { + .mappings = (const struct uvc_control_mapping *[]) { + &uvc_ctrl_power_line_mapping_uvc11, + NULL, /* Sentinel */ + }, +}; static const struct uvc_menu_info power_line_frequency_controls_limited[] = { { 1, "50 Hz" }, { 2, "60 Hz" }, @@ -2976,6 +3000,15 @@ static const struct usb_device_id uvc_ids[] = { .bInterfaceSubClass = 1, .bInterfaceProtocol = 0, .driver_info = UVC_INFO_QUIRK(UVC_QUIRK_FORCE_BPP) }, + /* Lenovo Integrated Camera */ + { .match_flags = USB_DEVICE_ID_MATCH_DEVICE + | USB_DEVICE_ID_MATCH_INT_INFO, + .idVendor = 0x30c9, + .idProduct = 0x0093, + .bInterfaceClass = USB_CLASS_VIDEO, + .bInterfaceSubClass = 1, + .bInterfaceProtocol = UVC_PC_PROTOCOL_15, + .driver_info = (kernel_ulong_t)&uvc_ctrl_power_line_uvc11 }, /* Sonix Technology USB 2.0 Camera */ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO,