Re: [PATCH] drm/msm/mdss: specify cfg bandwidth for SDM670

2024-01-11 Thread Richard Acayan
On Fri, Dec 15, 2023 at 03:32:22AM +0200, Dmitry Baryshkov wrote:
> Lower the requested CFG bus bandwidth for the SDM670 platform. The
> default value is 153600 kBps, which is twice as big as required by the
> platform according to the vendor kernel.
>
> Fixes: a55c8ff252d3 ("drm/msm/mdss: Handle the reg bus ICC path")
> Signed-off-by: Dmitry Baryshkov 
> ---
>  drivers/gpu/drm/msm/msm_mdss.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
> index 455b2e3a0cdd..35423d10aafa 100644
> --- a/drivers/gpu/drm/msm/msm_mdss.c
> +++ b/drivers/gpu/drm/msm/msm_mdss.c
> @@ -562,6 +562,7 @@ static const struct msm_mdss_data sdm670_data = {
>   .ubwc_enc_version = UBWC_2_0,
>   .ubwc_dec_version = UBWC_2_0,
>   .highest_bank_bit = 1,
> + .reg_bus_bw = 76800,

This seems to be the bandwidth applied to the "cpu-cfg" path, but it is
not in the device tree yet and is not allowed by schema (for no
particular reason). In sdm670.dtsi, it would be defined as:

<_noc MASTER_AMPSS_M0 0 _noc SLAVE_DISPLAY_CFG 0>

Furthermore, I have not yet emailed the patches that I use to test the
display on SDM670, namely, the panel driver and device tree changes for
the Pixel 3a. Nevertheless, this does not break anything, even with the
interconnect path and everything needed to test.

Tested-by: Richard Acayan 

>  };
>  
>  static const struct msm_mdss_data sdm845_data = {
> -- 
> 2.39.2
>


[Freedreno] [PATCH v4 6/6] arm64: dts: qcom: sdm670: add display subsystem

2023-10-16 Thread Richard Acayan
The Snapdragon 670 has a display subsystem for controlling and
outputting to the display. Add support for it in the device tree.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Richard Acayan 
---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 292 +++
 1 file changed, 292 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi 
b/arch/arm64/boot/dts/qcom/sdm670.dtsi
index 84cd2e39266f..94f5d1bcf1e3 100644
--- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
@@ -6,6 +6,7 @@
  * Copyright (c) 2022, Richard Acayan. All rights reserved.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -400,6 +401,30 @@ cpu6_opp10: opp-199680 {
};
};
 
+   dsi_opp_table: opp-table-dsi {
+   compatible = "operating-points-v2";
+
+   opp-1920 {
+   opp-hz = /bits/ 64 <1920>;
+   required-opps = <_opp_min_svs>;
+   };
+
+   opp-18000 {
+   opp-hz = /bits/ 64 <18000>;
+   required-opps = <_opp_low_svs>;
+   };
+
+   opp-27500 {
+   opp-hz = /bits/ 64 <27500>;
+   required-opps = <_opp_svs>;
+   };
+
+   opp-35800 {
+   opp-hz = /bits/ 64 <35800>;
+   required-opps = <_opp_svs_l1>;
+   };
+   };
+
psci {
compatible = "arm,psci-1.0";
method = "smc";
@@ -1352,6 +1377,273 @@ spmi_bus: spmi@c44 {
#interrupt-cells = <4>;
};
 
+   mdss: display-subsystem@ae0 {
+   compatible = "qcom,sdm670-mdss";
+   reg = <0 0x0ae0 0 0x1000>;
+   reg-names = "mdss";
+
+   power-domains = < MDSS_GDSC>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "core";
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interconnects = <_noc MASTER_MDP_PORT0 0 _noc 
SLAVE_EBI_CH0 0>,
+   <_noc MASTER_MDP_PORT1 0 _noc 
SLAVE_EBI_CH0 0>;
+   interconnect-names = "mdp0-mem", "mdp1-mem";
+
+   iommus = <_smmu 0x880 0x8>,
+<_smmu 0xc80 0x8>;
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   status = "disabled";
+
+   mdss_mdp: display-controller@ae01000 {
+   compatible = "qcom,sdm670-dpu";
+   reg = <0 0x0ae01000 0 0x8f000>,
+ <0 0x0aeb 0 0x2008>;
+   reg-names = "mdp", "vbif";
+
+   clocks = < GCC_DISP_AXI_CLK>,
+< DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>,
+< DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "gcc-bus", "iface", "bus", 
"core", "vsync";
+
+   assigned-clocks = < 
DISP_CC_MDSS_VSYNC_CLK>;
+   assigned-clock-rates = <1920>;
+   operating-points-v2 = <_opp_table>;
+   power-domains = < SDM670_CX>;
+
+   interrupt-parent = <>;
+   interrupts = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_dsi0_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   

[Freedreno] [PATCH v4 5/6] drm/msm/dpu: Add hw revision 4.1 (SDM670)

2023-10-16 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Since revision 4.0 is SDM845, reuse some configuration from its catalog
entry.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 ++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   1 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 4 files changed, 107 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
new file mode 100644
index ..cbbdaebe357e
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023, Richard Acayan. All rights reserved.
+ */
+
+#ifndef _DPU_4_1_SDM670_H
+#define _DPU_4_1_SDM670_H
+
+static const struct dpu_mdp_cfg sdm670_mdp = {
+   .name = "top_0",
+   .base = 0x0, .len = 0x45c,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 },
+   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 },
+   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 },
+   },
+};
+
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_1_3,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_1_3,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x1c8,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA0,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA1,
+   }, {
+   .name = "sspp_10", .id = SSPP_DMA2,
+   .base = 0x28000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 9,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA2,
+   },
+};
+
+static const struct dpu_dsc_cfg sdm670_dsc[] = {
+   {
+   .name = "dsc_0", .id = DSC_0,
+   .base = 0x8, .len = 0x140,
+   }, {
+   .name = "dsc_1", .id = DSC_1,
+   .base = 0x80400, .len = 0x140,
+   },
+};
+
+static const struct dpu_mdss_version sdm670_mdss_ver = {
+   .core_major_ver = 4,
+   .core_minor_ver = 1,
+};
+
+const struct dpu_mdss_cfg dpu_sdm670_cfg = {
+   .mdss_ver = _mdss_ver,
+   .caps = _dpu_caps,
+   .mdp = _mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .perf = _perf_data,
+};
+
+#endif
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index be461586b108..84c29de9ad81 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b

[Freedreno] [PATCH v4 4/6] drm/msm: mdss: add support for SDM670

2023-10-16 Thread Richard Acayan
Add support for the MDSS block on the SDM670 platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Richard Acayan 
---
 drivers/gpu/drm/msm/msm_mdss.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 2e87dd6cb17b..2afb843271aa 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -551,6 +551,12 @@ static const struct msm_mdss_data sc8280xp_data = {
.macrotile_mode = 1,
 };
 
+static const struct msm_mdss_data sdm670_data = {
+   .ubwc_enc_version = UBWC_2_0,
+   .ubwc_dec_version = UBWC_2_0,
+   .highest_bank_bit = 1,
+};
+
 static const struct msm_mdss_data sdm845_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
@@ -609,6 +615,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,mdss" },
{ .compatible = "qcom,msm8998-mdss", .data = _data },
{ .compatible = "qcom,qcm2290-mdss", .data = _data },
+   { .compatible = "qcom,sdm670-mdss", .data = _data },
{ .compatible = "qcom,sdm845-mdss", .data = _data },
{ .compatible = "qcom,sc7180-mdss", .data = _data },
{ .compatible = "qcom,sc7280-mdss", .data = _data },
-- 
2.42.0



[Freedreno] [PATCH v4 3/6] dt-bindings: display: msm: Add SDM670 MDSS

2023-10-16 Thread Richard Acayan
Add documentation for the SDM670 display subsystem, adapted from the
SDM845 and SM6125 documentation.

Reviewed-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../display/msm/qcom,sdm670-mdss.yaml | 292 ++
 1 file changed, 292 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
