From patchwork Thu Jul 28 13:02:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931274 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0A67C19F29 for ; Thu, 28 Jul 2022 13:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238518AbiG1NCu (ORCPT ); Thu, 28 Jul 2022 09:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbiG1NCs (ORCPT ); Thu, 28 Jul 2022 09:02:48 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC0331921; Thu, 28 Jul 2022 06:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013367; x=1690549367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=kgePlvyEqNOKZc/fvox90VcBtIBBK25kBBHPBYO2tmOrXWVmV/uoPza9 EobQpBYGqlakiTkzfxbpN0wtAF3Lw0ISPfUpPpqVMet6PPH5NnjUBVMug R8Bhm5EKFnKYbpHXvChqqPguGWBTLiLaG2EGfA0u+xS1TePvUNU09oTDP wN/Iv1ODoUShP2HYbbcFg6B0FxeblPzWKySp7JdcFU77iElTzx8i2IllP A/opAWLdReEttUB04wyAAos2l0TyIN8MaBmNHkGMPrQ8lqT+s1GDg2Fhn zGNq2g/o5Mz8S3ffYTiVPLCdeVcmeOafdTLSdaWUJ1PZHXXRfWEZdXsAw g==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321365" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:43 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013363; x=1690549363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=YBCFy4egfC0LJlW7SvO8ERJqt401SBWGyHa6W8q1AuuxBEIJ81FHMilW F5Jx+hPxzIyF1rE3pXYXXSS2EFxN/fQSj89ZdBzhgPX2VI/qiz146wzfS NNxI3s5jagFEzTwAOFjnjVAuAJ5YnIRJ/dp1TbssyttU0VjPtEr89lW0f FIUwEc9SzzF7nlWBrAVKtB/bVWQEqc74sTCdfuoEh12m50NrEmB+OXm8K MSEBXhtEEV+ZFCc7jV0+g8gdmvPIs8mvtjVJ4FHI1FBdRIE46g2vSZVF+ xykwX6XXGhL27tpa6njwRWB2stZRWgRtMahXx4F0HjRIACt9ai//dw58G Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321364" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 588AB280072; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 1/7] media: i2c: ov9282: remove unused and unset i2c_client member Date: Thu, 28 Jul 2022 15:02:31 +0200 Message-Id: <20220728130237.3396663-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is not need anyway as the i2c_client is stored in v4l2_subdev. Signed-off-by: Alexander Stein Acked-by: Daniele Alessandrelli --- drivers/media/i2c/ov9282.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 2e0b315801e5..8a252bf3b59f 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -104,7 +104,6 @@ struct ov9282_mode { /** * struct ov9282 - ov9282 sensor device structure * @dev: Pointer to generic device - * @client: Pointer to i2c client * @sd: V4L2 sub-device * @pad: Media pad. Only one pad supported * @reset_gpio: Sensor reset gpio @@ -123,7 +122,6 @@ struct ov9282_mode { */ struct ov9282 { struct device *dev; - struct i2c_client *client; struct v4l2_subdev sd; struct media_pad pad; struct gpio_desc *reset_gpio; From patchwork Thu Jul 28 13:02:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A679C19F2C for ; Thu, 28 Jul 2022 13:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238596AbiG1NCv (ORCPT ); Thu, 28 Jul 2022 09:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238516AbiG1NCt (ORCPT ); Thu, 28 Jul 2022 09:02:49 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E763CBF2; Thu, 28 Jul 2022 06:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013368; x=1690549368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KaEDJVU3uZqRPoVDhl+O6jtIVNEtEGZ+mLxj2kIA+XQ=; b=dY9HFuIVzJWbwzFe3hRbunEy3ec3NAu6iNL5gyGp2HEmETH+YZOgfSFG dy5MrGtlSL8xjBjV7G8ScHSx3KojusK+8XT17UnUfUaKVsH3GitisUHRx pXPViAoZGi/46oaQb/JYd2TGYZFa8D5D6COYmKA1/4FZ53U4QFthPp/j6 DG3BPBAIJ2tlVuhPREo8aHHdAWVVZPrvYWY/mlM8DtNt1AqiLjD4bRDUg oUDy7TCzxsj7cGlEDwHrUblU31/2i5BvWqD+6pvY5E369pb4rP4Onhivx Hls2qlJHwF6LPEjIiGjqVGCOg8nsZy1p720rGQLALq7nUc77A7nPa7KGk w==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321367" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:43 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013363; x=1690549363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KaEDJVU3uZqRPoVDhl+O6jtIVNEtEGZ+mLxj2kIA+XQ=; b=G9vZUAme1fd/v6Wlu+BrZr0/uPMbGhGoavwo2o4ka9S0gR5bM4nxsrFA AXO203YZGCffYKh4B/T7Y9WVr94PA7tb1xogNkXqnhCYrbUBe/rTmsHxK Gaci34gl19QvQnGJWiwDwNPSNpOpENqHpgBC/QlKJClOGbrF8m8Brofqt zbglVxkpNDfod4YOxfmKR7gRsHSX+wl6L5pORgA19pfHZofBB3NHfXlBl MACKrkJMG1UbWxCl3tvc/2gr/PsmqfPDgBaKn2B1C7I+/kJ86dOjZP9nD EH6NQ4wB+UHcJHOqOByU4i8Q9yRsUxRV/zv2Rt/KcgvSjk0USYw8t6mfP w==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321366" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 80635280056; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus , Krzysztof Kozlowski Subject: [PATCH v4 2/7] media: dt-bindings: media: Add compatible for ov9281 Date: Thu, 28 Jul 2022 15:02:32 +0200 Message-Id: <20220728130237.3396663-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is a slightly different hardware with identical software interface. Signed-off-by: Alexander Stein Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml index bf115ab9d926..285f8c85f253 100644 --- a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml @@ -16,10 +16,13 @@ description: sensor with an active array size of 1296H x 816V. It is programmable through I2C interface. The I2C client address is fixed to 0x60/0x70 as per sensor data sheet. Image data is sent through MIPI CSI-2. + OV9281 has a different lens chief ray angle. properties: compatible: - const: ovti,ov9282 + enum: + - ovti,ov9281 + - ovti,ov9282 reg: description: I2C address maxItems: 1 From patchwork Thu Jul 28 13:02:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931276 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2734C25B06 for ; Thu, 28 Jul 2022 13:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238818AbiG1NCw (ORCPT ); Thu, 28 Jul 2022 09:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236063AbiG1NCu (ORCPT ); Thu, 28 Jul 2022 09:02:50 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E48CE3E776; Thu, 28 Jul 2022 06:02:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013369; x=1690549369; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G4u1tivvbK5IkZ2oQaHeT7PpCwIMbfiPJFHfYAMie1U=; b=gFBhab7XUi4Yp8BpTtnd2vLQDVqh5JQvomrTqAc2Ggl21RBnkYXgs5bt 0G8rwBR2VH2XURdbgUQH17Rdx4sVw43mVrERePxOYLhXcGwcGVRXaTqE/ KngOw8h/qKXWp/NZysojjeBePKRHJjD6TNsb8dnie0x1YcrSdSTSJadNO +QeQQ4f7dI5lO+AE5+VnxYs63obb+vfF3JS17dUG6KMjdA7ybf+V9HH2J kKoJwpsInA8J2L4J+f43K2wkrlMGo5TnLimKA5ZrSiOo0ueRfIDQ4gc8Q 2REdsKZBDqr0xtAIeA4kc/dlGN0s1X6s0LAcDR03c0HfcrjdcMLXkcxPP g==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321369" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:43 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013363; x=1690549363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G4u1tivvbK5IkZ2oQaHeT7PpCwIMbfiPJFHfYAMie1U=; b=izBtzfY4utTI1L2Gg3znF7GrWm4Hq/mU8UL53G7AO3jcdhx5p3dj9/9G 0jPXXv09favnrYTKW4Qn/1qxheYm8NLt3lLPUBQZwv9EEnnH1pACXVE9M f/oaQfrgFTakwIvCvWDzt5zY89pNSOpA+8wPRo8KdJkBPxMaX4yYqMqYa 1c7PlKumyUW/eeIo9Se6IjImlrTgZ4o+qPJztXpOMraUa+tC0IfP76JZN LhUwu8MzGucrm7fc0iFMTs2MRxeUs/t8KIZWzyuDh5PPp0X1sSbV2egcn xpCMbYQFd0bPUu/0eGkj5epFAB1xV3KharkBox3sWt1lo9Dp4MdNVYtnO g==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321368" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:43 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id AAFCA280072; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 3/7] media: i2c: ov9282: Add ov9281 compatible Date: Thu, 28 Jul 2022 15:02:33 +0200 Message-Id: <20220728130237.3396663-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org According to product brief they are identical from software point of view. Differences are a different chief ray angle (CRA) and the package. Signed-off-by: Alexander Stein Acked-by: Daniele Alessandrelli --- drivers/media/i2c/ov9282.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 8a252bf3b59f..c8d83a29f9bb 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1113,6 +1113,7 @@ static const struct dev_pm_ops ov9282_pm_ops = { }; static const struct of_device_id ov9282_of_match[] = { + { .compatible = "ovti,ov9281" }, { .compatible = "ovti,ov9282" }, { } }; From patchwork Thu Jul 28 13:02:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F165C25B07 for ; Thu, 28 Jul 2022 13:02:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238854AbiG1NCw (ORCPT ); Thu, 28 Jul 2022 09:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238516AbiG1NCv (ORCPT ); Thu, 28 Jul 2022 09:02:51 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AE33402DD; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=G/2mPJJMGUqf/aMpvnAXMDeJ1dOU81mnhkH0/F3XYyBur169MrOZCJrg mTNIUDzxr7KZMQUSxFqOWyysU/5AcItVEq4tN5I2/SG+g9Ba+eve0OhX1 b9fse2uAuC6FJo7ihqBBdehYvpIciWiwsqzfp7MzQisUMdOh2wjZ8Azf2 Bmuf4xTKuCnOEXD6j92Nv/wmhfDHv7fRmMcfuvl/AuvaU0ls4dPrpc1rk jHy8uazfsBDPlekSjfthdg76dPWpMPb5CJu7VVS7gZqcYPDuolVTdrXfu 86Tb1VGoZeoRMRGNdQlAVRYAuNtLwI9v15T19KG+pcyuIdcsbb1iPoqUv Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321371" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=iUubRkMrhHF5+nUgCtuNwnMYmEf5HYrNKrkwfATbYGPWs9eRzK9rotJk XrDWP+iU8Q0wnfhTaY6PVzA/x6/7eWCr8x/Q00q4SWIOTF3P1ABUc9zN9 GQT43Y3ETCQBrKCKnOMLCWuc0IeyFgrEFRyTTsGdeRZMG9jDf5Q+L1RFX Z+McO42spPX4OWL2gSqFZZlT5/L/PmPpV5Z6I7GdZSKSNviLTvs9EUPuu c4E2MS+OYW/yhPyy3o+NtNQEIvZpyxvq9lYWrnoJmLq8ERAXyfwSXYK90 4JJAOlvmqlyyemsZMOSOvM1pyvDE4sZAgSKbKeuacckRRMJokjFEnra55 Q==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321370" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id DD4D3280073; Thu, 28 Jul 2022 15:02:43 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus , Krzysztof Kozlowski Subject: [PATCH v4 4/7] media: dt-bindings: media: ov9282: Add power supply properties Date: Thu, 28 Jul 2022 15:02:34 +0200 Message-Id: <20220728130237.3396663-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add regulators for each power domain. Signed-off-by: Alexander Stein Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/media/i2c/ovti,ov9282.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml index 285f8c85f253..9abfaabd373a 100644 --- a/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov9282.yaml @@ -39,6 +39,15 @@ properties: description: Reference to the GPIO connected to the XCLR pin, if any. maxItems: 1 + avdd-supply: + description: Analog power supply + + dovdd-supply: + description: Digital I/O power supply + + dvdd-supply: + description: Digital core supply + port: additionalProperties: false $ref: /schemas/graph.yaml#/$defs/port-base From patchwork Thu Jul 28 13:02:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4116CC3F6B0 for ; Thu, 28 Jul 2022 13:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238876AbiG1NCy (ORCPT ); Thu, 28 Jul 2022 09:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238655AbiG1NCv (ORCPT ); Thu, 28 Jul 2022 09:02:51 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CDE40BF8; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=mgKv2/jhBf+FU4p2CY0+/kj+H9M49yi3LWTIUlLK7CI4ngQuu/3LsYub 2cWVCMI6Aq4jS2Zfk/WSh/wNESoVVFhbAp6LMLD+9Iv2LssIfQ8iyABcn Yrkjhbbo042LTTfOGeYWsqCvN/vkSJJaShn1w1pHdR1sFKGxHxaPjvAEe ZnAxb8leT7/CUO3N20z5gLtfAdOvwRzLceCrGwqSJ13UxoGcJFt8LBeL8 IZcv6rk7SKU/RqChR48Kgs1+Xmq7DUzXStJKZfopUBnZ/uRweBQgF3Tjo tedN3fZnp9gw56VJMnz5muH6suQc0fnsoffnWqvD6eolYuS7QwO45KiMS A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321373" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=YOdtc5+BX264kYfXAYnzbuyq2GV6rqWe+yY23UlhE3vQRMbRE6cGp3jG fEH6KDyefpBciSMKxDZbbf98LEVtIHVfN6qYCkNjqOf7WrB9TBcSR+E6u bTyf7bQhbH/vIfqSncOeZARvgMH5Izf05EWLuhfDkiD9lg2lbzcOF8Ty0 DGOjE4Hicvd91EQI3e/winH0YErI83sGSSMszDFr0JZNhKpkU2MgRGzlS 5AVl5IxF0jqjD/rlj1ow+OA0A4AAf8Sox1WjjEfRjJp9g9BQYokHUx1NN WiMxQjKiAeujXAqH0/kEeagnElPDekSThnaTSMxxdl4hj4Ici4QL+gvUM A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321372" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 138A2280056; Thu, 28 Jul 2022 15:02:44 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 5/7] media: i2c: ov9282: Add regulator support Date: Thu, 28 Jul 2022 15:02:35 +0200 Message-Id: <20220728130237.3396663-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Need in case the sensors is supplied by a switchable regulator. Signed-off-by: Alexander Stein --- drivers/media/i2c/ov9282.c | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index c8d83a29f9bb..352dbe21a902 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,14 @@ #define OV9282_REG_MIN 0x00 #define OV9282_REG_MAX 0xfffff +static const char * const ov9282_supply_names[] = { + "avdd", /* Analog power */ + "dovdd", /* Digital I/O power */ + "dvdd", /* Digital core power */ +}; + +#define OV9282_NUM_SUPPLIES ARRAY_SIZE(ov9282_supply_names) + /** * struct ov9282_reg - ov9282 sensor register * @address: Register address @@ -126,6 +135,7 @@ struct ov9282 { struct media_pad pad; struct gpio_desc *reset_gpio; struct clk *inclk; + struct regulator_bulk_data supplies[OV9282_NUM_SUPPLIES]; struct v4l2_ctrl_handler ctrl_handler; struct v4l2_ctrl *link_freq_ctrl; struct v4l2_ctrl *pclk_ctrl; @@ -882,10 +892,19 @@ static int ov9282_power_on(struct device *dev) goto error_reset; } + ret = regulator_bulk_enable(ARRAY_SIZE(ov9282->supplies), + ov9282->supplies); + if (ret) { + dev_err(dev, "Failed to enable regulators\n"); + goto disable_clk; + } + usleep_range(400, 600); return 0; +disable_clk: + clk_disable_unprepare(ov9282->inclk); error_reset: gpiod_set_value_cansleep(ov9282->reset_gpio, 0); @@ -903,6 +922,8 @@ static int ov9282_power_off(struct device *dev) struct v4l2_subdev *sd = dev_get_drvdata(dev); struct ov9282 *ov9282 = to_ov9282(sd); + regulator_bulk_disable(ARRAY_SIZE(ov9282->supplies), ov9282->supplies); + gpiod_set_value_cansleep(ov9282->reset_gpio, 0); clk_disable_unprepare(ov9282->inclk); @@ -995,6 +1016,18 @@ static int ov9282_init_controls(struct ov9282 *ov9282) return 0; } +static int ov9282_get_regulators(struct ov9282 *ov9282) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(ov9282->supplies); i++) + ov9282->supplies[i].supply = ov9282_supply_names[i]; + + return devm_regulator_bulk_get(ov9282->dev, + ARRAY_SIZE(ov9282->supplies), + ov9282->supplies); +} + /** * ov9282_probe() - I2C client device binding * @client: pointer to i2c client device @@ -1021,6 +1054,12 @@ static int ov9282_probe(struct i2c_client *client) return ret; } + ret = ov9282_get_regulators(ov9282); + if (ret) { + dev_err(&client->dev, "Failed to get power regulators\n"); + return ret; + } + mutex_init(&ov9282->mutex); ret = ov9282_power_on(ov9282->dev); From patchwork Thu Jul 28 13:02:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931280 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D68A3C19F29 for ; Thu, 28 Jul 2022 13:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238844AbiG1NCz (ORCPT ); Thu, 28 Jul 2022 09:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238837AbiG1NCw (ORCPT ); Thu, 28 Jul 2022 09:02:52 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EEA746D81; Thu, 28 Jul 2022 06:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013370; x=1690549370; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGHyMONZ2wrKJUIuy4ZNGqJusCkm0oXUk4BvqHTAOwU=; b=MNTBc7Fbln2ij6NNxC7QJ5oUlU4mYb8Ctl61cp+hWhYZTeOf8wBpvXKf muWAo5EiFXIiSdNDArfglqHT1x8u3hJYV3B9bZ6eqAig5OcRDOBoi8ZVr F+U04F90c5dO1DmVxL/+HwzS6U252CLfS9jXqiFuO2G38GTWfnYnMrEZp a2V4tWYPIUcYncbXPwOnE9XZ3en02jf93upFZs7/vW1+I7AT4x3BDi1MZ ncs3GAhpamRl0DGjitRVDTD6SM1qvpwFuWmkMph7VR7hmX/T7UHSjUU/6 Qk0Y235Ddgr+hW8rqK5Kcs1eoRtyzulbrxA0he2Ck6shTISSmDEe4GIs7 w==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321375" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CGHyMONZ2wrKJUIuy4ZNGqJusCkm0oXUk4BvqHTAOwU=; b=Ka5mZJhxRXR4V9p/9rpGyYb8Gww8tSV0sSccCKFuQR/lr/BR71t0s9Jn KqLsMsYfixhjR3I9/t6bnmaQCP2nE9xx5p1oOxtCbDk7kbG9f23UY4M6U WvMYJ8Yd+23iUgFzxem+1xwsEIEtMZoJN4amGgx5mTQvntpYaYbipql4L T8Hn01vXuwAvKm9kZH3xqPwJ3j2340V26CRNpZwJC56tOw2o8zfgJZOLl NkXbWRkNnDHBwhOheI/tF8EzJWjoLvYHojWboQNA2HieCTPaSifNk4NyI n377YMLZ3/+FoRq/mkSu+Vb+8q4xJWJ0L302WK9kPWIkByTzx9GKPyAwF A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321374" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3B440280072; Thu, 28 Jul 2022 15:02:44 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Date: Thu, 28 Jul 2022 15:02:36 +0200 Message-Id: <20220728130237.3396663-7-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org To distinguish ov9281 & ov9282 the name has to be explicitly set. Provide a fixed string using platform data. Signed-off-by: Alexander Stein Reported-by: kernel test robot --- Changes in v4: * Replaced v4l2_i2c_subdev_set_name with device_get_match_data and added platform data containing the sensor name drivers/media/i2c/ov9282.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 352dbe21a902..f79bdfa821e8 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1037,6 +1037,7 @@ static int ov9282_get_regulators(struct ov9282 *ov9282) static int ov9282_probe(struct i2c_client *client) { struct ov9282 *ov9282; + const char *sensor_name; int ret; ov9282 = devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL); @@ -1047,6 +1048,12 @@ static int ov9282_probe(struct i2c_client *client) /* Initialize subdev */ v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops); + sensor_name = device_get_match_data(ov9282->dev); + if (!sensor_name) { + dev_err(ov9282->dev, "Sensor name is missing"); + return ret; + } + v4l2_i2c_subdev_set_name(&ov9282->sd, client, sensor_name, NULL); ret = ov9282_parse_hw_config(ov9282); if (ret) { @@ -1152,8 +1159,8 @@ static const struct dev_pm_ops ov9282_pm_ops = { }; static const struct of_device_id ov9282_of_match[] = { - { .compatible = "ovti,ov9281" }, - { .compatible = "ovti,ov9282" }, + { .compatible = "ovti,ov9281", .data = "ov9281" }, + { .compatible = "ovti,ov9282", .data = "ov9282" }, { } }; From patchwork Thu Jul 28 13:02:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12931278 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5D7CC25B07 for ; Thu, 28 Jul 2022 13:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238871AbiG1NCz (ORCPT ); Thu, 28 Jul 2022 09:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238857AbiG1NCx (ORCPT ); Thu, 28 Jul 2022 09:02:53 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC6CE120AD; Thu, 28 Jul 2022 06:02:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013372; x=1690549372; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NHRBrcQiwCmbc51NNix9lvaPQkQhf1coVWgrxlz9mFg=; b=d46QorvCaDjixQw1SpQ9gKVU+OtcKQkwW5byG87EwmcJLPIrlJtEgMCp 9KJFbQMtMWqgKytKX+VYsSLIz3QvHAQMzN7kbFMdD6mUm2i27C2KWYZyT gBpniuWKG5VgoCvnRSKyAYYlvR90g8I3vJgIml2RNCdo8rHemto2TvkCK AmOQoWNuPqdW9WQC6PEIW/PRM30hzNa49/ttT+RCFB3u9yYThlCAtTm9C GsuVNiY6TBONxBA2X1m4j9K/UtUMThdjeGpHAF2qitnAcdQBsAKP9poPC u3X72jOjOWa4FkV9y5qwuA9SF1hObPgFPIx8cILCgStqQbOZ9tD6CvJSw A==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321377" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Thu, 28 Jul 2022 15:02:44 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Thu, 28 Jul 2022 15:02:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1659013364; x=1690549364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NHRBrcQiwCmbc51NNix9lvaPQkQhf1coVWgrxlz9mFg=; b=IDko2Xa5etYpWovoMgHydnHY77roCRTfJiG+mKo+p6cFadFDF0McFCz9 aiOsLwbRPAcTIzEAzWQLRob8Q3hbWBelx30vqH3VO9XfgHQgCY7BuFqCf CS8KDVPMoaXP9hfMkd9pR8oAQe8YSaUg7S9O7yQl8HMbOiFAV+YXTvBjs ZHSxNWGsFilrF8VgH6BAbCs+UvlgPVu1MmlOn2jSBKZ1uQIl8bALxdOWC WSGJIwSpCKfOf6zrOrCyWWdd8g+D1XViwNGDTBK4ZizJWmoJfg2sx2eJ0 gkmm4dBWNlmcegwOkgUUyGLV0AXYhi6twayRXcZMUg2rNwDK7O5bqjQl4 g==; X-IronPort-AV: E=Sophos;i="5.93,198,1654552800"; d="scan'208";a="25321376" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 28 Jul 2022 15:02:44 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 63F9E280056; Thu, 28 Jul 2022 15:02:44 +0200 (CEST) From: Alexander Stein To: "Paul J . Murphy" , Daniele Alessandrelli , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski Cc: Alexander Stein , linux-media@vger.kernel.org, devicetree@vger.kernel.org, Sakari Ailus Subject: [PATCH v4 7/7] media: i2c: ov9282: Add regmap support Date: Thu, 28 Jul 2022 15:02:37 +0200 Message-Id: <20220728130237.3396663-8-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> References: <20220728130237.3396663-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Register values apparently are stored in MSB format, hence the manual swap when reading/writing. regmap's endianness swapping is not applied when reading with val_bits = 8. Signed-off-by: Alexander Stein --- Changes in v4: * Removed superfluous line break * Shortened variable initialization drivers/media/i2c/ov9282.c | 57 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index f79bdfa821e8..e9e595df187b 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -113,6 +114,7 @@ struct ov9282_mode { /** * struct ov9282 - ov9282 sensor device structure * @dev: Pointer to generic device + * @regmap: sensor's regmap * @sd: V4L2 sub-device * @pad: Media pad. Only one pad supported * @reset_gpio: Sensor reset gpio @@ -131,6 +133,7 @@ struct ov9282_mode { */ struct ov9282 { struct device *dev; + struct regmap *regmap; struct v4l2_subdev sd; struct media_pad pad; struct gpio_desc *reset_gpio; @@ -151,6 +154,11 @@ struct ov9282 { bool streaming; }; +static const struct regmap_config ov9282_regmap_config = { + .reg_bits = 16, + .val_bits = 8, +}; + static const s64 link_freq[] = { OV9282_LINK_FREQ, }; @@ -297,35 +305,20 @@ static inline struct ov9282 *to_ov9282(struct v4l2_subdev *subdev) */ static int ov9282_read_reg(struct ov9282 *ov9282, u16 reg, u32 len, u32 *val) { - struct i2c_client *client = v4l2_get_subdevdata(&ov9282->sd); - struct i2c_msg msgs[2] = {0}; - u8 addr_buf[2] = {0}; - u8 data_buf[4] = {0}; + u8 data[4] = {0}; int ret; if (WARN_ON(len > 4)) return -EINVAL; - put_unaligned_be16(reg, addr_buf); - - /* Write register address */ - msgs[0].addr = client->addr; - msgs[0].flags = 0; - msgs[0].len = ARRAY_SIZE(addr_buf); - msgs[0].buf = addr_buf; - - /* Read data from register */ - msgs[1].addr = client->addr; - msgs[1].flags = I2C_M_RD; - msgs[1].len = len; - msgs[1].buf = &data_buf[4 - len]; - - ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); - if (ret != ARRAY_SIZE(msgs)) - return -EIO; - - *val = get_unaligned_be32(data_buf); + ret = regmap_raw_read(ov9282->regmap, reg, &data[4 - len], len); + if (ret < 0) { + dev_err(ov9282->dev, "read from 0x%04x failed: %d\n", + reg, ret); + return ret; + } + *val = get_unaligned_be32(data); return 0; } @@ -340,16 +333,17 @@ static int ov9282_read_reg(struct ov9282 *ov9282, u16 reg, u32 len, u32 *val) */ static int ov9282_write_reg(struct ov9282 *ov9282, u16 reg, u32 len, u32 val) { - struct i2c_client *client = v4l2_get_subdevdata(&ov9282->sd); - u8 buf[6] = {0}; + u8 data[4] = {0}; + int ret; if (WARN_ON(len > 4)) return -EINVAL; - put_unaligned_be16(reg, buf); - put_unaligned_be32(val << (8 * (4 - len)), buf + 2); - if (i2c_master_send(client, buf, len + 2) != len + 2) - return -EIO; + put_unaligned_be32(val << (8 * (4 - len)), data); + + ret = regmap_raw_write(ov9282->regmap, reg, data, len); + if (ret < 0) + dev_err(ov9282->dev, "write to 0x%04x failed: %d\n", reg, ret); return 0; } @@ -1045,6 +1039,11 @@ static int ov9282_probe(struct i2c_client *client) return -ENOMEM; ov9282->dev = &client->dev; + ov9282->regmap = devm_regmap_init_i2c(client, &ov9282_regmap_config); + if (IS_ERR(ov9282->regmap)) { + dev_err(ov9282->dev, "Unable to initialize I2C\n"); + return -ENODEV; + } /* Initialize subdev */ v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops);