From patchwork Sat Jun 18 22:21:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 583090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A362DC43334 for ; Sat, 18 Jun 2022 22:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbiFRWVU (ORCPT ); Sat, 18 Jun 2022 18:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbiFRWVT (ORCPT ); Sat, 18 Jun 2022 18:21:19 -0400 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C0AE10FFB for ; Sat, 18 Jun 2022 15:21:17 -0700 (PDT) Received: from tr.lan (ip-86-49-12-201.net.upcbroadband.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 2DE2983F6A; Sun, 19 Jun 2022 00:21:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1655590874; bh=l3Nfidy/ECss9Wwgs79LDwLmT12rwop0BbbKE53CdCk=; h=From:To:Cc:Subject:Date:From; b=R1HMdYCdIGusnppA74LMvuyrATzDa5BTUCRPBblE7K90p4FFXpqLyDeOjIXObKije 7ofDyopHSG83V+0bVaPGrU5EhbDFz0cUjA8KOdVSSdqyGzWKzdVUnbte34bdy5WnWa H5/JBKoPQorz9v6h1U3Nbwy3IQAfM1Zjlrlm03BHUKn8IkRODNqaOxXmx6ImfrI1in R81Z2y+sWwCczRCr7DmMg16HlPNIlNcv+RP5USdsOUWKAnHX45c7HKspzBnmogbkac wjieYMu7g58yLbONpA0PDsUdHAdsozKNIUXnbHpwTqdLEln3oeChMj0tKeXtsoKOHH v8lWegGWZ0MRg== From: Marek Vasut To: linux-media@vger.kernel.org Cc: Marek Vasut , Laurent Pinchart , Mauro Carvalho Chehab , Sakari Ailus , Stefan Riedmueller Subject: [PATCH] media: mt9p031: Implement crop bounds get selection Date: Sun, 19 Jun 2022 00:21:08 +0200 Message-Id: <20220618222108.478082-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Implement V4L2_SEL_TGT_CROP_BOUNDS query in get_selection subdev op for this sensor. This is required e.g. to bind it to STM32MP15x DCMI. Signed-off-by: Marek Vasut Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Sakari Ailus Cc: Stefan Riedmueller --- drivers/media/i2c/mt9p031.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c index cbce8b88dbcf5..e73e814c60207 100644 --- a/drivers/media/i2c/mt9p031.c +++ b/drivers/media/i2c/mt9p031.c @@ -623,12 +623,20 @@ static int mt9p031_get_selection(struct v4l2_subdev *subdev, { struct mt9p031 *mt9p031 = to_mt9p031(subdev); - if (sel->target != V4L2_SEL_TGT_CROP) + switch (sel->target) { + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.left = MT9P031_COLUMN_START_DEF; + sel->r.top = MT9P031_ROW_START_DEF; + sel->r.width = MT9P031_WINDOW_WIDTH_DEF; + sel->r.height = MT9P031_WINDOW_HEIGHT_DEF; + return 0; + case V4L2_SEL_TGT_CROP: + sel->r = *__mt9p031_get_pad_crop(mt9p031, sd_state, + sel->pad, sel->which); + return 0; + default: return -EINVAL; - - sel->r = *__mt9p031_get_pad_crop(mt9p031, sd_state, sel->pad, - sel->which); - return 0; + } } static int mt9p031_set_selection(struct v4l2_subdev *subdev,