new file mode 100644
index ..7dc269322b8e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
@@ -0,0 +1,292 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sdm670-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SDM670 Display MDSS
+
+maintainers:
+  - Richard Acayan 
+
+description:
+  SDM670 MSM Mobile Display Subsystem (MDSS), which encapsulates sub-blocks
+  like DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sdm670-mdss
+
+  clocks:
+items:
+  - description: Display AHB clock from gcc
+  - description: Display core clock
+
+  clock-names:
+items:
+  - const: iface
+  - const: core
+
+  iommus:
+maxItems: 2
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dpu
+
+  "^displayport-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dp
+
+  "^dsi@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+contains:
+  const: qcom,sdm670-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,dsi-phy-10nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sdm670-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+power-domains = < MDSS_GDSC>;
+
+clocks = < GCC_DISP_AHB_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>;
+clock-names = "iface", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+interconnects = <_noc MASTER_MDP_PORT0 0 _noc SLAVE_EBI_CH0 
0>,
+<_noc MASTER_MDP_PORT1 0 _noc SLAVE_EBI_CH0 
0>;
+interconnect-names = "mdp0-mem", "mdp1-mem";
+
+iommus = <_smmu 0x880 0x8>,
+ <_smmu 0xc80 0x8>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sdm670-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = < GCC_DISP_AXI_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>,
+ < DISP_CC_MDSS_VSYNC_CLK>;
+clock-names = "gcc-bus", "iface", "bus", "core", "vsync";
+
+interrupt-parent = <>;
+interrupts = <0>;
+power-domains = < SDM670_CX>;
+operating-points-v2 = <_opp_table>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_dsi0_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_dsi1_in>;
+};
+};
+};
+};
+
+dsi@ae94000 {
+compatible = "qcom,sdm670-dsi-ctrl", "qcom,mdss-dsi-ctrl";
+reg = <0x0ae94000 0x400>;
+reg-names = "dsi_ctrl";
+
+interrupt-parent = <>;
+interrupts = <4>;
+
+clocks = < DISP_CC_MDSS_B

[Freedreno] [PATCH v4 1/6] dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible

2023-10-16 Thread Richard Acayan
The SDM670 has DSI ports. Add the compatible for the controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/dsi-controller-main.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..887c7dcaf438 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -25,6 +25,7 @@ properties:
   - qcom,sc7180-dsi-ctrl
   - qcom,sc7280-dsi-ctrl
   - qcom,sdm660-dsi-ctrl
+  - qcom,sdm670-dsi-ctrl
   - qcom,sdm845-dsi-ctrl
   - qcom,sm6115-dsi-ctrl
   - qcom,sm6125-dsi-ctrl
-- 
2.42.0



[Freedreno] [PATCH v4 2/6] dt-bindings: display/msm: sdm845-dpu: Describe SDM670

2023-10-16 Thread Richard Acayan
The SDM670 display controller has the same requirements as the SDM845
display controller, despite having distinct properties as described in
the catalog. Add the compatible for SDM670 to the SDM845 controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
index b917064bdf33..dc11fd421a27 100644
--- a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
@@ -13,7 +13,9 @@ $ref: /schemas/display/msm/dpu-common.yaml#
 
 properties:
   compatible:
-const: qcom,sdm845-dpu
+enum:
+  - qcom,sdm670-dpu
+  - qcom,sdm845-dpu
 
   reg:
 items:
-- 
2.42.0



[Freedreno] [PATCH v4 0/6] SDM670 display subsystem support

2023-10-16 Thread Richard Acayan
Changes since v3 (2023100927.485054-8-mailingrad...@gmail.com):
 - move status properties down (review tag retained) (6/6)
 - accumulate review tag (3/6)

Changes since v2 (20231003012119.857198-9-mailingrad...@gmail.com):
 - rebase on series and reference generic sblk definitions (5/6)
 - add interconnects properties in example (3/6)
 - remove phy-names properties from dtsi (6/6)
 - accumulate review tags (4/6, 6/6)

Changes since v1 (20230925232625.84-9-mailingrad...@gmail.com):
 - prefix dsi1 labels with `mdss_` in example dts (3/6)
 - make all parts of catalog entry const (5/6)
 - add spaces before closing brackets on same line (5/6)
 - join opening and closing braces on the same line in dsc array (5/6)

This series adds support for the display subsystem on the Snapdragon
670. It is based on an earlier patch a few versions back, which had
missing device tree bindings and device tree changes.

There is a separate IOMMU patch which adds the MDSS compatible to a
workaround.

This series depends on https://patchwork.freedesktop.org/series/119804/.

Richard Acayan (6):
  dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible
  dt-bindings: display/msm: sdm845-dpu: Describe SDM670
  dt-bindings: display: msm: Add SDM670 MDSS
  drm/msm: mdss: add support for SDM670
  drm/msm/dpu: Add hw revision 4.1 (SDM670)
  arm64: dts: qcom: sdm670: add display subsystem

 .../display/msm/dsi-controller-main.yaml  |   1 +
 .../display/msm/qcom,sdm670-mdss.yaml | 292 ++
 .../bindings/display/msm/qcom,sdm845-dpu.yaml |   4 +-
 arch/arm64/boot/dts/qcom/sdm670.dtsi  | 292 ++
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 +++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   1 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 drivers/gpu/drm/msm/msm_mdss.c|   7 +
 9 files changed, 702 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

-- 
2.42.0



[Freedreno] [PATCH v3 6/6] arm64: dts: qcom: sdm670: add display subsystem

2023-10-09 Thread Richard Acayan
The Snapdragon 670 has a display subsystem for controlling and
outputting to the display. Add support for it in the device tree.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Richard Acayan 
---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 292 +++
 1 file changed, 292 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi 
b/arch/arm64/boot/dts/qcom/sdm670.dtsi
index 84cd2e39266f..b62b4ff4c621 100644
--- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
@@ -6,6 +6,7 @@
  * Copyright (c) 2022, Richard Acayan. All rights reserved.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -400,6 +401,30 @@ cpu6_opp10: opp-199680 {
};
};
 
+   dsi_opp_table: opp-table-dsi {
+   compatible = "operating-points-v2";
+
+   opp-1920 {
+   opp-hz = /bits/ 64 <1920>;
+   required-opps = <_opp_min_svs>;
+   };
+
+   opp-18000 {
+   opp-hz = /bits/ 64 <18000>;
+   required-opps = <_opp_low_svs>;
+   };
+
+   opp-27500 {
+   opp-hz = /bits/ 64 <27500>;
+   required-opps = <_opp_svs>;
+   };
+
+   opp-35800 {
+   opp-hz = /bits/ 64 <35800>;
+   required-opps = <_opp_svs_l1>;
+   };
+   };
+
psci {
compatible = "arm,psci-1.0";
method = "smc";
@@ -1352,6 +1377,273 @@ spmi_bus: spmi@c44 {
#interrupt-cells = <4>;
};
 
+   mdss: display-subsystem@ae0 {
+   compatible = "qcom,sdm670-mdss";
+   reg = <0 0x0ae0 0 0x1000>;
+   reg-names = "mdss";
+
+   power-domains = < MDSS_GDSC>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "core";
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interconnects = <_noc MASTER_MDP_PORT0 0 _noc 
SLAVE_EBI_CH0 0>,
+   <_noc MASTER_MDP_PORT1 0 _noc 
SLAVE_EBI_CH0 0>;
+   interconnect-names = "mdp0-mem", "mdp1-mem";
+
+   iommus = <_smmu 0x880 0x8>,
+<_smmu 0xc80 0x8>;
+
+   status = "disabled";
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   mdss_mdp: display-controller@ae01000 {
+   compatible = "qcom,sdm670-dpu";
+   reg = <0 0x0ae01000 0 0x8f000>,
+ <0 0x0aeb 0 0x2008>;
+   reg-names = "mdp", "vbif";
+
+   clocks = < GCC_DISP_AXI_CLK>,
+< DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>,
+< DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "gcc-bus", "iface", "bus", 
"core", "vsync";
+
+   assigned-clocks = < 
DISP_CC_MDSS_VSYNC_CLK>;
+   assigned-clock-rates = <1920>;
+   operating-points-v2 = <_opp_table>;
+   power-domains = < SDM670_CX>;
+
+   interrupt-parent = <>;
+   interrupts = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_dsi0_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   

[Freedreno] [PATCH v3 5/6] drm/msm/dpu: Add hw revision 4.1 (SDM670)

2023-10-09 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Since revision 4.0 is SDM845, reuse some configuration from its catalog
entry.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 ++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   1 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 4 files changed, 107 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
new file mode 100644
index ..cbbdaebe357e
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023, Richard Acayan. All rights reserved.
+ */
+
+#ifndef _DPU_4_1_SDM670_H
+#define _DPU_4_1_SDM670_H
+
+static const struct dpu_mdp_cfg sdm670_mdp = {
+   .name = "top_0",
+   .base = 0x0, .len = 0x45c,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 },
+   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 },
+   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 },
+   },
+};
+
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_1_3,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_1_3,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x1c8,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA0,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA1,
+   }, {
+   .name = "sspp_10", .id = SSPP_DMA2,
+   .base = 0x28000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 9,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA2,
+   },
+};
+
+static const struct dpu_dsc_cfg sdm670_dsc[] = {
+   {
+   .name = "dsc_0", .id = DSC_0,
+   .base = 0x8, .len = 0x140,
+   }, {
+   .name = "dsc_1", .id = DSC_1,
+   .base = 0x80400, .len = 0x140,
+   },
+};
+
+static const struct dpu_mdss_version sdm670_mdss_ver = {
+   .core_major_ver = 4,
+   .core_minor_ver = 1,
+};
+
+const struct dpu_mdss_cfg dpu_sdm670_cfg = {
+   .mdss_ver = _mdss_ver,
+   .caps = _dpu_caps,
+   .mdp = _mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .perf = _perf_data,
+};
+
+#endif
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index be461586b108..84c29de9ad81 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b

[Freedreno] [PATCH v3 2/6] dt-bindings: display/msm: sdm845-dpu: Describe SDM670

2023-10-09 Thread Richard Acayan
The SDM670 display controller has the same requirements as the SDM845
display controller, despite having distinct properties as described in
the catalog. Add the compatible for SDM670 to the SDM845 controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
index b917064bdf33..dc11fd421a27 100644
--- a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
@@ -13,7 +13,9 @@ $ref: /schemas/display/msm/dpu-common.yaml#
 
 properties:
   compatible:
-const: qcom,sdm845-dpu
+enum:
+  - qcom,sdm670-dpu
+  - qcom,sdm845-dpu
 
   reg:
 items:
-- 
2.42.0



[Freedreno] [PATCH v3 4/6] drm/msm: mdss: add support for SDM670

2023-10-09 Thread Richard Acayan
Add support for the MDSS block on the SDM670 platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Richard Acayan 
---
 drivers/gpu/drm/msm/msm_mdss.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 2e87dd6cb17b..2afb843271aa 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -551,6 +551,12 @@ static const struct msm_mdss_data sc8280xp_data = {
.macrotile_mode = 1,
 };
 
