Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp615609iog; Wed, 15 Jun 2022 08:45:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v84ujXE6ilxmHhekn4wGxV/lhTKrq++UIFjiQ/UWviMR2t7FphuuVw5/Z+62SHTz2L0gZw X-Received: by 2002:a05:6a00:2349:b0:51c:29c0:82f6 with SMTP id j9-20020a056a00234900b0051c29c082f6mr258543pfj.32.1655307921009; Wed, 15 Jun 2022 08:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655307921; cv=none; d=google.com; s=arc-20160816; b=VA1w0dZH4/feCk3WEBnpqx//x3N25SdrNWux5gyjG20RLEX5S/FqfPHYQN1a+cEn+l aS8MwekzwDFzoxxwRqlUKtZwhqkePk8U0Nta+wwRQq59fe0ixUyfXqL/frUaceT8GDkv VTxMlVPXcXfk82OKRoPvPoXDgPR22ogoaKs9ks65gLg3V5ldo0bM5T9Nd/2+zfwGGDx8 7TSgvdFO2N34+KDpqRVbcLDS6MsDnO7+2RLXYW2wqOPjxfoEBmb3YM0gZ9R54eXKAsw8 uGoHZG9zqbCcxc6RovMAR/s8VC0HJ/bhyynf3LlatKHKcRJFgqfm4cflQxsrxMSaEpAA obJw== 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=OjjiSlQh+KQwfaYvi2mEOGjLKBYgCm6kAtkC4G5WzJS4OjDmT2IjcEGQfb63Fe8j1h 1fnNmqPIBI+EMF4YVymdyvTZ7Ez6XlERtL59XuCyV00UqZbYJwQAfc67IL8UgwC2qRG6 J4ibdDzMYyGOP8B9+lViAl9dbWTyxHQ7u4Wzu//9ieeePoIbklLTI9ahZ+s0W+PIhWv/ nx8l1YGar3LQ1vzbjldXUo32Dl5BRm88kzIhYbNx3Nst1476UhLWGAesIhBGbJs7rWIB MVZn5pNJOyfgoD9mc0gtXn4znqA1uNxmDDlplhPKEKOeqxwiaLTyXEG4L7yJesfl1jBB nrog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ILBT80z1; 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 j3-20020a170903028300b001678b6bde1asi21760668plr.330.2022.06.15.08.45.07; Wed, 15 Jun 2022 08:45:20 -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=ILBT80z1; 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 S245041AbiFOPNM (ORCPT + 99 others); Wed, 15 Jun 2022 11:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233533AbiFOPNF (ORCPT ); Wed, 15 Jun 2022 11:13:05 -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 0137EDECD for ; Wed, 15 Jun 2022 08:13:04 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id m20so23833886ejj.10 for ; Wed, 15 Jun 2022 08:13:03 -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=ILBT80z1mB8y3KmFDHu42InPyMxTsikDuFOoymGYG4+NI6AT9uYgeYqeMiDZwatAn+ PI6lswksIKinPKFuB8pZ1+l/17POaRw4DP3g+x4ikG+iJKRiofwtME4fB1g5/+Xgqm6J EDofovu/rfj3dRCnrKMCL5QlyvEgBDV95n64I= 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=KRgwtx2rhYL0jv5TTrabGWkdqnto+m8fw4qs9hfZasnwSDkIpBWvN4qC78qnxvkBnI 4r496vFR7aVATStKZYK5TznxFhoGvmHnTrJLohIgAXSYIA/+mTupCK2dwMTFp7+NZgNQ j4/TOVetHftjrwVy+9Q+bmLO6wjQe08qjZoIB806d8obOSy9CZGpX6LUbBz4vTgHLJIu USfupTUSmusTV1C7CiyjvO57nj0nzHv4RLBt2NLCDwCTJ26gGhzeIuzkfNTd+cnFs4lF Kr998O8+x3MpR7XHXwZ7yxlD3cIDCJySAlhswrp5N+mYyWmS04gMH3oWrQpxkTn9p1W3 DC8A== X-Gm-Message-State: AJIora/Qkc0yabYapHtgyGFUA+XfgjmZhG668tCLIW2HDv+AI/MACG4d JVsI5jU7M3KVlbgKgcNRB2NnkA== X-Received: by 2002:a17:907:6e13:b0:711:c722:4fc with SMTP id sd19-20020a1709076e1300b00711c72204fcmr251107ejc.253.1655305982591; Wed, 15 Jun 2022 08:13:02 -0700 (PDT) Received: from alco.lan (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id b25-20020aa7cd19000000b0042bd2012196sm9610264edw.85.2022.06.15.08.13.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 08:13:02 -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 v6 1/8] media: uvcvideo: Add missing value for power_line_frequency Date: Wed, 15 Jun 2022 17:12:52 +0200 Message-Id: <20220615151259.77825-2-ribalda@chromium.org> X-Mailer: git-send-email 2.36.1.476.g0c4daa206d-goog In-Reply-To: <20220615151259.77825-1-ribalda@chromium.org> References: <20220615151259.77825-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 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=ham 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