Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp283318iog; Fri, 17 Jun 2022 03:38:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uWWGaCKTyQuF9uAi2uK304TyYqMqBMkgoD/7pFtF0prG+oieoLGDTVDvNDZe5Gd8ouuYAR X-Received: by 2002:a63:8641:0:b0:3fd:94e8:a650 with SMTP id x62-20020a638641000000b003fd94e8a650mr8674123pgd.367.1655462321040; Fri, 17 Jun 2022 03:38:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655462321; cv=none; d=google.com; s=arc-20160816; b=G9+WQTN9dWkvAN/RGrRIMbF8eQvs1st8GBMoPu2o/phJHuagdcihGNWUazjz9VcM1q U9s3i7Lfp92Uw1oQ+nulo/wufqKlCoTYbg09P7Er5q8aRlnR+I9nWf4LEN+DTlyglP8m TRN/HBL32D0ResdvmnPEgJNdfmcSThwsrKN2VDWe6Un768l07vw7Y7Ozt/UxEV4RrY/h 5p7Ti25YU3D375BWlS9gpkAXdP3KFiXR77x6MemofUpEwQm9BSk874n2fSMWeZ5n3w/7 4EQFCyW3hKIdk2Ev7wrfdogsGD0fqQ3AFuPknLTH3doAzjeO7CfNIUEAXZYuWrXACPvW k/dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OWXOrfm/9NlVmpLfpsXcZqYVwwJxQb+7BpdjaEQ5k6g=; b=u7STtVs6gEdtJoGHXI6jJ5waxWuZZ4Z1upYyE8kMeYgRRL5SGSoR+TR+89ZnbbJi7s MW6ItC94sD3/B6+h2mEFFaibC2ebR9dGsfrHbr+WkGRy44e21vEwn5gv8FoKGowVMOm/ RwldzwJnhLMxj8uavN1jB1rqBe08dFYobthnSnlP2z7P1KkLDFsyYOgmirU9p7+cnmah 8U2PrQp5ATiWJ0RbUeWdkuyIbXipjNNIAyJq4OHRHeSvFn00/GK0+isfJKQL5VgNRPzr r0XGmXCUUt9/2hYA4NameRe4iPjjHvELecG+00RbRr/Nz1jh0q7sy5sDtTnzvr0L9CWx kUgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VqpmmgwB; 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 j11-20020a056a00234b00b0051c10b55b92si5601177pfj.187.2022.06.17.03.38.26; Fri, 17 Jun 2022 03:38:41 -0700 (PDT) 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=VqpmmgwB; 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 S1381813AbiFQKg5 (ORCPT + 99 others); Fri, 17 Jun 2022 06:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381638AbiFQKgx (ORCPT ); Fri, 17 Jun 2022 06:36:53 -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 AF93D6AA6F for ; Fri, 17 Jun 2022 03:36:52 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id d14so5602478eda.12 for ; Fri, 17 Jun 2022 03:36:52 -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=OWXOrfm/9NlVmpLfpsXcZqYVwwJxQb+7BpdjaEQ5k6g=; b=VqpmmgwB9gpg08sRLNNq2XcQRtywaBLgHK4xMwR5pdGmiUfO8h1ZjX81chGhBPMRRh s9oMNg02+R4kYGfMALJvOdjWx3sdjoK/HlijaShqMOoWkLPFQwhRZPyXLEgU1+Y7hFs+ I2jvD46HvfucBjlrObdmcagqCZgqpbTYFytOk= 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=OWXOrfm/9NlVmpLfpsXcZqYVwwJxQb+7BpdjaEQ5k6g=; b=b5/uE5zUjzqupqZwUO/6DNSDYNyPiWedDAXdt9ehMjcU10JWvFzSsOGOqvFvalsFeP 2kLu8GOmTISF5M+vQiPJjK/il9wUDhMbRJ8EzL24W9dAngb73Le3JJVzo67BDvMLx+Pk Dw9fMNG6r+TLlKFFSg8T88mSQZ53wpA1cNVcmLDdYzlXQEz7weIfVvipxVFUyRkh0/IN ZKSPwKnzmMMVKhMFpSlBvg3uAYuiOy4EIuIqkK9mD9z/FEIet3CVy71swu7mHgmpLwfE WPCgEiLPxalS+RpMzjcOTl2xyfC96PXINqK0XaisX+oX27+3W1xoYd+tocg4HRD99HsF KLYA== X-Gm-Message-State: AJIora/amAjYVc+r6nfIlCnE6n81dUlnQCCD0Cl3+W5B9FGBfW6320MY G6+s0CqrRW/LCECNSL7zmkx9wA== X-Received: by 2002:a05:6402:274a:b0:42d:dcd1:c847 with SMTP id z10-20020a056402274a00b0042ddcd1c847mr11590035edd.169.1655462211289; Fri, 17 Jun 2022 03:36:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jun 2022 03:36:50 -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 1/8] media: uvcvideo: Add missing value for power_line_frequency Date: Fri, 17 Jun 2022 12:36:38 +0200 Message-Id: <20220617103645.71560-2-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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 UVC 1.5 class defines 4 values for this control on: 4.2.2.3.6 Power Line Frequency Control Add the missing value when the UVC version is 1.5. Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_ctrl.c | 56 +++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 0e78233fc8a0..a709ebbb4d69 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -366,6 +366,7 @@ static const struct uvc_menu_info power_line_frequency_controls[] = { { 0, "Disabled" }, { 1, "50 Hz" }, { 2, "60 Hz" }, + { 3, "Auto" }, }; static const struct uvc_menu_info exposure_auto_controls[] = { @@ -504,17 +505,6 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = { .v4l2_type = V4L2_CTRL_TYPE_INTEGER, .data_type = UVC_CTRL_DATA_TYPE_UNSIGNED, }, - { - .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, - .menu_count = ARRAY_SIZE(power_line_frequency_controls), - }, { .id = V4L2_CID_HUE_AUTO, .entity = UVC_GUID_UVC_PROCESSING, @@ -730,6 +720,34 @@ static const struct uvc_control_mapping uvc_ctrl_mappings[] = { }, }; +static const struct uvc_control_mapping uvc_ctrl_mappings_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, + .menu_count = ARRAY_SIZE(power_line_frequency_controls) - 1, + }, +}; + +static const struct uvc_control_mapping uvc_ctrl_mappings_uvc15[] = { + { + .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, + .menu_count = ARRAY_SIZE(power_line_frequency_controls), + }, +}; + /* ------------------------------------------------------------------------ * Utility functions */ @@ -2415,6 +2433,22 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, if (!ctrl->initialized) return; + /* Process common mappings first. */ + for (; 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. */ + if (chain->dev->uvc_version < 0x0150) { + mapping = uvc_ctrl_mappings_uvc11; + mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings_uvc11); + } else { + mapping = uvc_ctrl_mappings_uvc15; + mend = mapping + ARRAY_SIZE(uvc_ctrl_mappings_uvc15); + } + for (; mapping < mend; ++mapping) { if (uvc_entity_match_guid(ctrl->entity, mapping->entity) && ctrl->info.selector == mapping->selector) -- 2.36.1.476.g0c4daa206d-goog