+static const struct msm_mdss_data sdm670_data = {
+   .ubwc_enc_version = UBWC_2_0,
+   .ubwc_dec_version = UBWC_2_0,
+   .highest_bank_bit = 1,
+};
+
 static const struct msm_mdss_data sdm845_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
@@ -609,6 +615,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,mdss" },
{ .compatible = "qcom,msm8998-mdss", .data = _data },
{ .compatible = "qcom,qcm2290-mdss", .data = _data },
+   { .compatible = "qcom,sdm670-mdss", .data = _data },
{ .compatible = "qcom,sdm845-mdss", .data = _data },
{ .compatible = "qcom,sc7180-mdss", .data = _data },
{ .compatible = "qcom,sc7280-mdss", .data = _data },
-- 
2.42.0



[Freedreno] [PATCH v3 3/6] dt-bindings: display: msm: Add SDM670 MDSS

2023-10-09 Thread Richard Acayan
Add documentation for the SDM670 display subsystem, adapted from the
SDM845 and SM6125 documentation.

Signed-off-by: Richard Acayan 
---
 .../display/msm/qcom,sdm670-mdss.yaml | 292 ++
 1 file changed, 292 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
new file mode 100644
index ..7dc269322b8e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
@@ -0,0 +1,292 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sdm670-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SDM670 Display MDSS
+
+maintainers:
+  - Richard Acayan 
+
+description:
+  SDM670 MSM Mobile Display Subsystem (MDSS), which encapsulates sub-blocks
+  like DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sdm670-mdss
+
+  clocks:
+items:
+  - description: Display AHB clock from gcc
+  - description: Display core clock
+
+  clock-names:
+items:
+  - const: iface
+  - const: core
+
+  iommus:
+maxItems: 2
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dpu
+
+  "^displayport-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dp
+
+  "^dsi@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+contains:
+  const: qcom,sdm670-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,dsi-phy-10nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sdm670-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+power-domains = < MDSS_GDSC>;
+
+clocks = < GCC_DISP_AHB_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>;
+clock-names = "iface", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+interconnects = <_noc MASTER_MDP_PORT0 0 _noc SLAVE_EBI_CH0 
0>,
+<_noc MASTER_MDP_PORT1 0 _noc SLAVE_EBI_CH0 
0>;
+interconnect-names = "mdp0-mem", "mdp1-mem";
+
+iommus = <_smmu 0x880 0x8>,
+ <_smmu 0xc80 0x8>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sdm670-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = < GCC_DISP_AXI_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>,
+ < DISP_CC_MDSS_VSYNC_CLK>;
+clock-names = "gcc-bus", "iface", "bus", "core", "vsync";
+
+interrupt-parent = <>;
+interrupts = <0>;
+power-domains = < SDM670_CX>;
+operating-points-v2 = <_opp_table>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_dsi0_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_dsi1_in>;
+};
+};
+};
+};
+
+dsi@ae94000 {
+compatible = "qcom,sdm670-dsi-ctrl", "qcom,mdss-dsi-ctrl";
+reg = <0x0ae94000 0x400>;
+reg-names = "dsi_ctrl";
+
+interrupt-parent = <>;
+interrupts = <4>;
+
+clocks = < DISP_CC_MDSS_BYTE0_CLK>,
+ 

[Freedreno] [PATCH v3 1/6] dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible

2023-10-09 Thread Richard Acayan
The SDM670 has DSI ports. Add the compatible for the controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/dsi-controller-main.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..887c7dcaf438 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -25,6 +25,7 @@ properties:
   - qcom,sc7180-dsi-ctrl
   - qcom,sc7280-dsi-ctrl
   - qcom,sdm660-dsi-ctrl
+  - qcom,sdm670-dsi-ctrl
   - qcom,sdm845-dsi-ctrl
   - qcom,sm6115-dsi-ctrl
   - qcom,sm6125-dsi-ctrl
-- 
2.42.0



[Freedreno] [PATCH v3 0/6] SDM670 display subsystem support

2023-10-09 Thread Richard Acayan
Changes since v2 (20231003012119.857198-9-mailingrad...@gmail.com):
 - rebase on series and reference generic sblk definitions (5/6)
 - add interconnects properties in example (3/6)
 - remove phy-names properties from dtsi (6/6)
 - accumulate review tags (4/6, 6/6)

Changes since v1 (20230925232625.84-9-mailingrad...@gmail.com):
 - prefix dsi1 labels with `mdss_` in example dts (3/6)
 - make all parts of catalog entry const (5/6)
 - add spaces before closing brackets on same line (5/6)
 - join opening and closing braces on the same line in dsc array (5/6)

This series adds support for the display subsystem on the Snapdragon
670. It is based on an earlier patch a few versions back, which had
missing device tree bindings and device tree changes.

There is a separate IOMMU patch which adds the MDSS compatible to a
workaround.

This series depends on https://patchwork.freedesktop.org/series/119804/.

Richard Acayan (6):
  dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible
  dt-bindings: display/msm: sdm845-dpu: Describe SDM670
  dt-bindings: display: msm: Add SDM670 MDSS
  drm/msm: mdss: add support for SDM670
  drm/msm/dpu: Add hw revision 4.1 (SDM670)
  arm64: dts: qcom: sdm670: add display subsystem

 .../display/msm/dsi-controller-main.yaml  |   1 +
 .../display/msm/qcom,sdm670-mdss.yaml | 292 ++
 .../bindings/display/msm/qcom,sdm845-dpu.yaml |   4 +-
 arch/arm64/boot/dts/qcom/sdm670.dtsi  | 292 ++
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 +++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   1 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 drivers/gpu/drm/msm/msm_mdss.c|   7 +
 9 files changed, 702 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

-- 
2.42.0



[Freedreno] [PATCH v2 4/6] drm/msm: mdss: add support for SDM670

2023-10-02 Thread Richard Acayan
Add support for the MDSS block on the SDM670 platform.

Signed-off-by: Richard Acayan 
---
 drivers/gpu/drm/msm/msm_mdss.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 2e87dd6cb17b..2afb843271aa 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -551,6 +551,12 @@ static const struct msm_mdss_data sc8280xp_data = {
.macrotile_mode = 1,
 };
 
+static const struct msm_mdss_data sdm670_data = {
+   .ubwc_enc_version = UBWC_2_0,
+   .ubwc_dec_version = UBWC_2_0,
+   .highest_bank_bit = 1,
+};
+
 static const struct msm_mdss_data sdm845_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
@@ -609,6 +615,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,mdss" },
{ .compatible = "qcom,msm8998-mdss", .data = _data },
{ .compatible = "qcom,qcm2290-mdss", .data = _data },
+   { .compatible = "qcom,sdm670-mdss", .data = _data },
{ .compatible = "qcom,sdm845-mdss", .data = _data },
{ .compatible = "qcom,sc7180-mdss", .data = _data },
{ .compatible = "qcom,sc7280-mdss", .data = _data },
-- 
2.42.0



[Freedreno] [PATCH v2 6/6] arm64: dts: qcom: sdm670: add display subsystem

2023-10-02 Thread Richard Acayan
The Snapdragon 670 has a display subsystem for controlling and
outputting to the display. Add support for it in the device tree.

Signed-off-by: Richard Acayan 
---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 294 +++
 1 file changed, 294 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi 
b/arch/arm64/boot/dts/qcom/sdm670.dtsi
index 84cd2e39266f..427415ed4e4a 100644
--- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
@@ -6,6 +6,7 @@
  * Copyright (c) 2022, Richard Acayan. All rights reserved.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -400,6 +401,30 @@ cpu6_opp10: opp-199680 {
};
};
 
