Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1390215rwb; Mon, 7 Nov 2022 00:45:12 -0800 (PST) X-Google-Smtp-Source: AMsMyM7qbo8rLPH8gSmVyfgRQWtmJcl9OpttFMaLjUQ1Yk1iWCOeCkHrxHJKL5ibpxA4K6X6gB5s X-Received: by 2002:a05:6402:530d:b0:463:b0cb:50e5 with SMTP id eo13-20020a056402530d00b00463b0cb50e5mr33081509edb.45.1667810712200; Mon, 07 Nov 2022 00:45:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667810712; cv=none; d=google.com; s=arc-20160816; b=iC5+Yc4xnGxkA6dEUMNsBIdg6CGc4G3r7hSy/T8Yq2Yubg65Rjzrlq2iJeOhJH1onb R9A524/wGXty0ImxF0+LJ8EFABMmmywAsbBHUE0AUUsS1yh5pS/9KiWWzbsNcSW1vonT eTY/gZiLI1U+sH5hzXuTgsMNijQ3rI9WfPuUICpSwvmVDogQKz1Nre9RhOy7LRPPzMt5 MSqbN3kn2gebSZk8MoAbyuSukt5nF7VzJfweWD8jNlgTA/he8mim7J3KTaLzn4D5ekT4 1Ozn4h0fzW/8GheigBa9e33xJKIINvVTbCXv0jPUN1vtC0qxpXkpGRVd8PJLcfppSexH rzmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=Z6kffknxDSIyVdjYQhxigXMXVYL7F6gYUStmrKmvuh4=; b=Cb8PQ58hYEQ/7N2xqlxZNbwk0VcWVMMCb8vpufsf2geSPQvBOyfqsZf1zrX195FY7O rhlEALxPHTfmcZ1xUfuVxCkmOkSmHtkAOi31Q/pUiV5ycOjpb3JTg4NMi3Uty0etNpQP 7LrQPHFoks1TC5V4HJGJ4SggsOjohtFMrX4W/5TxzXo8lETdxjDsBwvERnckFvd7ffeJ Rb0X4DsXFt3ThUKqRDJKTX8mSEi3QnL+c5eR62fpujc89TmhPUYjzIrsicLCVfpqG5ho j5juCYq+Upyz6abBBRG9A6Qf7hlbtJVZnd22MeJmVQQaS0PPwc/kNTI7Dn9LS9HZgGDN aPYw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz19-20020a170906bb1300b007addbdb9fbbsi7562761ejb.558.2022.11.07.00.44.49; Mon, 07 Nov 2022 00:45:12 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230507AbiKGIXw (ORCPT + 95 others); Mon, 7 Nov 2022 03:23:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiKGIXt (ORCPT ); Mon, 7 Nov 2022 03:23:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04FAB26CA; Mon, 7 Nov 2022 00:23:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B548CB80E34; Mon, 7 Nov 2022 08:23:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D10AC433D6; Mon, 7 Nov 2022 08:23:43 +0000 (UTC) Message-ID: Date: Mon, 7 Nov 2022 09:23:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH v6 5/5] drivers: media: platform: Add NPCM Video Capture/Encode Engine driver To: Kun-Fa Lin Cc: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, kwliu@nuvoton.com, kflin@nuvoton.com References: <20221104033810.1324686-1-milkfafa@gmail.com> <20221104033810.1324686-6-milkfafa@gmail.com> <357a3098-918b-895b-7305-0f1a63aacdb0@xs4all.nl> Content-Language: en-US From: Hans Verkuil In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On 07/11/2022 08:20, Kun-Fa Lin wrote: > Hi Hans, > > Thanks for the review. > >> >> These functions are not usually present when capturing from video. You don't >> have a choice w.r.t. resolution and fps, since that's determined by the >> incoming video. I would drop support for this. > > Just to confirm, do you mean `npcm_video_enum_framesizes` and > `npcm_video_enum_frameintervals` functions? Right. > > >>> + switch (ctrl->id) { >>> + case V4L2_CID_DETECT_MD_MODE: >>> + if (ctrl->val == V4L2_DETECT_MD_MODE_GLOBAL) >>> + video->ctrl_cmd = VCD_CMD_OPERATION_CAPTURE; >>> + else >>> + video->ctrl_cmd = VCD_CMD_OPERATION_COMPARE; >>> + break; >> >> Incorrect indentation for the 'break'. > > Will correct it. > > >>> + v4l2_ctrl_new_std_menu(&video->ctrl_handler, &npcm_video_ctrl_ops, >>> + V4L2_CID_DETECT_MD_MODE, >>> + V4L2_DETECT_MD_MODE_REGION_GRID, 0, >>> + V4L2_DETECT_MD_MODE_GLOBAL); >> >> Why is this driver using a control designed for motion detection devices? >> That seems odd, and it looks like you are abusing this control to do something >> else. > > The Video Capture/Differentiation (VCD) engine supports two modes: > - COMPLETE (capture the next "complete frame" into memory) > - DIFF (compare the incoming frame with the frame stored in memory, > and updates the "diff frame" in memory) > > The purpose here is to provide a way for application to switch the > COMPLETE/DIFF mode. Since I couldn't find an appropriate ioctl that is > designed for this purpose, so I used VIDIOC_S_CTRL with control values > of V4L2_DETECT_MD_MODE_GLOBAL (for COMPLETE) and > V4L2_DETECT_MD_MODE_REGION_GRID (for DIFF). It would be appreciated if > you could point me in the right direction. This is very much a driver-specific control. So you have to make your own. This series is a good example on how to add a custom control: https://lore.kernel.org/linux-media/20221028023554.928-1-jammy_huang@aspeedtech.com/ Driver-specific controls are fine, as long as they are properly documented. > > >> When you post v7, please also include the output of v4l2-compliance to the >> cover letter! >> Make sure you compile v4l2-compliance from the v4l-utils git repo, do not >> use a version from a distro, that will be too old. > > OK, I'll try to compile v4l2-compliance and include the output. > > Regards, > Marvin Regards, Hans