From patchwork Sat Jun 29 12:48:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 11023939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8BA4E13B1 for ; Sat, 29 Jun 2019 12:49:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D8D2287E3 for ; Sat, 29 Jun 2019 12:49:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71DB3287F2; Sat, 29 Jun 2019 12:49:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0229F287E3 for ; Sat, 29 Jun 2019 12:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbfF2MtU (ORCPT ); Sat, 29 Jun 2019 08:49:20 -0400 Received: from mout.gmx.net ([212.227.17.20]:54777 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbfF2MtT (ORCPT ); Sat, 29 Jun 2019 08:49:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1561812540; bh=y9m97Wf190flRY/FkjssAEHMINPsT0DgpJSYt7gV5jk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SBVowYsxUrIPB3LmgQtaC4QKvIlrowGhIoEbXoPWy6xP+XFd9FkyxztiE5HZqWsQf IyC9TfMSrOEzzMbhYlwrgMcLx5oROxhYByeFO9D83eHK4/4onMwzSKQmmBk+VRSKhR ofnEcQ1r5bPDNYQKYIEIjKsR/j3LB0HjeOMmOJSI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([37.4.249.111]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MYNNy-1i2bHC2lRy-00VRcW; Sat, 29 Jun 2019 14:49:00 +0200 From: Stefan Wahren To: Eric Anholt , Greg Kroah-Hartman , Dave Stevenson , Hans Verkuil , Mauro Carvalho Chehab Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devel@driverdev.osuosl.org, linux-media@vger.kernel.org, Stefan Wahren Subject: [PATCH V2 22/29] staging: bcm2835-camera: Use enums for max value in controls Date: Sat, 29 Jun 2019 14:48:29 +0200 Message-Id: <1561812516-9087-7-git-send-email-wahrenst@gmx.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561812516-9087-1-git-send-email-wahrenst@gmx.net> References: <1561812516-9087-1-git-send-email-wahrenst@gmx.net> X-Provags-ID: V03:K1:xAm5i4guJHEE2OzWyqtVW+g+GY6h9CQ5fCfoYk7BWskckUgggKA 1gd/Z1LbxBlTvCDkpeF6xhQPAlQ1P7AqRcK48LHPZQHWlFDjnwdvNLZAUwKuAfjxHn3/MTl +vpkibuOvRWp23BvxnmSzB1+07VJWyGfF0t2sv1XG/U5XyN1/Hi1hSCrCvPRkvAT2anI77O 3fy0Gn5aij+7gRm47P5hQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:nlycN+a7BJ4=:flC5BhW5HIdydHoAOBxPCx dQBMzEVxz8+He0UUfVqO+C+jpjxqwIjtUX9eZrOywqBteseMHyK5Af6APhFWDx15Z8nDYdT99 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ing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Stevenson Controls of type MMAL_CONTROL_TYPE_STD_MENU call v4l2_ctrl_new_std_menu with a max value and a mask. The max value is one of the defined values for the control, however in the config array there are several entries where raw numbers have been used instead. Replace these with the appropriate enum. Signed-off-by: Dave Stevenson Signed-off-by: Stefan Wahren Acked-by: Hans Verkuil Acked-by: Mauro Carvalho Chehab --- .../vc04_services/bcm2835-camera/controls.c | 37 ++++++++-------------- 1 file changed, 13 insertions(+), 24 deletions(-) -- 2.7.4 diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c index bc2f3f4..038b9b9 100644 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c @@ -58,19 +58,6 @@ static const u32 iso_values[] = { 0, 100, 200, 400, 800, }; -static const s64 mains_freq_qmenu[] = { - V4L2_CID_POWER_LINE_FREQUENCY_DISABLED, - V4L2_CID_POWER_LINE_FREQUENCY_50HZ, - V4L2_CID_POWER_LINE_FREQUENCY_60HZ, - V4L2_CID_POWER_LINE_FREQUENCY_AUTO -}; - -/* Supported video encode modes */ -static const s64 bitrate_mode_qmenu[] = { - (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, - (s64)V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, -}; - enum bm2835_mmal_ctrl_type { MMAL_CONTROL_TYPE_STD, MMAL_CONTROL_TYPE_STD_MENU, @@ -972,8 +959,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { }, { V4L2_CID_ISO_SENSITIVITY_AUTO, MMAL_CONTROL_TYPE_STD_MENU, - 0, 1, V4L2_ISO_SENSITIVITY_AUTO, 1, NULL, - MMAL_PARAMETER_ISO, + 0, V4L2_ISO_SENSITIVITY_AUTO, V4L2_ISO_SENSITIVITY_AUTO, 1, + NULL, MMAL_PARAMETER_ISO, ctrl_set_iso, false }, @@ -990,8 +977,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { */ { V4L2_CID_EXPOSURE_AUTO, MMAL_CONTROL_TYPE_STD_MENU, - ~0x03, 3, V4L2_EXPOSURE_AUTO, 0, NULL, - MMAL_PARAMETER_EXPOSURE_MODE, + ~0x03, V4L2_EXPOSURE_APERTURE_PRIORITY, V4L2_EXPOSURE_AUTO, 0, + NULL, MMAL_PARAMETER_EXPOSURE_MODE, ctrl_set_exposure, false }, @@ -1027,7 +1014,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { { V4L2_CID_EXPOSURE_METERING, MMAL_CONTROL_TYPE_STD_MENU, - ~0x7, 2, V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, + ~0x7, V4L2_EXPOSURE_METERING_SPOT, + V4L2_EXPOSURE_METERING_AVERAGE, 0, NULL, MMAL_PARAMETER_EXP_METERING_MODE, ctrl_set_metering_mode, false @@ -1035,7 +1023,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { { V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE, MMAL_CONTROL_TYPE_STD_MENU, - ~0x3ff, 9, V4L2_WHITE_BALANCE_AUTO, 0, NULL, + ~0x3ff, V4L2_WHITE_BALANCE_SHADE, V4L2_WHITE_BALANCE_AUTO, 0, + NULL, MMAL_PARAMETER_AWB_MODE, ctrl_set_awb_mode, false @@ -1056,7 +1045,7 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { }, { V4L2_CID_COLORFX, MMAL_CONTROL_TYPE_STD_MENU, - 0, 15, V4L2_COLORFX_NONE, 0, NULL, + 0, V4L2_COLORFX_SET_CBCR, V4L2_COLORFX_NONE, 0, NULL, MMAL_PARAMETER_IMAGE_EFFECT, ctrl_set_image_effect, false @@ -1091,8 +1080,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { }, { V4L2_CID_MPEG_VIDEO_BITRATE_MODE, MMAL_CONTROL_TYPE_STD_MENU, - 0, ARRAY_SIZE(bitrate_mode_qmenu) - 1, - 0, 0, bitrate_mode_qmenu, + 0, V4L2_MPEG_VIDEO_BITRATE_MODE_CBR, + 0, 0, NULL, MMAL_PARAMETER_RATECONTROL, ctrl_set_bitrate_mode, false @@ -1114,8 +1103,8 @@ static const struct bm2835_mmal_v4l2_ctrl v4l2_ctrls[V4L2_CTRL_COUNT] = { }, { V4L2_CID_POWER_LINE_FREQUENCY, MMAL_CONTROL_TYPE_STD_MENU, - 0, ARRAY_SIZE(mains_freq_qmenu) - 1, - 1, 1, mains_freq_qmenu, + 0, V4L2_CID_POWER_LINE_FREQUENCY_AUTO, + 1, 1, NULL, MMAL_PARAMETER_FLICKER_AVOID, ctrl_set_flicker_avoidance, false