From patchwork Wed Dec 6 22:33:57 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: 174752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4421165vqy; Wed, 6 Dec 2023 14:39:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9Xd7jljSJdKy/gTWyGj+bNLjU8pbs8LK5EaS8fofxiESXPQU16yRq/ZDLCwJTwXBfpwK3 X-Received: by 2002:a17:90a:94c6:b0:286:6cc1:867a with SMTP id j6-20020a17090a94c600b002866cc1867amr1452704pjw.95.1701902352704; Wed, 06 Dec 2023 14:39:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701902352; cv=none; d=google.com; s=arc-20160816; b=WHBVBQV4j7snwNRZPx64Cu3lnIn50iLWyu2N0U0WYqzuyjdDVVCTIhZjivL2O8uWzo zcRtNxVOi+aA6rHiYfNlSq4khc5zmZRH5PbxW61JU5aJHne325j8I88fgYqTCt9PRX8z FSqXAtnBJrlieUngzHBeL8k7yICWXZw99XgrqDvsk+P3SQhMph73Aghxv4xfGj3Yd0aE 6MTXJ3iRGO3P990xvV0t7TaEYN3G8vngHt+myw5d/3MYJrFuZlXb47Lchzd3Bjq0z15w HRzDnKixYpnNB4Ywx5BJ4aJb6PD7MzqEaKZ6aZr1ipG/N8uFnEQIv0GOvoWvdli2tk8u IDAg== 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=xuweJZaI/idihSoX/plEWlD9rR9h6okXuzvwKic1/Lw=; fh=Zgky+q+8PvhHkxojJIPDJHGW0QVIUIBdH6AVhu4TA4w=; b=eZHevUsaM0taBAkRdbomapDcAWEXhqg4kvYwlKwTeUcJ9sKncGFt2p2qdQgj5hBe4i m4+a8PQO5AT4hpUUokObKGSuOybCd9rTRHjzMOBGcpue0Ut+k1MTtBcV5d1nRshU3o2h LKDN1E68BjA4ZPnhR4yz9vmKAt6X0wZ9/TybBFQeTjlDtUQBC7ylyTXFc9LuAI4CyzHx U+W4EtkS9TEgUQbvVIvm60TwV8Z1qWGIhrV6zqHFSOlXwOcmN9YvBveXQYQPLlhNk7Kc CvrK0wYCT1iwJXQP9FdZ6nL4EmUWJxlFDy7w7BF46qxX1YJh8tDF3hh7ytvkgazYIsMH z85A== 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:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id fs24-20020a17090af29800b002791035445esi486295pjb.76.2023.12.06.14.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 14:39:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 9DB1281EE52B; Wed, 6 Dec 2023 14:39:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377507AbjLFWjA (ORCPT + 99 others); Wed, 6 Dec 2023 17:39:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377604AbjLFWi7 (ORCPT ); Wed, 6 Dec 2023 17:38:59 -0500 Received: from smtprelay03.ispgateway.de (smtprelay03.ispgateway.de [80.67.31.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6D4510C3; Wed, 6 Dec 2023 14:39:04 -0800 (PST) Received: from [92.206.191.209] (helo=note-book.lan) by smtprelay03.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1rB0TI-0007Ur-12; Wed, 06 Dec 2023 23:34:24 +0100 From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Date: Wed, 06 Dec 2023 23:33:57 +0100 Subject: [PATCH v4 3/4] media: i2c: imx214: Read orientation and rotation from system firmware MIME-Version: 1.0 Message-Id: <20231206-imx214-v4-3-7ef604b01dcb@apitzsch.eu> References: <20231206-imx214-v4-0-7ef604b01dcb@apitzsch.eu> In-Reply-To: <20231206-imx214-v4-0-7ef604b01dcb@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.4 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 06 Dec 2023 14:39:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784573961413349813 X-GMAIL-MSGID: 1784573961413349813 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 e460030a601b..132267e3a8f5 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);