From patchwork Fri Oct 14 18:34:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2786 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp325598wrs; Fri, 14 Oct 2022 11:36:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4+hXO5jUEctfPS87KxLC6ysb0N3itNPrmYGGgyciZKa+QyhAO4q++E4zzFunELWPgWm2lh X-Received: by 2002:aa7:9e0f:0:b0:562:7faf:e281 with SMTP id y15-20020aa79e0f000000b005627fafe281mr6671381pfq.58.1665772590101; Fri, 14 Oct 2022 11:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665772590; cv=none; d=google.com; s=arc-20160816; b=eSG5FEnEFlLzM4j2OiQqNcL1Grv9E8ksdBMq+pp5kNwZKC2Hcv+RQWtxeZWEDN+J89 SkCQK9MAaIcWQ1unkjucmJUHsuhfub0NJSKAHUxnkvVaLNSPoT7w5XazmfJ3ZBdVZ89j 0481ppeEUP1TNUjOpT8E70Wn8WlFirPH+ZtGgwkpckqeJXWiPhnQXgUgsrROV/g8quuz sWV6FLGTw9x0A9a7ClEwTWhpeVHK3hhIk8MUbG/HwHILlBPrRdcmg4Gtsb0S0bNAxr0h +LhbY4WMobXZQySMdr4sy6I/oqmFnMDO9VOV6TC4z+edPd5dBPAXc4JZdf0gY5rvLzx0 90Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lDixN45FQzRM4eL6eFYAjPKPemRI5INigTEGaTugYlA=; b=FMguRWmk80A2SmVBmZFYKOl18+IhZL10TXCErzIK6mfCbo4+iHbxYdhjUncZtqNgvk nUFbaqqSzBuVO1LAeP15XwmE0AydCPKHTxWXDuIjEgaWTGyn+LeYKaXg9cbuFGwWrZSO PYcCyYNcU9gYKZyXdRMVIW5m5bWk3i1t385xc9bt6r8yjGMjXclQD/Eaqmvn3dGNIlJj YIOXOFxfKewloJh3/Rn0WR/5u8uz/SCK09JBn+pIDp0cjaYel52BFoi535C031hVco1J 1WTQ08DPxMRVI8EjE1DUeJShC3woLRjsRTMKP6UmpJPb3UkXsRn7AMH8QOfeia+tDVSY P/bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NYybLzct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn15-20020a056a00340f00b005655fc278f3si2776676pfb.201.2022.10.14.11.36.17; Fri, 14 Oct 2022 11:36:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NYybLzct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231216AbiJNSfk (ORCPT + 99 others); Fri, 14 Oct 2022 14:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbiJNSf3 (ORCPT ); Fri, 14 Oct 2022 14:35:29 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C36A78BB81; Fri, 14 Oct 2022 11:35:19 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id j7so8896610wrr.3; Fri, 14 Oct 2022 11:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lDixN45FQzRM4eL6eFYAjPKPemRI5INigTEGaTugYlA=; b=NYybLzctaEutujS2StmVDi8CYxQPIeeK1/1ZcfwDx6IdPJzRSzpAkwAn9wH6WYI1JH NGSjCns9DbEvq8bgKrG/HzMHEjCF/osAh5E4rXtDv8Z3d3J424SQj+/TKWQSWaJQTHBF 8Qnzrsi0a4CtKhsfsbWj9AabMFfK7Iqx+lN0ym/CAT989h1GCoPHJBvVwEbzBB6KIBhU jScyEmKMILUNtG7T8YHPm+EnOxFm1oPwykgWmboUIxmtVkG+rjhXw2g9R6/t1ScG5z4B 7tWg3Cekzf2aa/KVQUoJa04Uofg9bf2XLLTcI/xf8r0x9XYkb/zuxY90vgvvpQzi68k5 g1mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lDixN45FQzRM4eL6eFYAjPKPemRI5INigTEGaTugYlA=; b=66hTCnvpqBDZzHBygmZRaMjbUgm5Ysn74K90vjozoyYgI3NVLqy7GW1vFwQlPkSq5o gx8+3VItBij/bbcCkiB9YMJOWQlpsCqRf86P/xvr9/vuaTahP0RaR/QWKoX5bM+4pZfZ BqRGPPKnLll4PtoG585rwh+jzOXQWb9z5Fn5AfmwEV6piGvHuyJzXEKq2r7shJTBlj19 SMuuAv1xY9hMvd4ltLKC/k68lm0ZCukeMf4xRwdYAW8pnK/sbsesCVE3pclmD8fmTb+U rER1tFitDYXb+hbEnK9+IJlOQdpkWrqKn30icAA4OP5UX5TqypSJ7UPZ7I/BK09tgZnm nmng== X-Gm-Message-State: ACrzQf3mrYa4gdKDQTz++J/OyUXBDKM+CI33ZsI4IKANWrzZPRPuWLXb yzsqNwO+1U9anbAH62jMy+4= X-Received: by 2002:a05:6000:1842:b0:22e:7bbf:c75 with SMTP id c2-20020a056000184200b0022e7bbf0c75mr4265877wri.547.1665772518041; Fri, 14 Oct 2022 11:35:18 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:fc4d:6548:d8bd:5bd]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a403954c3sm2485410wrt.42.2022.10.14.11.35.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 11:35:17 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Sakari Ailus , Laurent Pinchart , Krzysztof Kozlowski , Rob Herring , Mauro Carvalho Chehab , Hans Verkuil Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v2 1/5] media: dt-bindings: ov5645: Convert OV5645 binding to a schema Date: Fri, 14 Oct 2022 19:34:55 +0100 Message-Id: <20221014183459.181567-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746689159685447404?= X-GMAIL-MSGID: =?utf-8?q?1746689159685447404?= From: Lad Prabhakar Convert the simple OV5645 Device Tree binding to json-schema. The previous binding marked the below properties as required which was a driver requirement and not the device requirement so just drop them from the required list during the conversion. - clock-frequency - enable-gpios - reset-gpios Also drop the "clock-names" property as we have a single clock source for the sensor and the driver has been updated to drop the clk referencing by name. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- Resend v3: * No change v2 -> v3 * Dropped clock-names property * Marked power supplies as mandatory * Dropped the comment for voltage power supplies * Included RB tag from Laurent * Driver change to drop clock-names [0] [0] https://lore.kernel.org/linux-media/Yyh%2F3uzOJOu3drEB@pendragon.ideasonboard.com/T/#t v1 -> v2 * Dropped ref to video-interface-devices.yaml# * Dropped driver specific required items from the list * Updated commit message * Dropped clock-lanes and bus-type from the port and example node * Marked data-lanes as required in port node --- .../devicetree/bindings/media/i2c/ov5645.txt | 54 --------- .../bindings/media/i2c/ovti,ov5645.yaml | 104 ++++++++++++++++++ 2 files changed, 104 insertions(+), 54 deletions(-) delete mode 100644 Documentation/devicetree/bindings/media/i2c/ov5645.txt create mode 100644 Documentation/devicetree/bindings/media/i2c/ovti,ov5645.yaml diff --git a/Documentation/devicetree/bindings/media/i2c/ov5645.txt b/Documentation/devicetree/bindings/media/i2c/ov5645.txt deleted file mode 100644 index 72ad992f77be..000000000000 --- a/Documentation/devicetree/bindings/media/i2c/ov5645.txt +++ /dev/null @@ -1,54 +0,0 @@ -* Omnivision 1/4-Inch 5Mp CMOS Digital Image Sensor - -The Omnivision OV5645 is a 1/4-Inch CMOS active pixel digital image sensor with -an active array size of 2592H x 1944V. It is programmable through a serial I2C -interface. - -Required Properties: -- compatible: Value should be "ovti,ov5645". -- clocks: Reference to the xclk clock. -- clock-names: Should be "xclk". -- clock-frequency: Frequency of the xclk clock. -- enable-gpios: Chip enable GPIO. Polarity is GPIO_ACTIVE_HIGH. This corresponds - to the hardware pin PWDNB which is physically active low. -- reset-gpios: Chip reset GPIO. Polarity is GPIO_ACTIVE_LOW. This corresponds to - the hardware pin RESETB. -- vdddo-supply: Chip digital IO regulator. -- vdda-supply: Chip analog regulator. -- vddd-supply: Chip digital core regulator. - -The device node must contain one 'port' child node for its digital output -video port, in accordance with the video interface bindings defined in -Documentation/devicetree/bindings/media/video-interfaces.txt. - -Example: - - &i2c1 { - ... - - ov5645: ov5645@3c { - compatible = "ovti,ov5645"; - reg = <0x3c>; - - enable-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; - reset-gpios = <&gpio5 20 GPIO_ACTIVE_LOW>; - pinctrl-names = "default"; - pinctrl-0 = <&camera_rear_default>; - - clocks = <&clks 200>; - clock-names = "xclk"; - clock-frequency = <24000000>; - - vdddo-supply = <&camera_dovdd_1v8>; - vdda-supply = <&camera_avdd_2v8>; - vddd-supply = <&camera_dvdd_1v2>; - - port { - ov5645_ep: endpoint { - clock-lanes = <1>; - data-lanes = <0 2>; - remote-endpoint = <&csi0_ep>; - }; - }; - }; - }; diff --git a/Documentation/devicetree/bindings/media/i2c/ovti,ov5645.yaml b/Documentation/devicetree/bindings/media/i2c/ovti,ov5645.yaml new file mode 100644 index 000000000000..0b10483cd267 --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ovti,ov5645.yaml @@ -0,0 +1,104 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/ovti,ov5645.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: OmniVision OV5645 Image Sensor Device Tree Bindings + +maintainers: + - Lad Prabhakar + +properties: + compatible: + const: ovti,ov5645 + + reg: + maxItems: 1 + + clocks: + description: XCLK Input Clock + + clock-frequency: + description: Frequency of the xclk clock in Hz. + + vdda-supply: + description: Analog voltage supply, 2.8 volts + + vddd-supply: + description: Digital core voltage supply, 1.5 volts + + vdddo-supply: + description: Digital I/O voltage supply, 1.8 volts + + enable-gpios: + maxItems: 1 + description: + Reference to the GPIO connected to the PWDNB pin, if any. + + reset-gpios: + maxItems: 1 + description: + Reference to the GPIO connected to the RESETB pin, if any. + + port: + description: Digital Output Port + $ref: /schemas/graph.yaml#/$defs/port-base + additionalProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + minItems: 1 + maxItems: 2 + items: + enum: [1, 2] + + required: + - data-lanes + +required: + - compatible + - reg + - clocks + - vdddo-supply + - vdda-supply + - vddd-supply + - port + +additionalProperties: false + +examples: + - | + #include + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + camera@3c { + compatible = "ovti,ov5645"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5645>; + reg = <0x3c>; + clocks = <&clks 1>; + clock-frequency = <24000000>; + vdddo-supply = <&ov5645_vdddo_1v8>; + vdda-supply = <&ov5645_vdda_2v8>; + vddd-supply = <&ov5645_vddd_1v5>; + enable-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; + + port { + ov5645_ep: endpoint { + remote-endpoint = <&csi0_ep>; + data-lanes = <1 2>; + }; + }; + }; + }; +... From patchwork Fri Oct 14 18:34:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp325701wrs; Fri, 14 Oct 2022 11:36:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6nxun6oAvq6CUimr7FR0QDtqkLCGjVgxIggBG5mfqmO8gRYEAn6xj2ty3fPMh01eFwek6q X-Received: by 2002:a17:90b:2741:b0:20a:ebc3:6513 with SMTP id qi1-20020a17090b274100b0020aebc36513mr7435064pjb.29.1665772610194; Fri, 14 Oct 2022 11:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665772610; cv=none; d=google.com; s=arc-20160816; b=PtSnQ51ytcGJlsQML+ATEQ/oClLxky1R5RXkjh0jqNWFkI3Hhr46PqdOsc6hnOSDhq disj3o39Y0+t5LyilHq9AkTVvh3JQz+6tzrE/kjPEnnpf36Z018L8lrNzmyaB+9GUpfr 5STXfJiOklLgDk3n4iZuUxL7K2ikXKB0eD7iefr3K8a3ErKijFfE6vTcCtNWEpiLM15S btVwVoLAsBUAKNLuySd9fo8eg+Ep+ESj9BA4EJztZmYVLzGsx0kUDT/ewErUe9P4iILL dVlLhhIHbNzQFzfPDl5jOiuAXR/z01ehAWIopMsTy8SAnekQCgmu6ZchSsVyFGSxthqX 41aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UiEFfAcdWdXIO10yeqLn2kjMb2xqsk14NlsbM8q2PJc=; b=VSNsuaaNSWJB5iTUoMIkd2Urhoe0j1T+WdVPMYCniWk5aSHISOfS2NXRkKFT1iDcZJ I66TeIASaDXa6906CGm0Ys7aXk4rK440+oo8PS2KDXHE3AVQjWSas41yxbrFD8/SUYux KLs5nJ/J/FIX4ABbvirBQ8vkxGbIXBIYT7enTeM91E44FraCAVvtf85JDSQiUBhKwu8O +chX0Zgt7ZkZbOqn3UEzmFg8E8k8qtPQE38DUmTRYxtJkN0FtPWl2bj6NNA7r839fui4 TMeKLG3mNL49vijpPOVXpg+jFeT43PRrUvfqHNUnaFSKoW/zYN077d6eUHP/gPyeZk/b sydw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hzTJ1vTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pc3-20020a17090b3b8300b001fe4eebefe5si10908026pjb.135.2022.10.14.11.36.37; Fri, 14 Oct 2022 11:36:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hzTJ1vTV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230480AbiJNSfs (ORCPT + 99 others); Fri, 14 Oct 2022 14:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbiJNSfa (ORCPT ); Fri, 14 Oct 2022 14:35:30 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97909F368; Fri, 14 Oct 2022 11:35:21 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id r13so8846542wrj.11; Fri, 14 Oct 2022 11:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UiEFfAcdWdXIO10yeqLn2kjMb2xqsk14NlsbM8q2PJc=; b=hzTJ1vTVbL5GH17OppMGwJnbCOXcp6XvJ2Hj/NEf8PDfKQlmUcN55BZdP5h7mvVshm 504L19V+ZvDa3sIuGJGiwdB9cCdF+W3XHe07Ltqcs1zWWfu75jCtuKLDs1m0LVonQZ0X ZaGAb3MLCFyy5cnWxN7uq7eoo827604yK48pMZFtDYIT8nS/R4+YAXRWIsH4THMj9Ysc NnMMOuL1UiDbxBWMzjsJ9Swo82I7i2CfmgiVoHawYDr+Wj/a5MUxjIKHPQ3Ci1W9Fl7R ucZm0rkTcW7WoxO+PXXU0CZa9lwaipmdoPTihi8NfwoDZJWdiwFzh9DfoR+x3Jv/1vSX uRFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UiEFfAcdWdXIO10yeqLn2kjMb2xqsk14NlsbM8q2PJc=; b=b5zGb9jD0PlPn8ASrR4j+Wj/HogWbiKjbPl15gTBePPQdkRNE619F9UeQApHkZRutk MxFMEq73Ga9gA1rQqRhQE+5cKUEhvA474rW6RDT9u6q02UxFJ/nBNzMdp/Em3TfaB2Qq w9gB4eq+B9z/5C5Dwh2ZD/Rr+M8IUeIvxyv1MVV69/ilSUAh2UyxuSamV88Y5dDlQhjx GOSahJGmtQ0yTwvaZyasjlVMOC4gn+hHRnjRHdIVye+de9JSt1mxDjLnX4nwo5CC3cCh 9XcwYFR2c7KOLrV2K+OBbOfPDlDj5O8vsMvRxpQlkezVbia3/4doTmjL1/gxfWsE8AxP qE5g== X-Gm-Message-State: ACrzQf0FIwaAg2FB+7r6BNLlUhqvcvREuqzVJqjTsUdx5JXot4Clqf/v FHJlm3/O4hJV9myeLx4xPV7K2fJ26fXDyQ== X-Received: by 2002:a5d:6dab:0:b0:231:3a49:3079 with SMTP id u11-20020a5d6dab000000b002313a493079mr4229577wrs.148.1665772519305; Fri, 14 Oct 2022 11:35:19 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:fc4d:6548:d8bd:5bd]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a403954c3sm2485410wrt.42.2022.10.14.11.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 11:35:18 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Sakari Ailus , Laurent Pinchart , Krzysztof Kozlowski , Rob Herring , Mauro Carvalho Chehab , Hans Verkuil Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v2 2/5] media: i2c: ov5645: Use runtime PM Date: Fri, 14 Oct 2022 19:34:56 +0100 Message-Id: <20221014183459.181567-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746689180638820223?= X-GMAIL-MSGID: =?utf-8?q?1746689180638820223?= From: Lad Prabhakar Switch to using runtime PM for power management. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v1->v2 * Moved pm_runtime_*_autosuspend() calls after registering the subdev. --- drivers/media/i2c/Kconfig | 2 +- drivers/media/i2c/ov5645.c | 137 +++++++++++++++++++------------------ 2 files changed, 70 insertions(+), 69 deletions(-) diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 7806d4b81716..c0edd1017fe8 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -459,7 +459,7 @@ config VIDEO_OV5640 config VIDEO_OV5645 tristate "OmniVision OV5645 sensor support" depends on OF - depends on I2C && VIDEO_DEV + depends on I2C && PM && VIDEO_DEV select MEDIA_CONTROLLER select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index 81e4e87e1821..1551690a94e0 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -108,7 +109,6 @@ struct ov5645 { u8 timing_tc_reg21; struct mutex power_lock; /* lock to protect power state */ - int power_count; struct gpio_desc *enable_gpio; struct gpio_desc *rst_gpio; @@ -635,8 +635,24 @@ static int ov5645_set_register_array(struct ov5645 *ov5645, return 0; } -static int ov5645_set_power_on(struct ov5645 *ov5645) +static int ov5645_set_power_off(struct device *dev) { + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov5645 *ov5645 = to_ov5645(sd); + + ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58); + gpiod_set_value_cansleep(ov5645->rst_gpio, 1); + gpiod_set_value_cansleep(ov5645->enable_gpio, 0); + clk_disable_unprepare(ov5645->xclk); + regulator_bulk_disable(OV5645_NUM_SUPPLIES, ov5645->supplies); + + return 0; +} + +static int ov5645_set_power_on(struct device *dev) +{ + struct v4l2_subdev *sd = dev_get_drvdata(dev); + struct ov5645 *ov5645 = to_ov5645(sd); int ret; ret = regulator_bulk_enable(OV5645_NUM_SUPPLIES, ov5645->supplies); @@ -658,57 +674,19 @@ static int ov5645_set_power_on(struct ov5645 *ov5645) msleep(20); - return 0; -} - -static void ov5645_set_power_off(struct ov5645 *ov5645) -{ - gpiod_set_value_cansleep(ov5645->rst_gpio, 1); - gpiod_set_value_cansleep(ov5645->enable_gpio, 0); - clk_disable_unprepare(ov5645->xclk); - regulator_bulk_disable(OV5645_NUM_SUPPLIES, ov5645->supplies); -} - -static int ov5645_s_power(struct v4l2_subdev *sd, int on) -{ - struct ov5645 *ov5645 = to_ov5645(sd); - int ret = 0; - - mutex_lock(&ov5645->power_lock); - - /* If the power count is modified from 0 to != 0 or from != 0 to 0, - * update the power state. - */ - if (ov5645->power_count == !on) { - if (on) { - ret = ov5645_set_power_on(ov5645); - if (ret < 0) - goto exit; - - ret = ov5645_set_register_array(ov5645, - ov5645_global_init_setting, + ret = ov5645_set_register_array(ov5645, ov5645_global_init_setting, ARRAY_SIZE(ov5645_global_init_setting)); - if (ret < 0) { - dev_err(ov5645->dev, - "could not set init registers\n"); - ov5645_set_power_off(ov5645); - goto exit; - } - - usleep_range(500, 1000); - } else { - ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58); - ov5645_set_power_off(ov5645); - } + if (ret < 0) { + dev_err(ov5645->dev, "could not set init registers\n"); + goto exit; } - /* Update the power count. */ - ov5645->power_count += on ? 1 : -1; - WARN_ON(ov5645->power_count < 0); + usleep_range(500, 1000); -exit: - mutex_unlock(&ov5645->power_lock); + return 0; +exit: + ov5645_set_power_off(dev); return ret; } @@ -795,7 +773,7 @@ static int ov5645_s_ctrl(struct v4l2_ctrl *ctrl) int ret; mutex_lock(&ov5645->power_lock); - if (!ov5645->power_count) { + if (!pm_runtime_get_if_in_use(ov5645->dev)) { mutex_unlock(&ov5645->power_lock); return 0; } @@ -827,6 +805,7 @@ static int ov5645_s_ctrl(struct v4l2_ctrl *ctrl) break; } + pm_runtime_put_autosuspend(ov5645->dev); mutex_unlock(&ov5645->power_lock); return ret; @@ -991,6 +970,10 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) int ret; if (enable) { + ret = pm_runtime_resume_and_get(ov5645->dev); + if (ret < 0) + return ret; + ret = ov5645_set_register_array(ov5645, ov5645->current_mode->data, ov5645->current_mode->data_size); @@ -998,22 +981,22 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) dev_err(ov5645->dev, "could not set mode %dx%d\n", ov5645->current_mode->width, ov5645->current_mode->height); - return ret; + goto err_rpm_put; } ret = v4l2_ctrl_handler_setup(&ov5645->ctrls); if (ret < 0) { dev_err(ov5645->dev, "could not sync v4l2 controls\n"); - return ret; + goto err_rpm_put; } ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x45); if (ret < 0) - return ret; + goto err_rpm_put; ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0, OV5645_SYSTEM_CTRL0_START); if (ret < 0) - return ret; + goto err_rpm_put; } else { ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40); if (ret < 0) @@ -1023,14 +1006,15 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) OV5645_SYSTEM_CTRL0_STOP); if (ret < 0) return ret; + pm_runtime_put(ov5645->dev); } return 0; -} -static const struct v4l2_subdev_core_ops ov5645_core_ops = { - .s_power = ov5645_s_power, -}; +err_rpm_put: + pm_runtime_put(ov5645->dev); + return ret; +} static const struct v4l2_subdev_video_ops ov5645_video_ops = { .s_stream = ov5645_s_stream, @@ -1046,7 +1030,6 @@ static const struct v4l2_subdev_pad_ops ov5645_subdev_pad_ops = { }; static const struct v4l2_subdev_ops ov5645_subdev_ops = { - .core = &ov5645_core_ops, .video = &ov5645_video_ops, .pad = &ov5645_subdev_pad_ops, }; @@ -1188,11 +1171,9 @@ static int ov5645_probe(struct i2c_client *client) goto free_ctrl; } - ret = ov5645_s_power(&ov5645->sd, true); - if (ret < 0) { - dev_err(dev, "could not power up OV5645\n"); + ret = ov5645_set_power_on(dev); + if (ret) goto free_entity; - } ret = ov5645_read_reg(ov5645, OV5645_CHIP_ID_HIGH, &chip_id_high); if (ret < 0 || chip_id_high != OV5645_CHIP_ID_HIGH_BYTE) { @@ -1209,12 +1190,16 @@ static int ov5645_probe(struct i2c_client *client) dev_info(dev, "OV5645 detected at address 0x%02x\n", client->addr); + pm_runtime_set_active(dev); + pm_runtime_get_noresume(dev); + pm_runtime_enable(dev); + ret = ov5645_read_reg(ov5645, OV5645_AEC_PK_MANUAL, &ov5645->aec_pk_manual); if (ret < 0) { dev_err(dev, "could not read AEC/AGC mode\n"); ret = -ENODEV; - goto power_down; + goto err_pm_runtime; } ret = ov5645_read_reg(ov5645, OV5645_TIMING_TC_REG20, @@ -1222,7 +1207,7 @@ static int ov5645_probe(struct i2c_client *client) if (ret < 0) { dev_err(dev, "could not read vflip value\n"); ret = -ENODEV; - goto power_down; + goto err_pm_runtime; } ret = ov5645_read_reg(ov5645, OV5645_TIMING_TC_REG21, @@ -1230,23 +1215,30 @@ static int ov5645_probe(struct i2c_client *client) if (ret < 0) { dev_err(dev, "could not read hflip value\n"); ret = -ENODEV; - goto power_down; + goto err_pm_runtime; } - ov5645_s_power(&ov5645->sd, false); - ret = v4l2_async_register_subdev(&ov5645->sd); if (ret < 0) { dev_err(dev, "could not register v4l2 device\n"); + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); goto free_entity; } + pm_runtime_set_autosuspend_delay(dev, 1000); + pm_runtime_use_autosuspend(dev); + pm_runtime_put_autosuspend(dev); + ov5645_entity_init_cfg(&ov5645->sd, NULL); return 0; +err_pm_runtime: + pm_runtime_disable(dev); + pm_runtime_put_noidle(dev); power_down: - ov5645_s_power(&ov5645->sd, false); + ov5645_set_power_off(dev); free_entity: media_entity_cleanup(&ov5645->sd.entity); free_ctrl: @@ -1264,6 +1256,10 @@ static void ov5645_remove(struct i2c_client *client) v4l2_async_unregister_subdev(&ov5645->sd); media_entity_cleanup(&ov5645->sd.entity); v4l2_ctrl_handler_free(&ov5645->ctrls); + pm_runtime_disable(ov5645->dev); + if (!pm_runtime_status_suspended(ov5645->dev)) + ov5645_set_power_off(ov5645->dev); + pm_runtime_set_suspended(ov5645->dev); mutex_destroy(&ov5645->power_lock); } @@ -1279,10 +1275,15 @@ static const struct of_device_id ov5645_of_match[] = { }; MODULE_DEVICE_TABLE(of, ov5645_of_match); +static const struct dev_pm_ops ov5645_pm_ops = { + SET_RUNTIME_PM_OPS(ov5645_set_power_off, ov5645_set_power_on, NULL) +}; + static struct i2c_driver ov5645_i2c_driver = { .driver = { .of_match_table = ov5645_of_match, .name = "ov5645", + .pm = &ov5645_pm_ops, }, .probe_new = ov5645_probe, .remove = ov5645_remove, From patchwork Fri Oct 14 18:34:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp325932wrs; Fri, 14 Oct 2022 11:37:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TnnB+yuBnJ4yNQip8M+rkQH5Xbu7YnyLV51xql73qmbCQgWV2Blb//lozCAfHG8KraxRS X-Received: by 2002:a05:6a00:150a:b0:562:bc4d:e244 with SMTP id q10-20020a056a00150a00b00562bc4de244mr6405057pfu.27.1665772650042; Fri, 14 Oct 2022 11:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665772650; cv=none; d=google.com; s=arc-20160816; b=IBkz26GQhVsrWLcWZOsBkvb6GRpmtgrzo2WbTnhqboqQFW02QLKmMLTAiw/h6l6X16 93+yTgwktFGhi7rBlsiY2Ly2DHcQkj7+G8+ZaDoxd2FdCzExzeUC0vzTQG0p66XCQ4Vh mKdsRRFIiMIR+LY6UxUALNrZJYc0NktCFZbTAROqzbtDurlwYN9hqlZtb1BFPPoeuFP1 8hN4sMOm/sl52GoHNx/SIzOC2PzeDN/J+Yb9g3t5J7sEQrKFFU/zA6Wi1RQATczlkoQM sAyeRUChCPJZfxKZHaspOL5sGF++MKAAObeRrzoPJzPBKPzaJSStStxROJnp2tOKXnHb G8xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FJOMeXQc0Af23KUB04em2P8Wb6t/cXjCGBlz5qX5m2I=; b=HHBlUsJjdChrdAfM5lcU6LtDKqRAo8q2ripYZ3Sitz5kBfHfBNZFXCiITzvKWn83m+ vxh7WeGzO8IkwM4oqaCt0ESNokyvOpmsHr1++2un4l+K3yC76ZVheomtFAMPeN3dvSnn 9LatxiOAyZItxAew6Xp8iWk0Aguq3PK0Y5bUn5OMFgSa2d6yey0Ft3fcp08YDHRj3WjY sUnqFOIDu95YZ9Uqih//o6la6d/FEo34y1csxMq/fMxDf0bqpp8OZeCdbaq7KZP1uqOG PAguQs2MXE6+7QePJes9PUlQe5tUUKwAl4E90khCo8RSvMclNCfNDKVsw5w4/AxhNlqV hpSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Blx6n6pT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020aa79207000000b00563653bc151si1781495pfo.110.2022.10.14.11.37.17; Fri, 14 Oct 2022 11:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Blx6n6pT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231231AbiJNSf6 (ORCPT + 99 others); Fri, 14 Oct 2022 14:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231142AbiJNSfc (ORCPT ); Fri, 14 Oct 2022 14:35:32 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85509A3ABA; Fri, 14 Oct 2022 11:35:22 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id f11so8863244wrm.6; Fri, 14 Oct 2022 11:35:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FJOMeXQc0Af23KUB04em2P8Wb6t/cXjCGBlz5qX5m2I=; b=Blx6n6pTCzYuF2uFy4alGGau4/NnYP0o4vNBhGXWQRNsNrieWBhNlU5sXvUlt36deY Up8KjVElZ9eJzp09elNQ7ohGy95b7beEFL6gq8JioodbGPmNNnOCtMFrOw2TaKWZ72tT H/1engiV+OY1rQ8QZkPRYgS//0kuDuEofrv1CGegAelLJpjADbY4HaTAW5Mz8Rird3X1 Vqjr9eYKml6aC6FfmoIyiH4uC7zX4p0MKAh4CLZrj9vCTxA58QYUM7gfoy5blJe2AcBA 6vX2JBjEYXjXWDmnW3NHkAzOAmNYa76E0ILDhJHY2sXQy5Nr342NhIISTi82YMv0Di33 gajg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FJOMeXQc0Af23KUB04em2P8Wb6t/cXjCGBlz5qX5m2I=; b=NXNVpnFPXwD5XM4IN+Alm+70IdmAC216ULv0bR1G/dmiYOt1vVKsWtjh/Aeh78Mdqb SfVsRCSHvnwac1B5oBuMSZ21E7V8/Nr3p/WiHe/vytiemHgisqzM2NPoTF1TenTp2295 /0apgnO7UY2vlr17o7W0WTeC6gqJSqTv+BDU0419bo/8It29BJ3+30asoT/xLqAkRuXH Rm+0xexiDK0W7RVndeCe7LXPHdhSxXRgTxf4cpX1stviZq8gsiJ4RFN2U+e2jWF37M6N jSVa989WNvaLpMY5STL7qW1UU394sUrXBHH45OGxdhiWubaBRe0ojNrnk3DJS/GwLh5R vBtA== X-Gm-Message-State: ACrzQf0tm8v0LCGqU1lH0B6RNmcRg7SlC6hXdXc0cSCm4OFfTi/juABz K5XBCLHyEt3IVKxalQ/vTfQ= X-Received: by 2002:a5d:674f:0:b0:22e:3d59:cf0f with SMTP id l15-20020a5d674f000000b0022e3d59cf0fmr4267687wrw.304.1665772520556; Fri, 14 Oct 2022 11:35:20 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:fc4d:6548:d8bd:5bd]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a403954c3sm2485410wrt.42.2022.10.14.11.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 11:35:19 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Sakari Ailus , Laurent Pinchart , Krzysztof Kozlowski , Rob Herring , Mauro Carvalho Chehab , Hans Verkuil Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v2 3/5] media: i2c: ov5645: Drop empty comment Date: Fri, 14 Oct 2022 19:34:57 +0100 Message-Id: <20221014183459.181567-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746689222346319372?= X-GMAIL-MSGID: =?utf-8?q?1746689222346319372?= From: Lad Prabhakar Drop empty multiline comment. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v1->v2 * No change --- drivers/media/i2c/ov5645.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index 1551690a94e0..a0b9d0c43b78 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -14,9 +14,6 @@ * https://www.mail-archive.com/linux-media%40vger.kernel.org/msg92671.html */ -/* - */ - #include #include #include From patchwork Fri Oct 14 18:34:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2788 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp325760wrs; Fri, 14 Oct 2022 11:36:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QAKXw9YHESK04n9FDItKGBiDeKKvKuo4fgxxKza7HrD2fQ0cdRY5kNYQ0wdMcc3z3mY91 X-Received: by 2002:a63:2a02:0:b0:42b:2711:d534 with SMTP id q2-20020a632a02000000b0042b2711d534mr5644029pgq.176.1665772618941; Fri, 14 Oct 2022 11:36:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665772618; cv=none; d=google.com; s=arc-20160816; b=OI4z2cAZu1yXISwaQyZqHBNHitu4zWVuBlZ0aWPs3iA3B0mR4YC2ZeSgxpukxCikTP 1TTbMlIAc6sagng9/OW30KuVd38xesOj6TDkeF9JyrH3/RELqKRJUyjzOAxjq2Ltvqwa SvmJWehWWZ1vRmf39wDrcIXeUleLFV4ko9tnri1X2evl2VR5oImR+NIKJJQEGKQwZCUC PxHqRGVCjuPytQCqai7krBufn4cluygGEVfzhopDKbGlL8Tms9/dHjOj62+wvMYLG7vL LyplE0yoQ2/yMyFHbHpn1qHg5nMbaI7jWPQifAWG4KBPZyQWUUi6niz3unwlE6QR/N7c pS4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FPNinP5NcVb9ViQFD23z9JvBzsucMh06jMRDsBjL9jk=; b=Ay0KS7+H6nCTpFt+OLy3ke9BGAPciDkW2cxNBP5nciS1inGdLaYsWlxBrcLbr8Vq13 YzYUBg9zhw8Q+7Bwiave1ZekPiGlf0lX4YeGy00vwuoN1QrwNeeYcmzVqiQ5YuwRbrb8 jie4FtSGGJO+jaY0RAafJQa08GHpLGovbqsDtYvGtSzuaL/hIBhpFVBpktJriYQgJVWj 3zga8Ab6cYa/KHoZ/uU6EGxEtVH8nocOePBctrub1mnTH/jHubYirJoA8gUXpgALrmQZ 9tB+tXrLIdXxOA1qTR5Y4OPuo1dVh+I83T6N4PlrUoe4BCGx+9Tk4KM1VIf6RXqHsJRG irig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K3ZIGnYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020a170902c41200b00172e069021dsi4073808plk.469.2022.10.14.11.36.45; Fri, 14 Oct 2022 11:36:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K3ZIGnYT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbiJNSfy (ORCPT + 99 others); Fri, 14 Oct 2022 14:35:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231130AbiJNSfb (ORCPT ); Fri, 14 Oct 2022 14:35:31 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857C4A7A99; Fri, 14 Oct 2022 11:35:23 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id r13so8846637wrj.11; Fri, 14 Oct 2022 11:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FPNinP5NcVb9ViQFD23z9JvBzsucMh06jMRDsBjL9jk=; b=K3ZIGnYTG2IW438XZKj0WhZ+OGMxdF8aRcvKK9NtgqDu/HP4htzpzZP5o4f6MqSCNn hoDyxzJP5TSGezWugWfiKaUdYwng+RoV0hCpMm+dava7Kf8Y7i0X09qMAxg58qrqFS56 49X+On/sn8fp+tQfes6gRmGRmp6yJskbhBVD6gjINZ3nhKtrcNSe0b434f/2idDVba5S 1ASPzAUmhBiGb6aXngjNu3ZSL78xhXOqlqgLmad4HP7ToGqNIUolv8EJgMdkr2CVv/4T 1M4k2F5fpbP+82IboWoD+wVeYUnHJK19a3gP/dWYxvpiwZ7kxEjqe/N8cQM7oFz3e31Q PnMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FPNinP5NcVb9ViQFD23z9JvBzsucMh06jMRDsBjL9jk=; b=tbNvugd/stySTJmTLWIHLVs8t61V/u57XlkwRLBS0IKjTwpVH/u1dQ7q340BPOt9j2 f1LQ4WlvbPHv2RTIsDVu0TX+/qtXWaIHOt441EXXopeaLlkVsDgRPO1PTbL/iMhwHn5v tR+cuc3bMa99UdkFCE20KeTJ15HmUpaLvEGseiuNCGhqJ7f44gQYLUgiKUWYO1HNucnw TxZzfV2WLrVG4FjmCKRcxhF62OUTH1cdaot3YJDGXoCM22J4n8X4y8lO3RBUyagw2TXj skZY6PeOr0P5H+xSuJr4pRhWxGzQxZ9h+WgCZUznh3iNjmim5iZIPGJVXkls4ObboeQb g1AA== X-Gm-Message-State: ACrzQf0UFDVOWALkJKDvyXeoX1117ojsYK/tcOeZAt7SiyCCdNuxy/iP GrASPFoJRC/UUv4mcn0DEa8= X-Received: by 2002:a05:6000:1565:b0:22f:1407:9bfd with SMTP id 5-20020a056000156500b0022f14079bfdmr4240073wrz.620.1665772521673; Fri, 14 Oct 2022 11:35:21 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:fc4d:6548:d8bd:5bd]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a403954c3sm2485410wrt.42.2022.10.14.11.35.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 11:35:21 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Sakari Ailus , Laurent Pinchart , Krzysztof Kozlowski , Rob Herring , Mauro Carvalho Chehab , Hans Verkuil Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v2 4/5] media: i2c: ov5645: Return zero for s_stream(0) Date: Fri, 14 Oct 2022 19:34:58 +0100 Message-Id: <20221014183459.181567-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746689189507507635?= X-GMAIL-MSGID: =?utf-8?q?1746689189507507635?= From: Lad Prabhakar Always return zero while stopping the stream as the caller will ignore the return value. This patch drops checking the return value of ov5645_write_reg() and continues further in the code path while stopping stream. The user anyway gets an error message in case ov5645_write_reg() fails. Suggested-by: Sakari Ailus Signed-off-by: Lad Prabhakar --- v1->v2 * New patch --- drivers/media/i2c/ov5645.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index a0b9d0c43b78..b3825294aaf1 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -995,14 +995,11 @@ static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) if (ret < 0) goto err_rpm_put; } else { - ret = ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40); - if (ret < 0) - return ret; + ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x40); + + ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0, + OV5645_SYSTEM_CTRL0_STOP); - ret = ov5645_write_reg(ov5645, OV5645_SYSTEM_CTRL0, - OV5645_SYSTEM_CTRL0_STOP); - if (ret < 0) - return ret; pm_runtime_put(ov5645->dev); } From patchwork Fri Oct 14 18:34:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2790 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp326230wrs; Fri, 14 Oct 2022 11:38:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM708kIkBD45sX35w/1fFKF6zr0oZg/ilsqw8eRCU9TVJBEU53KZyO0iK0q9Qq4t92lR5TKi X-Received: by 2002:a05:6402:274c:b0:45c:bb27:3d39 with SMTP id z12-20020a056402274c00b0045cbb273d39mr5328697edd.163.1665772706153; Fri, 14 Oct 2022 11:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665772706; cv=none; d=google.com; s=arc-20160816; b=0eNu5v4Q7c0XMNz0V/Sw/UR8sm+JWbIgqIsTRz3425lYeb4g+Pr3znnn0gDSkU7Y95 hhkworEJau1ReZIKbq3PLHnMpIKqIqL11fWJb0lN55EHWtA7AGUIdTTD6Fu68hPD0vEt legajbxoW0uY82kf6J6apPMuGh6Um0AufbfLQEC3DUq19EIH7GIRJpYSuRBKeXJ6+mYM 0jQN1FRvjF53IvaqPgoxfMLLIqbEq6yKsOQY2B7nlI+Y6U9AHnmLx0bsV2RuiaeNrn/q spM6LCkcROUGLh38DMkrWZxECoxqFJinsuqETfDIu1g3/hj/q9dXr7h1CjQjHwNlWoAS tIAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IBuenOFJAznaNzn5YDk4yF74Fdz4lVjclL9qQtkiwdo=; b=ydyQQ8mC6mXhUiL+5Jt0CTDlWbexzMXh11e/pfGfYIB4NWxywXN9YMC9W5ZyycH9Da emYmQjLr//FRDbtIfOyqFv5htSEIrh1fRUC4iPIWuMZTmI026PjR6WXvoHfEXMBy8POB V8i/8rx+ceaLjPeU8cYBFjrco6TUO2oE1pZ5Ok5znieErXhdoVfEfPifLl65Z9P9gK7A Q2ByB3+DkgiK2o5idXtfq1xHgkG3NKBYKp6lBPoQ/VCmi3zIUTli3Fa5K7fKuFkLL8q1 i7o8rXFdSQtvf536gi+jci+FPnZegPwXk0z5Mk/5DPIBCiSnID70O2xF8FHH67DKhGCK zujQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DNvi+Xkg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d12-20020a170906304c00b00781e568f39bsi2620189ejd.308.2022.10.14.11.38.00; Fri, 14 Oct 2022 11:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DNvi+Xkg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbiJNSgD (ORCPT + 99 others); Fri, 14 Oct 2022 14:36:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231134AbiJNSfb (ORCPT ); Fri, 14 Oct 2022 14:35:31 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C7E6AC3B8; Fri, 14 Oct 2022 11:35:24 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id j16so8887087wrh.5; Fri, 14 Oct 2022 11:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IBuenOFJAznaNzn5YDk4yF74Fdz4lVjclL9qQtkiwdo=; b=DNvi+XkgFPURgg9h2yvF+OAQjfWCz4Q5bDAPd9AG/WVwO8S7/5tVvK/rOBk7iWahRz qNO7hZHQkTw5ABNOn7X+7NhDN3dAO5oKM5+eDMdZHYAEwIwv1WS9UynqxSkgXMPSHm2W Me8ySipXpk1kfAkglN9v5y09cNmhCHDCyyUgTN8VNdTPacax1aKqUoxnoJuvJ4TNzBKl +Xm//krW7k7zBtkLw5zswNIzJ8mF9c9ToEegAqRtCaWeVw+3Dxt6Zn9561nqdO+KNzrO xEi2azNDZldMksDWM3MoZRvnlCyRJ/sCitUeFEpBLGOtHLr7D3Gn0kbB3RrW6GjP4BAE Qw7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IBuenOFJAznaNzn5YDk4yF74Fdz4lVjclL9qQtkiwdo=; b=o8lk8Jff6RYlZPNx2t7F82IAmpBuGIbbn5r+tHrGj8mmOm7YpPMYJUW12oa803NJPZ kxUIbKp0x9Lpkm0p8Ky/x24uvBNA4E5KDhmKuRwGOAjOtXbUFsqbEFTRwWtvM0J2dOmQ JPNZx6tGav/1JS/mrrwZRUKV89bkFW5gIgxQDBAH5RCL4gKrGeowpWG/qlYER8Y7ilAe q8k4EiKQUfsLpdTriBLhwq1XKw8qp1BqHaXpQfI0f1BGx1nzZShtT0vkWTLNCyzNttov XdmdzMFj6+9enmZ37yCXDz5xS73Ff3n2lGZFMvbJW3z+LBH5hjQAXJT+9Js2j/edH0uQ SUeQ== X-Gm-Message-State: ACrzQf0TNpdaM/9PYSgJoz7G5bdUrrpkYkhDJWYVEO8DGOOiLoqfHBps xrXSGI7l9hCAB8TM3GxNWTg= X-Received: by 2002:a5d:428c:0:b0:22e:5d4e:c71e with SMTP id k12-20020a5d428c000000b0022e5d4ec71emr4154030wrq.19.1665772522695; Fri, 14 Oct 2022 11:35:22 -0700 (PDT) Received: from prasmi.home ([2a00:23c8:2501:c701:fc4d:6548:d8bd:5bd]) by smtp.gmail.com with ESMTPSA id h10-20020a5d504a000000b0022a403954c3sm2485410wrt.42.2022.10.14.11.35.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 11:35:22 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Sakari Ailus , Laurent Pinchart , Krzysztof Kozlowski , Rob Herring , Mauro Carvalho Chehab , Hans Verkuil Cc: Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [PATCH v2 5/5] media: i2c: ov5645: Call ov5645_entity_init_cfg() before registering the subdev Date: Fri, 14 Oct 2022 19:34:59 +0100 Message-Id: <20221014183459.181567-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20221014183459.181567-1-prabhakar.mahadev-lad.rj@bp.renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746689280883405942?= X-GMAIL-MSGID: =?utf-8?q?1746689280883405942?= From: Lad Prabhakar Make sure we call ov5645_entity_init_cfg() before registering the subdev to make sure default formats are set up. Suggested-by: Sakari Ailus Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- v1->v2 * New patch --- drivers/media/i2c/ov5645.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index b3825294aaf1..14bcc6e42dd2 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1212,6 +1212,8 @@ static int ov5645_probe(struct i2c_client *client) goto err_pm_runtime; } + ov5645_entity_init_cfg(&ov5645->sd, NULL); + ret = v4l2_async_register_subdev(&ov5645->sd); if (ret < 0) { dev_err(dev, "could not register v4l2 device\n"); @@ -1224,8 +1226,6 @@ static int ov5645_probe(struct i2c_client *client) pm_runtime_use_autosuspend(dev); pm_runtime_put_autosuspend(dev); - ov5645_entity_init_cfg(&ov5645->sd, NULL); - return 0; err_pm_runtime: