From patchwork Sun Dec 6 17:27:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Srba X-Patchwork-Id: 11954199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30671C4167B for ; Sun, 6 Dec 2020 17:31:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4AEF22D06 for ; Sun, 6 Dec 2020 17:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4AEF22D06 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seznam.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Wb8Al9UjiPv7BR1XZjX2X8gTeewmQeX0iXio5K2T+/o=; b=PQkS9tJGWISU6HIYF12vRVF3ET j5ZhwnhYIQtzRLs52hhbIsmQvfPnF2/lx++FqKvTmFe5zguMQWeYwXZM37rIb+r50CngqwC3X2XTK XJCgiWVxAuW7i528244uX7ShxjlJ3LXzLkvOcmu0orbwNRzUOPKaJ9c/OHS7seS8lJbuPJ+7yTMKU K5YG15zhe0Adf8Ouf7wfycfo3y1Nv0zTsQrBKlb5YFIf5XiVp0GsyZw7KGnIOBksRgTY5QvpKoQK3 xXB07ZkPzzT1UYo6toN60byNMUlarRpcq6vy0Rx+pJ8zqriy8UdrxtRZdI41bguMp9yChj1TpTtxl U0YZmp3A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrI-0000Z2-RC; Sun, 06 Dec 2020 17:30:04 +0000 Received: from mxf1.seznam.cz ([2a02:598:a::78:123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrA-0000Wr-AD for linux-arm-kernel@lists.infradead.org; Sun, 06 Dec 2020 17:29:58 +0000 Received: from email.seznam.cz by email-smtpc5b.ko.seznam.cz (email-smtpc5b.ko.seznam.cz [10.53.13.135]) id 177cf2754c72a61c16d53e2b; Sun, 06 Dec 2020 18:29:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1607275788; bh=ybBRjPqU6rJbV5rjROFU6Aw8Yi20t5tZm3wNoJxhQoU=; h=Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=W0Eb/fahfv3jR1xYww7la/Lvvm4l/ogTeAAj/+iUpVcfGYR3ojFtXfSb7JTmREvAD IoOL3Qt7sV7U/pIHDoFq1j11akEPIFCC9DIR03qJb/uADnVsb3qVqUEgrOiMdyK6w/ iWw9dsc5DPt5t9rUaZw+HSLwt0jQB+w7DfRrtAcI= Received: from localhost.localdomain (ip-228-128.dynamic.ccinternet.cz [212.69.128.228]) by email-relay23.ko.seznam.cz (Seznam SMTPD 1.3.122) with ESMTP; Sun, 06 Dec 2020 18:29:46 +0100 (CET) From: michael.srba@seznam.cz To: Dave Stevenson , Mauro Carvalho Chehab , Rob Herring , Shawn Guo , Sascha Hauer Subject: [PATCH v2 1/3] media: i2c: imx219: add support for specifying clock-frequencies Date: Sun, 6 Dec 2020 18:27:18 +0100 Message-Id: <20201206172720.9406-1-michael.srba@seznam.cz> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201206_122956_714923_C6CE4E48 X-CRM114-Status: GOOD ( 17.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Geert Uytterhoeven , Magnus Damm , linux-renesas-soc@vger.kernel.org, Michael Srba , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Michael Srba This patch adds 1% tolerance on input clock, similar to other camera sensor drivers. It also allows for specifying the actual clock in the device tree, instead of relying on it being already set to the right frequency (which is often not the case). Signed-off-by: Michael Srba --- changes since v1: default to exactly 24MHz when `clock-frequency` is not present --- drivers/media/i2c/imx219.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index f64c0ef7a897..b6500e2ab19e 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1443,13 +1443,28 @@ static int imx219_probe(struct i2c_client *client) return PTR_ERR(imx219->xclk); } - imx219->xclk_freq = clk_get_rate(imx219->xclk); - if (imx219->xclk_freq != IMX219_XCLK_FREQ) { + ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency", &imx219->xclk_freq); + if (ret) { + dev_warn(dev, "could not get xclk frequency\n"); + + /* default to 24MHz */ + imx219->xclk_freq = 24000000; + } + + /* this driver currently expects 24MHz; allow 1% tolerance */ + if (imx219->xclk_freq < 23760000 || imx219->xclk_freq > 24240000) { dev_err(dev, "xclk frequency not supported: %d Hz\n", imx219->xclk_freq); return -EINVAL; } + ret = clk_set_rate(imx219->xclk, imx219->xclk_freq); + if (ret) { + dev_err(dev, "could not set xclk frequency\n"); + return ret; + } + + ret = imx219_get_regulators(imx219); if (ret) { dev_err(dev, "failed to get regulators\n"); From patchwork Sun Dec 6 17:27:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Srba X-Patchwork-Id: 11954195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72547C4361B for ; Sun, 6 Dec 2020 17:31:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AC5322D06 for ; Sun, 6 Dec 2020 17:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AC5322D06 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seznam.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=J2czzpoku+lMF6ZKbNH5S5l/KuCuyrp9yCOJXu1shSQ=; b=JTPmoV+dnJ9w6glmkvAkYcO+F YfRbrZKCzRc9LVhkk6mrlf5TW4sz9/E21FgdfO4v4uhRXFqwoLt3Ifx5TAwTQMdwZ2GLLzuPa/SnI KytG6K5SGg6MrKp9H95a7y71fRwTZHsIlyJgkP4dmHzTgYOprqriwRlF5xEepEAUIH36CKKeWEmkC gkdLqDbnYsR5W8K23YTwNWUgJL4aItWHuEXFRwg6b7kzWaB7UE8Bz3nEmdrRXHRJbJeco6mwIOCVj x/3TEPYNJ6HWZevx/xfPFNw49VSNfHksiV70MBrb7HlWJye1i/kr4O0xFDUhPtcQt2OhLw4GV7G77 X9JmWNHag==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrG-0000YW-Tr; Sun, 06 Dec 2020 17:30:02 +0000 Received: from mxf1.seznam.cz ([2a02:598:a::78:123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrA-0000Wq-AC for linux-arm-kernel@lists.infradead.org; Sun, 06 Dec 2020 17:29:57 +0000 Received: from email.seznam.cz by email-smtpc12a.ko.seznam.cz (email-smtpc12a.ko.seznam.cz [10.53.11.105]) id 6225ee47392bba2e638c2219; Sun, 06 Dec 2020 18:29:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1607275788; bh=OsqIBbxu6dHOZRO3EWBlE2gBad2O349VxgymSsZsbuc=; h=Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=WvMeXPpD9h6koro2sCHlc0cOban/io4o1WRYkhcPpz+FcCdjRSj3GN1+vKUvDpiOV Cipsq55r2+E/ackKfI0YQMHc7HyjoGoDZWphtwSoKHk739TkSDiro/nSluOA5BSBdS 42QxraUSPO2v5FGslh9CoU7/FuCg4sgahmIklPfk= Received: from localhost.localdomain (ip-228-128.dynamic.ccinternet.cz [212.69.128.228]) by email-relay23.ko.seznam.cz (Seznam SMTPD 1.3.122) with ESMTP; Sun, 06 Dec 2020 18:29:46 +0100 (CET) From: michael.srba@seznam.cz To: Dave Stevenson , Mauro Carvalho Chehab , Rob Herring , Shawn Guo , Sascha Hauer Subject: [PATCH v2 2/3] media: dt-bindings: media: i2c: imx219: document clock-frequency property Date: Sun, 6 Dec 2020 18:27:19 +0100 Message-Id: <20201206172720.9406-2-michael.srba@seznam.cz> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206172720.9406-1-michael.srba@seznam.cz> References: <20201206172720.9406-1-michael.srba@seznam.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201206_122956_712953_3545A11A X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Geert Uytterhoeven , Magnus Damm , linux-renesas-soc@vger.kernel.org, Michael Srba , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Michael Srba This patch documents the clock-frequency property, which allows the driver to change the clock frequency from it's default value. Signed-off-by: Michael Srba --- changes since v1: none --- Documentation/devicetree/bindings/media/i2c/imx219.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/imx219.yaml b/Documentation/devicetree/bindings/media/i2c/imx219.yaml index dfc4d29a4f04..666b8a9da5be 100644 --- a/Documentation/devicetree/bindings/media/i2c/imx219.yaml +++ b/Documentation/devicetree/bindings/media/i2c/imx219.yaml @@ -27,6 +27,10 @@ properties: clocks: maxItems: 1 + clock-frequency: + description: + Frequency of the input clock in Hertz. + VDIG-supply: description: Digital I/O voltage supply, 1.8 volts @@ -78,6 +82,7 @@ required: - compatible - reg - clocks + - clock-frequency - VANA-supply - VDIG-supply - VDDL-supply @@ -95,6 +100,7 @@ examples: compatible = "sony,imx219"; reg = <0x10>; clocks = <&imx219_clk>; + clock-frequency = <24000000>; VANA-supply = <&imx219_vana>; /* 2.8v */ VDIG-supply = <&imx219_vdig>; /* 1.8v */ VDDL-supply = <&imx219_vddl>; /* 1.2v */ From patchwork Sun Dec 6 17:27:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Srba X-Patchwork-Id: 11954197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D39F6C433FE for ; Sun, 6 Dec 2020 17:31:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8595E22D06 for ; Sun, 6 Dec 2020 17:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8595E22D06 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=seznam.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VyF96y8TxxYVKkupUsPYMTm3IeD8Ex05CciDIpuxdN8=; b=cyD1Uz05MU5e7JByD/9PbA2I/ zCSceUfZOwiFmhZiY7dML76ze43iF23x+3DBWbdNEQqohHpYc8OGO+bxzCOzGA+iJaPfeOBo4+Ct1 jWPwmDoyZe0/QyxpGaO7mpekMjFUexeSI3AiRjUnYl4CAPXVsNUonZi17U9Lz0JRy2XyBcKyjdN7U EFWD550TNA3WDDB9Mqd+Eh+XJdrCD7K7+PtYeZRHe5+FEKtAtQhGuwXs+8XeeLt/JLZQtRS5Sjz10 4W1yJgXFAoxVtTLyyn1j4KvtP4bgfTZA6uyvUGRHSCuynKL2x5kq1iS9O4g55FTQnmLExhh6GdMX0 0T7Ahsr5g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrD-0000Y8-Vv; Sun, 06 Dec 2020 17:30:00 +0000 Received: from mxf1.seznam.cz ([2a02:598:a::78:123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1klxrA-0000Ww-AC for linux-arm-kernel@lists.infradead.org; Sun, 06 Dec 2020 17:29:57 +0000 Received: from email.seznam.cz by email-smtpc17b.ko.seznam.cz (email-smtpc17b.ko.seznam.cz [10.53.18.19]) id 5822b254032ce63d598b7e0a; Sun, 06 Dec 2020 18:29:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seznam.cz; s=beta; t=1607275790; bh=oaf72hRe5cPmAi3mu1C9bnHaKNa77su7C6AXZDPrAHc=; h=Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=bj5Drh2Bifz4twpXRqf5cE5E9psE7R50k2gAJOKuGBlFNeaeRSgSVEN9y0rYSEV4n cHXqyTDN4wQGw6rY8RdQk26t6udf3QYpLzbLHjT8kRI9FGe40zVp+NPyUOO/j8Dndq D06wOUqUEcz5yzuTQmJiBovJapDhsVfc2hn2qDgc= Received: from localhost.localdomain (ip-228-128.dynamic.ccinternet.cz [212.69.128.228]) by email-relay23.ko.seznam.cz (Seznam SMTPD 1.3.122) with ESMTP; Sun, 06 Dec 2020 18:29:47 +0100 (CET) From: michael.srba@seznam.cz To: Dave Stevenson , Mauro Carvalho Chehab , Rob Herring , Shawn Guo , Sascha Hauer Subject: [PATCH v2 3/3] arm64: dts: update device trees to specify clock-frequency in imx219 node Date: Sun, 6 Dec 2020 18:27:20 +0100 Message-Id: <20201206172720.9406-3-michael.srba@seznam.cz> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201206172720.9406-1-michael.srba@seznam.cz> References: <20201206172720.9406-1-michael.srba@seznam.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201206_122956_700391_1E04BBEA X-CRM114-Status: GOOD ( 12.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Geert Uytterhoeven , Magnus Damm , linux-renesas-soc@vger.kernel.org, Michael Srba , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Michael Srba This patch adds the clock-frequency property to all device trees that use the imx219 binding, with the value of exactly 24Mhz which was previously implicitly assumed. Signed-off-by: Michael Srba --- changes since v1: remove errorneous edit --- arch/arm64/boot/dts/renesas/aistarvision-mipi-adapter-2.1.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/renesas/aistarvision-mipi-adapter-2.1.dtsi b/arch/arm64/boot/dts/renesas/aistarvision-mipi-adapter-2.1.dtsi index dac6ff49020f..986c6c1f7312 100644 --- a/arch/arm64/boot/dts/renesas/aistarvision-mipi-adapter-2.1.dtsi +++ b/arch/arm64/boot/dts/renesas/aistarvision-mipi-adapter-2.1.dtsi @@ -82,6 +82,7 @@ imx219: imx219@10 { compatible = "sony,imx219"; reg = <0x10>; clocks = <&osc25250_clk>; + clock-frequency = <24000000>; VANA-supply = <&imx219_vana_2v8>; VDIG-supply = <&imx219_vdig_1v8>; VDDL-supply = <&imx219_vddl_1v2>;