From patchwork Fri Jul 22 13:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592569 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 7BBA5CCA473 for ; Fri, 22 Jul 2022 13:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233902AbiGVNT6 (ORCPT ); Fri, 22 Jul 2022 09:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229593AbiGVNT5 (ORCPT ); Fri, 22 Jul 2022 09:19:57 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9373AA0B90; Fri, 22 Jul 2022 06:19:56 -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=1658495996; x=1690031996; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=LztSgfjlje+c/MwBn01HdGchgDuLnzMzI0NQIu0/c6AAnnhJQuk+ZF9f 5h17qs1TGo5Htqty6PNpUk313ydOntiDKzvKRazyD9CHJU7HRMh01weHu x6pCVRS1Fuda4uqm6eEwI3yOQQxXFgoJYbix2mYlIF5v2cpK4fcClrSI9 uNrJhX5/4EqWJr/kvkKEjCaMcgSta2T+mfWH2BcoU94cks/ts135G02M8 F0bXu03nMiTRXsLOKwqrPTd1CR7AD3w/ZRF6q68/b7bJtQ6L7lzx4C2hm o+48zFC7qkRXcAfYVSa6TA8C2WexK48rXviy45cuooqEGcVlFSdYagKhf w==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212300" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:52 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:52 +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=1658495992; x=1690031992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jHGCy+LY2xn86PxwDOHDZMu5ODeZxv+Kr+sz0BLuCiI=; b=AtfbV9b7E7p4u1IBRnQnQi2MnluNE7YV6UV+6HDLPOxaX3hU8n0cSzN5 pY41mG33l4L+0299+9iXzJCK/ftG4rn9uet9DQqay4cSAQvBIjig7eA8t exYcTcVa7Vu8aOFaWNLrHt2txSU3z53C/OmlfBHOB0qEN4Jy2aIGxZXFl qBIHv1S4DsdxGeHbWJYLtezcfUs3Mqd0Pp2w0ZkG1968NI1FWMkWjLj6L VJn7RmkcHm65pbRdCxyqTlyUm8J6KE4S6RM01wi5n558cR0s43sjWWgNi iCsKkMDRG78KxWzLbZRDS9KE9MMThhgMJel7CxUQu+k2IO7IdAr7b9oye g==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212298" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +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 2B970280072; Fri, 22 Jul 2022 15:19:52 +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 v3 1/7] media: i2c: ov9282: remove unused and unset i2c_client member Date: Fri, 22 Jul 2022 15:19:41 +0200 Message-Id: <20220722131947.2456988-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Fri Jul 22 13:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592982 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 A35F2C433EF for ; Fri, 22 Jul 2022 13:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiGVNT7 (ORCPT ); Fri, 22 Jul 2022 09:19:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234583AbiGVNT6 (ORCPT ); Fri, 22 Jul 2022 09:19:58 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD6F7A0B89; Fri, 22 Jul 2022 06:19:57 -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=1658495998; x=1690031998; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KaEDJVU3uZqRPoVDhl+O6jtIVNEtEGZ+mLxj2kIA+XQ=; b=CgE1nCZVHTnnpLLgCaA2uwkp+Txs+yYWrVM5pgToI9u4hEsapwAQCtRX G+jdlG+qCxYk0PAPMhJhAzfQmX2oAMDJLvwPY2vJdk1UqftLSBjaILt9V U41GgEYCP2aG1Cdz6JuMKf2VmsIi6q/PpQes385KPL0/axWuHArdqXIrP Dkk4QtGi5ZpTy8zILR9pNnrGvQ+fktUbFPEvfv7mRuwNrWYAXcCt4JMY6 bWvZcwV7QUgvP0xtod/sdXz4yfS6AE+3FMNgEv+jsnUJlds5WomKDGI2X rka0iQRQ1DTCs3FUIVsjbXjkw2vW/gSI+4+YslU3VMJFBlKyt4G9HGKXk A==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212302" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:52 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:52 +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=1658495992; x=1690031992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KaEDJVU3uZqRPoVDhl+O6jtIVNEtEGZ+mLxj2kIA+XQ=; b=JDZbJsvu1GE+LMN2MZRtqlYNS7A8XO18er8K41Jrj30O/S83sgIgZx8F gpXtHmIF6/+HNH67R7ctn8cHNCW8aa36cbL6hAbzBhPSImX+AtwCfvY9j wdKbaOAFO1ikKutUnInqjOYqRF/bBbrD1zYIr7ROz+zTjylXsRHNPIr+W DUZNyuWM5rD6EPiwZytGljvRcMYKytdvXOoNLhoYBolbNPToePg1XVP5v XBNQrDEpM1s37TbaYp6kr647pY20awMMlsBhd3xVRaBDir/HqFUpHMZBy mjdJonE1Qh6rADsdw+Kjjd6hYXCcVXnH5RCcyy63lc0RKyHt0QQ1n/ke1 g==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212301" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +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 59C1E280056; Fri, 22 Jul 2022 15:19:52 +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 v3 2/7] media: dt-bindings: media: Add compatible for ov9281 Date: Fri, 22 Jul 2022 15:19:42 +0200 Message-Id: <20220722131947.2456988-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Fri Jul 22 13:19:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592568 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 6EBFECCA48C for ; Fri, 22 Jul 2022 13:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234516AbiGVNUA (ORCPT ); Fri, 22 Jul 2022 09:20:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234727AbiGVNT7 (ORCPT ); Fri, 22 Jul 2022 09:19:59 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEE4AA0B90; Fri, 22 Jul 2022 06:19:57 -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=1658495998; x=1690031998; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G4u1tivvbK5IkZ2oQaHeT7PpCwIMbfiPJFHfYAMie1U=; b=DL2c5T+hFCoTl0NXCM0PLvuVulCKegLrvtmqbyD3a6in/RwDOb4I6MdU n/RMi+IgYVCCOPUdR1EbuIuupOrjj527lgqqncWOzQXMlEApjbwViLpzn tOtIXguWEppgkEqjxpVkrZYNA8uqTfcOlFM15z68RZEVpZ+mpHX51nK7F Jq9tieAn8GqE6fBO2R+wE0zTN6GUgT1aMOW+H2AgF4doEMnbL+Wg7gZwX jCLzOETSB/xmDyTOnRK7euJ8LPqXc9tkJDqTfVgga+LnU888DG2yki9SQ tDFoH6+OfCcSth8lbPunSyb3MOhecHnseDxsh0AE/ExXmFCtvKMtgE5Zl Q==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212304" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:52 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:52 +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=1658495992; x=1690031992; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G4u1tivvbK5IkZ2oQaHeT7PpCwIMbfiPJFHfYAMie1U=; b=oVeexQxmLRgpZuggtpip9Xpn44ZfDT2/a1FWE75aHXY/X8Hl6GGzfwxo LF3z3b7QsC7lulNO2TjRkKQoeIDY5e4wWzoxIogUMOeSrF2sanm/yPuJ6 nGp2TvPCNdEfBKHJtcMZN5Sh/JpkSfybLm7V4iPBwV5op4y8dHXwuMLCr OyLvP9opNMrMbFm3t90Xa3SkHa0ow07la+fykIl6Flcbhq3GI+SSXVCDQ oAIi/eAYWpnhBwUxo2Jna/rXugbOUwarrWYP366DBg/GlDHvu/MKeNcWM yVdWDN2wrcNIrXV9ASYoYkMLkXEIDD/FOgFBMN3KHPR4W6DqjkYvpb60E A==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212303" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +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 88B76280072; Fri, 22 Jul 2022 15:19:52 +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 v3 3/7] media: i2c: ov9282: Add ov9281 compatible Date: Fri, 22 Jul 2022 15:19:43 +0200 Message-Id: <20220722131947.2456988-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Fri Jul 22 13:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592980 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 93A4AC43334 for ; Fri, 22 Jul 2022 13:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235013AbiGVNUC (ORCPT ); Fri, 22 Jul 2022 09:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234583AbiGVNUA (ORCPT ); Fri, 22 Jul 2022 09:20:00 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30C64A0B84; Fri, 22 Jul 2022 06:19:59 -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=1658495999; x=1690031999; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=dH/IBolaeR/8zZ274+TsW5bw84lbH4JWJFGRF9V46BC8hj7FL6tkKUi+ vi4bPNrqD4+aEPYG/EGcvE3OchIhqH/j1kWu+OQSPx/doeLkbHiMUgfT5 dJXYvdSntjtDZ54Lt3MdWgT+osmZKH1gqjpnsQ/EWdQqZzJaIIn9cYT9O m9gtPM0TL/hiNxM5mXhNdkqupGCoQcb5FvMQ+4DgdtOeccK2ETTR+PDpb t6iTAcMqK0PytTmKHpD/P15fuiV9aAwYBpr4KhN3QiZMOj0+JgIBPCLkU zkQnh6N/D/U4qWNxFRucGBHscyaMb4r3YMq7F3F4xkj58hnr3Xb8KKqie g==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212306" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:53 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:53 +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=1658495993; x=1690031993; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZEpBns6FBLrwGth9N0WA8nJfnM4oXu/eo0E3+I9z84=; b=QWkRifcYxQF7WPfqLo4WVGAvByMFJXSqO4qdigMcoV8BUtV0lOkhtb5K MO9AkG850NC35E3fjfFFUIRHBFNXvIfCB0b8nBPoa4CwAn5cidU+uewRp ES6JkFBZPZPGx/hgfhZWjQMrqRKydIHjfYh91aR6VnNuuvfjeIPCzH5EL DHP0DcIoysQUtaucbqTqbiIHBtYPAzwA4zcU8E3yzddOPhndpi2H0uT79 PzxxAehFuA1A0OOLSCGeNK6Iq6c2SLPJfiEuXlgoD4kwevD466jgWw2AJ vzOneqgkQXgFb9xI/RXCi5V7+OiW/VmG2a6W0PtGjjbKwecqx84BQ7hJS A==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212305" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:52 +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 BFD78280056; Fri, 22 Jul 2022 15:19:52 +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 v3 4/7] media: dt-bindings: media: ov9282: Add power supply properties Date: Fri, 22 Jul 2022 15:19:44 +0200 Message-Id: <20220722131947.2456988-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Fri Jul 22 13:19:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592981 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 497D0CCA473 for ; Fri, 22 Jul 2022 13:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234863AbiGVNUB (ORCPT ); Fri, 22 Jul 2022 09:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234830AbiGVNUA (ORCPT ); Fri, 22 Jul 2022 09:20:00 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D21A0B89; Fri, 22 Jul 2022 06:19:59 -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=1658495999; x=1690031999; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=DF6vsb/DWilunUWyUa25/Njf18ba33oVwT6L+y6A4gQNuFJFI25ALEt1 +ADCvTUAu8uDnJ/wP6urXVxlo814+Oilu/OPLJa+ZbSJuNUTtnbo6jV9G rvzficJxpvnLcKkCAAJ1YtLP6flNYWy/X4aeBbQCYZIwS80ixJLJwsE05 KaMpQuK4mqK2O3s/jKOdBCays2wMm3s3icH51eotOSHqBAoB5hmmaZvd5 x0hBov5MC84L5AVT+D2bGXUdT+lBewKl9qO1x5ucIYz7H5V7EIt4A6jhm m3yIdDbsRSVe8fAEV92LdtrbUGIFgiP0B6Qk6PpAHY4PGXTHXrzd0t6rz Q==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212308" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:53 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:53 +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=1658495993; x=1690031993; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eUVoM8eILSRtiJWPnfEMpUTwJ5DdzPLtU9RvqhESVtc=; b=M5Ont76B40IDjGkOcDcSVG1j0s5Evt2a8YiRPhzUBJFYLY49W8jNEvVn fgYRuvWmA8KKvoq1o8L2Oomr4cU6p+qya2/vtfXQnn1B0Tj7PI+9MnMYb JXRITCsuaFq5RvEmpQhEu+KPtyF9npuXHFt0929YAaHwOi9Me2e+bPzvN 16KZA3/s2uQaeEofPG1LUhDFZLccgtPFPRxFBAnNXaXto4QcGKz3nMyjH dcQiz6fqXtPj3MJaP0I41FVvB9uZ3594MxKChtQ1fGDa2PEXAc3U/s+O0 a7YN17HZVeEcqFm2Kul60sw1aqV5LuExtFsszVKjHkPWlTaIv4V01u2Pr A==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212307" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +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 EB8E0280073; Fri, 22 Jul 2022 15:19:52 +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 v3 5/7] media: i2c: ov9282: Add regulator support Date: Fri, 22 Jul 2022 15:19:45 +0200 Message-Id: <20220722131947.2456988-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 Fri Jul 22 13:19:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592567 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 BE091C433EF for ; Fri, 22 Jul 2022 13:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234948AbiGVNUB (ORCPT ); Fri, 22 Jul 2022 09:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234763AbiGVNUA (ORCPT ); Fri, 22 Jul 2022 09:20:00 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B01A0B90; Fri, 22 Jul 2022 06:19:59 -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=1658495999; x=1690031999; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mo4CG3rrxyUa5AtMRikbley8JX0pQHZDQRhOhS6nJfI=; b=PjbgtDO+k5Y+2UEnZhO/kdiDYkY74rhO/FQq1CHOcJNQTuotz8XsMvfl z2C7NDCeVSG6Dq3qpGvXR0OmT5/Ilb3e6/46fNXfbcQDXXRl6rLPcsOW0 V3wLhetyMJjU5/BTM7rPuZwnNHpecg4Njy9IfiYtNpypmJwZmpItqa90k maR1y16Aqz6uL9QajD2knIzrN1RNkN3SYV4tUYRqiVKvf/fKeVYQEsRyB AVHknoFrledzCxAmc796NtKO8iI0F/wNvd+HqEXsOS4iQzffBqyc+Vs3t xlyB0H86hF+/51Te1gllCwVBsUJdp9LQgegdMG5tH/GS2NxPn1PmT0uAD w==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212310" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:53 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:53 +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=1658495993; x=1690031993; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mo4CG3rrxyUa5AtMRikbley8JX0pQHZDQRhOhS6nJfI=; b=BGfY63xFf5eoPLoq7w3Kj/ac9oycBMH9XdGrrHYRlldT0+c53tIigO1M JkD3RKnwst1pQ9ngZgvvZDIl9j4nvKgkqa9zi/TVaRaX7klpmEuslXy+y gG9y8C0mRhJiWiBFBrc0zkPqSYB2sQkE53N2cbYNxKd4UgwBXssf4ouhI s+9twrKSaaC9T6kuLztyBEJGU+28TxdWBRGbPU1C+eTu2GpHfvC4MCq12 tRdgZ766B/ui0i2FsP5hxKPAfoGMMzuOBon1ZSC+/xVKjs/wpm2w+yoaR hvBJCBsxXbHX5ElmrVFG5/t0TieRG/xKIeesrGP5ou4uWn/mX8GXRsaoJ A==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212309" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +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 1FB60280056; Fri, 22 Jul 2022 15:19:53 +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 v3 6/7] media: i2c: ov9282: Set v4l2 subdev name according to sensor model Date: Fri, 22 Jul 2022 15:19:46 +0200 Message-Id: <20220722131947.2456988-7-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org To distinguish ov9281 & ov9282 the name has to be explicitly set. i2c_client already has the name parsed from the compatible. Signed-off-by: Alexander Stein --- 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 352dbe21a902..dbc0a4cd060f 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1047,6 +1047,7 @@ static int ov9282_probe(struct i2c_client *client) /* Initialize subdev */ v4l2_i2c_subdev_init(&ov9282->sd, client, &ov9282_subdev_ops); + v4l2_i2c_subdev_set_name(&ov9282->sd, client, client->name, NULL); ret = ov9282_parse_hw_config(ov9282); if (ret) { From patchwork Fri Jul 22 13:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 592566 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 6911BCCA473 for ; Fri, 22 Jul 2022 13:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235052AbiGVNUD (ORCPT ); Fri, 22 Jul 2022 09:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235007AbiGVNUC (ORCPT ); Fri, 22 Jul 2022 09:20:02 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5595A0B9B; Fri, 22 Jul 2022 06:20:00 -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=1658496001; x=1690032001; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p7HUA3YLc7nFX1rcFsh1lwJDFUEFutuOysO8L9DkWug=; b=biiP0V7dTrNKPh5uY4uAU54S3XkUQD09JT6a23OVX7hckW+2A3IMOgn0 H6WVPW69RI2ZQEr/lRdyikbDMArDHWzvVtfPd9GqEIjIkTHaK64P90qN8 zONocMGMN23JwdlCXY/HY+cHvk1U9NZzNDWdJT3mMT2v51r56RXsTFCKQ SHkWssyIcWVF46YkN+odgtlp21KotkOxAjEVjYWzls74oflxiaCjlz0j2 laKmKWqounUcfqhmTXVrHzuKkXwue0o+hFHFDcuoPynDgNOupj3y6t4rx lV1kDfUR2/08iLq8kJGTuiMg3Vt/6Nw8rPTcmazjf150dgEaoCILz/sbx g==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212312" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 22 Jul 2022 15:19:53 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 22 Jul 2022 15:19:53 +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=1658495993; x=1690031993; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p7HUA3YLc7nFX1rcFsh1lwJDFUEFutuOysO8L9DkWug=; b=DWhWa9w48hxWFcbkGXTk/RlOdlzTtbZIU5WtHRSm/Z7C3wCT2erMwBGG BXFt01i0lZOKEfscQxd0zS/7G+8qqjhhAIj5rr0bLw3IIRWtRiJ+63CNp 57PWR5ROtpt4QGw/6NZktjbJgsvxf3I9+GQv9WQ9wzIKXOMQPGlUYlPxt +MXky+MRzjhc8Up2TAmUmpds488+nZPwIak5+32FMMraYSQgPEahEEXs+ PxEpLxl76rvO1M+tb8tbsuXR+BoS9oqN3DPftF8KUH7dc+xYaud3jXlC6 7l8j1m2MhFvl3JGvw7h4WEpm6dwqTbDC62r3dC94QastrYsQOzB/0gT+A w==; X-IronPort-AV: E=Sophos;i="5.93,185,1654552800"; d="scan'208";a="25212311" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 22 Jul 2022 15:19:53 +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 5366C280072; Fri, 22 Jul 2022 15:19:53 +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 v3 7/7] media: i2c: ov9282: Add regmap support Date: Fri, 22 Jul 2022 15:19:47 +0200 Message-Id: <20220722131947.2456988-8-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> References: <20220722131947.2456988-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 --- drivers/media/i2c/ov9282.c | 59 +++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index dbc0a4cd060f..d8eb71245aae 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, 0, 0, 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,19 @@ 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, 0, 0, 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; } @@ -1044,6 +1040,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);