+   dsi_opp_table: opp-table-dsi {
+   compatible = "operating-points-v2";
+
+   opp-1920 {
+   opp-hz = /bits/ 64 <1920>;
+   required-opps = <_opp_min_svs>;
+   };
+
+   opp-18000 {
+   opp-hz = /bits/ 64 <18000>;
+   required-opps = <_opp_low_svs>;
+   };
+
+   opp-27500 {
+   opp-hz = /bits/ 64 <27500>;
+   required-opps = <_opp_svs>;
+   };
+
+   opp-35800 {
+   opp-hz = /bits/ 64 <35800>;
+   required-opps = <_opp_svs_l1>;
+   };
+   };
+
psci {
compatible = "arm,psci-1.0";
method = "smc";
@@ -1352,6 +1377,275 @@ spmi_bus: spmi@c44 {
#interrupt-cells = <4>;
};
 
+   mdss: display-subsystem@ae0 {
+   compatible = "qcom,sdm670-mdss";
+   reg = <0 0x0ae0 0 0x1000>;
+   reg-names = "mdss";
+
+   power-domains = < MDSS_GDSC>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "core";
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interconnects = <_noc MASTER_MDP_PORT0 0 _noc 
SLAVE_EBI_CH0 0>,
+   <_noc MASTER_MDP_PORT1 0 _noc 
SLAVE_EBI_CH0 0>;
+   interconnect-names = "mdp0-mem", "mdp1-mem";
+
+   iommus = <_smmu 0x880 0x8>,
+<_smmu 0xc80 0x8>;
+
+   status = "disabled";
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   mdss_mdp: display-controller@ae01000 {
+   compatible = "qcom,sdm670-dpu";
+   reg = <0 0x0ae01000 0 0x8f000>,
+ <0 0x0aeb 0 0x2008>;
+   reg-names = "mdp", "vbif";
+
+   clocks = < GCC_DISP_AXI_CLK>,
+< DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>,
+< DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "gcc-bus", "iface", "bus", 
"core", "vsync";
+
+   assigned-clocks = < 
DISP_CC_MDSS_VSYNC_CLK>;
+   assigned-clock-rates = <1920>;
+   operating-points-v2 = <_opp_table>;
+   power-domains = < SDM670_CX>;
+
+   interrupt-parent = <>;
+   interrupts = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_dsi0_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   dpu_intf1_out: e

[Freedreno] [PATCH v2 5/6] drm/msm/dpu: Add hw revision 4.1 (SDM670)

2023-10-02 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Since revision 4.0 is SDM845, reuse some configuration from its catalog
entry.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 ++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   6 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 4 files changed, 112 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
new file mode 100644
index ..01a9aec1c956
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
@@ -0,0 +1,104 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023, Richard Acayan. All rights reserved.
+ */
+
+#ifndef _DPU_4_1_SDM670_H
+#define _DPU_4_1_SDM670_H
+
+static const struct dpu_mdp_cfg sdm670_mdp = {
+   .name = "top_0",
+   .base = 0x0, .len = 0x45c,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0 },
+   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0 },
+   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8 },
+   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8 },
+   },
+};
+
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_0,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_1,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x1c8,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_0,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA0,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_1,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA1,
+   }, {
+   .name = "sspp_10", .id = SSPP_DMA2,
+   .base = 0x28000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_2,
+   .xin_id = 9,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA2,
+   },
+};
+
+static const struct dpu_dsc_cfg sdm670_dsc[] = {
+   {
+   .name = "dsc_0", .id = DSC_0,
+   .base = 0x8, .len = 0x140,
+   }, {
+   .name = "dsc_1", .id = DSC_1,
+   .base = 0x80400, .len = 0x140,
+   },
+};
+
+static const struct dpu_mdss_version sdm670_mdss_ver = {
+   .core_major_ver = 4,
+   .core_minor_ver = 1,
+};
+
+const struct dpu_mdss_cfg dpu_sdm670_cfg = {
+   .mdss_ver = _mdss_ver,
+   .caps = _dpu_caps,
+   .mdp = _mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .perf = _perf_data,
+};
+
+#endif
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 713dfc079718..63b274ae032a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers

[Freedreno] [PATCH v2 3/6] dt-bindings: display: msm: Add SDM670 MDSS

2023-10-02 Thread Richard Acayan
Add documentation for the SDM670 display subsystem, adapted from the
SDM845 and SM6125 documentation.

Signed-off-by: Richard Acayan 
---
 .../display/msm/qcom,sdm670-mdss.yaml | 287 ++
 1 file changed, 287 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
new file mode 100644
index ..9995b018cd9e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
@@ -0,0 +1,287 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sdm670-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SDM670 Display MDSS
+
+maintainers:
+  - Richard Acayan 
+
+description:
+  SDM670 MSM Mobile Display Subsystem (MDSS), which encapsulates sub-blocks
+  like DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sdm670-mdss
+
+  clocks:
+items:
+  - description: Display AHB clock from gcc
+  - description: Display core clock
+
+  clock-names:
+items:
+  - const: iface
+  - const: core
+
+  iommus:
+maxItems: 2
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dpu
+
+  "^displayport-controller@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,sdm670-dp
+
+  "^dsi@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+contains:
+  const: qcom,sdm670-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+additionalProperties: true
+
+properties:
+  compatible:
+const: qcom,dsi-phy-10nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sdm670-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+power-domains = < MDSS_GDSC>;
+
+clocks = < GCC_DISP_AHB_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>;
+clock-names = "iface", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+iommus = <_smmu 0x880 0x8>,
+ <_smmu 0xc80 0x8>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sdm670-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = < GCC_DISP_AXI_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>,
+ < DISP_CC_MDSS_VSYNC_CLK>;
+clock-names = "gcc-bus", "iface", "bus", "core", "vsync";
+
+interrupt-parent = <>;
+interrupts = <0>;
+power-domains = < SDM670_CX>;
+operating-points-v2 = <_opp_table>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_dsi0_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_dsi1_in>;
+};
+};
+};
+};
+
+dsi@ae94000 {
+compatible = "qcom,sdm670-dsi-ctrl", "qcom,mdss-dsi-ctrl";
+reg = <0x0ae94000 0x400>;
+reg-names = "dsi_ctrl";
+
+interrupt-parent = <>;
+interrupts = <4>;
+
+clocks = < DISP_CC_MDSS_BYTE0_CLK>,
+ < DISP_CC_MDSS_BYTE0_INTF_CLK>,
+ < DISP_CC_MDSS_PCLK0_CLK>,
+ < DISP_CC_MDSS_ESC0_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>;
+

[Freedreno] [PATCH v2 2/6] dt-bindings: display/msm: sdm845-dpu: Describe SDM670

2023-10-02 Thread Richard Acayan
The SDM670 display controller has the same requirements as the SDM845
display controller, despite having distinct properties as described in
the catalog. Add the compatible for SDM670 to the SDM845 controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
index b917064bdf33..dc11fd421a27 100644
--- a/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm845-dpu.yaml
@@ -13,7 +13,9 @@ $ref: /schemas/display/msm/dpu-common.yaml#
 
 properties:
   compatible:
-const: qcom,sdm845-dpu
+enum:
+  - qcom,sdm670-dpu
+  - qcom,sdm845-dpu
 
   reg:
 items:
-- 
2.42.0



[Freedreno] [PATCH v2 1/6] dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible

2023-10-02 Thread Richard Acayan
The SDM670 has DSI ports. Add the compatible for the controller.

Acked-by: Rob Herring 
Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/dsi-controller-main.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..887c7dcaf438 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -25,6 +25,7 @@ properties:
   - qcom,sc7180-dsi-ctrl
   - qcom,sc7280-dsi-ctrl
   - qcom,sdm660-dsi-ctrl
+  - qcom,sdm670-dsi-ctrl
   - qcom,sdm845-dsi-ctrl
   - qcom,sm6115-dsi-ctrl
   - qcom,sm6125-dsi-ctrl
-- 
2.42.0



[Freedreno] [PATCH v2 0/6] SDM670 display subsystem support

2023-10-02 Thread Richard Acayan
Changes since v1 (20230925232625.84-9-mailingrad...@gmail.com):
 - prefix dsi1 labels with `mdss_` in example dts (3/6)
 - make all parts of catalog entry const (5/6)
 - add spaces before closing brackets on same line (5/6)
 - join opening and closing braces on the same line in dsc array (5/6)

This series adds support for the display subsystem on the Snapdragon
670. It is based on an earlier patch a few versions back, which had
missing device tree bindings and device tree changes.

There is a separate IOMMU patch which adds the MDSS compatible to a
workaround.

Richard Acayan (6):
  dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible
  dt-bindings: display/msm: sdm845-dpu: Describe SDM670
  dt-bindings: display: msm: Add SDM670 MDSS
  drm/msm: mdss: add support for SDM670
  drm/msm/dpu: Add hw revision 4.1 (SDM670)
  arm64: dts: qcom: sdm670: add display subsystem

 .../display/msm/dsi-controller-main.yaml  |   1 +
 .../display/msm/qcom,sdm670-mdss.yaml | 287 +
 .../bindings/display/msm/qcom,sdm845-dpu.yaml |   4 +-
 arch/arm64/boot/dts/qcom/sdm670.dtsi  | 294 ++
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 104 +++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   6 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 drivers/gpu/drm/msm/msm_mdss.c|   7 +
 9 files changed, 704 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

-- 
2.42.0



Re: [Freedreno] [PATCH 5/6] drm/msm/dpu: Add hw revision 4.1 (SDM670)

2023-10-02 Thread Richard Acayan
On Mon, Sep 25, 2023 at 07:26:32PM -0400, Richard Acayan wrote:
> The Snapdragon 670 uses similar clocks (with one frequency added) to the
> Snapdragon 845 but reports DPU revision 4.1. Add support for this DPU
> with configuration from the Pixel 3a downstream kernel.
>
> Since revision 4.0 is SDM845, reuse some configuration from its catalog
> entry.
>
> Link: 
> https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
> Signed-off-by: Richard Acayan 
> ---
>  .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 105 ++
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   6 +
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
>  4 files changed, 113 insertions(+)
>  create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h 
> b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
> new file mode 100644
> index ..eaccb16b5db9
> --- /dev/null
> +++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
> @@ -0,0 +1,105 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
> + * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) 2023, Richard Acayan. All rights reserved.
> + */
> +
> +#ifndef _DPU_4_1_SDM670_H
> +#define _DPU_4_1_SDM670_H
> +
> +static const struct dpu_mdp_cfg sdm670_mdp = {
> + .name = "top_0",
> + .base = 0x0, .len = 0x45c,
> + .features = BIT(DPU_MDP_AUDIO_SELECT),
> + .clk_ctrls = {
> + [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0},
> + [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0},
> + [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8},
> + [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8},
> + [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8},
> + },
> +};
> +
> +static const struct dpu_sspp_cfg sdm670_sspp[] = {
> + {
> + .name = "sspp_0", .id = SSPP_VIG0,
> + .base = 0x4000, .len = 0x1c8,
> + .features = VIG_SDM845_MASK_SDMA,
> + .sblk = _vig_sblk_0,
> + .xin_id = 0,
> + .type = SSPP_TYPE_VIG,
> + .clk_ctrl = DPU_CLK_CTRL_VIG0,
> + }, {
> + .name = "sspp_1", .id = SSPP_VIG1,
> + .base = 0x6000, .len = 0x1c8,
> + .features = VIG_SDM845_MASK_SDMA,
> + .sblk = _vig_sblk_1,
> + .xin_id = 4,
> + .type = SSPP_TYPE_VIG,
> + .clk_ctrl = DPU_CLK_CTRL_VIG0,
> + }, {
> + .name = "sspp_8", .id = SSPP_DMA0,
> + .base = 0x24000, .len = 0x1c8,
> + .features = DMA_SDM845_MASK_SDMA,
> + .sblk = _dma_sblk_0,
> + .xin_id = 1,
> + .type = SSPP_TYPE_DMA,
> + .clk_ctrl = DPU_CLK_CTRL_DMA0,
> + }, {
> + .name = "sspp_9", .id = SSPP_DMA1,
> + .base = 0x26000, .len = 0x1c8,
> + .features = DMA_CURSOR_SDM845_MASK_SDMA,
> + .sblk = _dma_sblk_1,
> + .xin_id = 5,
> + .type = SSPP_TYPE_DMA,
> + .clk_ctrl = DPU_CLK_CTRL_DMA1,
> + }, {
> + .name = "sspp_10", .id = SSPP_DMA2,
> + .base = 0x28000, .len = 0x1c8,
> + .features = DMA_CURSOR_SDM845_MASK_SDMA,
> + .sblk = _dma_sblk_2,
> + .xin_id = 9,
> + .type = SSPP_TYPE_DMA,
> + .clk_ctrl = DPU_CLK_CTRL_DMA2,
> + },
> +};
> +
> +static struct dpu_dsc_cfg sdm670_dsc[] = {
> + {
> + .name = "dsc_0", .id = DSC_0,
> + .base = 0x8, .len = 0x140,
> + },
> + {

Let's join these braces on the same line.

> + .name = "dsc_1", .id = DSC_1,
> + .base = 0x80400, .len = 0x140,
> + },
> +};
> +
> +static struct dpu_mdss_version sdm670_mdss_ver = {
> + .core_major_ver = 4,
> + .core_minor_ver = 1,
> +};
> +
> +const struct dpu_mdss_cfg dpu_sdm670_cfg = {
> + .mdss_ver = _mdss_ver,
> + .caps = _dpu_caps,
> + .mdp = _mdp,
> + .ctl_count = ARRAY_SIZE(sdm845_ctl),
> + .ctl = sdm845_ctl,
> + .sspp_count = ARRAY_SIZE(sdm670_sspp),
> + .sspp = sdm670_sspp,
> + .mixer_count = ARRAY_SIZE(sdm845_lm),
> + .mixer = sdm845_lm,
> + .pi

[Freedreno] [PATCH 6/6] arm64: dts: qcom: sdm670: add display subsystem

2023-09-25 Thread Richard Acayan
The Snapdragon 670 has a display subsystem for controlling and
outputting to the display. Add support for it in the device tree.

Signed-off-by: Richard Acayan 
---
 arch/arm64/boot/dts/qcom/sdm670.dtsi | 294 +++
 1 file changed, 294 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm670.dtsi 
b/arch/arm64/boot/dts/qcom/sdm670.dtsi
index 84cd2e39266f..427415ed4e4a 100644
--- a/arch/arm64/boot/dts/qcom/sdm670.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm670.dtsi
@@ -6,6 +6,7 @@
  * Copyright (c) 2022, Richard Acayan. All rights reserved.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -400,6 +401,30 @@ cpu6_opp10: opp-199680 {
};
};
 
