From patchwork Mon Oct 23 21:47:52 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: 157123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1571423vqx; Mon, 23 Oct 2023 14:50:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXYdmk23UVYCrGb6F3CzMZiv89SbPCnDAJIhJx0tI3PnyXnEo2+DqXa6dbgryD7tegmwo5 X-Received: by 2002:a17:903:27ce:b0:1c1:f6d1:3118 with SMTP id km14-20020a17090327ce00b001c1f6d13118mr9522918plb.27.1698097800411; Mon, 23 Oct 2023 14:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698097800; cv=none; d=google.com; s=arc-20160816; b=UP4rCLf/DYb8xbTcZ8ygZnjbas6NvO6Gnku+oeKRwSMYXG8B0xh2RRJXxGLaNFXSx7 7pmtxYUkGcfJ7lHZNVCBAWMjhrSuRnaaOZnZitNSCd/FkfXV3ANdXBzsvyKMZAfbTju7 qB5L09LACWcJtWaPplyxYRdQbVOrmxlycqcsclASpGBmnQII7LfQO+ejPcbNKn58dlqg UGaQyqVGdcs3QFkCIfZuIPzzI2XjztInKtZiZ/KNtIj0z8Lb8+y/NSrEhBQiWTziIdKW KWOVo217KlDbwm8T0Xnfng6gfs2gP1wui3zVwQDGLXykB49+5QaPdKR/S9yvq5Ue5uAV iq/w== 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=eRpkYQ1yWHzXIQiDaWA2X9B6aGOEDEmshNF9lUm8s1E=; fh=p+mi5Td8bOurAzEd8CdVTJhDRtapyUXUHLHoRH6vUVQ=; b=mJPUyOvoQLARC9Xs1uinVLhKwMMzMq4Z2HWfxJ4zoBJbY3IlcGzdFRzfpQLetkCFgn mTRQFFcdcccNEMJjZRaHIvEAEO+UW/WmBJSkK28MMonQYbPLMNUBoMR13awdVTYdoWPr M0Q7LntREXpZzcUUlyd2rBEG0kyFulneUmel9wMHsQqKGpNA64JlcxAVYPxoMmmQjcmD kaFpD4A6oRtsaHmTI4WsQjUiWux/lph14ve5ECelZPEqB+Tsjk0P2ZesMJJHFeKDuX2C uvMDf6ZP6mVZ+4Br1sHR6Bh0Omfrq8w7dTFm07amDrmaGGFGzyHVu5wYX+9pARHjn+zV dSyA== 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:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i8-20020a170902c94800b001bbacfdad2fsi7199783pla.291.2023.10.23.14.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 14:50:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id AEB5D8031137; Mon, 23 Oct 2023 14:49:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231533AbjJWVtf (ORCPT + 27 others); Mon, 23 Oct 2023 17:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjJWVte (ORCPT ); Mon, 23 Oct 2023 17:49:34 -0400 Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.18.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B18E810C for ; Mon, 23 Oct 2023 14:49:32 -0700 (PDT) Received: from [92.206.139.21] (helo=note-book.lan) by smtprelay01.ispgateway.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qv2nh-0004Kz-0O; Mon, 23 Oct 2023 23:49:29 +0200 From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Date: Mon, 23 Oct 2023 23:47:52 +0200 Subject: [PATCH 3/4] media: i2c: imx214: Read orientation and rotation from system firmware MIME-Version: 1.0 Message-Id: <20231023-imx214-v1-3-b33f1bbd1fcf@apitzsch.eu> References: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> In-Reply-To: <20231023-imx214-v1-0-b33f1bbd1fcf@apitzsch.eu> To: Ricardo Ribalda , Sakari Ailus , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.12.3 X-Df-Sender: YW5kcmVAYXBpdHpzY2guZXU= X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 14:49:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780584599113407357 X-GMAIL-MSGID: 1780584599113407357 Obtain rotation and orientation information from system firmware and register the appropriate controls. Signed-off-by: André Apitzsch Reviewed-by: Jacopo Mondi Reviewed-by: Ricardo Ribalda --- drivers/media/i2c/imx214.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 554fc4733128..bef8dc36e2d0 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -704,9 +704,14 @@ 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); if (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);