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: 593086 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 20AC6C43334 for ; Fri, 22 Jul 2022 13:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234826AbiGVNUA (ORCPT ); Fri, 22 Jul 2022 09:20:00 -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: 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 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: 593084 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 C7565CCA489 for ; Fri, 22 Jul 2022 13:20:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235144AbiGVNUD (ORCPT ); Fri, 22 Jul 2022 09:20:03 -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: 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 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: 593085 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 2DC28CCA48E for ; Fri, 22 Jul 2022 13:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234953AbiGVNUC (ORCPT ); Fri, 22 Jul 2022 09:20:02 -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: 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);