+   dsi_opp_table: opp-table-dsi {
+   compatible = "operating-points-v2";
+
+   opp-1920 {
+   opp-hz = /bits/ 64 <1920>;
+   required-opps = <_opp_min_svs>;
+   };
+
+   opp-18000 {
+   opp-hz = /bits/ 64 <18000>;
+   required-opps = <_opp_low_svs>;
+   };
+
+   opp-27500 {
+   opp-hz = /bits/ 64 <27500>;
+   required-opps = <_opp_svs>;
+   };
+
+   opp-35800 {
+   opp-hz = /bits/ 64 <35800>;
+   required-opps = <_opp_svs_l1>;
+   };
+   };
+
psci {
compatible = "arm,psci-1.0";
method = "smc";
@@ -1352,6 +1377,275 @@ spmi_bus: spmi@c44 {
#interrupt-cells = <4>;
};
 
+   mdss: display-subsystem@ae0 {
+   compatible = "qcom,sdm670-mdss";
+   reg = <0 0x0ae0 0 0x1000>;
+   reg-names = "mdss";
+
+   power-domains = < MDSS_GDSC>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_MDP_CLK>;
+   clock-names = "iface", "core";
+
+   interrupts = ;
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interconnects = <_noc MASTER_MDP_PORT0 0 _noc 
SLAVE_EBI_CH0 0>,
+   <_noc MASTER_MDP_PORT1 0 _noc 
SLAVE_EBI_CH0 0>;
+   interconnect-names = "mdp0-mem", "mdp1-mem";
+
+   iommus = <_smmu 0x880 0x8>,
+<_smmu 0xc80 0x8>;
+
+   status = "disabled";
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   mdss_mdp: display-controller@ae01000 {
+   compatible = "qcom,sdm670-dpu";
+   reg = <0 0x0ae01000 0 0x8f000>,
+ <0 0x0aeb 0 0x2008>;
+   reg-names = "mdp", "vbif";
+
+   clocks = < GCC_DISP_AXI_CLK>,
+< DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_AXI_CLK>,
+< DISP_CC_MDSS_MDP_CLK>,
+< DISP_CC_MDSS_VSYNC_CLK>;
+   clock-names = "gcc-bus", "iface", "bus", 
"core", "vsync";
+
+   assigned-clocks = < 
DISP_CC_MDSS_VSYNC_CLK>;
+   assigned-clock-rates = <1920>;
+   operating-points-v2 = <_opp_table>;
+   power-domains = < SDM670_CX>;
+
+   interrupt-parent = <>;
+   interrupts = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_dsi0_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+   dpu_intf1_out: e

[Freedreno] [PATCH 4/6] drm/msm: mdss: add support for SDM670

2023-09-25 Thread Richard Acayan
Add support for the MDSS block on the SDM670 platform.

Signed-off-by: Richard Acayan 
---
 drivers/gpu/drm/msm/msm_mdss.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 2e87dd6cb17b..2afb843271aa 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -551,6 +551,12 @@ static const struct msm_mdss_data sc8280xp_data = {
.macrotile_mode = 1,
 };
 
+static const struct msm_mdss_data sdm670_data = {
+   .ubwc_enc_version = UBWC_2_0,
+   .ubwc_dec_version = UBWC_2_0,
+   .highest_bank_bit = 1,
+};
+
 static const struct msm_mdss_data sdm845_data = {
.ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0,
@@ -609,6 +615,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,mdss" },
{ .compatible = "qcom,msm8998-mdss", .data = _data },
{ .compatible = "qcom,qcm2290-mdss", .data = _data },
+   { .compatible = "qcom,sdm670-mdss", .data = _data },
{ .compatible = "qcom,sdm845-mdss", .data = _data },
{ .compatible = "qcom,sc7180-mdss", .data = _data },
{ .compatible = "qcom,sc7280-mdss", .data = _data },
-- 
2.42.0



[Freedreno] [PATCH 5/6] drm/msm/dpu: Add hw revision 4.1 (SDM670)

2023-09-25 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Since revision 4.0 is SDM845, reuse some configuration from its catalog
entry.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 105 ++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   6 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 4 files changed, 113 insertions(+)
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
new file mode 100644
index ..eaccb16b5db9
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023, Richard Acayan. All rights reserved.
+ */
+
+#ifndef _DPU_4_1_SDM670_H
+#define _DPU_4_1_SDM670_H
+
+static const struct dpu_mdp_cfg sdm670_mdp = {
+   .name = "top_0",
+   .base = 0x0, .len = 0x45c,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x2ac, .bit_off = 0},
+   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x2b4, .bit_off = 0},
+   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x2ac, .bit_off = 8},
+   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x2b4, .bit_off = 8},
+   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x2bc, .bit_off = 8},
+   },
+};
+
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_0,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x1c8,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_1,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x1c8,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_0,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA0,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_1,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA1,
+   }, {
+   .name = "sspp_10", .id = SSPP_DMA2,
+   .base = 0x28000, .len = 0x1c8,
+   .features = DMA_CURSOR_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk_2,
+   .xin_id = 9,
+   .type = SSPP_TYPE_DMA,
+   .clk_ctrl = DPU_CLK_CTRL_DMA2,
+   },
+};
+
+static struct dpu_dsc_cfg sdm670_dsc[] = {
+   {
+   .name = "dsc_0", .id = DSC_0,
+   .base = 0x8, .len = 0x140,
+   },
+   {
+   .name = "dsc_1", .id = DSC_1,
+   .base = 0x80400, .len = 0x140,
+   },
+};
+
+static struct dpu_mdss_version sdm670_mdss_ver = {
+   .core_major_ver = 4,
+   .core_minor_ver = 1,
+};
+
+const struct dpu_mdss_cfg dpu_sdm670_cfg = {
+   .mdss_ver = _mdss_ver,
+   .caps = _dpu_caps,
+   .mdp = _mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .perf = _perf_data,
+};
+
+#endif
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 713dfc079718..63b274ae032a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers

[Freedreno] [PATCH 3/6] dt-bindings: display: msm: Add SDM670 MDSS

2023-09-25 Thread Richard Acayan
Add documentation for the SDM670 display subsystem, adapted from the
SDM845 and SM6125 documentation.

