Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2558317iof; Wed, 8 Jun 2022 07:27:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwANYnjTfSnatY5N4MRsUUsjkq2+JW2pwH6VkJoMmZnIeQGrr6thQhMDmmQe/wto2usfblW X-Received: by 2002:a63:86c7:0:b0:3fd:9822:d1ae with SMTP id x190-20020a6386c7000000b003fd9822d1aemr16009250pgd.609.1654698455611; Wed, 08 Jun 2022 07:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654698455; cv=none; d=google.com; s=arc-20160816; b=Uf9XFyXQlyDq1qIXOBOG4a3ezDtf+ZYJr88ojXInJXIlhnj8qq/f5Ah+Q/831oCEbk gAIWPHKGMS2VKS6gvCsh9GgbRbsRiLgIAr8bykC5mI2Qe7f8kbGXOs1M5kV+Kca5bceh gJBC4r4312ANOYiaxG0J5fGIcHkQ4Swt8kSV25lviO4i1ZhOOuM04T+wfWRONHuSIfhX zgzh1/34V+GaX/50XtSgix/oV11CjJTkes9pkEs/Rdx2THhYlPeaHATwpRYA6d93u6Uo FGu9SG8gq5Dt165a60/OJ9lxXKX28HjDAQMn04nViRr4U2NoIhpvCOJXLvj8A+5V208i eAow== 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=DEDVaAnB3nTLQNCW8iu7pt7VFg3qlBAw/fWfZnxYg+g=; b=jRLjpdp+G1YEkRooiys8fG47aCDTfMlGZOGf3FRJ9o9YCATsf/Pvfb3Otvi0+ocKgV COr2rMToZUz4rmf+CDTcuBrgiIZ0QvSpRmWzfhKD+5AaVysdEIzQNW2r+0gQo8q6Cf9N tS6Crm52WfAFy60h5M9qOAwSwPiC6K8AxtaD1HnveeolCFEPL6JgIla/MBWVmS9AUCaZ Y6sFY2+JoXBs2Alze68P3x2FWJ3dkQUhW8GWyVCl7CQf7NQuq6H0OL8ACLTGweXxj9kK 9uVZ77dwdBv6kX4atVh9n7yuz6tdfEiki5BplmZNLYKwaxFAX1oAFmr1pn68PJl2+uip eNiA== 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 f12-20020a63510c000000b003c67a4e3e22si26922390pgb.138.2022.06.08.07.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 07:27:35 -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 7583D31D0EF; Wed, 8 Jun 2022 07:00:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240669AbiFHOAV (ORCPT + 99 others); Wed, 8 Jun 2022 10:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240533AbiFHOAS (ORCPT ); Wed, 8 Jun 2022 10:00:18 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA4AB30388A; Wed, 8 Jun 2022 07:00:12 -0700 (PDT) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id 702A01BF20E; Wed, 8 Jun 2022 14:00:08 +0000 (UTC) Date: Wed, 8 Jun 2022 16:00:06 +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 v7 4/4] media: i2c: ov5675: add .get_selection support Message-ID: <20220608140006.qhe47mdq423jkcu4@uno.localdomain> References: <20220608134420.1750530-1-foss+kernel@0leil.net> <20220608134420.1750530-4-foss+kernel@0leil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220608134420.1750530-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 Wed, Jun 08, 2022 at 03:44:20PM +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 yeah! looks good to me now! Reviewed-by: Jacopo Mondi Thanks j > --- > > v7: > - fixed incorrect V4L2_SEL_TGT_CROP_BOUNDS introduced in v6, > > 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 | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c > index 80840ad7bbb0..5f70ead2dd47 100644 > --- a/drivers/media/i2c/ov5675.c > +++ b/drivers/media/i2c/ov5675.c > @@ -1121,6 +1121,31 @@ 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_BOUNDS: > + sel->r.top = 0; > + sel->r.left = 0; > + sel->r.width = 2624; > + sel->r.height = 2000; > + return 0; > + case V4L2_SEL_TGT_CROP: > + 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 +1195,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 >