From patchwork Sat Oct 28 08:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Patchwork-Id: 159241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1109632vqb; Sat, 28 Oct 2023 01:43:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7marDnD2qlLTvVcW96+VP0wQQfHozI7qawGcaR2xtMK7NT7ZfotIUf0ZUIkkvxOJSVbvE X-Received: by 2002:a05:6a20:7f92:b0:157:64e4:4260 with SMTP id d18-20020a056a207f9200b0015764e44260mr7452254pzj.9.1698482617740; Sat, 28 Oct 2023 01:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698482617; cv=none; d=google.com; s=arc-20160816; b=Xbpzvr04aoxybxLFRKeH8RKz5M4oq3T7amzYaR67QWHHhCJuVW5OCFY9w0f/nvqgzx qUTAeJKTyc8vcOWrQGMCjjR9DUSfjDABWfruh/5Yqbp0s8FoCvPGQDKxspIpKoxEIz29 RAEgj8dgKT94La70BPHSpz1TiVlvEaa+5NmW5KQGwREL7CRxS7nMsNFRT41yyMr6G4Cb ESaiyt9vfDxp9ayzj5exus2gzTLWMGAee9PhDy+kPrL8S+LVnYeZt3Dx81fakbCrQ2Yr cNF4+pmkjaorbDPMVhp77EcT30rwEiLCL7poFN0Z2FKzdSn4PGE3Cbr7oubw9h4Pmj7w pXEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=CqwfF3/ehzQlG+EhvICyU3RuDWgayNY7TsG1/k6yXl0=; fh=Zgky+q+8PvhHkxojJIPDJHGW0QVIUIBdH6AVhu4TA4w=; b=HdLI8Z4TeBnDfFfHZWa9iqrOafaL7pXWM3TZ1TnyE093ZUbnjzwkyDTPftmLOR5dHi DJDiQNf3KtJlDayD2eS9LnFgE8uwKpDVekYZoTD9CcRNdcXPyZep/9OXnkotH27KXcyq tvb0bAGt7dAT05YRX84ovm8QV/HPS3MqjgcWIZclvxTjU5NOvVb7iJGDrRqGhbJjmr9g dG9LlogJ6KCUrwIhFBEoHD1Z03oiGr1QyfM7l///BjE6g7pk02dlNeOlb1uIyRKmbN0v fxAh3WtEvx9dSQvxQHp22xxBKZr8es2CWcFxLtJS9NSKxhyOgsnHoMCTWvkx+31VSlal 2EIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f15-20020aa79d8f000000b00690dbcb75d8si2161661pfq.386.2023.10.28.01.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Oct 2023 01:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 76390806664D; Sat, 28 Oct 2023 01:42:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229945AbjJ1Im2 (ORCPT + 28 others); Sat, 28 Oct 2023 04:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjJ1ImW (ORCPT ); Sat, 28 Oct 2023 04:42:22 -0400 Received: from smtprelay07.ispgateway.de (smtprelay07.ispgateway.de [134.119.228.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84FD611F; Sat, 28 Oct 2023 01:42:19 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay07.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qwetd-0006mt-0K; Sat, 28 Oct 2023 10:42:17 +0200 From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Date: Sat, 28 Oct 2023 10:41:47 +0200 Subject: [PATCH v3 3/4] media: i2c: imx214: Read orientation and rotation from system firmware MIME-Version: 1.0 Message-Id: <20231028-imx214-v3-3-cd4bf77f9690@apitzsch.eu> References: <20231028-imx214-v3-0-cd4bf77f9690@apitzsch.eu> In-Reply-To: <20231028-imx214-v3-0-cd4bf77f9690@apitzsch.eu> To: Ricardo Ribalda , Sakari Ailus , Mauro Carvalho Chehab Cc: Kieran Bingham , Jacopo Mondi , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Apitzsch?= , Ricardo Ribalda X-Mailer: b4 0.12.3 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 28 Oct 2023 01:42:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780988109410503543 X-GMAIL-MSGID: 1780988109410503543 Obtain rotation and orientation information from system firmware and register the appropriate controls. While at it, update number of pre-allocated control slots. Reviewed-by: Jacopo Mondi Reviewed-by: Ricardo Ribalda Signed-off-by: André Apitzsch --- drivers/media/i2c/imx214.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index f62cd131164e..81f126a1b145 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -704,11 +704,16 @@ static int imx214_ctrls_init(struct imx214 *imx214) .width = 1120, .height = 1120, }; + struct v4l2_fwnode_device_properties props; struct v4l2_ctrl_handler *ctrl_hdlr; int ret; + ret = v4l2_fwnode_device_parse(imx214->dev, &props); + if (ret < 0) + return ret; + ctrl_hdlr = &imx214->ctrls; - ret = v4l2_ctrl_handler_init(&imx214->ctrls, 3); + ret = v4l2_ctrl_handler_init(&imx214->ctrls, 6); if (ret) return ret; @@ -746,6 +751,8 @@ static int imx214_ctrls_init(struct imx214 *imx214) V4L2_CID_UNIT_CELL_SIZE, v4l2_ctrl_ptr_create((void *)&unit_size)); + v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx214_ctrl_ops, &props); + ret = ctrl_hdlr->error; if (ret) { v4l2_ctrl_handler_free(ctrl_hdlr);