Signed-off-by: Richard Acayan 
---
 .../display/msm/qcom,sdm670-mdss.yaml | 280 ++
 1 file changed, 280 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
new file mode 100644
index ..839b372759ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
@@ -0,0 +1,280 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sdm670-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SDM670 Display MDSS
+
+maintainers:
+  - Richard Acayan 
+
+description:
+  SDM670 MSM Mobile Display Subsystem (MDSS), which encapsulates sub-blocks
+  like DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sdm670-mdss
+
+  clocks:
+items:
+  - description: Display AHB clock from gcc
+  - description: Display core clock
+
+  clock-names:
+items:
+  - const: iface
+  - const: core
+
+  iommus:
+maxItems: 2
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sdm670-dpu
+
+  "^displayport-controller@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sdm670-dp
+
+  "^dsi@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+items:
+  - const: qcom,sdm670-dsi-ctrl
+  - const: qcom,mdss-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,dsi-phy-10nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sdm670-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+power-domains = < MDSS_GDSC>;
+
+clocks = < GCC_DISP_AHB_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>;
+clock-names = "iface", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+iommus = <_smmu 0x880 0x8>,
+ <_smmu 0xc80 0x8>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sdm670-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = < GCC_DISP_AXI_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>,
+ < DISP_CC_MDSS_MDP_CLK>,
+ < DISP_CC_MDSS_VSYNC_CLK>;
+clock-names = "gcc-bus", "iface", "bus", "core", "vsync";
+
+interrupt-parent = <>;
+interrupts = <0>;
+power-domains = < SDM670_CX>;
+operating-points-v2 = <_opp_table>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_dsi0_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_dsi1_in>;
+};
+};
+};
+};
+
+dsi@ae94000 {
+compatible = "qcom,sdm670-dsi-ctrl", "qcom,mdss-dsi-ctrl";
+reg = <0x0ae94000 0x400>;
+reg-names = "dsi_ctrl";
+
+interrupt-parent = <>;
+interrupts = <4>;
+
+clocks = < DISP_CC_MDSS_BYTE0_CLK>,
+ < DISP_CC_MDSS_BYTE0_INTF_CLK>,
+ < DISP_CC_MDSS_PCLK0_CLK>,
+ < DISP_CC_MDSS_ESC0_CLK>,
+ < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_AXI_CLK>;
+clock-names = "byte",
+  "byte_intf",
+   

[Freedreno] [PATCH 1/6] dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible

2023-09-25 Thread Richard Acayan
The SDM670 has DSI ports. Add the compatible for the controller.

Signed-off-by: Richard Acayan 
---
 .../devicetree/bindings/display/msm/dsi-controller-main.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..887c7dcaf438 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -25,6 +25,7 @@ properties:
   - qcom,sc7180-dsi-ctrl
   - qcom,sc7280-dsi-ctrl
   - qcom,sdm660-dsi-ctrl
+  - qcom,sdm670-dsi-ctrl
   - qcom,sdm845-dsi-ctrl
   - qcom,sm6115-dsi-ctrl
   - qcom,sm6125-dsi-ctrl
-- 
2.42.0



[Freedreno] [PATCH 0/6] SDM670 display subsystem support

2023-09-25 Thread Richard Acayan
This series adds support for the display subsystem on the Snapdragon
670. It is based on an earlier patch a few versions back, which had
missing device tree bindings and device tree changes.

There is a separate IOMMU patch which adds the MDSS compatible to a
workaround.

Richard Acayan (6):
  dt-bindings: display/msm: dsi-controller-main: add SDM670 compatible
  dt-bindings: display/msm: sdm845-dpu: Describe SDM670
  dt-bindings: display: msm: Add SDM670 MDSS
  drm/msm: mdss: add support for SDM670
  drm/msm/dpu: Add hw revision 4.1 (SDM670)
  arm64: dts: qcom: sdm670: add display subsystem

 .../display/msm/dsi-controller-main.yaml  |   1 +
 .../display/msm/qcom,sdm670-mdss.yaml | 280 +
 .../bindings/display/msm/qcom,sdm845-dpu.yaml |   4 +-
 arch/arm64/boot/dts/qcom/sdm670.dtsi  | 294 ++
 .../msm/disp/dpu1/catalog/dpu_4_1_sdm670.h| 105 +++
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c|   6 +
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h|   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |   1 +
 drivers/gpu/drm/msm/msm_mdss.c|   7 +
 9 files changed, 698 insertions(+), 1 deletion(-)
 create mode 100644 
Documentation/devicetree/bindings/display/msm/qcom,sdm670-mdss.yaml
 create mode 100644 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_4_1_sdm670.h

-- 
2.42.0



[Freedreno] [PATCH v2] drm/msm/dpu: add hw revision 410

2023-01-12 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1.0. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
Changes since v1:
 - proper use of DSC_BLK()

 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 67 +++
 1 file changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 0f3da480b066..56709d508a6f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -504,6 +504,25 @@ static const struct dpu_mdp_cfg msm8998_mdp[] = {
},
 };
 
