Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2159665iof; Tue, 7 Jun 2022 21:44:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxijw+kyYvyYyPiSicJcWLLDXwpKMo7YJbWjCjY1S9cqZpPwIrECK3GxjTu+zRBGsrlPNVx X-Received: by 2002:a17:902:9882:b0:167:5c8c:1ad with SMTP id s2-20020a170902988200b001675c8c01admr21570152plp.130.1654663485271; Tue, 07 Jun 2022 21:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663485; cv=none; d=google.com; s=arc-20160816; b=IWe76QcILpIwIV3lahjK+jepM5kd7kRs35TCS2kp8z6bU37x3NM1HKFmbKRYqhEX9C X0CodRkmLDOYzsuXSMjv18zSVQMIkvjn0m15Vwo4MBzP/e0GgsaRDZyzarqjea3Wqtw4 GQl7fyhvCiwQpe+sXSgIO7nMNqsMnYF7HZEefSeoCL+ZABgteqSVyMxHWyzJRm99cl8i kEpn2G90hT0zaTsxJ6xjZ9fTbfrAnZE3qX2ZefXStX8zANzCG7ybaprtIqShqe0bM+sH bLfFCqYBO0hFItajuFXH/frzD/lPTkHxgvcqEIXL9nDMqdGzv9//9gPgJP3tJ3rXha3j O0xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vgypy2jQYlhFK0Wx2+4xgNC9oDPDPD7QsfEzJv8gq2I=; b=Iq/ze5JUM7RmJicvmAdS78J9tjti9lsZJf1hQL4A4hj5h59M6Jmme12ku7tZ0WbPEY y1kht77NahTWDHoYczvMCeHhJIGWzqWa3cYxz1t3ykFaTBLc+qnB5zcfs+N0aBtpC4xm /QlGJASk2qo2qvK7KzzwHjZF2HQMwisYYWgZCooEkmvsrMJcUSv+IOpCSazPOxsZpw01 T5apsdyPA3SXiaca+RoXGLKPQUQFEY6aE8F6sjhcjvlIL/lwJ6XQaAcr5nCP9prq+fpm BIpoPzptfMsUAs/ZCDcvFV+U6WCMQgFYfy2sfACy0v/2LQT588Nz7uyZXT3uz4nXUofm 7IoQ== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l5-20020a170902f68500b00167993cbc69si4544415plg.582.2022.06.07.21.44.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:44:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 489BF30E757; Tue, 7 Jun 2022 21:13:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345210AbiFGQvv (ORCPT + 99 others); Tue, 7 Jun 2022 12:51:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345213AbiFGQvo (ORCPT ); Tue, 7 Jun 2022 12:51:44 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95916100509; Tue, 7 Jun 2022 09:51:41 -0700 (PDT) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 003FBFF80C; Tue, 7 Jun 2022 16:51:37 +0000 (UTC) Date: Tue, 7 Jun 2022 18:51:36 +0200 From: Jacopo Mondi To: Quentin Schulz Cc: shawnx.tu@intel.com, mchehab@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Quentin Schulz Subject: Re: [PATCH v6 4/4] media: i2c: ov5675: add .get_selection support Message-ID: <20220607165136.bmriu2n7yorc7fx6@uno.localdomain> References: <20220607153335.875956-1-foss+kernel@0leil.net> <20220607153335.875956-4-foss+kernel@0leil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220607153335.875956-4-foss+kernel@0leil.net> X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,PDS_OTHER_BAD_TLD, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Quentin, On Tue, Jun 07, 2022 at 05:33:35PM +0200, Quentin Schulz wrote: > From: Quentin Schulz > > The sensor has 2592*1944 active pixels, surrounded by 16 active dummy > pixels and there are an additional 24 black rows "at the bottom". > > [2624] > +-----+------------------+-----+ > | | 16 dummy | | > +-----+------------------+-----+ > | | | | > | | [2592] | | > | | | | > |16 | valid | 16 |[2000] > |dummy| |dummy| > | | [1944]| | > | | | | > +-----+------------------+-----+ > | | 16 dummy | | > +-----+------------------+-----+ > | | 24 black lines | | > +-----+------------------+-----+ > > The top-left coordinate is gotten from the registers specified in the > modes which are identical for both currently supported modes. > > There are currently two modes supported by this driver: 2592*1944 and > 1296*972. The second mode is obtained thanks to subsampling while > keeping the same field of view (FoV). No cropping involved, hence the > harcoded values. > > Signed-off-by: Quentin Schulz > --- > > v6: > - explicit a bit more the commit log around subsampling for lower > resolution modes, > - (again) fixed reporting for V4L2_SEL_TGT_CROP_* thanks to Jacopo's help, > > v4: > - explicit a bit more the commit log, > - added drawing in the commit log, > - fixed reporting for V4L2_SEL_TGT_CROP_* thanks to Jacopo's help, > > added in v3 > > drivers/media/i2c/ov5675.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c > index 80840ad7bbb0..2230ff47ef49 100644 > --- a/drivers/media/i2c/ov5675.c > +++ b/drivers/media/i2c/ov5675.c > @@ -1121,6 +1121,26 @@ static int ov5675_get_format(struct v4l2_subdev *sd, > return 0; > } > > +static int ov5675_get_selection(struct v4l2_subdev *sd, > + struct v4l2_subdev_state *state, > + struct v4l2_subdev_selection *sel) > +{ > + if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) > + return -EINVAL; > + > + switch (sel->target) { > + case V4L2_SEL_TGT_CROP: > + case V4L2_SEL_TGT_CROP_BOUNDS: Seem like we have trouble understanding each other, or better, I have troubles explaining myself most probably :) If the dummy/black area is readable, this should just be (0, 0, 2624, 2000) like it was in your previous version. What has changed that I have missed ? Thanks j > + case V4L2_SEL_TGT_CROP_DEFAULT: > + sel->r.top = 16; > + sel->r.left = 16; > + sel->r.width = 2592; > + sel->r.height = 1944; > + return 0; > + } > + return -EINVAL; > +} > + > static int ov5675_enum_mbus_code(struct v4l2_subdev *sd, > struct v4l2_subdev_state *sd_state, > struct v4l2_subdev_mbus_code_enum *code) > @@ -1170,6 +1190,7 @@ static const struct v4l2_subdev_video_ops ov5675_video_ops = { > static const struct v4l2_subdev_pad_ops ov5675_pad_ops = { > .set_fmt = ov5675_set_format, > .get_fmt = ov5675_get_format, > + .get_selection = ov5675_get_selection, > .enum_mbus_code = ov5675_enum_mbus_code, > .enum_frame_size = ov5675_enum_frame_size, > }; > -- > 2.36.1 >