From patchwork Wed Dec 22 00:37:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527463 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 C3411C43217 for ; Wed, 22 Dec 2021 00:35:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239555AbhLVAft (ORCPT ); Tue, 21 Dec 2021 19:35:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbhLVAfs (ORCPT ); Tue, 21 Dec 2021 19:35:48 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62AD6C061401 for ; Tue, 21 Dec 2021 16:35:48 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so2814440wmj.5 for ; Tue, 21 Dec 2021 16:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JxEWAeNVJKEIf23MftqiE+2szf+/v3JYv1Krjzg8Yls=; b=keuLj/qult47zXmkaNuY2yYJLz9052tOkPktP2mGnu8WHlo79TFHe5Y060O9RLMZnN Y5TdOQuVhzO/cFCux7mAVKob6JQB9mRVOOfS+2Z6f+ap56sJeL7WTWBcGRTk0+KJbvVw jQoLMsmY4p/pzof6ILTQfVupX3EdNZpw/rBAocHOTSmH66qYWmHr7GuVwTVpeRDDHb6f 2w94jHz2tTmHQNxO4PmzyofDanqDLa1ANFSiCBT8mq3gyZkojkpLEQuH4DHKLe898I+D GqnhbhD7nb4vAUIq5/zSIe+mJubeIufpV/e+mOS4/LiR2whIbW1HfSWxvqzQYylEUlMe G99g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JxEWAeNVJKEIf23MftqiE+2szf+/v3JYv1Krjzg8Yls=; b=SV6FTC2A8Nuu8GIKRo+XVoKetTCqfmz5bs5xWxOJt+EyV+F3io7PjnAITZcPn7Iu8c ZRa0XzWa6r8Hpb7n4OX+IYhESpCIkw3ZwXHv5WDFP/8QcHLgzZtoZ+gzDzTz9gPq2q2A yw+B6sdUzDso2aHijt3jwwwwR24g6jFb4dN8YIC6ZcAnXGZ6OLNQ4PZwre7XKfHR6g+U /dGAe9YlL1m+M/+80go8F2lUZbtf+KmN1fVP7b0L1liOh1lgGflooFeslZDYzpBRI/vW ojHKfQJTgn6pZwznww7ZZ6jUjFatq6CpV31gyL8DwPB9g/xrTC+NZo0A+bBHqGRtTZ83 LLBA== X-Gm-Message-State: AOAM533uTZMiDaLZ55BoYwY69/z4XvYsntk19QzD3jqah3IPjUrpdtwd HI3L5YuQPRycq3NlNpXALJeqYOWG1Wm/qw== X-Google-Smtp-Source: ABdhPJzR+bYDZCkRVhl4FfprueAdtn70+OXPeZtqEX01+E9Qo2Hd++2u61hiUFt0iuLa6ntV7ecZUQ== X-Received: by 2002:a05:600c:296:: with SMTP id 22mr614046wmk.11.1640133346508; Tue, 21 Dec 2021 16:35:46 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:45 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org, devicetree@vger.kernel.org, Rob Herring Subject: [PATCH v3 01/19] media: dt-bindings: media: camss: Add qcom,sm8250-camss binding Date: Wed, 22 Dec 2021 00:37:33 +0000 Message-Id: <20211222003751.2461466-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Add bindings for qcom,sm8250-camss in order to support the camera subsystem for SM8250. Cc: devicetree@vger.kernel.org Signed-off-by: Jonathan Marek Signed-off-by: Bryan O'Donoghue Reviewed-by: Rob Herring --- .../bindings/media/qcom,sm8250-camss.yaml | 450 ++++++++++++++++++ 1 file changed, 450 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml diff --git a/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml b/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml new file mode 100644 index 0000000000000..af877d61b607d --- /dev/null +++ b/Documentation/devicetree/bindings/media/qcom,sm8250-camss.yaml @@ -0,0 +1,450 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) + +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/media/qcom,sm8250-camss.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm CAMSS ISP + +maintainers: + - Robert Foss + +description: | + The CAMSS IP is a CSI decoder and ISP present on Qualcomm platforms. + +properties: + compatible: + const: qcom,sm8250-camss + + clocks: + minItems: 37 + maxItems: 37 + + clock-names: + items: + - const: cam_ahb_clk + - const: cam_hf_axi + - const: cam_sf_axi + - const: camnoc_axi + - const: camnoc_axi_src + - const: core_ahb + - const: cpas_ahb + - const: csiphy0 + - const: csiphy0_timer + - const: csiphy1 + - const: csiphy1_timer + - const: csiphy2 + - const: csiphy2_timer + - const: csiphy3 + - const: csiphy3_timer + - const: csiphy4 + - const: csiphy4_timer + - const: csiphy5 + - const: csiphy5_timer + - const: slow_ahb_src + - const: vfe0_ahb + - const: vfe0_axi + - const: vfe0 + - const: vfe0_cphy_rx + - const: vfe0_csid + - const: vfe0_areg + - const: vfe1_ahb + - const: vfe1_axi + - const: vfe1 + - const: vfe1_cphy_rx + - const: vfe1_csid + - const: vfe1_areg + - const: vfe_lite_ahb + - const: vfe_lite_axi + - const: vfe_lite + - const: vfe_lite_cphy_rx + - const: vfe_lite_csid + + interrupts: + minItems: 14 + maxItems: 14 + + interrupt-names: + items: + - const: csiphy0 + - const: csiphy1 + - const: csiphy2 + - const: csiphy3 + - const: csiphy4 + - const: csiphy5 + - const: csid0 + - const: csid1 + - const: csid2 + - const: csid3 + - const: vfe0 + - const: vfe1 + - const: vfe_lite0 + - const: vfe_lite1 + + iommus: + minItems: 8 + maxItems: 8 + + interconnects: + minItems: 4 + maxItems: 4 + + interconnect-names: + items: + - const: cam_ahb + - const: cam_hf_0_mnoc + - const: cam_sf_0_mnoc + - const: cam_sf_icp_mnoc + + power-domains: + items: + - description: IFE0 GDSC - Image Front End, Global Distributed Switch Controller. + - description: IFE1 GDSC - Image Front End, Global Distributed Switch Controller. + - description: Titan GDSC - Titan ISP Block, Global Distributed Switch Controller. + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + description: + CSI input ports. + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + port@1: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + port@2: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + port@3: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + port@4: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + port@5: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: + Input port for receiving CSI data. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + clock-lanes: + maxItems: 1 + + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - clock-lanes + - data-lanes + + reg: + minItems: 10 + maxItems: 10 + + reg-names: + items: + - const: csiphy0 + - const: csiphy1 + - const: csiphy2 + - const: csiphy3 + - const: csiphy4 + - const: csiphy5 + - const: vfe0 + - const: vfe1 + - const: vfe_lite0 + - const: vfe_lite1 + +required: + - clock-names + - clocks + - compatible + - interconnects + - interconnect-names + - interrupts + - interrupt-names + - iommus + - power-domains + - reg + - reg-names + +additionalProperties: false + +examples: + - | + #include + #include + #include + #include + #include + + soc { + #address-cells = <2>; + #size-cells = <2>; + + camss: camss@ac6a000 { + compatible = "qcom,sm8250-camss"; + + reg = <0 0xac6a000 0 0x2000>, + <0 0xac6c000 0 0x2000>, + <0 0xac6e000 0 0x1000>, + <0 0xac70000 0 0x1000>, + <0 0xac72000 0 0x1000>, + <0 0xac74000 0 0x1000>, + <0 0xacb4000 0 0xd000>, + <0 0xacc3000 0 0xd000>, + <0 0xacd9000 0 0x2200>, + <0 0xacdb200 0 0x2200>; + reg-names = "csiphy0", + "csiphy1", + "csiphy2", + "csiphy3", + "csiphy4", + "csiphy5", + "vfe0", + "vfe1", + "vfe_lite0", + "vfe_lite1"; + + interrupts = , + , + , + , + , + , + , + , + , + , + , + , + , + ; + interrupt-names = "csiphy0", + "csiphy1", + "csiphy2", + "csiphy3", + "csiphy4", + "csiphy5", + "csid0", + "csid1", + "csid2", + "csid3", + "vfe0", + "vfe1", + "vfe_lite0", + "vfe_lite1"; + + power-domains = <&camcc IFE_0_GDSC>, + <&camcc IFE_1_GDSC>, + <&camcc TITAN_TOP_GDSC>; + + clocks = <&gcc GCC_CAMERA_AHB_CLK>, + <&gcc GCC_CAMERA_HF_AXI_CLK>, + <&gcc GCC_CAMERA_SF_AXI_CLK>, + <&camcc CAM_CC_CAMNOC_AXI_CLK>, + <&camcc CAM_CC_CAMNOC_AXI_CLK_SRC>, + <&camcc CAM_CC_CORE_AHB_CLK>, + <&camcc CAM_CC_CPAS_AHB_CLK>, + <&camcc CAM_CC_CSIPHY0_CLK>, + <&camcc CAM_CC_CSI0PHYTIMER_CLK>, + <&camcc CAM_CC_CSIPHY1_CLK>, + <&camcc CAM_CC_CSI1PHYTIMER_CLK>, + <&camcc CAM_CC_CSIPHY2_CLK>, + <&camcc CAM_CC_CSI2PHYTIMER_CLK>, + <&camcc CAM_CC_CSIPHY3_CLK>, + <&camcc CAM_CC_CSI3PHYTIMER_CLK>, + <&camcc CAM_CC_CSIPHY4_CLK>, + <&camcc CAM_CC_CSI4PHYTIMER_CLK>, + <&camcc CAM_CC_CSIPHY5_CLK>, + <&camcc CAM_CC_CSI5PHYTIMER_CLK>, + <&camcc CAM_CC_SLOW_AHB_CLK_SRC>, + <&camcc CAM_CC_IFE_0_AHB_CLK>, + <&camcc CAM_CC_IFE_0_AXI_CLK>, + <&camcc CAM_CC_IFE_0_CLK>, + <&camcc CAM_CC_IFE_0_CPHY_RX_CLK>, + <&camcc CAM_CC_IFE_0_CSID_CLK>, + <&camcc CAM_CC_IFE_0_AREG_CLK>, + <&camcc CAM_CC_IFE_1_AHB_CLK>, + <&camcc CAM_CC_IFE_1_AXI_CLK>, + <&camcc CAM_CC_IFE_1_CLK>, + <&camcc CAM_CC_IFE_1_CPHY_RX_CLK>, + <&camcc CAM_CC_IFE_1_CSID_CLK>, + <&camcc CAM_CC_IFE_1_AREG_CLK>, + <&camcc CAM_CC_IFE_LITE_AHB_CLK>, + <&camcc CAM_CC_IFE_LITE_AXI_CLK>, + <&camcc CAM_CC_IFE_LITE_CLK>, + <&camcc CAM_CC_IFE_LITE_CPHY_RX_CLK>, + <&camcc CAM_CC_IFE_LITE_CSID_CLK>; + clock-names = "cam_ahb_clk", + "cam_hf_axi", + "cam_sf_axi", + "camnoc_axi", + "camnoc_axi_src", + "core_ahb", + "cpas_ahb", + "csiphy0", + "csiphy0_timer", + "csiphy1", + "csiphy1_timer", + "csiphy2", + "csiphy2_timer", + "csiphy3", + "csiphy3_timer", + "csiphy4", + "csiphy4_timer", + "csiphy5", + "csiphy5_timer", + "slow_ahb_src", + "vfe0_ahb", + "vfe0_axi", + "vfe0", + "vfe0_cphy_rx", + "vfe0_csid", + "vfe0_areg", + "vfe1_ahb", + "vfe1_axi", + "vfe1", + "vfe1_cphy_rx", + "vfe1_csid", + "vfe1_areg", + "vfe_lite_ahb", + "vfe_lite_axi", + "vfe_lite", + "vfe_lite_cphy_rx", + "vfe_lite_csid"; + + iommus = <&apps_smmu 0x800 0x400>, + <&apps_smmu 0x801 0x400>, + <&apps_smmu 0x840 0x400>, + <&apps_smmu 0x841 0x400>, + <&apps_smmu 0xC00 0x400>, + <&apps_smmu 0xC01 0x400>, + <&apps_smmu 0xC40 0x400>, + <&apps_smmu 0xC41 0x400>; + + interconnects = <&gem_noc MASTER_AMPSS_M0 &config_noc SLAVE_CAMERA_CFG>, + <&mmss_noc MASTER_CAMNOC_HF &mc_virt SLAVE_EBI_CH0>, + <&mmss_noc MASTER_CAMNOC_SF &mc_virt SLAVE_EBI_CH0>, + <&mmss_noc MASTER_CAMNOC_ICP &mc_virt SLAVE_EBI_CH0>; + interconnect-names = "cam_ahb", + "cam_hf_0_mnoc", + "cam_sf_0_mnoc", + "cam_sf_icp_mnoc"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + }; + }; + }; From patchwork Wed Dec 22 00:37:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527219 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 A6D2CC433F5 for ; Wed, 22 Dec 2021 00:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239485AbhLVAfu (ORCPT ); Tue, 21 Dec 2021 19:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbhLVAft (ORCPT ); Tue, 21 Dec 2021 19:35:49 -0500 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 71492C06173F for ; Tue, 21 Dec 2021 16:35:49 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id v7so1270361wrv.12 for ; Tue, 21 Dec 2021 16:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aVnKjjfoMlWOYQorgJz5dVMTeV/85OY8LLZz6SkWXLo=; b=yr71G2JKx3ZVmqqySQbjemfvCIKKbVIgMyLMbdnkrNDHq8wY3Ve8fWwgFD/m8XAfEY +uyYzQBBunWsEp1+1jOqJ5rLKmvJtt+caPNqWELsCqkxp2a7DNMJh8/aS90kzVDLvalK 1YTfq0LQtxzdbSaWhLfRYLtGmBPkXqrtn7NpDMRmud9v+THzXH8L6Nbm1G1Zo1wCstLE X0/kc96msWhcCXsco+4YXv4v7l/h06xwqW+f05b81ZtJSr1dcE4ZLnZsGVkEzHlYRim+ XlTCumTG9MYCaYztp0cQMfifoKJIfYxeUY4C6YCdpICbDswmmaHXIxGBDaRjcZh3L363 zvuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aVnKjjfoMlWOYQorgJz5dVMTeV/85OY8LLZz6SkWXLo=; b=CMlj9y4FGPcgAAS1DjpyYuLYsMI9+5Wq9egbkm+QHU8QS712QI9jhggvfzCG3h4bkH OdfZgq6UY5erTNi7/3cDOkcxyYBSvw2msexKftCziytEmb0BFK3pNS+OO2V6hIZPQsIM sIpsdDcNOLEfOa0mEEfEpgDr1Y1GdSFRiyYXpwiYyPQ1jSf0QE5MG+TClFobfPIX+yxx gU6hwNrt7PRjEyZiHi9tNDDQ87NHNjzKzVtfiUoK3huiW5f1etPPYUCuEU47/onm5REJ WxSef3RpcQxr8bJe/JxTmLS6okh3oYaMrUAxCaunpatOMWeFILyWDBsBwUdW3zZ2gIRR 84ew== X-Gm-Message-State: AOAM533Y9sObWklkcTw8tZ9uj9BI9kSRcxN6fJJmyksM0AXjcCTf7a1d 13h44XSOLfL6ywgBo3KSEN+tn5bFuDod6g== X-Google-Smtp-Source: ABdhPJxCkJKPNyUP5zGNfZgGF/ZFQsdsuhOsIUW37s5n+JTSnni/B6DaGwswSq6ujDp2ccO7gYz5ZQ== X-Received: by 2002:a5d:6d05:: with SMTP id e5mr407022wrq.46.1640133347679; Tue, 21 Dec 2021 16:35:47 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:47 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 02/19] media: camss: csiphy-3ph: don't print HW version as an error Date: Wed, 22 Dec 2021 00:37:34 +0000 Message-Id: <20211222003751.2461466-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Avoid unnecessary noise in normal usage (it prints every time CSIPHY is powered on). Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index e318c822ab04c..5948abdcd2206 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -163,7 +163,7 @@ static void csiphy_hw_version_read(struct csiphy_device *csiphy, hw_version |= readl_relaxed(csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_STATUSn(15)) << 24; - dev_err(dev, "CSIPHY 3PH HW Version = 0x%08x\n", hw_version); + dev_dbg(dev, "CSIPHY 3PH HW Version = 0x%08x\n", hw_version); } /* From patchwork Wed Dec 22 00:37:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527218 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 334D2C43219 for ; Wed, 22 Dec 2021 00:35:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239614AbhLVAfv (ORCPT ); Tue, 21 Dec 2021 19:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbhLVAfv (ORCPT ); Tue, 21 Dec 2021 19:35:51 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53BEC061574 for ; Tue, 21 Dec 2021 16:35:50 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so2814470wmj.5 for ; Tue, 21 Dec 2021 16:35:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aCn2AUBf+s4jY/6QkYpdOWBiS0aWpq/nnEFl+kmOZ6w=; b=KtYVbbf6yElUHr9DwyQmSWVnWcRdQPhYlopqPNqShRjkTrlIq6XqsPZCWdEvLUxo/C x5W8t7WhiUGtAVNesl7hnO9oLiCiZ7yABZIR7jIhGl3cSg0e6qH95mj1JFhQfYO2GwfB V1o2RLytaQ8dp/KII0m+BXMHGwoPWuQG11UkneSy7sCUzrh//hnQNIoA0i8Vtt1Rg1uD JqtHZnD4SsYqlEmJlCTAPHcicBfRgOOFf3DgowPO0BzDZmwDNpMdIAfkIYzUTvwbdhnv lbKAtyGRek6CSb2jhF03VMlEppV5GccWx85mBkrUwTJPSlyG5HV/SOmsLCnYa2uA7fsP 8IqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aCn2AUBf+s4jY/6QkYpdOWBiS0aWpq/nnEFl+kmOZ6w=; b=DZfRcOFkXl05uRe/iJYi4L/Pj/sqHJa/Pr5BVD6mSltvU7Jegn6Re699p8tPlBmPsl p2CQBk4k/sX2BlLNYIDu00q3aeK010IYlSD8mBVBwRhfBfAo35WPDdi8yNFbKDB9bwOk Fr+GW1neaUnUeMi5mvIBePHIw+cwZhO9ymTXF24YCfFsF4lh+5taxUeG5U/8lJz3KV/B zzITzRejUfzNIRYXlIy/qMdAdZX2cBGkBz1aLi+oedVFFWGp4CA5xASkmFb2EKloEY6C xRSSq4jYdM73MdH5w3pDS2yFtBcXjhn94PJPneH95Q+u93ZZjnTW5yg1fHg4mN4tM0un JtvQ== X-Gm-Message-State: AOAM5337HjGof1unN1lwssVKGxZeh2LPAQT4hpOlJBiZ8ktwZCANZhQ1 fbTmoE8eC/cOd8JVLAnLDhtQxsyv50iC5g== X-Google-Smtp-Source: ABdhPJxZhxI+jcdPrQ2s8dolyyTSY1KfK1+qE2zjnz63UM6BC8Wx0DyqGh62jCT/08VHfwdi5KafnA== X-Received: by 2002:a1c:1bd8:: with SMTP id b207mr632991wmb.114.1640133348857; Tue, 21 Dec 2021 16:35:48 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:48 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 03/19] media: camss: csiphy-3ph: disable interrupts Date: Wed, 22 Dec 2021 00:37:35 +0000 Message-Id: <20211222003751.2461466-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek The driver does nothing with the interrupts, so set the irq mask registers to zero to avoid wasting CPU time for nothing. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- .../qcom/camss/camss-csiphy-3ph-1-0.c | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 5948abdcd2206..783b65295d20b 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -352,38 +352,9 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, else if (csiphy->camss->version == CAMSS_845) csiphy_gen2_config_lanes(csiphy, settle_cnt); - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(11)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(12)); - - val = 0xfb; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(13)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(14)); - - val = 0x7f; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(15)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(16)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(17)); - - val = 0xef; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(18)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(19)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(20)); - - val = 0xff; - writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(21)); + /* IRQ_MASK registers - disable all interrupts */ + for (i = 11; i < 22; i++) + writel_relaxed(0, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(i)); } static void csiphy_lanes_disable(struct csiphy_device *csiphy, From patchwork Wed Dec 22 00:37:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527462 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 0BA0CC433F5 for ; Wed, 22 Dec 2021 00:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239664AbhLVAfw (ORCPT ); Tue, 21 Dec 2021 19:35:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239660AbhLVAfw (ORCPT ); Tue, 21 Dec 2021 19:35:52 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9A5DC06173F for ; Tue, 21 Dec 2021 16:35:51 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id r17so1356832wrc.3 for ; Tue, 21 Dec 2021 16:35:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ljMjKmJ/9wGWFq9xOZXIRuoF0j5niHQvp3VYwI5nr+4=; b=I1NR22raRI60fvmp2W4ju+c84vO7GlpL1K+Oye8m8LLB0dLw/QenIpN7g/+86xfuMN otEow9NwnyIhQHaU00dXFKe9exakl0JVRw/wDXXJtudAh7mn+lOmsmoGqcMuRT5Sj1/F 2rVUCFOeq9M+IIereO/pjgbRzK39orkoRolYJ1pZKZN1tKAodziM+xGzNYdys8l6fZJS sj/z2EWO4ybkrdExpQoLhSvbj3hlhxdxNXQwjE/gS/K44c/dtj0DY2+8XXXqNmSLSl5u YPpi6eHLdj14vaR+EkpPN5KHhhXy17mI2pTWg6xbhNgFoAb+Z97Bz5odXGOgACc8+BZ1 c9Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ljMjKmJ/9wGWFq9xOZXIRuoF0j5niHQvp3VYwI5nr+4=; b=uIULN1Fruo6QjjsAbE+RnJZ5uKooUZdMaw/Ko0R09EQZ2BKyJVOUQIUKx+1krWiXKs 8lIv+eztr5rT8F/4c3Vutn6M1312KO/1oIzU4MOeF4ZpxxeboNkv//Cv9qgDT2JQmWQP Dd6f2PFUqKZhrRp6Htg59jIpAd6FrtWkXW468hUjVOHg+FhMo/6gb44BV5BYiv8/OoZz Gv1IoSfSKGD8up4pK/8fvZjSokY76r79YR3nBE4lDFp67MdfPVfmeV0PCMB3+Raynudt uiJaho4ZEZEbdU1rHETywlNDLXVoOd7tqrbyi0PZSFgyWY5LD8M6lP7sc4KB0yCC8dOA l/Vw== X-Gm-Message-State: AOAM530Q7wBEOkq7ZJC3Vatz2xqIJ9yo/VmnW0poqwOpbb6WXgm+0fI0 Vek76aBXtTdsNa9VSgs7CFbas5ly1igu3A== X-Google-Smtp-Source: ABdhPJyMOzkT+pDorFLdNrc6IvqpFkOX+katQPeD7SV2obukm01AcRdyV7L+awWf4ndkj8jokmh0Kg== X-Received: by 2002:adf:dd11:: with SMTP id a17mr400879wrm.174.1640133349987; Tue, 21 Dec 2021 16:35:49 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:49 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 04/19] media: camss: csiphy-3ph: add support for SM8250 CSI DPHY Date: Wed, 22 Dec 2021 00:37:36 +0000 Message-Id: <20211222003751.2461466-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Add support for CSIPHY (2PH/DPHY mode) found on SM8250 hardware. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- .../qcom/camss/camss-csiphy-3ph-1-0.c | 147 ++++++++++++++++-- drivers/media/platform/qcom/camss/camss.h | 1 + 2 files changed, 139 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c index 783b65295d20b..c5b0a91b36f88 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c @@ -62,6 +62,7 @@ struct csiphy_reg_t { u32 csiphy_param_type; }; +/* GEN2 1.0 2PH */ static const struct csiphy_reg_t lane_regs_sdm845[5][14] = { { @@ -146,6 +147,121 @@ csiphy_reg_t lane_regs_sdm845[5][14] = { }, }; +/* GEN2 1.2.1 2PH */ +static const struct +csiphy_reg_t lane_regs_sm8250[5][20] = { + { + {0x0030, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0900, 0x05, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0908, 0x10, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0904, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0904, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0004, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x002C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0034, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0010, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x001C, 0x08, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x003C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0008, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, + {0x0000, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x000c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0038, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0014, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0028, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0024, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0884, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + }, + { + {0x0730, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C80, 0x05, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C88, 0x10, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C84, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C84, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0704, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x072C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0734, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0710, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x071C, 0x08, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x073C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0708, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, + {0x0700, 0x80, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x070c, 0xA5, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0738, 0x1F, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0714, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0728, 0x04, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0724, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0884, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + }, + { + {0x0230, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0A00, 0x05, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0A08, 0x10, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0A04, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0A04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0204, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x022C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0234, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0210, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x021C, 0x08, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x023C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0208, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, + {0x0200, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x020c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0238, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0214, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0228, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0224, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0884, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + }, + { + {0x0430, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0B00, 0x05, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0B08, 0x10, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0B04, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0B04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0404, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x042C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0434, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0410, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x041C, 0x08, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x043C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0408, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, + {0x0400, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x040c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0438, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0414, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0428, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0424, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0884, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + }, + { + {0x0630, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C00, 0x05, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C08, 0x10, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C04, 0x00, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0C04, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0604, 0x0C, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x062C, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0634, 0x07, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0610, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x061C, 0x08, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x063C, 0xB8, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0608, 0x10, 0x00, CSIPHY_SETTLE_CNT_LOWER_BYTE}, + {0x0600, 0x8D, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x060c, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0638, 0xFE, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0614, 0x60, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0628, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0624, 0x00, 0x00, CSIPHY_DNP_PARAMS}, + {0x0800, 0x02, 0x00, CSIPHY_DEFAULT_PARAMS}, + {0x0884, 0x01, 0x00, CSIPHY_DEFAULT_PARAMS}, + }, +}; + static void csiphy_hw_version_read(struct csiphy_device *csiphy, struct device *dev) { @@ -298,13 +414,25 @@ static void csiphy_gen1_config_lanes(struct csiphy_device *csiphy, static void csiphy_gen2_config_lanes(struct csiphy_device *csiphy, u8 settle_cnt) { - int i, l; + const struct csiphy_reg_t *r; + int i, l, array_size; u32 val; - for (l = 0; l < 5; l++) { - for (i = 0; i < 14; i++) { - const struct csiphy_reg_t *r = &lane_regs_sdm845[l][i]; + switch (csiphy->camss->version) { + case CAMSS_845: + r = &lane_regs_sdm845[0][0]; + array_size = ARRAY_SIZE(lane_regs_sdm845[0]); + break; + case CAMSS_8250: + r = &lane_regs_sm8250[0][0]; + array_size = ARRAY_SIZE(lane_regs_sm8250[0]); + break; + default: + unreachable(); + } + for (l = 0; l < 5; l++) { + for (i = 0; i < array_size; i++, r++) { switch (r->csiphy_param_type) { case CSIPHY_SETTLE_CNT_LOWER_BYTE: val = settle_cnt & 0xff; @@ -325,13 +453,15 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, s64 link_freq, u8 lane_mask) { struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg; + bool is_gen2 = (csiphy->camss->version == CAMSS_845 || + csiphy->camss->version == CAMSS_8250); u8 settle_cnt; u8 val; int i; settle_cnt = csiphy_settle_cnt_calc(link_freq, csiphy->timer_clk_rate); - val = BIT(c->clk.pos); + val = is_gen2 ? BIT(7) : BIT(c->clk.pos); for (i = 0; i < c->num_data; i++) val |= BIT(c->data[i].pos * 2); @@ -346,11 +476,10 @@ static void csiphy_lanes_enable(struct csiphy_device *csiphy, val = 0x00; writel_relaxed(val, csiphy->base + CSIPHY_3PH_CMN_CSI_COMMON_CTRLn(0)); - if (csiphy->camss->version == CAMSS_8x16 || - csiphy->camss->version == CAMSS_8x96) - csiphy_gen1_config_lanes(csiphy, cfg, settle_cnt); - else if (csiphy->camss->version == CAMSS_845) + if (is_gen2) csiphy_gen2_config_lanes(csiphy, settle_cnt); + else + csiphy_gen1_config_lanes(csiphy, cfg, settle_cnt); /* IRQ_MASK registers - disable all interrupts */ for (i = 11; i < 22; i++) diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index dc8b4154f92b3..377e2474a485f 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -69,6 +69,7 @@ enum camss_version { CAMSS_8x96, CAMSS_660, CAMSS_845, + CAMSS_8250, }; struct camss { From patchwork Wed Dec 22 00:37:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527217 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 10208C433EF for ; Wed, 22 Dec 2021 00:35:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239557AbhLVAfx (ORCPT ); Tue, 21 Dec 2021 19:35:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239660AbhLVAfx (ORCPT ); Tue, 21 Dec 2021 19:35:53 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACEA8C06173F for ; Tue, 21 Dec 2021 16:35:52 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id q16so1321540wrg.7 for ; Tue, 21 Dec 2021 16:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kPtTFGn2tGeKeymRdxbyf1QBvWwFI2h1xHsM32S/P4o=; b=RkN9fqfjbxRdlGyd9RBhWWhyVRavjiBgwFT+MkA+hQnVZDvXp4vo5rc6y2GpjKpxcU Ee06dbKnjhq09zwUuhJ7UdGKcIAI5/ypX1wkQvljzKeSp7ohn6rjkBn6HB87yBD7viG7 qMBjFxVe69N2bJF/jCnn27mZ9o01Vnb2FQ3IB7LKPIGDjtKt5GxG3aN20LjBV3b5YDjE +S1+hX3Hen9aUOWzlbfJeXqW4r3OCoRwafp/7csm84Vrnf2bpSW4WUTW/Pc7oIfOVhS7 Le8WnP/oWzV9u0q09ZKqk37t8t/J7WWd+pFXapb2MDop5mF/SGVdGBbyxCmj4g52rUJ9 9v/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kPtTFGn2tGeKeymRdxbyf1QBvWwFI2h1xHsM32S/P4o=; b=f8EFRIkwHa5M+FerEb+3YHhWIYpp9no9MxT9bhNUtBi52Vp4YL+XjrQBkHe/mEdgGi JefQ5KuHdkxbcqt5N6sJq2wYK73Hxy95tC1C7kGODX9RWiJ+xA73JZ2UCnuhhrp7FOxk ru7eqpqlvEK0S46uVBAw8awYqmyyAT172x1ML2I+8BjzqnhoPvz0tglMRTXo0ijxywXX fKRyAdLyG8xj9aKDkNUIaRuOm09ecYqVDBpqZFTKcoYTaqejPTUQjG/geeuPz0xnvZs0 lgd+jBRa7+x68uHwht3sL2LJ//KzLJvFVuFNP3kxbt57Mvb6tfr7Qvtvp7qJHtGTAwog Y25w== X-Gm-Message-State: AOAM530+KK+EKPa0MXD6bVifssdVs4x7PwperRLAPj3Txt65xc6fA6Mh 2B/35f7TLIi6intFTitXNA7ZGEGf1j/QjA== X-Google-Smtp-Source: ABdhPJylFz9zpNeUIEQl/G9jpSkXOwPlRHgAUTCTlQsqWRKgF//EktSua2lKSmpfaIXrwaKoizZCzQ== X-Received: by 2002:a05:6000:1048:: with SMTP id c8mr408286wrx.508.1640133351061; Tue, 21 Dec 2021 16:35:51 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:50 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 05/19] media: camss: csid-170: fix non-10bit formats Date: Wed, 22 Dec 2021 00:37:37 +0000 Message-Id: <20211222003751.2461466-6-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Use the decode_format/data_type from the "format" struct instead of a hardcoded 10-bit format. Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index ac22ff29d2a9f..aa65043c33037 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -366,7 +366,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) val |= input_format->width & 0x1fff << TPG_DT_n_CFG_0_FRAME_WIDTH; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_0(0)); - val = DATA_TYPE_RAW_10BIT << TPG_DT_n_CFG_1_DATA_TYPE; + val = format->data_type << TPG_DT_n_CFG_1_DATA_TYPE; writel_relaxed(val, csid->base + CSID_TPG_DT_n_CFG_1(0)); val = tg->mode << TPG_DT_n_CFG_2_PAYLOAD_MODE; @@ -382,8 +382,9 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) val = 1 << RDI_CFG0_BYTE_CNTR_EN; val |= 1 << RDI_CFG0_FORMAT_MEASURE_EN; val |= 1 << RDI_CFG0_TIMESTAMP_EN; + /* note: for non-RDI path, this should be format->decode_format */ val |= DECODE_FORMAT_PAYLOAD_ONLY << RDI_CFG0_DECODE_FORMAT; - val |= DATA_TYPE_RAW_10BIT << RDI_CFG0_DATA_TYPE; + val |= format->data_type << RDI_CFG0_DATA_TYPE; val |= vc << RDI_CFG0_VIRTUAL_CHANNEL; val |= dt_id << RDI_CFG0_DT_ID; writel_relaxed(val, csid->base + CSID_RDI_CFG0(0)); From patchwork Wed Dec 22 00:37:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527461 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 4F5E6C433FE for ; Wed, 22 Dec 2021 00:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239660AbhLVAfy (ORCPT ); Tue, 21 Dec 2021 19:35:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239691AbhLVAfy (ORCPT ); Tue, 21 Dec 2021 19:35:54 -0500 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 C75BAC06173F for ; Tue, 21 Dec 2021 16:35:53 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id s1so1367877wrg.1 for ; Tue, 21 Dec 2021 16:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rZQhtajV5OCi1ZATJjQjcnZmgKjOceV3woNx9SlMmGg=; b=lM/Ahfzh1WB5V3IlL7aA7hLyDxOE28FqB87R8MEYm54CJF1cL08x9RFcjBm+RNPcyC CAhyFnJdrog8/HPjLn/2DmBTNTM+LrurWA9EUXcm3oyITkE2s5H3L/zseq5iyXo1nfM0 KtbGQW8dFy9Fs9BHmITc7q+dx3cJ11LWDeIDi/INpbJORsgBVXM3hcqn5YW/8Pb6txJs K6idrvMQ3ZKqQUzIURbUy9ucJEcsI0bGf+MTDdNeRESEVR7QEFI2PUJ66K98s54/e8c2 +UtsqXXuiQbgEXeBSaPvyfuoM7xq+ZEGYkwNLFEcLfZrSqFkZESDZcJJOM7YgXSpsELC N//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rZQhtajV5OCi1ZATJjQjcnZmgKjOceV3woNx9SlMmGg=; b=RuVN6kuL7nQafo35czZpoOwFPlADYII4svUQq0INm8slKrEyn+Xsf4nd0lwJzFsLRz qFKQu2I52PgfsqlAGIGq8b7M3/zwhK5/ZK/0OwErzmfmaSBJNSWvHo+J71v67TaO1PDu hpWgB9dIzZgPSC5DQ1PBvME4su0mUn6yhvF8aURJJOgQbfE2IsbPf6z1FQm4CoQ3uYkq kCtsdkx8roB9JO9F64KXqkdYnnG5hZfhT3S5D6DURUzOiohBkOvRdGtK+eJbfjxTSSLh C3MLwXjomQlqG5YAYbFtBrf+XWB+S9xIplZ/0nw3STiRB8gpRvuWTSy3c423WM+2HyUW MODA== X-Gm-Message-State: AOAM530S2cmlJX6lm8w726p5T0xJKgteXOwYtQZK3/+L1Huv+l2Bb5e0 j2vltuWCMzLMrEiOgAM1RZ9UJp67w8oqPQ== X-Google-Smtp-Source: ABdhPJwMoWwmL1a44pwH0iCAjCpKEeO1Iq5wDCwQ4ZlIL9ALAfbYMrktW4kXwJnnijJ1FYz+vxlrQg== X-Received: by 2002:a5d:4d42:: with SMTP id a2mr388013wru.311.1640133352145; Tue, 21 Dec 2021 16:35:52 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:51 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 06/19] media: camss: csid-170: don't enable unused irqs Date: Wed, 22 Dec 2021 00:37:38 +0000 Message-Id: <20211222003751.2461466-7-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek csid_isr() only checks for the reset irq, so enabling any other irqs doesn't make sense. The "RDI irq" comment is also wrong, the register should be CSID_CSI2_RDIN_IRQ_MASK. Without this fix there may be an excessive amount of irqs. Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index aa65043c33037..a006c8dbceb13 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -444,12 +444,6 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) val |= 1 << CSI2_RX_CFG1_MISR_EN; writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); // csi2_vc_mode_shift_val ? - /* error irqs start at BIT(11) */ - writel_relaxed(~0u, csid->base + CSID_CSI2_RX_IRQ_MASK); - - /* RDI irq */ - writel_relaxed(~0u, csid->base + CSID_TOP_IRQ_MASK); - val = 1 << RDI_CTRL_HALT_CMD; writel_relaxed(val, csid->base + CSID_RDI_CTRL(0)); } From patchwork Wed Dec 22 00:37:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527216 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 7D24FC4332F for ; Wed, 22 Dec 2021 00:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239691AbhLVAf4 (ORCPT ); Tue, 21 Dec 2021 19:35:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239720AbhLVAfz (ORCPT ); Tue, 21 Dec 2021 19:35:55 -0500 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 377BAC061401 for ; Tue, 21 Dec 2021 16:35:55 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id a9so1300781wrr.8 for ; Tue, 21 Dec 2021 16:35:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w7vVV84QeulAKqVS1hzfWHEV7x8szBi3Rm7dK++hOYc=; b=lpBdO+cYdhX2YSQNusTHd2sbOATWTHKSqubuQyLTLpWjBIbwibBmC5Ku639/D44F++ Hd7HE2qb+M4/2ZdNeKAH53vnOXIuOvL8s0ROROkhw5L17HQdcyF3yzVqk20OlJ4bpODO fcl7ygBQvOrfy4ZWIWKZus77Rs+iIB91idY0eTKr2mJdbEvVmXA9zE9god9qEUYQ5LV3 +vWNixQDKOqPJvuF/8WT8/XfFnFLGq2RYqMt/5Ii2ksQ5Pb51bLee4UH8C2zdWoztsDV +FixHo7wAX0nEh7z11+R+cQ5H4fOvilZNBBbzfrOBI/VIIVZK6e6We5mEfaj0y+krTpA kEZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w7vVV84QeulAKqVS1hzfWHEV7x8szBi3Rm7dK++hOYc=; b=sm9hbJ9wFF4MPnuyYv1pyWjwr4yHikAY6rvBXhpHIT7NFO5udUO+K9oH5JfWUR2SSX XHMmYChflNfD/zRXYHWy03N1UHAT0w9BFCgEgsANNlupBodjZ09QrxqEN/iZ7Wt+eO2G EtfnYl0iZnyjgDMMp3lDmrSN6mEjq9Jc/ClzSvKmOXGiM58XR9/Uz38/fnzJva6dDz/D PlbRRzJY3NAExhAByrL7I+a8LK9qAgR4KejgNfxJ1SHt/F0bNjs4zAmfFCCueEy7X2Lt oRrMGSCwRM7vzZooPtIAAnGgue+zDCsAu9LBSE2oWyUBUsOA8Vx/d6JLsDh+oIyoyNBO jhlA== X-Gm-Message-State: AOAM533Hbl5WCNZxvLjseuVu/at4FJjl+lYb2+PJTMu14SqPfZ7078C3 SDYCku4EFi0GYY61VUZkbS6G+tx2i6Sf1w== X-Google-Smtp-Source: ABdhPJzawRic3+hsM8qCM+gLo9qOyZ5EuBg8NSAoyUqJ6fBKLq2VUnrNpOyGVkIKoZ0Nujl/ReTykA== X-Received: by 2002:a5d:448f:: with SMTP id j15mr385967wrq.603.1640133353545; Tue, 21 Dec 2021 16:35:53 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:53 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 07/19] media: camss: csid-170: remove stray comment Date: Wed, 22 Dec 2021 00:37:39 +0000 Message-Id: <20211222003751.2461466-8-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek This is a leftover from my original patches, it doesn't serve any purpose. (it was a reminder to figure out how downstream sets a particular field in the register). Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index a006c8dbceb13..f0c6a72592f99 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -442,7 +442,7 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) val = 1 << CSI2_RX_CFG1_PACKET_ECC_CORRECTION_EN; val |= 1 << CSI2_RX_CFG1_MISR_EN; - writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); // csi2_vc_mode_shift_val ? + writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); val = 1 << RDI_CTRL_HALT_CMD; writel_relaxed(val, csid->base + CSID_RDI_CTRL(0)); From patchwork Wed Dec 22 00:37:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527460 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 F292FC433F5 for ; Wed, 22 Dec 2021 00:35:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239738AbhLVAf5 (ORCPT ); Tue, 21 Dec 2021 19:35:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239736AbhLVAf4 (ORCPT ); Tue, 21 Dec 2021 19:35:56 -0500 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 4AFF5C06173F for ; Tue, 21 Dec 2021 16:35:56 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id t26so1340495wrb.4 for ; Tue, 21 Dec 2021 16:35:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sZhbVTtpbcH4BYK9ooicrZrPZMlg78QMZggSyLqjabQ=; b=nrM2P6t04YBZAqMKcL5YGX7fqxIG2yhyYUzHGjIAQSt/bvlTvn24XkxMER7ZLdlOob N1WawiXE7fkMLZ/g09JG2ShhATbNHczT0j9sAYkA9UbMwAqNpQzIZ0gfp+48AgWa4fm5 Ds6eqyjLNUMxJ6dEvr7c5mdUUldaSLIle9Nx5B88L7bJ0aPa19eO2Tbl2O/mpwE4G5dR YfuE3TV+V78VUQJ7tzjNg1YxfsY5NELldrsgho8em50c73/wGxcoFXN57OaY02J4cZ0H lufwqVyDg4/IkNj+kwGvA4eTQpf0C7T14k/2ThnLBMsjuScwMTZK+tnQAxkgH2apCdUB ftyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sZhbVTtpbcH4BYK9ooicrZrPZMlg78QMZggSyLqjabQ=; b=cDpwD71JsG3c0VgP1hp/jsR/MuYPl3fOovgNMoVA6ADN6z5k5NCjOZ6xCati81ZAtk 52ZNXz//SCdGGig9rOusvj1+VHIDoFkYT3MaSTfG2yqzF1iID1WctI+vj3nmOuIB57ok v+Uh70UY/4iHasaZlba+2XelVT5MHkLXEfThnBi1NsbxnmVj+3uecbAEMiiwZy8JM0gS QRgLPNiZjHF3O2QT65pGJDICaWD8ZAlXFATseNkGYLjdwxnZwmBb2EaSN+YP2I+TK8eY EdnaP5TQvoYsGFVVgcQVL1aCxs1oXLTTbFUA2Vb11I6Aexyu4u6X44nHra5ELN1CEJP6 Song== X-Gm-Message-State: AOAM533HUCtvd14l/YO4wpjNgTqPtGAqdQkbIB24f0fYfUbxMD89PB6B oAV7FVOlWqp6JSqsW0pSK/mj/WqlSNUtUQ== X-Google-Smtp-Source: ABdhPJzaQybV8VjT5xn6xtid/zFGv8DALF6t3rjZixiFB7YkVJLEj06LpmGVpFg0T2lmPCvsLgxMhA== X-Received: by 2002:a5d:4568:: with SMTP id a8mr392925wrc.471.1640133354644; Tue, 21 Dec 2021 16:35:54 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:54 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 08/19] media: camss: csid-170: support more than one lite vfe Date: Wed, 22 Dec 2021 00:37:40 +0000 Message-Id: <20211222003751.2461466-9-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Change the IS_LITE condition so that it returns true for the second lite vfe found on titan 480 hardware (8250), which will have id == 3. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index f0c6a72592f99..2c84d40fe3e04 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -21,7 +21,7 @@ * interface support. As a result of that it has an * alternate register layout. */ -#define IS_LITE (csid->id == 2 ? 1 : 0) +#define IS_LITE (csid->id >= 2 ? 1 : 0) #define CSID_HW_VERSION 0x0 #define HW_VERSION_STEPPING 0 From patchwork Wed Dec 22 00:37:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527215 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 CB903C433FE for ; Wed, 22 Dec 2021 00:35:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239797AbhLVAf6 (ORCPT ); Tue, 21 Dec 2021 19:35:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239736AbhLVAf5 (ORCPT ); Tue, 21 Dec 2021 19:35:57 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7542CC06173F for ; Tue, 21 Dec 2021 16:35:57 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id t18so1278173wrg.11 for ; Tue, 21 Dec 2021 16:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZufHHL56QnwdvQ0f3Flz67cCgVr3fdpU8FUQ+foUQdY=; b=B/2I0NH3IqgZyVF+jgW/K9NBAFGeF92U4vOximxPLEJJQFAw/yUqL8AoQiCDh+gQ25 u/FPL+3Y6Q3kub073s0DSoqD++1/Eii7I7geGk+HKF52+k3SLtjvHWUBSjLyRQee6kb6 JX/3tFCm1GA5/mhUmSXVfImGENDUKFmxWmKvs6tvwU64c8cYvyIkeajLZ9TOiBSxZjeB sG7R2Yexh5y5LqzDa9s8SSHj9i2IFI6SoOcsnwM3PUCUKOwwXZ4gjW87PT1IjCx74iD5 QlDNZYujFUFynMBXA8Uy3sv0EqCo2rRArxC4t5a82MLxGo5i+q4X58Xiz0NueAGhqMfu spMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZufHHL56QnwdvQ0f3Flz67cCgVr3fdpU8FUQ+foUQdY=; b=qjXAjSC0Ul85eg324KRVaNU/X2vwazzuDvdsD3od895tWwpjJ3RfGmcAKMeKTq0Rm1 GCpCg/PPyyfvcr7CbGEIJ7kKtYmtr8my+BuHDAA04EEhlZLIzzG3kCaaU4ksj5vdsHkW BZaPuoLqjgV/U1yEI65jZQsXA51ZXxDa038m67fIc1p9MJ2iLnanWrB+t+V9ip/o3yBc C/STiSBlSwM2+rXzHWIgkmilyT5Nr/hFMJ+nSNiSz8lC56/w5GUFhSxCxnTyOzLwbIzf 3x4P3y/fZI3vHp3RFmmaWEh3QRI+jvXpPWWSmJShSrEF817QMgQ1fr/6c06UzcXLbqt+ jpTA== X-Gm-Message-State: AOAM533tsl/gs1m7tXrsNbL6yKQsPv85q1WaUYhwXBDBCYzvrgYCdv4O gMh5u1ELSEo2UfQChBsSMJIOeGkss2hLKA== X-Google-Smtp-Source: ABdhPJwyVRoapyOKSitDwl0bFZFIq5o2eyeMIa5vtLzLMcJ89bbgrQ60+87kimH+sWfksv//Bz3EFA== X-Received: by 2002:adf:c10e:: with SMTP id r14mr405815wre.558.1640133355743; Tue, 21 Dec 2021 16:35:55 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:55 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 09/19] media: camss: csid-170: set the right HALT_CMD when disabled Date: Wed, 22 Dec 2021 00:37:41 +0000 Message-Id: <20211222003751.2461466-10-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Use the "HALT_CMD_RESUME_AT_FRAME_BOUNDARY" define instead of a "1" which is otherwise confusing, and add a "HALT_CMD_HALT_AT_FRAME_BOUNDARY" which is set when disabling. Fixes: eebe6d00e9bf ("media: camss: Add support for CSID hardware version Titan 170") Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index 2c84d40fe3e04..22a7d7ad63403 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -105,7 +105,8 @@ #define CSID_RDI_CTRL(rdi) ((IS_LITE ? 0x208 : 0x308)\ + 0x100 * (rdi)) #define RDI_CTRL_HALT_CMD 0 -#define ALT_CMD_RESUME_AT_FRAME_BOUNDARY 1 +#define HALT_CMD_HALT_AT_FRAME_BOUNDARY 0 +#define HALT_CMD_RESUME_AT_FRAME_BOUNDARY 1 #define RDI_CTRL_HALT_MODE 2 #define CSID_RDI_FRM_DROP_PATTERN(rdi) ((IS_LITE ? 0x20C : 0x30C)\ @@ -444,7 +445,10 @@ static void csid_configure_stream(struct csid_device *csid, u8 enable) val |= 1 << CSI2_RX_CFG1_MISR_EN; writel_relaxed(val, csid->base + CSID_CSI2_RX_CFG1); - val = 1 << RDI_CTRL_HALT_CMD; + if (enable) + val = HALT_CMD_RESUME_AT_FRAME_BOUNDARY << RDI_CTRL_HALT_CMD; + else + val = HALT_CMD_HALT_AT_FRAME_BOUNDARY << RDI_CTRL_HALT_CMD; writel_relaxed(val, csid->base + CSID_RDI_CTRL(0)); } From patchwork Wed Dec 22 00:37:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527459 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 DBA6FC433F5 for ; Wed, 22 Dec 2021 00:35:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239720AbhLVAf7 (ORCPT ); Tue, 21 Dec 2021 19:35:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239736AbhLVAf6 (ORCPT ); Tue, 21 Dec 2021 19:35:58 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 856D0C06173F for ; Tue, 21 Dec 2021 16:35:58 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id i22so1261261wrb.13 for ; Tue, 21 Dec 2021 16:35:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MdVc6LUMCGsgDZFlY5B3AT71gB/rmLONtDZ+6b8nxH0=; b=TPGFcTvva8KJxWvt4NvVkgedcLi5KCYQ0yfnFfk7m9cW7Kze5He4NLUVTe3QiLKC3w UKshtPA7MqQ2xFo+ly645vKEgj47PzS+FMuZyy2ZtpVmXd20S+C55vrRICW1NB7rOkOj Xp8r5beqKAKmlROP4bOYi8cI9rHqjiD5se6gMXZfWzpkXaXasY7qAdhsM1LmsxPYgFHY mkW871+wss/+WBI83v0CIgv5nJU2pnPi3GqbY8RIj4ly4VhyiOagUYWFm43ztJthweno Jhzp8XySVKk7y/3zA4VdW3qkTYhRWsnmEZdTde3eMqrdgVjRuGlxjXvHDm9TONcgi0PP ZYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MdVc6LUMCGsgDZFlY5B3AT71gB/rmLONtDZ+6b8nxH0=; b=rQUpmENcePFjptzD3uHgcm2Z71fHIbc+RMVPfiuSsfgOaDdRu1BF3z2Fvsfmxe4zDz G8YHCMkD1rU6FbyDlkrmxrYexQ+vQLxb+DQssal9CcjSAaKWHgfWeXEroJVz9k3sLUnb A5jzMe8oIu9cRXEx2eLTcqA3ykAAkFygrelZ3cDUoCBmp06wW+jCebOddN1Hji/Sg09K IHr8zapFfqvFgpmhEDH+b5lYFA4jo5Z/PGQ+5CMG141+epmWW8eSWNycVI1+rIxo3MuI T+7FsxvtPm3LkYBXePj+z16n39iGzWKhD4O1PPTkrGUBD5hiILaOfnDUBvyy8Rbju7vU +zww== X-Gm-Message-State: AOAM533Y8gGhcamjKu2K1enbY7ZRvLeoiVyTS60b0vkfAqqgcQMpO5sD thACuHpl5HGECq5yjGTV7fSVnxR90+00Zw== X-Google-Smtp-Source: ABdhPJxrMriEeuCr5DRL+AVJjIXUGh9Qh3CwzPGYjLlW78cc/VJ06WuNcIu8f0E0dgddenytihWxCw== X-Received: by 2002:a5d:6482:: with SMTP id o2mr424165wri.16.1640133356875; Tue, 21 Dec 2021 16:35:56 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:56 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 10/19] media: camss: csid: allow csid to work without a regulator Date: Wed, 22 Dec 2021 00:37:42 +0000 Message-Id: <20211222003751.2461466-11-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek At least for titan HW, CSID don't have an associated regulator. This change is necessary to be able to model this in the CSID resources. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index a1637b78568b2..1226913c623b0 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -160,7 +160,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) if (ret < 0) return ret; - ret = regulator_enable(csid->vdda); + ret = csid->vdda ? regulator_enable(csid->vdda) : 0; if (ret < 0) { pm_runtime_put_sync(dev); return ret; @@ -168,14 +168,16 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) ret = csid_set_clock_rates(csid); if (ret < 0) { - regulator_disable(csid->vdda); + if (csid->vdda) + regulator_disable(csid->vdda); pm_runtime_put_sync(dev); return ret; } ret = camss_enable_clocks(csid->nclocks, csid->clock, dev); if (ret < 0) { - regulator_disable(csid->vdda); + if (csid->vdda) + regulator_disable(csid->vdda); pm_runtime_put_sync(dev); return ret; } @@ -186,7 +188,8 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) if (ret < 0) { disable_irq(csid->irq); camss_disable_clocks(csid->nclocks, csid->clock); - regulator_disable(csid->vdda); + if (csid->vdda) + regulator_disable(csid->vdda); pm_runtime_put_sync(dev); return ret; } @@ -195,7 +198,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) } else { disable_irq(csid->irq); camss_disable_clocks(csid->nclocks, csid->clock); - ret = regulator_disable(csid->vdda); + ret = csid->vdda ? regulator_disable(csid->vdda) : 0; pm_runtime_put_sync(dev); } @@ -631,7 +634,9 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, /* Regulator */ - csid->vdda = devm_regulator_get(dev, res->regulator[0]); + csid->vdda = NULL; + if (res->regulator[0]) + csid->vdda = devm_regulator_get(dev, res->regulator[0]); if (IS_ERR(csid->vdda)) { dev_err(dev, "could not get regulator\n"); return PTR_ERR(csid->vdda); From patchwork Wed Dec 22 00:37:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527214 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 0B760C4332F for ; Wed, 22 Dec 2021 00:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239736AbhLVAgA (ORCPT ); Tue, 21 Dec 2021 19:36:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239830AbhLVAgA (ORCPT ); Tue, 21 Dec 2021 19:36:00 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7B6C06173F for ; Tue, 21 Dec 2021 16:35:59 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id g7-20020a7bc4c7000000b00345c4bb365aso80024wmk.4 for ; Tue, 21 Dec 2021 16:35:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZcMjdQkiVJ7cNLB1yHDfiaYLmc+S+ohuC3EPTWpGpPI=; b=uGLYwEHUGWL3hJKDRTmqALg8GjuUFchbwJOaaZpqZV1WTCi85OUq9A6iONJqqKv9Bf HVninYUseLQRjSBACXt82+okddgEi71NVJ5mhYKcV7NANy1SVxhcHfeMGFtjtJnr0Rxe GDv7oGYO+qKY3LLr+dWYzu/1sWj9gozfSuOgpg0rsMtlkQyCg0Sp+P/egiPRP7MD6DzY JHh9WeclZOXJ0op/hz1D3LcJtl2zwHz6Db94D5GEpkZ4jdAwgD04an+sXH8DUTdnqEh0 ad2y7kqW8bPHp2m2IaXnAC1E5MB9lH9yYMCOUWZ7cgbDJt+qyj2nsg92Wungq11XNu/W v1Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZcMjdQkiVJ7cNLB1yHDfiaYLmc+S+ohuC3EPTWpGpPI=; b=wTs0VrkVrlBj85TkaPCD+NRI1ZgWmtMnDnPTnep4aOROnwCfx6RcOQAiqf+7QsVKIJ FBX+NS9itlLelB6L+j8kBgGDF3gngK3PspptT7ODZDbKBBqFtAfw1OAXN60TbzuEh1ZR v31jjJLIOTB45EnftrPoNjtIEIiElz+JOHcGnl5yOY4kBuzfNt4QmdyS+Wi+zWOeLY9A orNnZ2TxUHQDHEoEVQya+y+Zn+l/Kf6vf/A94yLjUy31Yae55C7IjcpYJZzpiW00McGx DsZqppwTG8LXmUL7iXf6tZ8NzPOWWho9bL/Mhne0vibJSfEF0b/WLHD6tIUUL+Xe7bCF Fg4w== X-Gm-Message-State: AOAM533HR4hVdeMYGm9whaZQAsV0ZYRzJG4Cn6a9Fns8qMZwUs9D1D6s GUj9/2jcSGtncGDkW///rFDwJHhCB0T1wQ== X-Google-Smtp-Source: ABdhPJwbaGQpNGFvenUhVv+jd8ZLoY1uREh2zVL6M1OQGYss/jpOf/1GnCYYVSSUt8b8jx4j/hb8Ow== X-Received: by 2002:a7b:c101:: with SMTP id w1mr412682wmi.149.1640133357926; Tue, 21 Dec 2021 16:35:57 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:57 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 11/19] media: camss: remove vdda-csiN from sdm845 resources Date: Wed, 22 Dec 2021 00:37:43 +0000 Message-Id: <20211222003751.2461466-12-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek This isn't used and only works because devm_regulator_get() returns a dummy regulator. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index be091c50a3c0c..71c6109b05260 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -542,7 +542,7 @@ static const struct resources csiphy_res_845[] = { static const struct resources csid_res_845[] = { /* CSID0 */ { - .regulator = { "vdda-csi0" }, + .regulator = { NULL }, .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", "soc_ahb", "vfe0", "vfe0_src", "vfe0_cphy_rx", "csi0", @@ -562,7 +562,7 @@ static const struct resources csid_res_845[] = { /* CSID1 */ { - .regulator = { "vdda-csi1" }, + .regulator = { NULL }, .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", "soc_ahb", "vfe1", "vfe1_src", "vfe1_cphy_rx", "csi1", @@ -582,7 +582,7 @@ static const struct resources csid_res_845[] = { /* CSID2 */ { - .regulator = { "vdda-csi2" }, + .regulator = { NULL }, .clock = { "cpas_ahb", "cphy_rx_src", "slow_ahb_src", "soc_ahb", "vfe_lite", "vfe_lite_src", "vfe_lite_cphy_rx", "csi2", From patchwork Wed Dec 22 00:37:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527458 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 8A7EFC433FE for ; Wed, 22 Dec 2021 00:36:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239830AbhLVAgC (ORCPT ); Tue, 21 Dec 2021 19:36:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239866AbhLVAgB (ORCPT ); Tue, 21 Dec 2021 19:36:01 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9617C06173F for ; Tue, 21 Dec 2021 16:36:00 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id a9so1301106wrr.8 for ; Tue, 21 Dec 2021 16:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y2ECIv5rz0LlBtesPY2mGVUaYSCB2Z9s9Xx1bQRqPLs=; b=u4XgYVsk3yXqRlWXb5uTiqzblDxSscAlO4071k5vE9+r7OHnaWVKeNKyNnGlqopiEf 0Cfj51SrI41cRgvtZRTqIB17CIQiRT/9D5pbVaxwiAiMTHYjO8jr9z6XtIIBlT/Q1Y9n GsKE78b29yiWPIHo7WOZT76qlybCCy2X77VDyIiabPIf4vK1reB6Sesh92CeWY25rmKx CaDcK6quJ+xxIntTORiXWooqwiYlMCkm/vySMR0fbw9rHTGHHKO1j0odw5GmVcWrgiOw lmggHLD6v3MvdRWdQ/lAQxYWxC3tbsEPzP27MJoSSRSjpcLrtkXU1swkbdDTekc8afIP PBRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y2ECIv5rz0LlBtesPY2mGVUaYSCB2Z9s9Xx1bQRqPLs=; b=1861vFrws7RDX4hwzA0iUQWe3Z23lQjCCFXIQ6G+gY4nszp9kGz0vxukdUlnZFBqss FBQ/phA7u5/rzLYg3hQYsowo+SuSsHfG9CeTmFsHcGbgqSMon19hYcqSipnShEGX8pYM 7bQi2DOrfHFkFM52eX/QdEERH/TX7ihXxv5TBeFQmlri44hyKI1lh9i4ZWLionwF87GY Fq6tV2fOFS49Q0kL70vIPoX/KB4rzdQHrgHyWleZp6w9Y1qMu8Cm/AiXB0INm3lZ28Ee nkspwPuZOr4lrGJnPqHY+Saq7deYA9ohkePWbbdmKtnRaGDmyDuzDVhJsdFXP76CT2LQ dh/g== X-Gm-Message-State: AOAM530HiIShCJQcX47DrNBW8U1EZ2jfSbwgWiMVwkbyFKXS87/upt/C W46fC9kAjAIjyIzZt91jWXRxwOl6tI7o5Q== X-Google-Smtp-Source: ABdhPJzNS+l2xwjIvbbXru+KF8u4HLy2DHQBPTSwduRJVkTWc2MkjRPwsvzmyhUSOsMgpjkoSU8Bzw== X-Received: by 2002:a05:6000:1449:: with SMTP id v9mr392997wrx.280.1640133359039; Tue, 21 Dec 2021 16:35:59 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:58 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 12/19] media: camss: fix VFE irq name Date: Wed, 22 Dec 2021 00:37:44 +0000 Message-Id: <20211222003751.2461466-13-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek vfe->id isn't set yet, so use "id" instead here. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 71f78b40e7f55..165b404761db5 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1293,7 +1293,6 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, case CAMSS_660: vfe->ops = &vfe_ops_4_8; break; - case CAMSS_845: vfe->ops = &vfe_ops_170; break; @@ -1321,7 +1320,7 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, vfe->irq = r->start; snprintf(vfe->irq_name, sizeof(vfe->irq_name), "%s_%s%d", - dev_name(dev), MSM_VFE_NAME, vfe->id); + dev_name(dev), MSM_VFE_NAME, id); ret = devm_request_irq(dev, vfe->irq, vfe->ops->isr, IRQF_TRIGGER_RISING, vfe->irq_name, vfe); if (ret < 0) { From patchwork Wed Dec 22 00:37:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527213 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 7287AC4332F for ; Wed, 22 Dec 2021 00:36:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239896AbhLVAgC (ORCPT ); Tue, 21 Dec 2021 19:36:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239908AbhLVAgC (ORCPT ); Tue, 21 Dec 2021 19:36:02 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C728EC06173F for ; Tue, 21 Dec 2021 16:36:01 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id n10-20020a7bc5ca000000b00345c520d38eso44625wmk.1 for ; Tue, 21 Dec 2021 16:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5aY/+5y0GXzDTlZpEpWE7obtZJUB89+l2L8U2MuTUUk=; b=BPeDKNPCB6WWlt8zL5J0NV2FukQ5IXZpWGqrRef6mF5EdaCV+13qg1lDSc6z7iKn4N Xh1KWvmuaoywmqX+iePZaH0dvSp3yrs+PvqecQTKRcwwc8AuOSV00CvKOnSpsUi0kjWa 2zKoAl9VDkx4LcJ+UUfG2z7bQhleJgS1HRsA3yUMbPtiv07of7wvTi77Hs0NSUCz3T7q zexOt84VzynROd1yZJs+u31IzMqoooNg2pPgQTciD/EZ1450lkpX/kTxGseO2u5RzLJa spOc4x8k8peZBanPILRAzduKwBxItPjgYiRZjXBvL2/eJ389QXf+Xq3jFla/PyfCUMTZ pKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5aY/+5y0GXzDTlZpEpWE7obtZJUB89+l2L8U2MuTUUk=; b=19m4UdtbnB+FGyUwsv6QxhV1z7vAk7NrToWtIXHK96rH4yCDdeFfwh+i085JFAhiPm uSC1/y2F/pj14H4/aJ0CPqYOeuuq1wpk9Ia6DaWDuTRSIZvIX4pzbF1/uNHHLu2ZYnG+ k2nidE5fWwm1wxg7CfGbhh7jNyf6FY/hXfPTtwybNxEdmyZEz1qtagozJg+ohmxBOBbM CSVz1Ifn9C9RAL84Esnsgev6ywIjxE1hLekDdR38ibC+aTb3KeGr8sgADGINM4bVk307 S/UfX8jVejZGf3kVSmB1T/XjXKk7J0k1lX04uskzhVssgGkEYnPuE3og5o85C/pUaiWg FPNA== X-Gm-Message-State: AOAM532O5uWeEUwU0DW/W+1fqd9sszIW2rzMzviX0Wl2KKZL5syjNqeS tsq2CRlMAhvgqHP3vxBMiLIL3SAw1YZIfw== X-Google-Smtp-Source: ABdhPJyP69RpXtfZKXT3i1uOsP07mPntAbukYp2+qWwxXn3c8Q0+4IXIwFCmyHEH6pDhEUvj2jbnXA== X-Received: by 2002:a05:600c:24e:: with SMTP id 14mr426637wmj.67.1640133360158; Tue, 21 Dec 2021 16:36:00 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:35:59 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 13/19] media: camss: vfe-170: fix "VFE halt timeout" error Date: Wed, 22 Dec 2021 00:37:45 +0000 Message-Id: <20211222003751.2461466-14-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek This function waits for halt_complete but doesn't do anything to cause it to complete, and always hits the "VFE halt timeout" error. Just delete this code for now. Fixes: 7319cdf189bb ("media: camss: Add support for VFE hardware version Titan 170") Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-vfe-170.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-170.c b/drivers/media/platform/qcom/camss/camss-vfe-170.c index 5c083d70d4950..af71dc659bb98 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-170.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-170.c @@ -402,17 +402,7 @@ static irqreturn_t vfe_isr(int irq, void *dev) */ static int vfe_halt(struct vfe_device *vfe) { - unsigned long time; - - reinit_completion(&vfe->halt_complete); - - time = wait_for_completion_timeout(&vfe->halt_complete, - msecs_to_jiffies(VFE_HALT_TIMEOUT_MS)); - if (!time) { - dev_err(vfe->camss->dev, "VFE halt timeout\n"); - return -EIO; - } - + /* rely on vfe_disable_output() to stop the VFE */ return 0; } From patchwork Wed Dec 22 00:37:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527457 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 AE525C433EF for ; Wed, 22 Dec 2021 00:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239908AbhLVAgE (ORCPT ); Tue, 21 Dec 2021 19:36:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239931AbhLVAgD (ORCPT ); Tue, 21 Dec 2021 19:36:03 -0500 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 19EA9C06173F for ; Tue, 21 Dec 2021 16:36:03 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id r17so1357653wrc.3 for ; Tue, 21 Dec 2021 16:36:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gKTlVkvuCMOG7uQd4UYc8T3jiUZrLgkNQ30vrhYvEh8=; b=LXf0VRdF0SxjuiK7xRcRO+FkTGpnBXkFPlwXevbcTJvMclJAzOmkjiIiho7JjOX4zc 4X1cmR8ZmlJUxXPC4KUOCkeejqLkFlUj3AbMr2DMqEZe5MYrkq7TBT2PTfk3mQ33EUeA 83MQ+S5q0UzV47M7zMPzBELpjIcmUP/d665JjPn/nQTl4xXV/JU87RzJDXvBD7ssJWzj dCLwPSd/Fwa/ew3jmOnuaVLo4gm5o2z9r5P9GJV15vhX9Y10TJEJP/5ybBYSPUJUAmrz sTQe24pfIb5IzNwILMJnVOHT4IadRxDuwgZzGKEUH6YQIQZD7M6llEVqBnWh3v7a+RDN F9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gKTlVkvuCMOG7uQd4UYc8T3jiUZrLgkNQ30vrhYvEh8=; b=dRPutUo7F6s3HL7dfi0f7imMZf8GlFnFetAjfQ7SNdUKrsfeQmBPILoYMHCf9HCFSd BBqOa23RNsuWYq+cZmn1pNuBl/IquHjoO0PDJeNkifmZ2MXp0koaTZuUUKAOh7xqXETw xq2LR/ZTg+hNmpaN5ImyCaEfH1/yXE1ENUXPCiTtFxbJa7OrGyaFkgMe1vQqFaLH18SD jPnvveIkmsscX1PseuB9K5LBPPqFBZlq1dfO6ZmLldqHIuUQLmD62nw/cPlcLHMl0Mwj s2OF+nPB90CZuROxSf51825MwKOkXPd/NWZhgxu4JEOLbwnnXnaKCTlW/g4zzJH+eQ4o l7Nw== X-Gm-Message-State: AOAM533CWQpyUXewtJRB8EZALLqz9jnv0ech7aZjR28goCyyn2MS/VmE qFfl0W1ShaowcA3o99cE8WJBbOngZlkPmQ== X-Google-Smtp-Source: ABdhPJyc5aUL0emgQ9j1AfPtBFo1wSgd5wdfiLY2keslnIb3yaL3JZAqGoT2L+qp06S9+22Ry/5/Aw== X-Received: by 2002:adf:ea0d:: with SMTP id q13mr361589wrm.597.1640133361248; Tue, 21 Dec 2021 16:36:01 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:00 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 14/19] media: camss: Add initial support for VFE hardware version Titan 480 Date: Wed, 22 Dec 2021 00:37:46 +0000 Message-Id: <20211222003751.2461466-15-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Add support for VFE found on SM8250 (Titan 480). This implementation is based on the titan 170 implementation. It supports the normal and lite VFE, and only supports the RDI0 capture path. [bod: Updates hw_version callback] [bod: Use static inline for macros reusing parameters checkpatch --strict] Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Tested-by: Julian Grahsl Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/Makefile | 1 + .../media/platform/qcom/camss/camss-vfe-480.c | 564 ++++++++++++++++++ drivers/media/platform/qcom/camss/camss-vfe.h | 1 + 3 files changed, 566 insertions(+) create mode 100644 drivers/media/platform/qcom/camss/camss-vfe-480.c diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/platform/qcom/camss/Makefile index 0752c46ea37b5..81dd56aff0f27 100644 --- a/drivers/media/platform/qcom/camss/Makefile +++ b/drivers/media/platform/qcom/camss/Makefile @@ -15,6 +15,7 @@ qcom-camss-objs += \ camss-vfe-4-7.o \ camss-vfe-4-8.o \ camss-vfe-170.o \ + camss-vfe-480.o \ camss-vfe-gen1.o \ camss-vfe.o \ camss-video.o \ diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c new file mode 100644 index 0000000000000..1295851103931 --- /dev/null +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c @@ -0,0 +1,564 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * camss-vfe-480.c + * + * Qualcomm MSM Camera Subsystem - VFE (Video Front End) Module v480 (SM8250) + * + * Copyright (C) 2020-2021 Linaro Ltd. + * Copyright (C) 2021 Jonathan Marek + */ + +#include +#include +#include +#include + +#include "camss.h" +#include "camss-vfe.h" + +/* VFE 2/3 are lite and have a different register layout */ +#define IS_LITE (vfe->id >= 2 ? 1 : 0) + +#define VFE_HW_VERSION (0x00) + +#define VFE_GLOBAL_RESET_CMD (IS_LITE ? 0x0c : 0x1c) +#define GLOBAL_RESET_HW_AND_REG (IS_LITE ? BIT(1) : BIT(0)) + +#define VFE_REG_UPDATE_CMD (IS_LITE ? 0x20 : 0x34) +static inline int reg_update_rdi(struct vfe_device *vfe, int n) +{ + return IS_LITE ? BIT(n) : BIT(1 + (n)); +} + +#define REG_UPDATE_RDI reg_update_rdi +#define VFE_IRQ_CMD (IS_LITE ? 0x24 : 0x38) +#define IRQ_CMD_GLOBAL_CLEAR BIT(0) + +#define VFE_IRQ_MASK(n) ((IS_LITE ? 0x28 : 0x3c) + (n) * 4) +#define IRQ_MASK_0_RESET_ACK (IS_LITE ? BIT(17) : BIT(0)) +#define IRQ_MASK_0_BUS_TOP_IRQ (IS_LITE ? BIT(4) : BIT(7)) +#define VFE_IRQ_CLEAR(n) ((IS_LITE ? 0x34 : 0x48) + (n) * 4) +#define VFE_IRQ_STATUS(n) ((IS_LITE ? 0x40 : 0x54) + (n) * 4) + +#define BUS_REG_BASE (IS_LITE ? 0x1a00 : 0xaa00) + +#define VFE_BUS_WM_CGC_OVERRIDE (BUS_REG_BASE + 0x08) +#define WM_CGC_OVERRIDE_ALL (0x3FFFFFF) + +#define VFE_BUS_WM_TEST_BUS_CTRL (BUS_REG_BASE + 0xdc) + +#define VFE_BUS_IRQ_MASK(n) (BUS_REG_BASE + 0x18 + (n) * 4) +static inline int bus_irq_mask_0_rdi_rup(struct vfe_device *vfe, int n) +{ + return IS_LITE ? BIT(n) : BIT(3 + (n)); +} + +#define BUS_IRQ_MASK_0_RDI_RUP bus_irq_mask_0_rdi_rup +static inline int bus_irq_mask_0_comp_done(struct vfe_device *vfe, int n) +{ + return IS_LITE ? BIT(4 + (n)) : BIT(6 + (n)); +} + +#define BUS_IRQ_MASK_0_COMP_DONE bus_irq_mask_0_comp_done +#define VFE_BUS_IRQ_CLEAR(n) (BUS_REG_BASE + 0x20 + (n) * 4) +#define VFE_BUS_IRQ_STATUS(n) (BUS_REG_BASE + 0x28 + (n) * 4) +#define VFE_BUS_IRQ_CLEAR_GLOBAL (BUS_REG_BASE + 0x30) + +#define VFE_BUS_WM_CFG(n) (BUS_REG_BASE + 0x200 + (n) * 0x100) +#define WM_CFG_EN (0) +#define WM_CFG_MODE (16) +#define MODE_QCOM_PLAIN (0) +#define MODE_MIPI_RAW (1) +#define VFE_BUS_WM_IMAGE_ADDR(n) (BUS_REG_BASE + 0x204 + (n) * 0x100) +#define VFE_BUS_WM_FRAME_INCR(n) (BUS_REG_BASE + 0x208 + (n) * 0x100) +#define VFE_BUS_WM_IMAGE_CFG_0(n) (BUS_REG_BASE + 0x20c + (n) * 0x100) +#define WM_IMAGE_CFG_0_DEFAULT_WIDTH (0xFFFF) +#define VFE_BUS_WM_IMAGE_CFG_1(n) (BUS_REG_BASE + 0x210 + (n) * 0x100) +#define VFE_BUS_WM_IMAGE_CFG_2(n) (BUS_REG_BASE + 0x214 + (n) * 0x100) +#define VFE_BUS_WM_PACKER_CFG(n) (BUS_REG_BASE + 0x218 + (n) * 0x100) +#define VFE_BUS_WM_HEADER_ADDR(n) (BUS_REG_BASE + 0x220 + (n) * 0x100) +#define VFE_BUS_WM_HEADER_INCR(n) (BUS_REG_BASE + 0x224 + (n) * 0x100) +#define VFE_BUS_WM_HEADER_CFG(n) (BUS_REG_BASE + 0x228 + (n) * 0x100) + +#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n) (BUS_REG_BASE + 0x230 + (n) * 0x100) +#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n) (BUS_REG_BASE + 0x234 + (n) * 0x100) +#define VFE_BUS_WM_FRAMEDROP_PERIOD(n) (BUS_REG_BASE + 0x238 + (n) * 0x100) +#define VFE_BUS_WM_FRAMEDROP_PATTERN(n) (BUS_REG_BASE + 0x23c + (n) * 0x100) + +#define VFE_BUS_WM_SYSTEM_CACHE_CFG(n) (BUS_REG_BASE + 0x260 + (n) * 0x100) +#define VFE_BUS_WM_BURST_LIMIT(n) (BUS_REG_BASE + 0x264 + (n) * 0x100) + +/* for titan 480, each bus client is hardcoded to a specific path + * and each bus client is part of a hardcoded "comp group" + */ +#define RDI_WM(n) ((IS_LITE ? 0 : 23) + (n)) +#define RDI_COMP_GROUP(n) ((IS_LITE ? 0 : 11) + (n)) + +static u32 vfe_hw_version(struct vfe_device *vfe) +{ + u32 hw_version = readl_relaxed(vfe->base + VFE_HW_VERSION); + + u32 gen = (hw_version >> 28) & 0xF; + u32 rev = (hw_version >> 16) & 0xFFF; + u32 step = hw_version & 0xFFFF; + + dev_dbg(vfe->camss->dev, "VFE HW Version = %u.%u.%u\n", gen, rev, step); + + return hw_version; +} + +static void vfe_global_reset(struct vfe_device *vfe) +{ + writel_relaxed(IRQ_MASK_0_RESET_ACK, vfe->base + VFE_IRQ_MASK(0)); + writel_relaxed(GLOBAL_RESET_HW_AND_REG, vfe->base + VFE_GLOBAL_RESET_CMD); +} + +static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) +{ + struct v4l2_pix_format_mplane *pix = + &line->video_out.active_fmt.fmt.pix_mp; + + wm = RDI_WM(wm); /* map to actual WM used (from wm=RDI index) */ + + /* no clock gating at bus input */ + writel_relaxed(WM_CGC_OVERRIDE_ALL, vfe->base + VFE_BUS_WM_CGC_OVERRIDE); + + writel_relaxed(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL); + + writel_relaxed(pix->plane_fmt[0].bytesperline * pix->height, + vfe->base + VFE_BUS_WM_FRAME_INCR(wm)); + writel_relaxed(0xf, vfe->base + VFE_BUS_WM_BURST_LIMIT(wm)); + writel_relaxed(WM_IMAGE_CFG_0_DEFAULT_WIDTH, + vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm)); + writel_relaxed(pix->plane_fmt[0].bytesperline, + vfe->base + VFE_BUS_WM_IMAGE_CFG_2(wm)); + writel_relaxed(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm)); + + /* no dropped frames, one irq per frame */ + writel_relaxed(0, vfe->base + VFE_BUS_WM_FRAMEDROP_PERIOD(wm)); + writel_relaxed(1, vfe->base + VFE_BUS_WM_FRAMEDROP_PATTERN(wm)); + writel_relaxed(0, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(wm)); + writel_relaxed(1, vfe->base + VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(wm)); + + writel_relaxed(1 << WM_CFG_EN | MODE_MIPI_RAW << WM_CFG_MODE, + vfe->base + VFE_BUS_WM_CFG(wm)); +} + +static void vfe_wm_stop(struct vfe_device *vfe, u8 wm) +{ + wm = RDI_WM(wm); /* map to actual WM used (from wm=RDI index) */ + writel_relaxed(0, vfe->base + VFE_BUS_WM_CFG(wm)); +} + +static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr, + struct vfe_line *line) +{ + wm = RDI_WM(wm); /* map to actual WM used (from wm=RDI index) */ + writel_relaxed(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); +} + +static void vfe_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) +{ + vfe->reg_update |= REG_UPDATE_RDI(vfe, line_id); + writel_relaxed(vfe->reg_update, vfe->base + VFE_REG_UPDATE_CMD); +} + +static inline void vfe_reg_update_clear(struct vfe_device *vfe, + enum vfe_line_id line_id) +{ + vfe->reg_update &= ~REG_UPDATE_RDI(vfe, line_id); +} + +static void vfe_enable_irq_common(struct vfe_device *vfe) +{ + /* enable only the IRQs used: rup and comp_done irqs for RDI0 */ + writel_relaxed(IRQ_MASK_0_RESET_ACK | IRQ_MASK_0_BUS_TOP_IRQ, + vfe->base + VFE_IRQ_MASK(0)); + writel_relaxed(BUS_IRQ_MASK_0_RDI_RUP(vfe, 0) | + BUS_IRQ_MASK_0_COMP_DONE(vfe, RDI_COMP_GROUP(0)), + vfe->base + VFE_BUS_IRQ_MASK(0)); +} + +static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id); +static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm); + +/* + * vfe_isr - VFE module interrupt handler + * @irq: Interrupt line + * @dev: VFE device + * + * Return IRQ_HANDLED on success + */ +static irqreturn_t vfe_isr(int irq, void *dev) +{ + struct vfe_device *vfe = dev; + u32 status; + + status = readl_relaxed(vfe->base + VFE_IRQ_STATUS(0)); + writel_relaxed(status, vfe->base + VFE_IRQ_CLEAR(0)); + writel_relaxed(IRQ_CMD_GLOBAL_CLEAR, vfe->base + VFE_IRQ_CMD); + + if (status & IRQ_MASK_0_RESET_ACK) + vfe_isr_reset_ack(vfe); + + if (status & IRQ_MASK_0_BUS_TOP_IRQ) { + u32 status = readl_relaxed(vfe->base + VFE_BUS_IRQ_STATUS(0)); + + writel_relaxed(status, vfe->base + VFE_BUS_IRQ_CLEAR(0)); + writel_relaxed(1, vfe->base + VFE_BUS_IRQ_CLEAR_GLOBAL); + + if (status & BUS_IRQ_MASK_0_RDI_RUP(vfe, 0)) + vfe_isr_reg_update(vfe, 0); + + if (status & BUS_IRQ_MASK_0_COMP_DONE(vfe, RDI_COMP_GROUP(0))) + vfe_isr_wm_done(vfe, 0); + } + + return IRQ_HANDLED; +} + +/* + * vfe_halt - Trigger halt on VFE module and wait to complete + * @vfe: VFE device + * + * Return 0 on success or a negative error code otherwise + */ +static int vfe_halt(struct vfe_device *vfe) +{ + /* rely on vfe_disable_output() to stop the VFE */ + return 0; +} + +static int vfe_get_output(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + struct vfe_output *output; + unsigned long flags; + int wm_idx; + + spin_lock_irqsave(&vfe->output_lock, flags); + + output = &line->output; + if (output->state != VFE_OUTPUT_OFF) { + dev_err(vfe->camss->dev, "Output is running\n"); + goto error; + } + + output->wm_num = 1; + + wm_idx = vfe_reserve_wm(vfe, line->id); + if (wm_idx < 0) { + dev_err(vfe->camss->dev, "Can not reserve wm\n"); + goto error_get_wm; + } + output->wm_idx[0] = wm_idx; + + output->drop_update_idx = 0; + + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return 0; + +error_get_wm: + vfe_release_wm(vfe, output->wm_idx[0]); + output->state = VFE_OUTPUT_OFF; +error: + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return -EINVAL; +} + +static int vfe_enable_output(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + struct vfe_output *output = &line->output; + unsigned long flags; + unsigned int i; + + spin_lock_irqsave(&vfe->output_lock, flags); + + vfe_reg_update_clear(vfe, line->id); + + if (output->state != VFE_OUTPUT_OFF) { + dev_err(vfe->camss->dev, "Output is not in reserved state %d\n", + output->state); + spin_unlock_irqrestore(&vfe->output_lock, flags); + return -EINVAL; + } + + WARN_ON(output->gen2.active_num); + + output->state = VFE_OUTPUT_ON; + + output->sequence = 0; + output->wait_reg_update = 0; + reinit_completion(&output->reg_update); + + vfe_wm_start(vfe, output->wm_idx[0], line); + + for (i = 0; i < 2; i++) { + output->buf[i] = vfe_buf_get_pending(output); + if (!output->buf[i]) + break; + output->gen2.active_num++; + vfe_wm_update(vfe, output->wm_idx[0], output->buf[i]->addr[0], line); + } + + vfe_reg_update(vfe, line->id); + + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return 0; +} + +static int vfe_disable_output(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + struct vfe_output *output = &line->output; + unsigned long flags; + unsigned int i; + bool done; + int timeout = 0; + + do { + spin_lock_irqsave(&vfe->output_lock, flags); + done = !output->gen2.active_num; + spin_unlock_irqrestore(&vfe->output_lock, flags); + usleep_range(10000, 20000); + + if (timeout++ == 100) { + dev_err(vfe->camss->dev, "VFE idle timeout - resetting\n"); + vfe_reset(vfe); + output->gen2.active_num = 0; + return 0; + } + } while (!done); + + spin_lock_irqsave(&vfe->output_lock, flags); + for (i = 0; i < output->wm_num; i++) + vfe_wm_stop(vfe, output->wm_idx[i]); + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return 0; +} + +/* + * vfe_enable - Enable streaming on VFE line + * @line: VFE line + * + * Return 0 on success or a negative error code otherwise + */ +static int vfe_enable(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + int ret; + + mutex_lock(&vfe->stream_lock); + + if (!vfe->stream_count) + vfe_enable_irq_common(vfe); + + vfe->stream_count++; + + mutex_unlock(&vfe->stream_lock); + + ret = vfe_get_output(line); + if (ret < 0) + goto error_get_output; + + ret = vfe_enable_output(line); + if (ret < 0) + goto error_enable_output; + + vfe->was_streaming = 1; + + return 0; + +error_enable_output: + vfe_put_output(line); + +error_get_output: + mutex_lock(&vfe->stream_lock); + + vfe->stream_count--; + + mutex_unlock(&vfe->stream_lock); + + return ret; +} + +/* + * vfe_disable - Disable streaming on VFE line + * @line: VFE line + * + * Return 0 on success or a negative error code otherwise + */ +static int vfe_disable(struct vfe_line *line) +{ + struct vfe_device *vfe = to_vfe(line); + + vfe_disable_output(line); + + vfe_put_output(line); + + mutex_lock(&vfe->stream_lock); + + vfe->stream_count--; + + mutex_unlock(&vfe->stream_lock); + + return 0; +} + +/* + * vfe_isr_reg_update - Process reg update interrupt + * @vfe: VFE Device + * @line_id: VFE line + */ +static void vfe_isr_reg_update(struct vfe_device *vfe, enum vfe_line_id line_id) +{ + struct vfe_output *output; + unsigned long flags; + + spin_lock_irqsave(&vfe->output_lock, flags); + vfe_reg_update_clear(vfe, line_id); + + output = &vfe->line[line_id].output; + + if (output->wait_reg_update) { + output->wait_reg_update = 0; + complete(&output->reg_update); + } + + spin_unlock_irqrestore(&vfe->output_lock, flags); +} + +/* + * vfe_isr_wm_done - Process write master done interrupt + * @vfe: VFE Device + * @wm: Write master id + */ +static void vfe_isr_wm_done(struct vfe_device *vfe, u8 wm) +{ + struct vfe_line *line = &vfe->line[vfe->wm_output_map[wm]]; + struct camss_buffer *ready_buf; + struct vfe_output *output; + unsigned long flags; + u32 index; + u64 ts = ktime_get_ns(); + + spin_lock_irqsave(&vfe->output_lock, flags); + + if (vfe->wm_output_map[wm] == VFE_LINE_NONE) { + dev_err_ratelimited(vfe->camss->dev, + "Received wm done for unmapped index\n"); + goto out_unlock; + } + output = &vfe->line[vfe->wm_output_map[wm]].output; + + ready_buf = output->buf[0]; + if (!ready_buf) { + dev_err_ratelimited(vfe->camss->dev, + "Missing ready buf %d!\n", output->state); + goto out_unlock; + } + + ready_buf->vb.vb2_buf.timestamp = ts; + ready_buf->vb.sequence = output->sequence++; + + index = 0; + output->buf[0] = output->buf[1]; + if (output->buf[0]) + index = 1; + + output->buf[index] = vfe_buf_get_pending(output); + + if (output->buf[index]) + vfe_wm_update(vfe, output->wm_idx[0], output->buf[index]->addr[0], line); + else + output->gen2.active_num--; + + spin_unlock_irqrestore(&vfe->output_lock, flags); + + vb2_buffer_done(&ready_buf->vb.vb2_buf, VB2_BUF_STATE_DONE); + + return; + +out_unlock: + spin_unlock_irqrestore(&vfe->output_lock, flags); +} + +/* + * vfe_pm_domain_off - Disable power domains specific to this VFE. + * @vfe: VFE Device + */ +static void vfe_pm_domain_off(struct vfe_device *vfe) +{ + /* nop */ +} + +/* + * vfe_pm_domain_on - Enable power domains specific to this VFE. + * @vfe: VFE Device + */ +static int vfe_pm_domain_on(struct vfe_device *vfe) +{ + return 0; +} + +/* + * vfe_queue_buffer - Add empty buffer + * @vid: Video device structure + * @buf: Buffer to be enqueued + * + * Add an empty buffer - depending on the current number of buffers it will be + * put in pending buffer queue or directly given to the hardware to be filled. + * + * Return 0 on success or a negative error code otherwise + */ +static int vfe_queue_buffer(struct camss_video *vid, + struct camss_buffer *buf) +{ + struct vfe_line *line = container_of(vid, struct vfe_line, video_out); + struct vfe_device *vfe = to_vfe(line); + struct vfe_output *output; + unsigned long flags; + + output = &line->output; + + spin_lock_irqsave(&vfe->output_lock, flags); + + if (output->state == VFE_OUTPUT_ON && output->gen2.active_num < 2) { + output->buf[output->gen2.active_num++] = buf; + vfe_wm_update(vfe, output->wm_idx[0], buf->addr[0], line); + } else { + vfe_buf_add_pending(output, buf); + } + + spin_unlock_irqrestore(&vfe->output_lock, flags); + + return 0; +} + +static const struct camss_video_ops vfe_video_ops_480 = { + .queue_buffer = vfe_queue_buffer, + .flush_buffers = vfe_flush_buffers, +}; + +static void vfe_subdev_init(struct device *dev, struct vfe_device *vfe) +{ + vfe->video_ops = vfe_video_ops_480; + vfe->line_num = 1; +} + +const struct vfe_hw_ops vfe_ops_480 = { + .global_reset = vfe_global_reset, + .hw_version = vfe_hw_version, + .isr = vfe_isr, + .pm_domain_off = vfe_pm_domain_off, + .pm_domain_on = vfe_pm_domain_on, + .subdev_init = vfe_subdev_init, + .vfe_disable = vfe_disable, + .vfe_enable = vfe_enable, + .vfe_halt = vfe_halt, +}; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index f166d176cb771..6500474a749e7 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -201,5 +201,6 @@ extern const struct vfe_hw_ops vfe_ops_4_1; extern const struct vfe_hw_ops vfe_ops_4_7; extern const struct vfe_hw_ops vfe_ops_4_8; extern const struct vfe_hw_ops vfe_ops_170; +extern const struct vfe_hw_ops vfe_ops_480; #endif /* QC_MSM_CAMSS_VFE_H */ From patchwork Wed Dec 22 00:37:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527212 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 5AE27C43217 for ; Wed, 22 Dec 2021 00:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239942AbhLVAgE (ORCPT ); Tue, 21 Dec 2021 19:36:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239931AbhLVAgE (ORCPT ); Tue, 21 Dec 2021 19:36:04 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12705C06173F for ; Tue, 21 Dec 2021 16:36:04 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id s1so1319338wra.6 for ; Tue, 21 Dec 2021 16:36:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SqOUpaHa86SeXlyDw5Co87nQX7FB6PSroFT8OrpLLrU=; b=CHtds+HHLqWSi2qD5KD/G86f+1vTHana3HWpfL2aVaJ+2iXYVuuFgFlzoQVdT1A2Ro JQM2ZmMrTQ798JC+C89s/HsUMh8F2gzjQTsvOWGhX6z55aLz+dz9VMJsQnEuPyt1fRK8 O27mosghiEd2ekCikwGlPaCLn32l6E1BE1YEdAOyJ9sJxBTQI7NjN0uHbFC0otoozzmo VBC2fljxTNt6H6dvmFS/NRelM4hkq7X4++G7w1KLQmiGpNqLC9Rku3Jbi1Xq8IoQHFGP uve8AgUap1Y9EumKynvNhCqUNrte4c6YM+iwQbckjRe0tu4ChTtaG2kzFWVtJD+WR4S8 RKPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SqOUpaHa86SeXlyDw5Co87nQX7FB6PSroFT8OrpLLrU=; b=Q+18QaGnI4wCCvsgSCm69LhQnFsCcc6HEYBJX2zizM08R1u1rKF6pPOjlgsqHJbvAp mW0M/hML6ynnF/cCILFqVTFQ3Tymp0MigjOHMdfgJkSCSr9XKWtZksTGBBm84HzPDZ0M dlxHXkRNhnAtI0mq//Ze4Q4xsh6vORQioZsl7UaxFI+LVLXQYgV2Xys14xtb3JPdp3d/ +ukeEBGKO+BbFPMQTbDpjcqXdUIrEkaDRqd6eIeh9n32Cc02DUPhNPNofcavjKOXUxZP fC1c1PmJZVtortl5vG5POTvv+FKLqQMVXgVl1uUTrpm150eiKUzKzUNLBVRpkGcj5mT8 8jMQ== X-Gm-Message-State: AOAM533SlJUw9v7c1fTN5ALrBF1557g3Oog4Z9/R73DBHkKrjHWDB7zE VPzHJlljiv2O7/efqF/b4O9G9TOCeXvtow== X-Google-Smtp-Source: ABdhPJxR9l9eOY1aGak9o+tFzjIAA+jY56wMnc/I8h9xSX9UYYBs+TPhYnxgRoIK7wxLNky1XnvwPw== X-Received: by 2002:a5d:6d41:: with SMTP id k1mr404836wri.134.1640133362371; Tue, 21 Dec 2021 16:36:02 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:01 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 15/19] media: camss: add support for V4L2_PIX_FMT_GREY for sdm845 HW Date: Wed, 22 Dec 2021 00:37:47 +0000 Message-Id: <20211222003751.2461466-16-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek Add this common format to the various format lists relevant to sdm845. Signed-off-by: Jonathan Marek Reviewed-by: Robert Foss Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/camss-csid-170.c | 7 +++++++ drivers/media/platform/qcom/camss/camss-csiphy.c | 1 + drivers/media/platform/qcom/camss/camss-vfe.c | 1 + drivers/media/platform/qcom/camss/camss-video.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-170.c index 22a7d7ad63403..9e54d251793fc 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-170.c @@ -262,6 +262,13 @@ static const struct csid_format csid_formats[] = { 10, 1, }, + { + MEDIA_BUS_FMT_Y8_1X8, + DATA_TYPE_RAW_8BIT, + DECODE_FORMAT_UNCOMPRESSED_8_BIT, + 8, + 1, + }, { MEDIA_BUS_FMT_Y10_1X10, DATA_TYPE_RAW_10BIT, diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index 24eec16197e76..de1e81bb97c92 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -94,6 +94,7 @@ static const struct csiphy_format csiphy_formats_sdm845[] = { { MEDIA_BUS_FMT_SGBRG14_1X14, 14 }, { MEDIA_BUS_FMT_SGRBG14_1X14, 14 }, { MEDIA_BUS_FMT_SRGGB14_1X14, 14 }, + { MEDIA_BUS_FMT_Y8_1X8, 8 }, { MEDIA_BUS_FMT_Y10_1X10, 10 }, }; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 165b404761db5..3d2f554a4ef71 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -118,6 +118,7 @@ static const struct vfe_format formats_rdi_845[] = { { MEDIA_BUS_FMT_SGBRG14_1X14, 14 }, { MEDIA_BUS_FMT_SGRBG14_1X14, 14 }, { MEDIA_BUS_FMT_SRGGB14_1X14, 14 }, + { MEDIA_BUS_FMT_Y8_1X8, 8 }, { MEDIA_BUS_FMT_Y10_1X10, 10 }, { MEDIA_BUS_FMT_Y10_2X8_PADHI_LE, 16 }, }; diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index f282275af626f..54e77d30d452c 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -176,6 +176,8 @@ static const struct camss_format_info formats_rdi_845[] = { { { 1, 1 } }, { { 1, 1 } }, { 14 } }, { MEDIA_BUS_FMT_SRGGB14_1X14, V4L2_PIX_FMT_SRGGB14P, 1, { { 1, 1 } }, { { 1, 1 } }, { 14 } }, + { MEDIA_BUS_FMT_Y8_1X8, V4L2_PIX_FMT_GREY, 1, + { { 1, 1 } }, { { 1, 1 } }, { 8 } }, { MEDIA_BUS_FMT_Y10_1X10, V4L2_PIX_FMT_Y10P, 1, { { 1, 1 } }, { { 1, 1 } }, { 10 } }, { MEDIA_BUS_FMT_Y10_2X8_PADHI_LE, V4L2_PIX_FMT_Y10, 1, From patchwork Wed Dec 22 00:37:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527456 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 E80F6C4321E for ; Wed, 22 Dec 2021 00:36:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239931AbhLVAgG (ORCPT ); Tue, 21 Dec 2021 19:36:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239969AbhLVAgF (ORCPT ); Tue, 21 Dec 2021 19:36:05 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86972C06173F for ; Tue, 21 Dec 2021 16:36:05 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id r17so1357750wrc.3 for ; Tue, 21 Dec 2021 16:36:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7fyU18k+mvpWurEKXRhHfbJerjTd/u2Xk8Iya05ZuYM=; b=LTIY654+0uM1MMx5Gmq4Qb2OgoOx2Ap/sz4xOWV9bKP/UoalfuEXKLcAbUDZnZ0Lj2 rSGJXtiMyGf+fnFOFa/pgMkPgFfqSbCJQIDlM/AZ9LgwjZqzJqN9wG6tPQ05mobbhkvD dbqgr1sUTT2FLb1i3alcIcT0r0EC76kGwEcCeZ1TAwi5d1QyL/1CEIhaH+jZZcjusM6f BGpkbGd6y2tJu8q3woh/kivuCCgTL/flEek7SEln7AIJoidcOYh68N6Yg/9rbRPQmLM/ vpau3pQ4A9FkvxR4tlMOvNBKVUDJ/0gap2jaub1RnfFrabXqAYjK7EsnQTdqhEAwL3vv hB1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7fyU18k+mvpWurEKXRhHfbJerjTd/u2Xk8Iya05ZuYM=; b=3dmb6n6y5z4thcBi/CaPDPxWLXbhSQXUT3y65+pG2wjc5u3iY1buorVewG2u9U09xl SgePCbE9/rt4VaQQXm0QcoJA1E302k8Ba2t1wVfF6sS07AG2GOI7wUwfBXSgh9gM6Rji fWUUzdIqIcRu0xj5oCXliTsEChwp99aD6grApF4422aunDmUnCEP4tdjDf7mQGj6AEvy t2fnUvcD1oHN4oR8OdM8BxcGC2u9dtqWe5NhmBrqm4WNIl6VFsuID2kFjwiUZQwtzKtF 8VIg00kM1bxDwFv5F1y6siE3Z1Bgav4Nkm8eJzzjJyTjrxTCHYJyoFNGKCGGK7LwBvDE Wn4Q== X-Gm-Message-State: AOAM531grUwApfj+lInROl+6CA5VaSbwJf2bpgrdg38o5Fa0oy+b2p1X WofcVlyRnie/9FCsWYfRAwTl395oSQZiFQ== X-Google-Smtp-Source: ABdhPJw3DBeabgz+0P2+aCoMLSr6s7jvewQNsK7J6UgN96vKjZ+Cwan1UnHWQ/CHdsslICLpjIlcog== X-Received: by 2002:adf:e0c7:: with SMTP id m7mr397292wri.530.1640133363717; Tue, 21 Dec 2021 16:36:03 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:03 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 16/19] media: camss: add support for SM8250 camss Date: Wed, 22 Dec 2021 00:37:48 +0000 Message-Id: <20211222003751.2461466-17-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Jonathan Marek The Titan 480 camss found on SM8250 has 6 CSIPHY and 4 VFE/CSID. CSID is compatible with the Titan 170 CSID, but the Titan 480 CSID are inside the VFE region (between the "top" and "bus" registers), so a workaround is added to avoid ioremap failure. [bod] Fixed setting camnoc_axi_clk_src instead of camcc_camnoc_axi_clk [jgrahsl, bod] Add slow_ahb_src clock values [jgrahsl, bod] Add cpa_ahb clock values Signed-off-by: Jonathan Marek Tested-by: Julian Grahsl Co-developed-by: Julian Grahsl Signed-off-by: Julian Grahsl Reviewed-by: Robert Foss Co-developed-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue --- drivers/media/platform/qcom/camss/Makefile | 2 +- .../{camss-csid-170.c => camss-csid-gen2.c} | 2 +- .../media/platform/qcom/camss/camss-csid.c | 26 ++- .../media/platform/qcom/camss/camss-csid.h | 2 +- .../media/platform/qcom/camss/camss-csiphy.c | 8 +- drivers/media/platform/qcom/camss/camss-vfe.c | 9 +- .../media/platform/qcom/camss/camss-video.c | 3 +- drivers/media/platform/qcom/camss/camss.c | 219 +++++++++++++++++- 8 files changed, 246 insertions(+), 25 deletions(-) rename drivers/media/platform/qcom/camss/{camss-csid-170.c => camss-csid-gen2.c} (99%) diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/platform/qcom/camss/Makefile index 81dd56aff0f27..4e22223589739 100644 --- a/drivers/media/platform/qcom/camss/Makefile +++ b/drivers/media/platform/qcom/camss/Makefile @@ -6,7 +6,7 @@ qcom-camss-objs += \ camss-csid.o \ camss-csid-4-1.o \ camss-csid-4-7.o \ - camss-csid-170.o \ + camss-csid-gen2.o \ camss-csiphy-2ph-1-0.o \ camss-csiphy-3ph-1-0.o \ camss-csiphy.o \ diff --git a/drivers/media/platform/qcom/camss/camss-csid-170.c b/drivers/media/platform/qcom/camss/camss-csid-gen2.c similarity index 99% rename from drivers/media/platform/qcom/camss/camss-csid-170.c rename to drivers/media/platform/qcom/camss/camss-csid-gen2.c index 9e54d251793fc..abbfbf4488934 100644 --- a/drivers/media/platform/qcom/camss/camss-csid-170.c +++ b/drivers/media/platform/qcom/camss/camss-csid-gen2.c @@ -594,7 +594,7 @@ static void csid_subdev_init(struct csid_device *csid) csid->testgen.nmodes = CSID_PAYLOAD_MODE_NUM_SUPPORTED_GEN2; } -const struct csid_hw_ops csid_ops_170 = { +const struct csid_hw_ops csid_ops_gen2 = { .configure_stream = csid_configure_stream, .configure_testgen_pattern = csid_configure_testgen_pattern, .hw_version = csid_hw_version, diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index 1226913c623b0..9ef6fbbeeddf3 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -25,6 +25,10 @@ #include "camss-csid-gen1.h" #include "camss.h" +/* offset of CSID registers in VFE region for VFE 480 */ +#define VFE_480_CSID_OFFSET 0x1200 +#define VFE_480_LITE_CSID_OFFSET 0x200 + #define MSM_CSID_NAME "msm_csid" const char * const csid_testgen_modes[] = { @@ -559,8 +563,9 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, } else if (camss->version == CAMSS_8x96 || camss->version == CAMSS_660) { csid->ops = &csid_ops_4_7; - } else if (camss->version == CAMSS_845) { - csid->ops = &csid_ops_170; + } else if (camss->version == CAMSS_845 || + camss->version == CAMSS_8250) { + csid->ops = &csid_ops_gen2; } else { return -EINVAL; } @@ -568,9 +573,20 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid, /* Memory */ - csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]); - if (IS_ERR(csid->base)) - return PTR_ERR(csid->base); + if (camss->version == CAMSS_8250) { + /* for titan 480, CSID registers are inside the VFE region, + * between the VFE "top" and "bus" registers. this requires + * VFE to be initialized before CSID + */ + if (id >= 2) /* VFE/CSID lite */ + csid->base = camss->vfe[id].base + VFE_480_LITE_CSID_OFFSET; + else + csid->base = camss->vfe[id].base + VFE_480_CSID_OFFSET; + } else { + csid->base = devm_platform_ioremap_resource_byname(pdev, res->reg[0]); + if (IS_ERR(csid->base)) + return PTR_ERR(csid->base); + } /* Interrupt */ diff --git a/drivers/media/platform/qcom/camss/camss-csid.h b/drivers/media/platform/qcom/camss/camss-csid.h index 814ebc7c29d65..17a50fa426be1 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.h +++ b/drivers/media/platform/qcom/camss/camss-csid.h @@ -205,7 +205,7 @@ extern const char * const csid_testgen_modes[]; extern const struct csid_hw_ops csid_ops_4_1; extern const struct csid_hw_ops csid_ops_4_7; -extern const struct csid_hw_ops csid_ops_170; +extern const struct csid_hw_ops csid_ops_gen2; #endif /* QC_MSM_CAMSS_CSID_H */ diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index de1e81bb97c92..f1d8d883af8e7 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -586,7 +586,8 @@ int msm_csiphy_subdev_init(struct camss *camss, csiphy->ops = &csiphy_ops_3ph_1_0; csiphy->formats = csiphy_formats_8x96; csiphy->nformats = ARRAY_SIZE(csiphy_formats_8x96); - } else if (camss->version == CAMSS_845) { + } else if (camss->version == CAMSS_845 || + camss->version == CAMSS_8250) { csiphy->ops = &csiphy_ops_3ph_1_0; csiphy->formats = csiphy_formats_sdm845; csiphy->nformats = ARRAY_SIZE(csiphy_formats_sdm845); @@ -680,7 +681,10 @@ int msm_csiphy_subdev_init(struct camss *camss, if (!strcmp(clock->name, "csiphy0_timer") || !strcmp(clock->name, "csiphy1_timer") || - !strcmp(clock->name, "csiphy2_timer")) + !strcmp(clock->name, "csiphy2_timer") || + !strcmp(clock->name, "csiphy3_timer") || + !strcmp(clock->name, "csiphy4_timer") || + !strcmp(clock->name, "csiphy5_timer")) csiphy->rate_set[i] = true; if (camss->version == CAMSS_660 && diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 3d2f554a4ef71..5b5fe620914d0 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -220,7 +220,8 @@ static u32 vfe_src_pad_code(struct vfe_line *line, u32 sink_code, } else if (vfe->camss->version == CAMSS_8x96 || vfe->camss->version == CAMSS_660 || - vfe->camss->version == CAMSS_845) + vfe->camss->version == CAMSS_845 || + vfe->camss->version == CAMSS_8250) switch (sink_code) { case MEDIA_BUS_FMT_YUYV8_2X8: { @@ -1297,6 +1298,9 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, case CAMSS_845: vfe->ops = &vfe_ops_170; break; + case CAMSS_8250: + vfe->ops = &vfe_ops_480; + break; default: return -EINVAL; } @@ -1407,7 +1411,8 @@ int msm_vfe_subdev_init(struct camss *camss, struct vfe_device *vfe, l->formats = formats_rdi_8x96; l->nformats = ARRAY_SIZE(formats_rdi_8x96); } - } else if (camss->version == CAMSS_845) { + } else if (camss->version == CAMSS_845 || + camss->version == CAMSS_8250) { l->formats = formats_rdi_845; l->nformats = ARRAY_SIZE(formats_rdi_845); } else { diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index 54e77d30d452c..5dc1ddbe6d658 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -1011,7 +1011,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, video->formats = formats_rdi_8x96; video->nformats = ARRAY_SIZE(formats_rdi_8x96); } - } else if (video->camss->version == CAMSS_845) { + } else if (video->camss->version == CAMSS_845 || + video->camss->version == CAMSS_8250) { video->formats = formats_rdi_845; video->nformats = ARRAY_SIZE(formats_rdi_845); } else { diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 71c6109b05260..066639db9f18b 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -662,6 +662,185 @@ static const struct resources vfe_res_845[] = { } }; +static const struct resources csiphy_res_8250[] = { + /* CSIPHY0 */ + { + .regulator = { NULL }, + .clock = { "csiphy0", "csiphy0_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy0" }, + .interrupt = { "csiphy0" } + }, + /* CSIPHY1 */ + { + .regulator = { NULL }, + .clock = { "csiphy1", "csiphy1_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy1" }, + .interrupt = { "csiphy1" } + }, + /* CSIPHY2 */ + { + .regulator = { NULL }, + .clock = { "csiphy2", "csiphy2_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy2" }, + .interrupt = { "csiphy2" } + }, + /* CSIPHY3 */ + { + .regulator = { NULL }, + .clock = { "csiphy3", "csiphy3_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy3" }, + .interrupt = { "csiphy3" } + }, + /* CSIPHY4 */ + { + .regulator = { NULL }, + .clock = { "csiphy4", "csiphy4_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy4" }, + .interrupt = { "csiphy4" } + }, + /* CSIPHY5 */ + { + .regulator = { NULL }, + .clock = { "csiphy5", "csiphy5_timer" }, + .clock_rate = { { 400000000 }, + { 300000000 } }, + .reg = { "csiphy5" }, + .interrupt = { "csiphy5" } + } +}; + +static const struct resources csid_res_8250[] = { + /* CSID0 */ + { + .regulator = { NULL }, + .clock = { "vfe0_csid", "vfe0_cphy_rx", "vfe0", "vfe0_areg", "vfe0_ahb" }, + .clock_rate = { { 400000000 }, + { 400000000 }, + { 350000000, 475000000, 576000000, 720000000 }, + { 100000000, 200000000, 300000000, 400000000 }, + { 0 } }, + .reg = { "csid0" }, + .interrupt = { "csid0" } + }, + /* CSID1 */ + { + .regulator = { NULL }, + .clock = { "vfe1_csid", "vfe1_cphy_rx", "vfe1", "vfe1_areg", "vfe1_ahb" }, + .clock_rate = { { 400000000 }, + { 400000000 }, + { 350000000, 475000000, 576000000, 720000000 }, + { 100000000, 200000000, 300000000, 400000000 }, + { 0 } }, + .reg = { "csid1" }, + .interrupt = { "csid1" } + }, + /* CSID2 */ + { + .regulator = { NULL }, + .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, + .clock_rate = { { 400000000 }, + { 400000000 }, + { 400000000, 480000000 }, + { 0 } }, + .reg = { "csid2" }, + .interrupt = { "csid2" } + }, + /* CSID3 */ + { + .regulator = { NULL }, + .clock = { "vfe_lite_csid", "vfe_lite_cphy_rx", "vfe_lite", "vfe_lite_ahb" }, + .clock_rate = { { 400000000 }, + { 400000000 }, + { 400000000, 480000000 }, + { 0 } }, + .reg = { "csid3" }, + .interrupt = { "csid3" } + } +}; + +static const struct resources vfe_res_8250[] = { + /* VFE0 */ + { + .regulator = { NULL }, + .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", + "camnoc_axi", "vfe0_ahb", "vfe0_areg", "vfe0", + "vfe0_axi", "cam_hf_axi" }, + .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, + { 19200000, 80000000 }, + { 19200000 }, + { 0 }, + { 0 }, + { 100000000, 200000000, 300000000, 400000000 }, + { 350000000, 475000000, 576000000, 720000000 }, + { 0 }, + { 0 } }, + .reg = { "vfe0" }, + .interrupt = { "vfe0" } + }, + /* VFE1 */ + { + .regulator = { NULL }, + .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", + "camnoc_axi", "vfe1_ahb", "vfe1_areg", "vfe1", + "vfe1_axi", "cam_hf_axi" }, + .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, + { 19200000, 80000000 }, + { 19200000 }, + { 0 }, + { 0 }, + { 100000000, 200000000, 300000000, 400000000 }, + { 350000000, 475000000, 576000000, 720000000 }, + { 0 }, + { 0 } }, + .reg = { "vfe1" }, + .interrupt = { "vfe1" } + }, + /* VFE2 (lite) */ + { + .regulator = { NULL }, + .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", + "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi", + "vfe_lite", "cam_hf_axi" }, + .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, + { 19200000, 80000000 }, + { 19200000 }, + { 0 }, + { 0 }, + { 0 }, + { 400000000, 480000000 }, + { 0 } }, + .reg = { "vfe_lite0" }, + .interrupt = { "vfe_lite0" } + }, + /* VFE3 (lite) */ + { + .regulator = { NULL }, + .clock = { "camnoc_axi_src", "slow_ahb_src", "cpas_ahb", + "camnoc_axi", "vfe_lite_ahb", "vfe_lite_axi", + "vfe_lite", "cam_hf_axi" }, + .clock_rate = { { 19200000, 300000000, 400000000, 480000000 }, + { 19200000, 80000000 }, + { 19200000 }, + { 0 }, + { 0 }, + { 0 }, + { 400000000, 480000000 }, + { 0 } }, + .reg = { "vfe_lite1" }, + .interrupt = { "vfe_lite1" } + }, +}; + /* * camss_add_clock_margin - Add margin to clock frequency rate * @rate: Clock frequency rate @@ -945,6 +1124,12 @@ static int camss_init_subdevices(struct camss *camss) /* Titan VFEs don't have an ISPIF */ ispif_res = NULL; vfe_res = vfe_res_845; + } else if (camss->version == CAMSS_8250) { + csiphy_res = csiphy_res_8250; + csid_res = csid_res_8250; + /* Titan VFEs don't have an ISPIF */ + ispif_res = NULL; + vfe_res = vfe_res_8250; } else { return -EINVAL; } @@ -960,6 +1145,17 @@ static int camss_init_subdevices(struct camss *camss) } } + /* note: SM8250 requires VFE to be initialized before CSID */ + for (i = 0; i < camss->vfe_num; i++) { + ret = msm_vfe_subdev_init(camss, &camss->vfe[i], + &vfe_res[i], i); + if (ret < 0) { + dev_err(camss->dev, + "Fail to init vfe%d sub-device: %d\n", i, ret); + return ret; + } + } + for (i = 0; i < camss->csid_num; i++) { ret = msm_csid_subdev_init(camss, &camss->csid[i], &csid_res[i], i); @@ -978,16 +1174,6 @@ static int camss_init_subdevices(struct camss *camss) return ret; } - for (i = 0; i < camss->vfe_num; i++) { - ret = msm_vfe_subdev_init(camss, &camss->vfe[i], - &vfe_res[i], i); - if (ret < 0) { - dev_err(camss->dev, - "Fail to init vfe%d sub-device: %d\n", i, ret); - return ret; - } - } - return 0; } @@ -1250,7 +1436,8 @@ static int camss_configure_pd(struct camss *camss) if (camss->version == CAMSS_8x96 || camss->version == CAMSS_660) nbr_pm_domains = PM_DOMAIN_GEN1_COUNT; - else if (camss->version == CAMSS_845) + else if (camss->version == CAMSS_845 || + camss->version == CAMSS_8250) nbr_pm_domains = PM_DOMAIN_GEN2_COUNT; for (i = 0; i < nbr_pm_domains; i++) { @@ -1326,6 +1513,12 @@ static int camss_probe(struct platform_device *pdev) camss->csiphy_num = 4; camss->csid_num = 3; camss->vfe_num = 3; + } else if (of_device_is_compatible(dev->of_node, + "qcom,sm8250-camss")) { + camss->version = CAMSS_8250; + camss->csiphy_num = 6; + camss->csid_num = 4; + camss->vfe_num = 4; } else { ret = -EINVAL; goto err_free; @@ -1457,7 +1650,8 @@ void camss_delete(struct camss *camss) if (camss->version == CAMSS_8x96 || camss->version == CAMSS_660) nbr_pm_domains = PM_DOMAIN_GEN1_COUNT; - else if (camss->version == CAMSS_845) + else if (camss->version == CAMSS_845 || + camss->version == CAMSS_8250) nbr_pm_domains = PM_DOMAIN_GEN2_COUNT; for (i = 0; i < nbr_pm_domains; i++) { @@ -1493,6 +1687,7 @@ static const struct of_device_id camss_dt_match[] = { { .compatible = "qcom,msm8996-camss" }, { .compatible = "qcom,sdm660-camss" }, { .compatible = "qcom,sdm845-camss" }, + { .compatible = "qcom,sm8250-camss" }, { } }; From patchwork Wed Dec 22 00:37:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527211 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 0E1CAC433EF for ; Wed, 22 Dec 2021 00:36:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239969AbhLVAgH (ORCPT ); Tue, 21 Dec 2021 19:36:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240005AbhLVAgG (ORCPT ); Tue, 21 Dec 2021 19:36:06 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7914DC06173F for ; Tue, 21 Dec 2021 16:36:06 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id s1so1368643wrg.1 for ; Tue, 21 Dec 2021 16:36:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G8c71zTh04TorciXdFbO1w9DiM1ppvdvVk4okLW9tks=; b=rWoXBWCsnwaWG3cn1NTK6p6A1pK11bvXNdWXO+ycCT0Xse+IyCZDLMocicmCM2SEXJ wdGvzv1T+q+x/2h+DAPsTneV6Z2QYpeS/eAw5l/T9dq4KP10+ggr5QyUzT9uQT4EtySs zbmkXgbXjAd38tN8RRVrxtxUCsgO6U41vTXi3x/2JIYqB6eKyVXVI1b8IG0W5x8N7GrZ LOW0MKIS38r/4ZPDEJ3euPf7S547e2jOV4yRYjit+TwydBjhfcAY4E1eiKA+eFuW2Ubk OHv2F1SPH0MnJnn2oId5BRhsHv/j01xc4H1JP+z1AZU+Iu79+WXP36sMmMtJifxjkfz4 RMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G8c71zTh04TorciXdFbO1w9DiM1ppvdvVk4okLW9tks=; b=dk+Mw8fvlz+17tLm+3+BhJOmsPneys1IUJxi7WpSVpqIuY5nF5IEtne4gBElG6yBDf 0dBUGmouW6ykwPu8aUUd1WxBmL1J+cg7OYNcYipDAC7AZ2yJEykpTd5ZviKRPVyQosQZ +43rELRS4MX1r9sYyqBj1xzy83h/o4pEPpFCEwUAhzSSZ61Gqv+21qDtePqkpAvTFTsU /LUTfO2VKeYJas1TBWdX1PeFzsgZhkh7aJZmYcrfAFv43kSYb0ilj1rNTPNysLrgl0Ew ra566Q3TuAg40TPAb36Qe170B0k/t5GRVy+CcLMp6B3O1JO3HpeRRYS4Gc1VokguWDyJ gOPA== X-Gm-Message-State: AOAM530mkBvZhrDLnYWhsQIv5HUDEfBrGa9RLpr8zHn2hgl0Q23bktfi Y8pUU8KYO93AMAeYFkIuW9KC2ZF6o/L+bQ== X-Google-Smtp-Source: ABdhPJxcc5NIw5cUPcVfm3qsB9Y6se2t+rhNB50sfqbd7sRCwep+JNifauSjZMjRPR7gcQGDi1kP7Q== X-Received: by 2002:a05:6000:18aa:: with SMTP id b10mr381016wri.305.1640133364827; Tue, 21 Dec 2021 16:36:04 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:04 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 17/19] media: camss: Add SM8250 bandwdith configuration support Date: Wed, 22 Dec 2021 00:37:49 +0000 Message-Id: <20211222003751.2461466-18-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Downstream makes some pretty explicit comments about voting for bus bandwidth prior to camcc_camnoc_axi_clk_src. Working with camx downstream also shows that the bandwidth vote is required to get that root clock working. Add a simple mechanism to declare set and unset named NOCs. Whereas the objective is to enable the sm8250 specifically the code has been implemented to allow setting of whatever NOCs different SoCs using this driver may require. Tested-by: Julian Grahsl Signed-off-by: Bryan O'Donoghue Reviewed-by: Robert Foss --- drivers/media/platform/qcom/camss/camss.c | 81 +++++++++++++++++++++++ drivers/media/platform/qcom/camss/camss.h | 17 +++++ 2 files changed, 98 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 066639db9f18b..d9905e737d88d 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -8,6 +8,7 @@ * Copyright (C) 2015-2018 Linaro Ltd. */ #include +#include #include #include #include @@ -841,6 +842,29 @@ static const struct resources vfe_res_8250[] = { }, }; +static const struct resources_icc icc_res_sm8250[] = { + { + .name = "cam_ahb", + .icc_bw_tbl.avg = 38400, + .icc_bw_tbl.peak = 76800, + }, + { + .name = "cam_hf_0_mnoc", + .icc_bw_tbl.avg = 2097152, + .icc_bw_tbl.peak = 2097152, + }, + { + .name = "cam_sf_0_mnoc", + .icc_bw_tbl.avg = 0, + .icc_bw_tbl.peak = 2097152, + }, + { + .name = "cam_sf_icp_mnoc", + .icc_bw_tbl.avg = 2097152, + .icc_bw_tbl.peak = 2097152, + }, +}; + /* * camss_add_clock_margin - Add margin to clock frequency rate * @rate: Clock frequency rate @@ -1470,6 +1494,29 @@ static int camss_configure_pd(struct camss *camss) return ret; } +static int camss_icc_get(struct camss *camss) +{ + const struct resources_icc *icc_res; + int nbr_icc_paths = 0; + int i; + + if (camss->version == CAMSS_8250) { + icc_res = &icc_res_sm8250[0]; + nbr_icc_paths = ICC_SM8250_COUNT; + } + + for (i = 0; i < nbr_icc_paths; i++) { + camss->icc_path[i] = devm_of_icc_get(camss->dev, + icc_res[i].name); + if (IS_ERR(camss->icc_path[i])) + return PTR_ERR(camss->icc_path[i]); + + camss->icc_bw_tbl[i] = icc_res[i].icc_bw_tbl; + } + + return 0; +} + /* * camss_probe - Probe CAMSS platform device * @pdev: Pointer to CAMSS platform device @@ -1562,6 +1609,10 @@ static int camss_probe(struct platform_device *pdev) goto err_cleanup; } + ret = camss_icc_get(camss); + if (ret < 0) + goto err_cleanup; + ret = camss_init_subdevices(camss); if (ret < 0) goto err_cleanup; @@ -1695,11 +1746,41 @@ MODULE_DEVICE_TABLE(of, camss_dt_match); static int __maybe_unused camss_runtime_suspend(struct device *dev) { + struct camss *camss = dev_get_drvdata(dev); + int nbr_icc_paths = 0; + int i; + int ret; + + if (camss->version == CAMSS_8250) + nbr_icc_paths = ICC_SM8250_COUNT; + + for (i = 0; i < nbr_icc_paths; i++) { + ret = icc_set_bw(camss->icc_path[i], 0, 0); + if (ret) + return ret; + } + return 0; } static int __maybe_unused camss_runtime_resume(struct device *dev) { + struct camss *camss = dev_get_drvdata(dev); + int nbr_icc_paths = 0; + int i; + int ret; + + if (camss->version == CAMSS_8250) + nbr_icc_paths = ICC_SM8250_COUNT; + + for (i = 0; i < nbr_icc_paths; i++) { + ret = icc_set_bw(camss->icc_path[i], + camss->icc_bw_tbl[i].avg, + camss->icc_bw_tbl[i].peak); + if (ret) + return ret; + } + return 0; } diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h index 377e2474a485f..9c644e638a948 100644 --- a/drivers/media/platform/qcom/camss/camss.h +++ b/drivers/media/platform/qcom/camss/camss.h @@ -56,6 +56,16 @@ struct resources_ispif { char *interrupt; }; +struct icc_bw_tbl { + u32 avg; + u32 peak; +}; + +struct resources_icc { + char *name; + struct icc_bw_tbl icc_bw_tbl; +}; + enum pm_domain { PM_DOMAIN_VFE0 = 0, PM_DOMAIN_VFE1 = 1, @@ -72,6 +82,11 @@ enum camss_version { CAMSS_8250, }; +enum icc_count { + ICC_DEFAULT_COUNT = 0, + ICC_SM8250_COUNT = 4, +}; + struct camss { enum camss_version version; struct v4l2_device v4l2_dev; @@ -88,6 +103,8 @@ struct camss { atomic_t ref_count; struct device *genpd[PM_DOMAIN_GEN2_COUNT]; struct device_link *genpd_link[PM_DOMAIN_GEN2_COUNT]; + struct icc_path *icc_path[ICC_SM8250_COUNT]; + struct icc_bw_tbl icc_bw_tbl[ICC_SM8250_COUNT]; }; struct camss_camera_interface { From patchwork Wed Dec 22 00:37:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527455 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 1A5D5C433FE for ; Wed, 22 Dec 2021 00:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240032AbhLVAgI (ORCPT ); Tue, 21 Dec 2021 19:36:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240040AbhLVAgH (ORCPT ); Tue, 21 Dec 2021 19:36:07 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C517C06173F for ; Tue, 21 Dec 2021 16:36:07 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id j18so1359897wrd.2 for ; Tue, 21 Dec 2021 16:36:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jxsZJW0Dax3tkJBhDNpWDlh0EqpL+j0Vj65hBEhTL2A=; b=FqH41Gw0a/eYZjcDPzAoGnW0Mu+lYclKlISVWkCUx/tEj3Ja5K5hsX2OuPl8686s0Y 5MnrPSfrmYfMcL7LgFtiGaF9B2X1v1D/tq4OX+eFIz/uCbGTfyh0SViEt4FC7s5NrBV5 heNr/YyiLNIDIsm4N98RvojUnOYH5M5Z9Fdxq5tbFvYyM5NbbQfa+tesE5PubBmgqkdr B2zLKEflxuNKy2Uv6t7aZl8Hqx9ndggumFTbmJGTQxHo9aDECFUy2PESqAThDvm/9aea aTaGbD/2Mq+iXe1Mnr6gbLQvd+JV3qtce5eGgKAiTp1r0Lwljgl4xppgW3BrFY2vvtXI Zswg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jxsZJW0Dax3tkJBhDNpWDlh0EqpL+j0Vj65hBEhTL2A=; b=Qnw2dyBdFXTfw6ASBJ0o8UZgFXXECHiRvUe0219ornQBxnNCpkLrHx81fg4k86W0Lh 620F97rpw4/hQbGfoLGBABnTHjWh16qcq+imIF9PvM0ByY0y1p6oNkvl1NnjQ0O7Wsw+ n4eE0KgWusGvPdRDGv+l6V0YAZc4wVNlTZJsq+8H2LUgM8T1kAUxBqB8zDnO9J7IlGE8 M0OOqFq9527aVWbY++AfLkscmyZ/Jfg6GOWf7G/To2dtXxSOC97gd/aSDOqE7VOaB2EY jlvMANauIGF/NHUzhlAsiLVPfwHyta7TR0Hxhri1BDlurr+aDCDc3u21xfq6pV+kCBXh 8Zzg== X-Gm-Message-State: AOAM5311+nC2kkThtZNnbAyPZGgER5xU9SBcaEOYY957V+aH6bQYGrBJ CWAPPzNwvJ6jdomBLhLb4S4CThPXCFVtiw== X-Google-Smtp-Source: ABdhPJzVSFKMNrLaznuJQTczUmnmr45dCq9NvsADWVfMDSXqjY0YV9/hwvAKqoJBrDV2HoCl5UCEZA== X-Received: by 2002:adf:ec46:: with SMTP id w6mr398809wrn.288.1640133365880; Tue, 21 Dec 2021 16:36:05 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:05 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 18/19] media: camss: Do vfe_get/vfe_put for csid on sm8250 Date: Wed, 22 Dec 2021 00:37:50 +0000 Message-Id: <20211222003751.2461466-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The sm8250 CAMSS CSID depends on the VFE it is attached to being powered on and clocked prior to taking the CSID out of reset. It is possible to open just the CSID subdev from libcamera and attempt to bring the CSID block up. If we do not first bring up the VFE the CSID will fail to come out of reset. Tested-by: Julian Grahsl Signed-off-by: Bryan O'Donoghue Reviewed-by: Robert Foss --- drivers/media/platform/qcom/camss/camss-csid.c | 12 +++++++++++- drivers/media/platform/qcom/camss/camss-vfe.c | 4 ++-- drivers/media/platform/qcom/camss/camss-vfe.h | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index 9ef6fbbeeddf3..e6835b92695b6 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -156,10 +156,18 @@ static int csid_set_clock_rates(struct csid_device *csid) static int csid_set_power(struct v4l2_subdev *sd, int on) { struct csid_device *csid = v4l2_get_subdevdata(sd); - struct device *dev = csid->camss->dev; + struct camss *camss = csid->camss; + struct device *dev = camss->dev; + struct vfe_device *vfe = &camss->vfe[csid->id]; int ret; if (on) { + if (camss->version == CAMSS_8250) { + ret = vfe_get(vfe); + if (ret < 0) + return ret; + } + ret = pm_runtime_resume_and_get(dev); if (ret < 0) return ret; @@ -204,6 +212,8 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) camss_disable_clocks(csid->nclocks, csid->clock); ret = csid->vdda ? regulator_disable(csid->vdda) : 0; pm_runtime_put_sync(dev); + if (camss->version == CAMSS_8250) + vfe_put(vfe); } return ret; diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 5b5fe620914d0..703ea39f12628 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -575,7 +575,7 @@ static int vfe_check_clock_rates(struct vfe_device *vfe) * * Return 0 on success or a negative error code otherwise */ -static int vfe_get(struct vfe_device *vfe) +int vfe_get(struct vfe_device *vfe) { int ret; @@ -637,7 +637,7 @@ static int vfe_get(struct vfe_device *vfe) * vfe_put - Power down VFE module * @vfe: VFE Device */ -static void vfe_put(struct vfe_device *vfe) +void vfe_put(struct vfe_device *vfe) { mutex_lock(&vfe->power_lock); diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index 6500474a749e7..0eba04eb9b77c 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -203,4 +203,7 @@ extern const struct vfe_hw_ops vfe_ops_4_8; extern const struct vfe_hw_ops vfe_ops_170; extern const struct vfe_hw_ops vfe_ops_480; +int vfe_get(struct vfe_device *vfe); +void vfe_put(struct vfe_device *vfe); + #endif /* QC_MSM_CAMSS_VFE_H */ From patchwork Wed Dec 22 00:37:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 527210 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 E2045C433F5 for ; Wed, 22 Dec 2021 00:36:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240064AbhLVAgJ (ORCPT ); Tue, 21 Dec 2021 19:36:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240058AbhLVAgI (ORCPT ); Tue, 21 Dec 2021 19:36:08 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA03C06173F for ; Tue, 21 Dec 2021 16:36:08 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id t26so1341202wrb.4 for ; Tue, 21 Dec 2021 16:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+vogyF2UScbBECoFaJzBFj/WlT8gMBbKDtNi13q1rsU=; b=iGDar4Jp2+OVfw9Ek+kZLs81nxurgqwHoDpd5aVoZ1Mk6WbGF18xBcyLqOaF2BVTAC oMMiHCTfkt2BcXKkl7kgeyfBySHMFJTM0eLj4SKlNJgYDCAI8WPcvx5JGIbO6qlLk7Yw 0DXXKLF77KmatZyAu/xWL8kmjGSXh87scBWacNpy1c2z08aqzOEGpCvgjdkyB+LaoFUs GHpYeATnmVMmz+4W5wbm0mg2hRC//dkYA2T+2XGe+QheWlJgOsIRm0QWnG7OL6rjru6j dwn/UQmcngoQ5KiScPE+X2yZpnYKzZ528ce/WkAq5wjXYIuL0FJWDfM95MR93NjOIudW MUlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+vogyF2UScbBECoFaJzBFj/WlT8gMBbKDtNi13q1rsU=; b=FA52YME2AgH1TkcIk80R/GEDUoGDcufgLHiilYFsYEGiC11foMnIVTX6iN9oT3dcqQ /EQ0sGbjC4OjpiSrWVQaYmQRIGGTYWnsRqOHLD1SZzLpvCLpGIN8Rxx3B9CMnXoIyfZD uNImGbrs0G4iCFb8dfbdC+Xgd0uJ6Yd7LBUvN4R0LgUI8j8C9pqFmo+KjVX17XdoBBwg L7ejGLJwdsqEqRY6S01g8mj9CnIhBJdlgqY1a94SbDCQqlBuDQtUKNwLZBJuAnvw0HvI R/yBqyXotStGnjhJv5V+wc5EnemaelMws9cNUlAA1vblcEC26yWeQKk0Q+LNgC2eu4Wn JqkQ== X-Gm-Message-State: AOAM531zTt1qla1Qs4Z3fCj8XCP+z8D2LJb++BYCHLkeaxGNLlFdDroI +NLohHXwdOs1soZGKEUxTnd5iJvP5XuvgA== X-Google-Smtp-Source: ABdhPJzROdEb/D+NIOiW0s/fmrJtw2dV1OQIcsSuEvwWh5axVoK3MbGEx2s0XsRtKhf/tmlQBwrDlQ== X-Received: by 2002:a05:6000:12d0:: with SMTP id l16mr385035wrx.466.1640133366920; Tue, 21 Dec 2021 16:36:06 -0800 (PST) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id n7sm282825wms.45.2021.12.21.16.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 16:36:06 -0800 (PST) From: Bryan O'Donoghue To: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, mchehab@kernel.org, hverkuil@xs4all.nl, robert.foss@linaro.org Cc: jonathan@marek.ca, andrey.konovalov@linaro.org, todor.too@gmail.com, agross@kernel.org, bjorn.andersson@linaro.org, jgrahsl@snap.com, hfink@snap.com, vladimir.zapolskiy@linaro.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v3 19/19] media: camss: Apply vfe_get/vfe_put fix to SDM845 Date: Wed, 22 Dec 2021 00:37:51 +0000 Message-Id: <20211222003751.2461466-20-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> References: <20211222003751.2461466-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Similar to the SM8250 the CSID relies on the VFE to be clocked prior to taking the CSID out of reset. Apply the same fixup to SDM845 as SM8250. Suggested-by: Robert Foss Tested-by: Bryan O'Donoghue Signed-off-by: Bryan O'Donoghue Reviewed-by: Robert Foss --- drivers/media/platform/qcom/camss/camss-csid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index e6835b92695b6..32f82e471bae1 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -159,10 +159,11 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) struct camss *camss = csid->camss; struct device *dev = camss->dev; struct vfe_device *vfe = &camss->vfe[csid->id]; + u32 version = camss->version; int ret; if (on) { - if (camss->version == CAMSS_8250) { + if (version == CAMSS_8250 || version == CAMSS_845) { ret = vfe_get(vfe); if (ret < 0) return ret; @@ -212,7 +213,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) camss_disable_clocks(csid->nclocks, csid->clock); ret = csid->vdda ? regulator_disable(csid->vdda) : 0; pm_runtime_put_sync(dev); - if (camss->version == CAMSS_8250) + if (version == CAMSS_8250 || version == CAMSS_845) vfe_put(vfe); }