+static const struct dpu_mdp_cfg sdm670_mdp[] = {
+   {
+   .name = "top_0", .id = MDP_TOP,
+   .base = 0x0, .len = 0x45C,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .highest_bank_bit = 0x1,
+   .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
+   .reg_off = 0x2AC, .bit_off = 0},
+   .clk_ctrls[DPU_CLK_CTRL_VIG1] = {
+   .reg_off = 0x2B4, .bit_off = 0},
+   .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
+   .reg_off = 0x2AC, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
+   .reg_off = 0x2B4, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
+   .reg_off = 0x2BC, .bit_off = 8},
+   },
+};
+
 static const struct dpu_mdp_cfg sdm845_mdp[] = {
{
.name = "top_0", .id = MDP_TOP,
@@ -1154,6 +1173,11 @@ static const struct dpu_sspp_sub_blks sdm845_dma_sblk_1 
= _DMA_SBLK("9", 2);
 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_2 = _DMA_SBLK("10", 3);
 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_3 = _DMA_SBLK("11", 4);
 
+static const struct dpu_sspp_sub_blks sdm670_vig_sblk_0 =
+   _VIG_SBLK("0", 4, DPU_SSPP_SCALER_QSEED3);
+static const struct dpu_sspp_sub_blks sdm670_vig_sblk_1 =
+   _VIG_SBLK("1", 5, DPU_SSPP_SCALER_QSEED3);
+
 #define SSPP_BLK(_name, _id, _base, _features, \
_sblk, _xinid, _type, _clkctrl) \
{ \
@@ -1185,6 +1209,19 @@ static const struct dpu_sspp_cfg msm8998_sspp[] = {
sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
 };
 
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
+   sdm670_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
+   SSPP_BLK("sspp_1", SSPP_VIG1, 0x6000, VIG_SDM845_MASK,
+   sdm670_vig_sblk_1, 4,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG1),
+   SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000,  DMA_SDM845_MASK,
+   sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
+   SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
+   SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
+};
+
 static const struct dpu_sspp_cfg sdm845_sspp[] = {
SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
sdm845_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
@@ -1832,6 +1869,11 @@ static struct dpu_dsc_cfg sm8150_dsc[] = {
DSC_BLK("dsc_3", DSC_3, 0x80c00, BIT(DPU_DSC_OUTPUT_CTRL)),
 };
 
+static struct dpu_dsc_cfg sdm670_dsc[] = {
+   DSC_BLK("dsc_0", DSC_0, 0x8, 0),
+   DSC_BLK("dsc_1", DSC_1, 0x80400, 0),
+};
+
 /*
  * INTF sub blocks config
  */
@@ -2533,6 +2575,30 @@ static const struct dpu_mdss_cfg msm8998_dpu_cfg = {
.mdss_irqs = IRQ_SM8250_MASK,
 };
 
+static const struct dpu_mdss_cfg sdm670_dpu_cfg = {
+   .caps = _dpu_caps,
+   .mdp_count = ARRAY_SIZE(sdm670_mdp),
+   .mdp = sdm670_mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .reg_dma_count = 1,
+   .dma_cfg = _regdma,
+   .perf = _perf_data,
+   .mdss_irqs = IRQ_SDM845_MASK,
+};
+
 stati

Re: [Freedreno] [PATCH] drm/msm/dpu: add hw revision 410

2023-01-12 Thread Richard Acayan
On Thu, Jan 12, 2023 at 08:54:20PM -0500, Richard Acayan wrote:
> The Snapdragon 670 uses similar clocks (with one frequency added) to the
> Snapdragon 845 but reports DPU revision 4.1.0. Add support for this DPU
> with configuration from the Pixel 3a downstream kernel.
>
> Link: 
> https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
> Signed-off-by: Richard Acayan 
> ---
>  .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 67 +++
>  1 file changed, 67 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> index 0f3da480b066..6a077a9ef7a0 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
> @@ -504,6 +504,25 @@ static const struct dpu_mdp_cfg msm8998_mdp[] = {
>   },
>  };
>  
> +static const struct dpu_mdp_cfg sdm670_mdp[] = {
> + {
> + .name = "top_0", .id = MDP_TOP,
> + .base = 0x0, .len = 0x45C,
> + .features = BIT(DPU_MDP_AUDIO_SELECT),
> + .highest_bank_bit = 0x1,
> + .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
> + .reg_off = 0x2AC, .bit_off = 0},
> + .clk_ctrls[DPU_CLK_CTRL_VIG1] = {
> + .reg_off = 0x2B4, .bit_off = 0},
> + .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
> + .reg_off = 0x2AC, .bit_off = 8},
> + .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
> + .reg_off = 0x2B4, .bit_off = 8},
> + .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
> + .reg_off = 0x2BC, .bit_off = 8},
> + },
> +};
> +
>  static const struct dpu_mdp_cfg sdm845_mdp[] = {
>   {
>   .name = "top_0", .id = MDP_TOP,
> @@ -1154,6 +1173,11 @@ static const struct dpu_sspp_sub_blks 
> sdm845_dma_sblk_1 = _DMA_SBLK("9", 2);
>  static const struct dpu_sspp_sub_blks sdm845_dma_sblk_2 = _DMA_SBLK("10", 3);
>  static const struct dpu_sspp_sub_blks sdm845_dma_sblk_3 = _DMA_SBLK("11", 4);
>  
> +static const struct dpu_sspp_sub_blks sdm670_vig_sblk_0 =
> + _VIG_SBLK("0", 4, DPU_SSPP_SCALER_QSEED3);
> +static const struct dpu_sspp_sub_blks sdm670_vig_sblk_1 =
> + _VIG_SBLK("1", 5, DPU_SSPP_SCALER_QSEED3);
> +
>  #define SSPP_BLK(_name, _id, _base, _features, \
>   _sblk, _xinid, _type, _clkctrl) \
>   { \
> @@ -1185,6 +1209,19 @@ static const struct dpu_sspp_cfg msm8998_sspp[] = {
>   sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
>  };
>  
> +static const struct dpu_sspp_cfg sdm670_sspp[] = {
> + SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
> + sdm670_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
> + SSPP_BLK("sspp_1", SSPP_VIG1, 0x6000, VIG_SDM845_MASK,
> + sdm670_vig_sblk_1, 4,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG1),
> + SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000,  DMA_SDM845_MASK,
> + sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
> + SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000,  DMA_CURSOR_SDM845_MASK,
> + sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
> + SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000,  DMA_CURSOR_SDM845_MASK,
> + sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
> +};
> +
>  static const struct dpu_sspp_cfg sdm845_sspp[] = {
>   SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
>   sdm845_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
> @@ -1832,6 +1869,11 @@ static struct dpu_dsc_cfg sm8150_dsc[] = {
>   DSC_BLK("dsc_3", DSC_3, 0x80c00, BIT(DPU_DSC_OUTPUT_CTRL)),
>  };
>  
> +static struct dpu_dsc_cfg sdm670_dsc[] = {
> + DSC_BLK("dsc_0", DSC_0, 0x8),
> + DSC_BLK("dsc_1", DSC_1, 0x80400),
I remember changing this, but it seems the compiler error is still here. Sorry
for that.

> +};
> +
>  /*
>   * INTF sub blocks config
>   */
> @@ -2533,6 +2575,30 @@ static const struct dpu_mdss_cfg msm8998_dpu_cfg = {
>   .mdss_irqs = IRQ_SM8250_MASK,
>  };
>  
> +static const struct dpu_mdss_cfg sdm670_dpu_cfg = {
> + .caps = _dpu_caps,
> + .mdp_count = ARRAY_SIZE(sdm670_mdp),
> + .mdp = sdm670_mdp,
> + .ctl_count = ARRAY_SIZE(sdm845_ctl),
> + .ctl = sdm845_ctl,
> + .sspp_count = ARRAY_SIZE(sdm670_sspp),
> + .sspp = sdm670_sspp,
>

[Freedreno] [PATCH] drm/msm/dpu: add hw revision 410

2023-01-12 Thread Richard Acayan
The Snapdragon 670 uses similar clocks (with one frequency added) to the
Snapdragon 845 but reports DPU revision 4.1.0. Add support for this DPU
with configuration from the Pixel 3a downstream kernel.

Link: 
https://android.googlesource.com/kernel/msm/+/368478b0ae76566927a2769a2bf24dfe7f38bb78/arch/arm64/boot/dts/qcom/sdm670-sde.dtsi
Signed-off-by: Richard Acayan 
---
 .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c| 67 +++
 1 file changed, 67 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 0f3da480b066..6a077a9ef7a0 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -504,6 +504,25 @@ static const struct dpu_mdp_cfg msm8998_mdp[] = {
},
 };
 
+static const struct dpu_mdp_cfg sdm670_mdp[] = {
+   {
+   .name = "top_0", .id = MDP_TOP,
+   .base = 0x0, .len = 0x45C,
+   .features = BIT(DPU_MDP_AUDIO_SELECT),
+   .highest_bank_bit = 0x1,
+   .clk_ctrls[DPU_CLK_CTRL_VIG0] = {
+   .reg_off = 0x2AC, .bit_off = 0},
+   .clk_ctrls[DPU_CLK_CTRL_VIG1] = {
+   .reg_off = 0x2B4, .bit_off = 0},
+   .clk_ctrls[DPU_CLK_CTRL_DMA0] = {
+   .reg_off = 0x2AC, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR0] = {
+   .reg_off = 0x2B4, .bit_off = 8},
+   .clk_ctrls[DPU_CLK_CTRL_CURSOR1] = {
+   .reg_off = 0x2BC, .bit_off = 8},
+   },
+};
+
 static const struct dpu_mdp_cfg sdm845_mdp[] = {
{
.name = "top_0", .id = MDP_TOP,
@@ -1154,6 +1173,11 @@ static const struct dpu_sspp_sub_blks sdm845_dma_sblk_1 
= _DMA_SBLK("9", 2);
 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_2 = _DMA_SBLK("10", 3);
 static const struct dpu_sspp_sub_blks sdm845_dma_sblk_3 = _DMA_SBLK("11", 4);
 
+static const struct dpu_sspp_sub_blks sdm670_vig_sblk_0 =
+   _VIG_SBLK("0", 4, DPU_SSPP_SCALER_QSEED3);
+static const struct dpu_sspp_sub_blks sdm670_vig_sblk_1 =
+   _VIG_SBLK("1", 5, DPU_SSPP_SCALER_QSEED3);
+
 #define SSPP_BLK(_name, _id, _base, _features, \
_sblk, _xinid, _type, _clkctrl) \
{ \
@@ -1185,6 +1209,19 @@ static const struct dpu_sspp_cfg msm8998_sspp[] = {
sdm845_dma_sblk_3, 13, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
 };
 
+static const struct dpu_sspp_cfg sdm670_sspp[] = {
+   SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
+   sdm670_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
+   SSPP_BLK("sspp_1", SSPP_VIG1, 0x6000, VIG_SDM845_MASK,
+   sdm670_vig_sblk_1, 4,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG1),
+   SSPP_BLK("sspp_8", SSPP_DMA0, 0x24000,  DMA_SDM845_MASK,
+   sdm845_dma_sblk_0, 1, SSPP_TYPE_DMA, DPU_CLK_CTRL_DMA0),
+   SSPP_BLK("sspp_9", SSPP_DMA1, 0x26000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_1, 5, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR0),
+   SSPP_BLK("sspp_10", SSPP_DMA2, 0x28000,  DMA_CURSOR_SDM845_MASK,
+   sdm845_dma_sblk_2, 9, SSPP_TYPE_DMA, DPU_CLK_CTRL_CURSOR1),
+};
+
 static const struct dpu_sspp_cfg sdm845_sspp[] = {
SSPP_BLK("sspp_0", SSPP_VIG0, 0x4000, VIG_SDM845_MASK,
sdm845_vig_sblk_0, 0,  SSPP_TYPE_VIG, DPU_CLK_CTRL_VIG0),
@@ -1832,6 +1869,11 @@ static struct dpu_dsc_cfg sm8150_dsc[] = {
DSC_BLK("dsc_3", DSC_3, 0x80c00, BIT(DPU_DSC_OUTPUT_CTRL)),
 };
 
+static struct dpu_dsc_cfg sdm670_dsc[] = {
+   DSC_BLK("dsc_0", DSC_0, 0x8),
+   DSC_BLK("dsc_1", DSC_1, 0x80400),
+};
+
 /*
  * INTF sub blocks config
  */
@@ -2533,6 +2575,30 @@ static const struct dpu_mdss_cfg msm8998_dpu_cfg = {
.mdss_irqs = IRQ_SM8250_MASK,
 };
 
+static const struct dpu_mdss_cfg sdm670_dpu_cfg = {
+   .caps = _dpu_caps,
+   .mdp_count = ARRAY_SIZE(sdm670_mdp),
+   .mdp = sdm670_mdp,
+   .ctl_count = ARRAY_SIZE(sdm845_ctl),
+   .ctl = sdm845_ctl,
+   .sspp_count = ARRAY_SIZE(sdm670_sspp),
+   .sspp = sdm670_sspp,
+   .mixer_count = ARRAY_SIZE(sdm845_lm),
+   .mixer = sdm845_lm,
+   .pingpong_count = ARRAY_SIZE(sdm845_pp),
+   .pingpong = sdm845_pp,
+   .dsc_count = ARRAY_SIZE(sdm670_dsc),
+   .dsc = sdm670_dsc,
+   .intf_count = ARRAY_SIZE(sdm845_intf),
+   .intf = sdm845_intf,
+   .vbif_count = ARRAY_SIZE(sdm845_vbif),
+   .vbif = sdm845_vbif,
+   .reg_dma_count = 1,
+   .dma_cfg = _regdma,
+   .perf = _perf_data,
+   .mdss_irqs = IRQ_SDM845_MASK,
+};
+
 static const struct dpu_mdss_cfg sdm845_dpu_cfg = {
.caps 

Re: [Freedreno] [RFC PATCH v2 08/11] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500

2022-11-05 Thread Richard Acayan
On Wed, Nov 02, 2022 at 09:44:17PM +0300, Dmitry Baryshkov wrote:
> There is only one platform, which needs special care in the reset
> function, the SDM845. Add special handler for sdm845 and drop the
> qcom_smmu500_reset() function.
> 
> Reviewed-by: Sai Prakash Ranjan 
> Tested-by: Sai Prakash Ranjan 
> Signed-off-by: Dmitry Baryshkov 
> ---
>  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 34 --
>  1 file changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c 
> b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> index c3bcd6eb2f42..75bc770ccf8c 100644
> --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
> @@ -361,6 +361,8 @@ static int qcom_sdm845_smmu500_reset(struct 
> arm_smmu_device *smmu)
>  {
>   int ret;
>  
> + arm_mmu500_reset(smmu);
> +
>   /*
>* To address performance degradation in non-real time clients,
>* such as USB and UFS, turn off wait-for-safe on sdm845 based boards,
> @@ -374,23 +376,20 @@ static int qcom_sdm845_smmu500_reset(struct 
> arm_smmu_device *smmu)
>   return ret;
>  }
>  
> -static int qcom_smmu500_reset(struct arm_smmu_device *smmu)
> -{
> - const struct device_node *np = smmu->dev->of_node;
> -
> - arm_mmu500_reset(smmu);
> -
> - if (of_device_is_compatible(np, "qcom,sdm845-smmu-500"))
> - return qcom_sdm845_smmu500_reset(smmu);
> -
> - return 0;
> -}
> -
>  static const struct arm_smmu_impl qcom_smmu_impl = {
>   .init_context = qcom_smmu_init_context,
>   .cfg_probe = qcom_smmu_cfg_probe,
>   .def_domain_type = qcom_smmu_def_domain_type,
> - .reset = qcom_smmu500_reset,
> + .reset = arm_mmu500_reset,
> + .write_s2cr = qcom_smmu_write_s2cr,
> + .tlb_sync = qcom_smmu_tlb_sync,
> +};
> +
> +static const struct arm_smmu_impl sdm845_smmu_500_impl = {
> + .init_context = qcom_smmu_init_context,
> + .cfg_probe = qcom_smmu_cfg_probe,
> + .def_domain_type = qcom_smmu_def_domain_type,
> + .reset = qcom_sdm845_smmu500_reset,
>   .write_s2cr = qcom_smmu_write_s2cr,
>   .tlb_sync = qcom_smmu_tlb_sync,
>  };
> @@ -398,7 +397,7 @@ static const struct arm_smmu_impl qcom_smmu_impl = {
>  static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
>   .init_context = qcom_adreno_smmu_init_context,
>   .def_domain_type = qcom_smmu_def_domain_type,
> - .reset = qcom_smmu500_reset,
> + .reset = arm_mmu500_reset,
>   .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
>   .write_sctlr = qcom_adreno_smmu_write_sctlr,
>   .tlb_sync = qcom_smmu_tlb_sync,
> @@ -450,6 +449,11 @@ static const struct qcom_smmu_match_data qcom_smmu_data 
> = {
>   .adreno_impl = _adreno_smmu_impl,
>  };
>  
> +static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
> + .impl = _smmu_500_impl,
> + /* No adreno impl, on sdm845 it is handled by separete sdm845-smmu-v2. 
> */
separete -> separate

Also, while I'm here, does "No adreno impl" constitute adding a
compatible in the driver?
> +};
> +
>  static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match[] = {
>   { .compatible = "qcom,msm8996-smmu-v2", .data = _smmu_data },
>   { .compatible = "qcom,msm8998-smmu-v2", .data = _smmu_data },
> @@ -460,7 +464,7 @@ static const struct of_device_id __maybe_unused 
> qcom_smmu_impl_of_match[] = {
>   { .compatible = "qcom,sc8280xp-smmu-500", .data = _smmu_data },
>   { .compatible = "qcom,sdm630-smmu-v2", .data = _smmu_data },
>   { .compatible = "qcom,sdm845-smmu-v2", .data = _smmu_data },
> - { .compatible = "qcom,sdm845-smmu-500", .data = _smmu_data },
> + { .compatible = "qcom,sdm845-smmu-500", .data = _smmu_500_data },
>   { .compatible = "qcom,sm6125-smmu-500", .data = _smmu_data },
>   { .compatible = "qcom,sm6350-smmu-500", .data = _smmu_data },
>   { .compatible = "qcom,sm6375-smmu-500", .data = _smmu_data },
> -- 
> 2.35.1
> 


Re: [Freedreno] [RFC PATCH v2 08/11] iommu/arm-smmu-qcom: provide separate implementation for SDM845-smmu-500

2022-11-05 Thread Richard Acayan
On Sat, Nov 05, 2022 at 03:02:15AM +0300, Dmitry Baryshkov wrote:
> On Sat, 5 Nov 2022 at 01:16, Richard Acayan  wrote:
>>
>> On Wed, Nov 02, 2022 at 09:44:17PM +0300, Dmitry Baryshkov wrote:
>> > There is only one platform, which needs special care in the reset
>> > function, the SDM845. Add special handler for sdm845 and drop the
>> > qcom_smmu500_reset() function.
>> >
>> > Reviewed-by: Sai Prakash Ranjan 
>> > Tested-by: Sai Prakash Ranjan 
>> > Signed-off-by: Dmitry Baryshkov 
>> > ---
>> >  drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 34 --
>> >  1 file changed, 19 insertions(+), 15 deletions(-)
>> >
>> > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c 
>> > b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> > index c3bcd6eb2f42..75bc770ccf8c 100644
>> > --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
>> > @@ -361,6 +361,8 @@ static int qcom_sdm845_smmu500_reset(struct 
>> > arm_smmu_device *smmu)
>> >  {
>> >   int ret;
>> >
>> > + arm_mmu500_reset(smmu);
>> > +
>> >   /*
>> >* To address performance degradation in non-real time clients,
>> >* such as USB and UFS, turn off wait-for-safe on sdm845 based 
>> > boards,
>> > @@ -374,23 +376,20 @@ static int qcom_sdm845_smmu500_reset(struct 
>> > arm_smmu_device *smmu)
>> >   return ret;
>> >  }
>> >
>> > -static int qcom_smmu500_reset(struct arm_smmu_device *smmu)
>> > -{
>> > - const struct device_node *np = smmu->dev->of_node;
>> > -
>> > - arm_mmu500_reset(smmu);
>> > -
>> > - if (of_device_is_compatible(np, "qcom,sdm845-smmu-500"))
>> > - return qcom_sdm845_smmu500_reset(smmu);
>> > -
>> > - return 0;
>> > -}
>> > -
>> >  static const struct arm_smmu_impl qcom_smmu_impl = {
>> >   .init_context = qcom_smmu_init_context,
>> >   .cfg_probe = qcom_smmu_cfg_probe,
>> >   .def_domain_type = qcom_smmu_def_domain_type,
>> > - .reset = qcom_smmu500_reset,
>> > + .reset = arm_mmu500_reset,
>> > + .write_s2cr = qcom_smmu_write_s2cr,
>> > + .tlb_sync = qcom_smmu_tlb_sync,
>> > +};
>> > +
>> > +static const struct arm_smmu_impl sdm845_smmu_500_impl = {
>> > + .init_context = qcom_smmu_init_context,
>> > + .cfg_probe = qcom_smmu_cfg_probe,
>> > + .def_domain_type = qcom_smmu_def_domain_type,
>> > + .reset = qcom_sdm845_smmu500_reset,
>> >   .write_s2cr = qcom_smmu_write_s2cr,
>> >   .tlb_sync = qcom_smmu_tlb_sync,
>> >  };
>> > @@ -398,7 +397,7 @@ static const struct arm_smmu_impl qcom_smmu_impl = {
>> >  static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
>> >   .init_context = qcom_adreno_smmu_init_context,
>> >   .def_domain_type = qcom_smmu_def_domain_type,
>> > - .reset = qcom_smmu500_reset,
>> > + .reset = arm_mmu500_reset,
>> >   .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank,
>> >   .write_sctlr = qcom_adreno_smmu_write_sctlr,
>> >   .tlb_sync = qcom_smmu_tlb_sync,
>> > @@ -450,6 +449,11 @@ static const struct qcom_smmu_match_data 
>> > qcom_smmu_data = {
>> >   .adreno_impl = _adreno_smmu_impl,
>> >  };
>> >
>> > +static const struct qcom_smmu_match_data sdm845_smmu_500_data = {
>> > + .impl = _smmu_500_impl,
>> > + /* No adreno impl, on sdm845 it is handled by separete 
>> > sdm845-smmu-v2. */
>> separete -> separate
>
> Ack.
>
>> Also, while I'm here, does "No adreno impl" constitute adding a
>> compatible in the driver?
>
> Not sure that I got your question, please excuse me. Could you please
> describe what you meant?
> We already have qcom,sdm845-smmu-v2 in the match table, if that's your
> question. And there is no need for Adreno impl here, on sdm845 the
> SMMU connected to Adreno is v2 rather than mmu-500.

I'm asking because I wrote this patch:

https://lore.kernel.org/linux-iommu/20221103232632.217324-3-mailingrad...@gmail.com/

on the basis that the SDM670 SMMU shouldn't have an adreno_impl. I
looked at the other code in this series, and it shouldn't be a problem
to use the fallback entry for SDM670. The adreno_impl is simply unused,
and would cause no problems if it were in the match data for any
pl