From patchwork Wed Nov 1 13:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160539 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp408525vqx; Wed, 1 Nov 2023 06:14:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVkb4BLHmLLpRrRRex7RqNqwSnUg+vjVNSmefCxYH165K1DmdctNpnnKrfk+YjPm0I4zgC X-Received: by 2002:a17:90b:4a4b:b0:280:982:aa9f with SMTP id lb11-20020a17090b4a4b00b002800982aa9fmr3825007pjb.7.1698844452816; Wed, 01 Nov 2023 06:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844452; cv=none; d=google.com; s=arc-20160816; b=ILnIji84pbyF+cOUbwLMb1WZ91yZc2tceLAgLn+ZzI+pR5HGN8jxI5vLr0ZwNK/9or HHK8bevBqAnjSkbff1Z03pPG9E2guWmj+5XGdM09ImaoiK/PVRstGGi2VK63KnzvTxgi 4Q7ls/Tij1CKZpmJ3y2mIf2YdvJvVFjRBJCasqj1K9VD3cJe3J5jDkyogNS5dC+A4qdu XZbNbVoliL8aiPbeajI7EQFUJ3WLnoCrF5Fzoohi/na99alx6N1+orcIL4m5GTV3LTS2 QxJLDJNg+mRnkQgTEqr+MdWpQ8BMSG9oLSQe36UuFL2YlxQUxyRiKzpRB7oPMBhPKs+5 axeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nsHhRleKQNROPp6DrhD0LVyGQJjs1Es7N+/SFthANIM=; fh=IE0AfIp7u4XqCH8avYpeWoD/3CGUtSNOY/JSUZBYleo=; b=dxvb7sToIUdM+k5olToJn6cM22lBQ+tt9iAL93t8ZdfgXdNacK/k56FnJ6befEN1mQ s4xXrIdUSXxzw4/kehm+aEuEuzqMX9ZKWZRbUBw1M4TP4RvmFrq8FCWWq2VuKJS8ZJWe D1mSNdMIx0UD23rvvA3o9yWj0kPj8TLDkpSQ27C3BDjC/JHksSgn7lRg9uNZKBuurRnJ ts56BQTOOYevsxpxYEcrB2lf9QdE/5vmwK+iYvl1+MaiWdPmfBW9QCJASL5hLD6aFmho xYuLt5pXy0e0LITeQR8fl8F9M9m1fI7L34H6MfhlceHxFkwDxQ0E2e5GMT9ISEUKFb4q URVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=iuPZJIC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id r20-20020a6560d4000000b00578bea3c10esi2844910pgv.756.2023.11.01.06.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=iuPZJIC2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 E3FB9801BAE8; Wed, 1 Nov 2023 06:14:10 -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 S1343846AbjKANOI (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343683AbjKANOH (ORCPT ); Wed, 1 Nov 2023 09:14:07 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BFD5FC; Wed, 1 Nov 2023 06:14:02 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DDC3F7F8; Wed, 1 Nov 2023 14:13:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844423; bh=cZjHwAeBlPG60bYP7kLvS643hd8tohS5INB855qXSOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iuPZJIC2P5vfgkyVLQVN6zRrnO9o48Sx7sShtOjkgCw0GToCJNHspu1SQAZ9mDqFp 3CzxLchTIfGECPf5zWgx5rIr9RahuIxsf3InMUTm/reHGEWuHUUK9Nnbz28ybV5uQN Vzyl5+niRWqPyxAluz3F2Qjjjr6wVnzZ9klqqz7o= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , Umang Jain , Marco Felsch , "Paul J. Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/6] media: dt-bindings: media: imx335: Add supply bindings Date: Wed, 1 Nov 2023 13:13:49 +0000 Message-Id: <20231101131354.2333498-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:10 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367520822181879 X-GMAIL-MSGID: 1781367520822181879 Add the bindings for the supply references used on the IMX335. Reviewed-by: Umang Jain Reviewed-by: Marco Felsch Signed-off-by: Kieran Bingham Acked-by: Conor Dooley --- v2: - Remove the supplies from required properties to prevent ABI breakage. Signed-off-by: Kieran Bingham --- .../devicetree/bindings/media/i2c/sony,imx335.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml b/Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml index a167dcdb3a32..106c36ee966d 100644 --- a/Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml +++ b/Documentation/devicetree/bindings/media/i2c/sony,imx335.yaml @@ -32,6 +32,15 @@ properties: description: Clock frequency from 6 to 27 MHz, 37.125MHz, 74.25MHz maxItems: 1 + avdd-supply: + description: Analog power supply (2.9V) + + ovdd-supply: + description: Interface power supply (1.8V) + + dvdd-supply: + description: Digital power supply (1.2V) + reset-gpios: description: Reference to the GPIO connected to the XCLR pin, if any. maxItems: 1 @@ -79,6 +88,10 @@ examples: assigned-clock-parents = <&imx335_clk_parent>; assigned-clock-rates = <24000000>; + avdd-supply = <&camera_vdda_2v9>; + ovdd-supply = <&camera_vddo_1v8>; + dvdd-supply = <&camera_vddd_1v2>; + port { imx335: endpoint { remote-endpoint = <&cam>; From patchwork Wed Nov 1 13:13:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp408646vqx; Wed, 1 Nov 2023 06:14:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHxPMwq1ZvwiuMQBsrw4FXujXNhM7Sb8u1Bk0I98/HRu7ZdkreRE1P9wgKOHulAsXm9DJf X-Received: by 2002:a17:90a:2d83:b0:280:29e8:4379 with SMTP id p3-20020a17090a2d8300b0028029e84379mr8302893pjd.34.1698844462621; Wed, 01 Nov 2023 06:14:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844462; cv=none; d=google.com; s=arc-20160816; b=Z92rWlRV0oAnEQPUgRfAAFFTpcb9dbDu05VzKlfOGKrzfo4Fa06gM3SbexuR7CIA+M EHlZrxkzuPRR3gyx4hckLxZVeutDFo4hpnUMZKq3uo9onrByIjVlI6uGuKUc11foouBe oXSWurQQo2Wid2XWqyjWZrX38Rp4CGVe4WYK/f/WkHf7bymhcYpFGMXXJ4EO+XCK2g8q SSJf/qvtTVKU0C3C1Vo7zPyEtjgzUSpKOlloMzLRc0RtARetRXRQScbTKqeN0/zbCgGx /4nB9lMWwA58q0F9UHleMeJYre/IeqbsjPeJS0GMThqQOKAaHVQ/T0cLQdvz+WE27g35 JaDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lLzyU/ywuSYrnStO5EFuCiiQcaHQm5vsu1XHyykHnxs=; fh=pzDjuBW6iTH3lRufj60HcOrI13gwrAMAibI8ac4xXMg=; b=dR6963Pessz1dkxK3/8wP83KxjhfuRlS2FTKxFanJu3c+QneV/+ardeYJ+ULSx3XuV +kAEvaKFMTwjVYNaR3MEWpB0FdlO+8duSXoEchw3Qrg7THlsjUM02dLssyrqeK+767NK U4WCKhu2WoLGFY8KiCzLNEecKpU08JbUz8ETg1H+E9FgkB7MNNQIBw1IiA2GvK7SH1DN a+e6+pvgwdua5mTSqqkrgfduCsDLAjZWcl0FZnEFuPbNPTAsM0797nWs/lULFzLjpA7t 6XMe6YyJmIbwiht++0DOi7Ib0w+UWDnmfhqES/WITntC5WpbdixhaXdF+6aGHVKlEdhY DReg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jEIA471t; 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 x6-20020a17090a970600b0027d61342674si804221pjo.70.2023.11.01.06.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:22 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=jEIA471t; 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 7E992801B1BE; Wed, 1 Nov 2023 06:14:19 -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 S1343969AbjKANOO (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343771AbjKANOM (ORCPT ); Wed, 1 Nov 2023 09:14:12 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 817BFF7; Wed, 1 Nov 2023 06:14:06 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F1AF8E1; Wed, 1 Nov 2023 14:13:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844423; bh=qWTucJxCHRuWa+6BbfKBcBj1vMLwMG0gc1X5MvGAkQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jEIA471t2cZUrlUs87x7Nq1GFjrx6AEsSHaPW1ddF+BgcWbmSGMCGtt3gjzwCvBtF yFciqRNI1VHXJA8BfoXQyQtK0L27PaJdQ2w2NJnaO5aX9/q0dN7fTUNefEriifOkZ/ YPl0qkrdzB8tbVn7tpvSHqzm7vn0ssmFVA3ZgvO8= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , "Paul J. Murphy" , Daniele Alessandrelli , Sakari Ailus , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/6] media: i2c: imx335: Fix logging line endings Date: Wed, 1 Nov 2023 13:13:50 +0000 Message-Id: <20231101131354.2333498-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367531329244861 X-GMAIL-MSGID: 1781367531329244861 The use of \n as a line ending throughout the driver is inconsistent. While it is possible for logging messages to automatically have newlines added by the kernel printk mechanisms, this is specifically to support continued lines with PR_CONT and the lack of a new line character indicates that the text is a fragment of a continuation line. As each of these lines are whole and not fragments, explicitly define the newline for consistency. Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx335.c | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index ec729126274b..cbabef968e21 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -396,7 +396,7 @@ static int imx335_update_exp_gain(struct imx335 *imx335, u32 exposure, u32 gain) lpfr = imx335->vblank + imx335->cur_mode->height; shutter = lpfr - exposure; - dev_dbg(imx335->dev, "Set exp %u, analog gain %u, shutter %u, lpfr %u", + dev_dbg(imx335->dev, "Set exp %u, analog gain %u, shutter %u, lpfr %u\n", exposure, gain, shutter, lpfr); ret = imx335_write_reg(imx335, IMX335_REG_HOLD, 1, 1); @@ -443,7 +443,7 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_VBLANK: imx335->vblank = imx335->vblank_ctrl->val; - dev_dbg(imx335->dev, "Received vblank %u, new lpfr %u", + dev_dbg(imx335->dev, "Received vblank %u, new lpfr %u\n", imx335->vblank, imx335->vblank + imx335->cur_mode->height); @@ -462,7 +462,7 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl) exposure = ctrl->val; analog_gain = imx335->again_ctrl->val; - dev_dbg(imx335->dev, "Received exp %u, analog gain %u", + dev_dbg(imx335->dev, "Received exp %u, analog gain %u\n", exposure, analog_gain); ret = imx335_update_exp_gain(imx335, exposure, analog_gain); @@ -471,7 +471,7 @@ static int imx335_set_ctrl(struct v4l2_ctrl *ctrl) break; default: - dev_err(imx335->dev, "Invalid control %d", ctrl->id); + dev_err(imx335->dev, "Invalid control %d\n", ctrl->id); ret = -EINVAL; } @@ -652,14 +652,14 @@ static int imx335_start_streaming(struct imx335 *imx335) ret = imx335_write_regs(imx335, reg_list->regs, reg_list->num_of_regs); if (ret) { - dev_err(imx335->dev, "fail to write initial registers"); + dev_err(imx335->dev, "fail to write initial registers\n"); return ret; } /* Setup handler will write actual exposure and gain */ ret = __v4l2_ctrl_handler_setup(imx335->sd.ctrl_handler); if (ret) { - dev_err(imx335->dev, "fail to setup handler"); + dev_err(imx335->dev, "fail to setup handler\n"); return ret; } @@ -667,7 +667,7 @@ static int imx335_start_streaming(struct imx335 *imx335) ret = imx335_write_reg(imx335, IMX335_REG_MODE_SELECT, 1, IMX335_MODE_STREAMING); if (ret) { - dev_err(imx335->dev, "fail to start streaming"); + dev_err(imx335->dev, "fail to start streaming\n"); return ret; } @@ -744,7 +744,7 @@ static int imx335_detect(struct imx335 *imx335) return ret; if (val != IMX335_ID) { - dev_err(imx335->dev, "chip id mismatch: %x!=%x", + dev_err(imx335->dev, "chip id mismatch: %x!=%x\n", IMX335_ID, val); return -ENXIO; } @@ -776,7 +776,7 @@ static int imx335_parse_hw_config(struct imx335 *imx335) imx335->reset_gpio = devm_gpiod_get_optional(imx335->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(imx335->reset_gpio)) { - dev_err(imx335->dev, "failed to get reset gpio %ld", + dev_err(imx335->dev, "failed to get reset gpio %ld\n", PTR_ERR(imx335->reset_gpio)); return PTR_ERR(imx335->reset_gpio); } @@ -784,13 +784,13 @@ static int imx335_parse_hw_config(struct imx335 *imx335) /* Get sensor input clock */ imx335->inclk = devm_clk_get(imx335->dev, NULL); if (IS_ERR(imx335->inclk)) { - dev_err(imx335->dev, "could not get inclk"); + dev_err(imx335->dev, "could not get inclk\n"); return PTR_ERR(imx335->inclk); } rate = clk_get_rate(imx335->inclk); if (rate != IMX335_INCLK_RATE) { - dev_err(imx335->dev, "inclk frequency mismatch"); + dev_err(imx335->dev, "inclk frequency mismatch\n"); return -EINVAL; } @@ -805,14 +805,14 @@ static int imx335_parse_hw_config(struct imx335 *imx335) if (bus_cfg.bus.mipi_csi2.num_data_lanes != IMX335_NUM_DATA_LANES) { dev_err(imx335->dev, - "number of CSI2 data lanes %d is not supported", + "number of CSI2 data lanes %d is not supported\n", bus_cfg.bus.mipi_csi2.num_data_lanes); ret = -EINVAL; goto done_endpoint_free; } if (!bus_cfg.nr_of_link_frequencies) { - dev_err(imx335->dev, "no link frequencies defined"); + dev_err(imx335->dev, "no link frequencies defined\n"); ret = -EINVAL; goto done_endpoint_free; } @@ -863,7 +863,7 @@ static int imx335_power_on(struct device *dev) ret = clk_prepare_enable(imx335->inclk); if (ret) { - dev_err(imx335->dev, "fail to enable inclk"); + dev_err(imx335->dev, "fail to enable inclk\n"); goto error_reset; } @@ -969,7 +969,7 @@ static int imx335_init_controls(struct imx335 *imx335) imx335->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; if (ctrl_hdlr->error) { - dev_err(imx335->dev, "control init failed: %d", + dev_err(imx335->dev, "control init failed: %d\n", ctrl_hdlr->error); v4l2_ctrl_handler_free(ctrl_hdlr); return ctrl_hdlr->error; @@ -1002,7 +1002,7 @@ static int imx335_probe(struct i2c_client *client) ret = imx335_parse_hw_config(imx335); if (ret) { - dev_err(imx335->dev, "HW configuration is not supported"); + dev_err(imx335->dev, "HW configuration is not supported\n"); return ret; } @@ -1010,14 +1010,14 @@ static int imx335_probe(struct i2c_client *client) ret = imx335_power_on(imx335->dev); if (ret) { - dev_err(imx335->dev, "failed to power-on the sensor"); + dev_err(imx335->dev, "failed to power-on the sensor\n"); goto error_mutex_destroy; } /* Check module identity */ ret = imx335_detect(imx335); if (ret) { - dev_err(imx335->dev, "failed to find sensor: %d", ret); + dev_err(imx335->dev, "failed to find sensor: %d\n", ret); goto error_power_off; } @@ -1027,7 +1027,7 @@ static int imx335_probe(struct i2c_client *client) ret = imx335_init_controls(imx335); if (ret) { - dev_err(imx335->dev, "failed to init controls: %d", ret); + dev_err(imx335->dev, "failed to init controls: %d\n", ret); goto error_power_off; } @@ -1039,14 +1039,14 @@ static int imx335_probe(struct i2c_client *client) imx335->pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&imx335->sd.entity, 1, &imx335->pad); if (ret) { - dev_err(imx335->dev, "failed to init entity pads: %d", ret); + dev_err(imx335->dev, "failed to init entity pads: %d\n", ret); goto error_handler_free; } ret = v4l2_async_register_subdev_sensor(&imx335->sd); if (ret < 0) { dev_err(imx335->dev, - "failed to register async subdev: %d", ret); + "failed to register async subdev: %d\n", ret); goto error_media_entity; } From patchwork Wed Nov 1 13:13:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160541 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp408713vqx; Wed, 1 Nov 2023 06:14:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG67/zw4FfPq5816gxlRjAyPa4ZCPJsJSyo05zkirpkhaa2ZRupHk0tFvqEUS8xzIYPCegk X-Received: by 2002:a05:6a20:3d0b:b0:16b:79c2:7d6e with SMTP id y11-20020a056a203d0b00b0016b79c27d6emr15691847pzi.30.1698844468425; Wed, 01 Nov 2023 06:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844468; cv=none; d=google.com; s=arc-20160816; b=Hx2dWxY41Knpm5Ie1EfAZoABwlCNb0LGjU+VzdF2/OhlPTbFu5YG2KN3kNpBpEpa6P H/I5XsSFbfjbrAHg3ILcnAsERHIFm0+v7fHpm/a9R8aMY9CGxvz5K525fCWkK/6qXTUb gWSfmvcPsx/29ZlkowSNfh0EY9Xouxh5c62kevkLRgJsNqT42Doet8OLSp/iCJQeC/tl m131ghPqBJy5gxyWj/HUaSVB/cnNcKD3mCs3RE+MJBjJhzHRE2AVSeQVvB9WaydMecWr AKBP43fmuREZiJ6EAF0pTZET2YxjhsbBFBB0Z+47Bu80l7YK2qIIrrguoqheag0/eIrU F6NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IuuDjy2pmUZk2Ukm2/UmxOOb+HQE3/PmtWEZLUghAXM=; fh=L7bdhVUSRGewbZGUqR4L3H+66lE0SlV2odlkQU7WUEM=; b=vBtG12AGUrJlsXSYJGzhR1e05hhePhAujQkUygFvgEaYVBp5EkW2qN61OfCt/2wsPO iV+trx+tIFldguwduKQLGcJPywhnBpWr440G1SSdljgoEmQzeO91VKmSa6hM1A6JqxA9 AiEGTGpZxWJOPRhZxI8q8Ko6qh59nl1bN6KRAKPM1yM7Yr9xhjn6hMXETAc5mTE5PVrt r+n/3+13kyfvLgyGt5svmGuQb+gaUspKTfOCRvkSv1xuSkzkxIsM/JrZ6j//1iKFotgJ rMePzs4Wq1fdbTjgBAj0xX0YoIah4QEe5SHN5tDv55CzFCScI1mLgdXY4CWcKK8PCWn+ 4tcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HSM+abDc; 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 bo7-20020a17090b090700b00278f5fad9b6si810001pjb.139.2023.11.01.06.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:28 -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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=HSM+abDc; 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 520E5801B9FF; Wed, 1 Nov 2023 06:14:23 -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 S1344051AbjKANOR (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343851AbjKANON (ORCPT ); Wed, 1 Nov 2023 09:14:13 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C2FFF4; Wed, 1 Nov 2023 06:14:07 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1AF14E52; Wed, 1 Nov 2023 14:13:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844424; bh=cqUYU2q4hDhZpxo1Fi1Ix4DPuhuP0paFGsY1V5zSNXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSM+abDc4nh4X1w6CkN20KztnDROtn/zTk28cdU2ACq5iJhBOF9BDE5xnWJpaCI6O 7cbMhav8/xZw6XUmxLt7GHeMCjSTRjKbWIf4o6RASH/JEdejrN9Avjj3UZRkGqmE+w f38jTHAVGLWJDqUqEpiB9qmZEB/YEJe1JlPhljdE= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , Umang Jain , "Paul J. Murphy" , Daniele Alessandrelli , Sakari Ailus , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 3/6] media: i2c: imx335: Improve configuration error reporting Date: Wed, 1 Nov 2023 13:13:51 +0000 Message-Id: <20231101131354.2333498-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367537271901754 X-GMAIL-MSGID: 1781367537271901754 The existing imx335_parse_hw_config function has two paths that can be taken without reporting to the user the reason for failing to accept the hardware configuration. Extend the error reporting paths to identify failures when probing the device. Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- v2: - Fix line endings Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx335.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index cbabef968e21..31c612c6bdd8 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -795,8 +795,10 @@ static int imx335_parse_hw_config(struct imx335 *imx335) } ep = fwnode_graph_get_next_endpoint(fwnode, NULL); - if (!ep) + if (!ep) { + dev_err(imx335->dev, "Failed to get next endpoint\n"); return -ENXIO; + } ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg); fwnode_handle_put(ep); @@ -821,6 +823,8 @@ static int imx335_parse_hw_config(struct imx335 *imx335) if (bus_cfg.link_frequencies[i] == IMX335_LINK_FREQ) goto done_endpoint_free; + dev_err(imx335->dev, "no compatible link frequencies found\n"); + ret = -EINVAL; done_endpoint_free: From patchwork Wed Nov 1 13:13:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp408771vqx; Wed, 1 Nov 2023 06:14:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgoOTuWPePYf/MuHo85N4UmlIwxB0sDl5QUClYhlxdcJ7Hbj2A3bypH++piJWQgg715ZWN X-Received: by 2002:a05:6a20:7487:b0:17e:498c:7553 with SMTP id p7-20020a056a20748700b0017e498c7553mr14492006pzd.51.1698844472963; Wed, 01 Nov 2023 06:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844472; cv=none; d=google.com; s=arc-20160816; b=pwf68VIii+vcDA3hggsSfvWQtnUuUM3pDcPEfutcjlyhZ6ZJ/63JyZbOTn9Sf7jkAr KcPZjeItOOLXHUeLDVklaUgYydlj2R+r7w56+EktzQQ5XX8oUxcRba4lhUy1OuXtz7Ay m5nuvbqpP3/jSoC4xopDP245Pas1Ly/5eHNgm5BIS2Y65c8R085W+mxglWqx0I4qZ2y4 tQCeGSnaY4yWk9uEgbohCyKOfGdd5MYIsPaPQSIdaT1mjM5crXHmRnHD+D+McQ4Z1NdI 5dHE2j/hR8nLXycV7BdMoq8Hguuhy12DM6zCO4hUanQwzqna0fRVbUsDbDdkf0djZbKt v1eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S0cqoO4ULZEk3tjCjNQPGpvL4UCucxWW2rS+zzf6Bkk=; fh=pzDjuBW6iTH3lRufj60HcOrI13gwrAMAibI8ac4xXMg=; b=zBG+vDJORunTYmk6lAiC8mHzGREK4zzyRHxKoWdwWXVB1nuSiG5e2tnboKXPQoA8XH f4jXpRVq9fdhTDfzovjKWP1YvqyTeXQPdJt/TomtiUxJCC7sS7CR3KUQHAj/wgRFfu7c TZ+gFoqPQRYe3MzqPsejBtT/7CQVad7ISFOipiZVhR2+t3w6KFN78wDI7kqvLGCTw0tC ukldECCWHnrlK2w1ixkYEkBvk0eCXdI1Ek90BdWI6+H9Dw8/1AGInvGCgItqTdQKcGJq iMTnhe42d7QLYQ+PCwZQ4FwNhbNu723M6rQhe81V5Y/OY7OWgMa4/rhBq5gcERdNPqIB yw9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bImg6fEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n4-20020a170902e54400b001cc5ada2b94si3136927plf.366.2023.11.01.06.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bImg6fEe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 00C1280E0686; Wed, 1 Nov 2023 06:14:28 -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 S1343916AbjKANOX (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344095AbjKANOS (ORCPT ); Wed, 1 Nov 2023 09:14:18 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4691410D; Wed, 1 Nov 2023 06:14:12 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9774FEBA; Wed, 1 Nov 2023 14:13:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844424; bh=rWqdVjp7cdOWjdFZPS8Nn5D09Y53JzqDLSoZWcTjgF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bImg6fEeNxbDUz7l93KsXXvYgzoCcsZJtiYswKpRuhZhICoR7oxMvu3IDaeVdHY+Q XLubV0n9hBYo05GmNQQW3fCAC6KKv110dM7rTVKwaMc0DWxKc6QbdIDXQgdo58pdZz Fluc25+lMvmCDC/zsOyoNeF1u8ySBnbyZzpSnrcM= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , "Paul J. Murphy" , Daniele Alessandrelli , Sakari Ailus , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 4/6] media: i2c: imx335: Enable regulator supplies Date: Wed, 1 Nov 2023 13:13:52 +0000 Message-Id: <20231101131354.2333498-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367542071051769 X-GMAIL-MSGID: 1781367542071051769 Provide support for enabling and disabling regulator supplies to control power to the camera sensor. While updating the power on function, document that a sleep is represented as 'T4' in the datasheet power on sequence. Signed-off-by: Kieran Bingham --- v2: - document 'supplies' member variable - disable regulators in error path - Remove 'unhelpful' comments Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx335.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index 31c612c6bdd8..f17ce40b9c77 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -75,6 +75,14 @@ struct imx335_reg_list { const struct imx335_reg *regs; }; +static const char * const imx335_supply_name[] = { + "avdd", /* Analog (2.9V) supply */ + "ovdd", /* Digital I/O (1.8V) supply */ + "dvdd", /* Digital Core (1.2V) supply */ +}; + +#define IMX335_NUM_SUPPLIES ARRAY_SIZE(imx335_supply_name) + /** * struct imx335_mode - imx335 sensor mode structure * @width: Frame width @@ -108,6 +116,7 @@ struct imx335_mode { * @sd: V4L2 sub-device * @pad: Media pad. Only one pad supported * @reset_gpio: Sensor reset gpio + * @supplies: Regulator supplies to handle power control * @inclk: Sensor input clock * @ctrl_handler: V4L2 control handler * @link_freq_ctrl: Pointer to link frequency control @@ -126,6 +135,8 @@ struct imx335 { struct v4l2_subdev sd; struct media_pad pad; struct gpio_desc *reset_gpio; + struct regulator_bulk_data supplies[IMX335_NUM_SUPPLIES]; + struct clk *inclk; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_ctrl *link_freq_ctrl; @@ -781,6 +792,17 @@ static int imx335_parse_hw_config(struct imx335 *imx335) return PTR_ERR(imx335->reset_gpio); } + for (i = 0; i < IMX335_NUM_SUPPLIES; i++) + imx335->supplies[i].supply = imx335_supply_name[i]; + + ret = devm_regulator_bulk_get(imx335->dev, + IMX335_NUM_SUPPLIES, + imx335->supplies); + if (ret) { + dev_err(imx335->dev, "Failed to get regulators\n"); + return ret; + } + /* Get sensor input clock */ imx335->inclk = devm_clk_get(imx335->dev, NULL); if (IS_ERR(imx335->inclk)) { @@ -863,6 +885,17 @@ static int imx335_power_on(struct device *dev) struct imx335 *imx335 = to_imx335(sd); int ret; + ret = regulator_bulk_enable(IMX335_NUM_SUPPLIES, + imx335->supplies); + if (ret) { + dev_err(dev, "%s: failed to enable regulators\n", + __func__); + return ret; + } + + usleep_range(500, 550); /* Tlow */ + + /* Set XCLR */ gpiod_set_value_cansleep(imx335->reset_gpio, 1); ret = clk_prepare_enable(imx335->inclk); @@ -871,12 +904,13 @@ static int imx335_power_on(struct device *dev) goto error_reset; } - usleep_range(20, 22); + usleep_range(20, 22); /* T4 */ return 0; error_reset: gpiod_set_value_cansleep(imx335->reset_gpio, 0); + regulator_bulk_disable(IMX335_NUM_SUPPLIES, imx335->supplies); return ret; } @@ -893,8 +927,8 @@ static int imx335_power_off(struct device *dev) struct imx335 *imx335 = to_imx335(sd); gpiod_set_value_cansleep(imx335->reset_gpio, 0); - clk_disable_unprepare(imx335->inclk); + regulator_bulk_disable(IMX335_NUM_SUPPLIES, imx335->supplies); return 0; } From patchwork Wed Nov 1 13:13:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp409008vqx; Wed, 1 Nov 2023 06:14:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERAAFyNh5a6Y1BD/Zm7Ep6HBjRHDfJEAVAs21YkooaWQ3lZnUS9uVLyVBmrd0QUtJCUUpK X-Received: by 2002:a05:6a20:3d82:b0:16b:9886:7eda with SMTP id s2-20020a056a203d8200b0016b98867edamr18056821pzi.35.1698844490305; Wed, 01 Nov 2023 06:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844490; cv=none; d=google.com; s=arc-20160816; b=hSb6PY0qm2AiBEcZXH/8glGGlkrxkpY+UWg6xSz+4i4i5g4QvLjnrNX0X9sMDw3l2E cFRe08PSC8FXYSwoI1hYR+JB/JUqK+r8tpv3Ezrqb4J0tG8c/qShz1YbtrYshKwSg0Sk /giFGXStUON7/uf+0rrdmhQZOB16Z4gTXAJMHnIb+CeqIPAqQl9HSDq+mfLMNokeJ5a1 EyjeJiv9E1QAqKkmpHOGT9djZNuZxhUfeyp2fiNNLmckTmnTVl6GhN376mFGysZKUkBd MMdm0tfhZKrPsFQQB+v9VW4RzFfLcwepDOrurUbX4B+YE33kSrsnreGcNGdleaZcX9Ml sicg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UsLW2VPiGE7GBqYqoqimJV0AHJ6z4YAITkE2i1+Sj9g=; fh=f/966SgsAbIcykPEP2Lvqjlt9B7hNcBFmm2fwqoCZfc=; b=ATf7hTmqBqEPItzIxYP14ns/JUfxg7k52Dvbc8bcZGJIJq5SUkH6zMIFrelnAYijAV tpHXP7H95NpAiApvBcwmJ33VqIA/l2UlX1DCYz/3QZYmDl6Fe2AraSrNH6GjYco6QteH o0jdyMjB1bsl9yeibimJRYIz738cNarQjctuCzzwRPh4uCH3vwj2sTN/TeqyEW+d3wUx +wNfc15Za9XvPh+9+jbqVguyiyHJK8hIB721/zyxLKxNX4qLZadOxdwg7yni4Nyj+TCA uf971Wbp+IDYgI4m03ISY3bVG+2YHQYQUIktnL9CKAEXHc3igQmvTWQGNVqBUCrgl2dN F03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=ooE2Z946; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a5-20020a656405000000b00578d026e2eesi2937362pgv.283.2023.11.01.06.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=ooE2Z946; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 B564A80E65A7; Wed, 1 Nov 2023 06:14:34 -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 S1344162AbjKANOZ (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344097AbjKANOV (ORCPT ); Wed, 1 Nov 2023 09:14:21 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A3C7F7; Wed, 1 Nov 2023 06:14:13 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BA951B3C; Wed, 1 Nov 2023 14:13:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844425; bh=M7qeXtW80BMCwOM97yVw3yfM3PFOFxYQN2xPoFyTdX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ooE2Z946WCHrsCKQ5BvFK6kE7OqxB5SGGgfAc7H7ZbB5euXJHcpG0iB+D7N0Kg8UJ /7Y4vrILoLNOy7hvLpHoSGDig8co75fLCi80PREln9O++5yPXkBhkrBy2YYED2U436 //9dQ9FE+L4DPUU7zOkmZsulJT6+vXnLKkDRth3A= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , Umang Jain , Sakari Ailus , "Paul J. Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 5/6] media: i2c: imx335: Implement get selection API Date: Wed, 1 Nov 2023 13:13:53 +0000 Message-Id: <20231101131354.2333498-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_PDS_OTHER_BAD_TLD,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367560461246570 X-GMAIL-MSGID: 1781367560461246570 Support reporting of the Sensor Native and Active pixel array areas through the Selection API. The implementation reports a single target crop only for the mode that is presently exposed by the driver. Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- v2: - Also define .set_selection Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx335.c | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index f17ce40b9c77..ce41e9f669bc 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -55,6 +55,14 @@ #define IMX335_REG_MIN 0x00 #define IMX335_REG_MAX 0xfffff +/* IMX335 native and active pixel array size. */ +#define IMX335_NATIVE_WIDTH 2616U +#define IMX335_NATIVE_HEIGHT 1964U +#define IMX335_PIXEL_ARRAY_LEFT 12U +#define IMX335_PIXEL_ARRAY_TOP 12U +#define IMX335_PIXEL_ARRAY_WIDTH 2592U +#define IMX335_PIXEL_ARRAY_HEIGHT 1944U + /** * struct imx335_reg - imx335 sensor register * @address: Register address @@ -647,6 +655,41 @@ static int imx335_init_pad_cfg(struct v4l2_subdev *sd, return imx335_set_pad_format(sd, sd_state, &fmt); } +/** + * imx335_get_selection() - Selection API + * @sd: pointer to imx335 V4L2 sub-device structure + * @sd_state: V4L2 sub-device configuration + * @sel: V4L2 selection info + * + * Return: 0 if successful, error code otherwise. + */ +static int imx335_get_selection(struct v4l2_subdev *sd, + struct v4l2_subdev_state *sd_state, + struct v4l2_subdev_selection *sel) +{ + switch (sel->target) { + case V4L2_SEL_TGT_NATIVE_SIZE: + sel->r.top = 0; + sel->r.left = 0; + sel->r.width = IMX335_NATIVE_WIDTH; + sel->r.height = IMX335_NATIVE_HEIGHT; + + return 0; + + case V4L2_SEL_TGT_CROP: + case V4L2_SEL_TGT_CROP_DEFAULT: + case V4L2_SEL_TGT_CROP_BOUNDS: + sel->r.top = IMX335_PIXEL_ARRAY_TOP; + sel->r.left = IMX335_PIXEL_ARRAY_LEFT; + sel->r.width = IMX335_PIXEL_ARRAY_WIDTH; + sel->r.height = IMX335_PIXEL_ARRAY_HEIGHT; + + return 0; + } + + return -EINVAL; +} + /** * imx335_start_streaming() - Start sensor stream * @imx335: pointer to imx335 device @@ -864,6 +907,8 @@ static const struct v4l2_subdev_pad_ops imx335_pad_ops = { .init_cfg = imx335_init_pad_cfg, .enum_mbus_code = imx335_enum_mbus_code, .enum_frame_size = imx335_enum_frame_size, + .get_selection = imx335_get_selection, + .set_selection = imx335_get_selection, .get_fmt = imx335_get_pad_format, .set_fmt = imx335_set_pad_format, }; From patchwork Wed Nov 1 13:13:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 160544 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp409031vqx; Wed, 1 Nov 2023 06:14:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFPehirgeyiNONYfGGvFqaR/8C9OaSPtuxL+uDC9K8rsumGT0KRkwcjQXyuz1f0tmay1KE+ X-Received: by 2002:a05:6358:186:b0:168:e3e1:11d5 with SMTP id d6-20020a056358018600b00168e3e111d5mr20958593rwa.28.1698844492833; Wed, 01 Nov 2023 06:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698844492; cv=none; d=google.com; s=arc-20160816; b=evRejUCOhzO8jmL3B02f3E1Z1nxcUyIJgqjTSOSdiNoI1UYgyKIeC6rDfoYRbePHXe UDoozlXu/N8dkuqwGIz9OTGGneecM0xjHh51P0Bpg4QUT+UWAVjJGVkema63kfcgAtGv hNBcD/ova069b2PevDlzTnlSwrAtj9yAvOyhl+RAOmW4QSAxTcbd++azs3mMSAV5enf4 ui/BG/lMhuvoduh2pyLFBrDbBYUwCT2ufi7hrhi9RU+LeKKv6QdGI8p+MAr/w9il8rHL EOiKXdZkpgnJMPs3U5xSib6YljUfFQxLSuZEwnpcBs4Ihvsx7KDrNkkV5tomA8bOIFoj 4uQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9jJMnq3t911vjpLlhC9Pko3KkWJTvBKgH70qvh9LHJE=; fh=L7bdhVUSRGewbZGUqR4L3H+66lE0SlV2odlkQU7WUEM=; b=uoUI8gvTw87wcEcgNM0ym4KqVMOx4B/gQ2X8ylC6DwHGtv/hOrN9hwHq4q9JOOCMH7 m9WtI6v9ktDsELztFfXQTunAsT3Fc2WdvhJzDIEGnE1ZtfyVfx+xYdukZR61GLmgvSqq p8e8QddStkThlBVbUSSXBeZkVRWliiSVYmbrx1m22Y7lo33p5hdmlWK9pk5cA2ay2MOP Nm/ophQJZYSzqjlnfYVaFeQVY3PbEHwCnoeXOLkfxJ6htZ8ZDdhtfx8f/Sf7GV4aL6LL FmAiKFAtn7eVXVBYh5CMmO8MumAhKe3g27tVmYyCGVfS36EedtK9m0LVU8AriFRT38CQ jrug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hvQ3tiua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j69-20020a638048000000b00578e98dec9dsi3034391pgd.160.2023.11.01.06.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 06:14:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hvQ3tiua; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 6238F80E7116; Wed, 1 Nov 2023 06:14:38 -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 S1344163AbjKANO3 (ORCPT + 35 others); Wed, 1 Nov 2023 09:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344123AbjKANOY (ORCPT ); Wed, 1 Nov 2023 09:14:24 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED220126; Wed, 1 Nov 2023 06:14:17 -0700 (PDT) Received: from Monstersaurus.local (aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net [82.37.23.78]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F29551BAE; Wed, 1 Nov 2023 14:13:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698844426; bh=d0d7Rf2i4W+OeBaDehCuPFL1ycw0UNOszMGw/ErkDB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hvQ3tiuanR7IGruQnZLms19/RyFFkoyLbgtZ/Ugcq/iB1EnKF1uE0r0SnQg5IWxpq 1f+VBdOGgrRCaF7D3LbCGBDLlQ5ju+kej4KR8hYsoASkvMv5/cKR7jBR7zRiFnRrar xKRUgYfb2x5k9xNlTqRhzFqaAvgpbk+bDzmHK2+M= From: Kieran Bingham To: devicetree@vger.kernel.org, linux-media@vger.kernel.org Cc: Kieran Bingham , Umang Jain , "Paul J. Murphy" , Daniele Alessandrelli , Sakari Ailus , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 6/6] media: i2c: imx335: Fix hblank min/max values Date: Wed, 1 Nov 2023 13:13:54 +0000 Message-Id: <20231101131354.2333498-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> References: <20231101131354.2333498-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 06:14:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781367562768021432 X-GMAIL-MSGID: 1781367562768021432 The V4L2_CID_HBLANK control is marked as readonly and can only be a single value. Set the minimum and maximum value to match the mode value. Reviewed-by: Umang Jain Signed-off-by: Kieran Bingham --- drivers/media/i2c/imx335.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c index ce41e9f669bc..5373775cf63f 100644 --- a/drivers/media/i2c/imx335.c +++ b/drivers/media/i2c/imx335.c @@ -1045,8 +1045,8 @@ static int imx335_init_controls(struct imx335 *imx335) imx335->hblank_ctrl = v4l2_ctrl_new_std(ctrl_hdlr, &imx335_ctrl_ops, V4L2_CID_HBLANK, - IMX335_REG_MIN, - IMX335_REG_MAX, + mode->hblank, + mode->hblank, 1, mode->hblank); if (imx335->hblank_ctrl) imx335->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;