[PATCH 0/2] SDM630/660 Venus hardware video decoder/encoder

STALE2025d

16 messages, 5 authors, 2021-01-26 · open the first message on its own page

[PATCH 0/2] SDM630/660 Venus hardware video decoder/encoder

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-15 18:54:10

This patch series enables the Venus hardware video decoder/encoder
on the SDM630/660 series of SoCs.

Please keep in mind that these patches (especially the dt-bindings one)
depend on series 480030 (SDM630/660 GCC/MMCC/GPUCC clock controllers),
as the MultiMedia Clock Controller and related fixes in the GCC one
are needed to enable functionality of the Venus block.

This series was tested on SDM630 and SDM636 on the following smartphones:
- Sony Xperia 10 (SDM630)
- Sony Xperia 10 Plus (SDM636)
- Sony Xperia XA2 (SDM630)
- Sony Xperia XA2 Ultra (SDM630)

P.S.: Remember! SDM636 is a variant of SDM660, *not* a variant of 630.

AngeloGioacchino Del Regno (2):
  media: venus: core: Add sdm660 DT compatible and resource struct
  media: dt-bindings: media: venus: Add sdm660 DT schema

 .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
 drivers/media/platform/qcom/venus/core.c      |  66 +++++++
 2 files changed, 230 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml


base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
-- 
2.29.2

[PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-15 18:54:11

Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
 drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
 	.fwname = "qcom/venus-5.2/venus.mdt",
 };
 
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
+};
+
 static const struct freq_tbl sc7180_freq_table[] = {
 	{  0, 500000000 },
 	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
 	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
 	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
-- 
2.29.2

[PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-15 18:54:11

Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
 .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
 1 file changed, 164 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
diff --git a/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
new file mode 100644
index 000000000000..e7568d4007af
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
@@ -0,0 +1,164 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/media/qcom,sdm660-venus.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm Venus video encode and decode accelerators
+
+maintainers:
+  - Stanimir Varbanov <stanimir.varbanov@linaro.org>
+
+description: |
+  The Venus IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+properties:
+  compatible:
+    const: qcom,sdm660-venus
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 5
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: bus_throttle
+      - const: vcodec0_core
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  iommus:
+    maxItems: 20
+
+  memory-region:
+    maxItems: 1
+
+  power-domains:
+    minItems: 3
+
+  power-domain-names:
+    items:
+      - const: cx
+      - const: vcodec0
+      - const: venus
+
+  video-decoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-decoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-encoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-encoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-firmware:
+    type: object
+
+    description: |
+      Firmware subnode is needed when the platform does not
+      have TrustZone.
+
+    properties:
+      iommus:
+        maxItems: 2
+
+    required:
+      - iommus
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - power-domains
+  - power-domain-names
+  - clocks
+  - clock-names
+  - iommus
+  - memory-region
+  - video-decoder
+  - video-encoder
+
+additionalProperties: false
+
+examples:
+  - |
+        #include <dt-bindings/interrupt-controller/arm-gic.h>
+        #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
+        #include <dt-bindings/power/qcom-rpmpd.h>
+
+        video-codec@cc00000 {
+                compatible = "qcom,sdm660-venus";
+                reg = <0x0cc00000 0xff000>;
+                interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>;
+                power-domains = <&rpmpd SDM660_VDDCX>,
+                                <&mmcc VENUS_CORE0_GDSC>,
+                                <&mmcc VENUS_GDSC>;
+                power-domain-names = "cx", "vcodec0", "venus";
+                clocks = <&mmcc VIDEO_CORE_CLK>,
+                         <&mmcc VIDEO_AHB_CLK>,
+                         <&mmcc VIDEO_AXI_CLK>,
+                         <&mmcc THROTTLE_VIDEO_AXI_CLK>,
+                         <&mmcc VIDEO_SUBCORE0_CLK>;
+                clock-names = "core", "iface", "bus", "bus_throttle",
+                              "vcodec0_core";
+                iommus = <&mmss_smmu 0x400>,
+                         <&mmss_smmu 0x401>,
+                         <&mmss_smmu 0x40a>,
+                         <&mmss_smmu 0x407>,
+                         <&mmss_smmu 0x40e>,
+                         <&mmss_smmu 0x40f>,
+                         <&mmss_smmu 0x408>,
+                         <&mmss_smmu 0x409>,
+                         <&mmss_smmu 0x40b>,
+                         <&mmss_smmu 0x40c>,
+                         <&mmss_smmu 0x40d>,
+                         <&mmss_smmu 0x410>,
+                         <&mmss_smmu 0x421>,
+                         <&mmss_smmu 0x428>,
+                         <&mmss_smmu 0x429>,
+                         <&mmss_smmu 0x42b>,
+                         <&mmss_smmu 0x42c>,
+                         <&mmss_smmu 0x42d>,
+                         <&mmss_smmu 0x411>,
+                         <&mmss_smmu 0x431>;
+                memory-region = <&venus_region>;
+
+                video-decoder {
+                        compatible = "venus-decoder";
+                };
+
+                video-encoder {
+                        compatible = "venus-encoder";
+                };
+        };
-- 
2.29.2

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: Rob Herring <robh@kernel.org>
Date: 2021-01-17 15:47:56

On Fri, 15 Jan 2021 19:52:52 +0100, AngeloGioacchino Del Regno wrote:
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
 .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
 1 file changed, 164 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dts:20:18: fatal error: dt-bindings/clock/qcom,mmcc-sdm660.h: No such file or directory
   20 |         #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1427279

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-17 19:27:44

Il 17/01/21 16:45, Rob Herring ha scritto:
On Fri, 15 Jan 2021 19:52:52 +0100, AngeloGioacchino Del Regno wrote:
quoted
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
  .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
  1 file changed, 164 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dts:20:18: fatal error: dt-bindings/clock/qcom,mmcc-sdm660.h: No such file or directory
    20 |         #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:344: Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dt.yaml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1427279

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Yes, because this depends on the commits that are mentioned in the tags.
Is there any better way to add a dependency on another patch series?

- Angelo

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: Stanimir Varbanov <hidden>
Date: 2021-01-18 17:27:05


On 1/17/21 9:23 PM, AngeloGioacchino Del Regno wrote:
Il 17/01/21 16:45, Rob Herring ha scritto:
quoted
On Fri, 15 Jan 2021 19:52:52 +0100, AngeloGioacchino Del Regno wrote:
quoted
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno
[off-list ref]
---
  .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
  1 file changed, 164 insertions(+)
  create mode 100644
Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dts:20:18:
fatal error: dt-bindings/clock/qcom,mmcc-sdm660.h: No such file or
directory
    20 |         #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:344:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dt.yaml]
Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1427279

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Yes, because this depends on the commits that are mentioned in the tags.
Is there any better way to add a dependency on another patch series?
What is the status of mmcc-sdm660 clk driver? I guess we have to
postpone this until clock driver is ready for merge?
- Angelo
-- 
regards,
Stan

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: Stanimir Varbanov <hidden>
Date: 2021-01-18 17:30:44

Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted hunk
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
 drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
 	.fwname = "qcom/venus-5.2/venus.mdt",
 };
 
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
quoted hunk
+};
+
 static const struct freq_tbl sc7180_freq_table[] = {
 	{  0, 500000000 },
 	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
 	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
 	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
Reviewed-by: Stanimir Varbanov <redacted>

-- 
regards,
Stan

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/qcom/venus-4.2

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-18 17:47:36

Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
  drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
  1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
  	.fwname = "qcom/venus-5.2/venus.mdt",
  };
  
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
No I haven't.. and I can't... my Sony devices (but I think that this is
a practice of all OEMs/ODMs) are using a Sony signed venus firmware, so
I am totally limited to use the firmware that comes with the device.

Besides that, the version is still different so, even if I had any
possibility to try that, I don't think that it would work anyway...
quoted
+};
+
  static const struct freq_tbl sc7180_freq_table[] = {
  	{  0, 500000000 },
  	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
  static const struct of_device_id venus_dt_match[] = {
  	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
  	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
  	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
  	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
  	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
Reviewed-by: Stanimir Varbanov <redacted>
Thank you!
- Angelo

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-18 17:51:26

Il 18/01/21 18:21, Stanimir Varbanov ha scritto:

On 1/17/21 9:23 PM, AngeloGioacchino Del Regno wrote:
quoted
Il 17/01/21 16:45, Rob Herring ha scritto:
quoted
On Fri, 15 Jan 2021 19:52:52 +0100, AngeloGioacchino Del Regno wrote:
quoted
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno
[off-list ref]
---
   .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
   1 file changed, 164 insertions(+)
   create mode 100644
Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dts:20:18:
fatal error: dt-bindings/clock/qcom,mmcc-sdm660.h: No such file or
directory
     20 |         #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
        |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [scripts/Makefile.lib:344:
Documentation/devicetree/bindings/media/qcom,sdm660-venus.example.dt.yaml]
Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1370: dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1427279

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Yes, because this depends on the commits that are mentioned in the tags.
Is there any better way to add a dependency on another patch series?
What is the status of mmcc-sdm660 clk driver? I guess we have to
postpone this until clock driver is ready for merge?
I have sent it already, the driver is waiting for review...

By the way, this is not the only driver that I've sent that is getting
postponed because of that and I knew that this one would've had the same
destiny, but I thought to send everything "before I forget" pieces here
and there.

Of course I understand that everyone's time is limited, this is not a
rant at all!

Thanks for your review!
quoted
- Angelo

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: Rob Herring <robh@kernel.org>
Date: 2021-01-19 23:18:56

On Fri, Jan 15, 2021 at 07:52:52PM +0100, AngeloGioacchino Del Regno wrote:
quoted hunk
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
 .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
 1 file changed, 164 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
diff --git a/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
new file mode 100644
index 000000000000..e7568d4007af
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
@@ -0,0 +1,164 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/media/qcom,sdm660-venus.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm Venus video encode and decode accelerators
+
+maintainers:
+  - Stanimir Varbanov <stanimir.varbanov@linaro.org>
+
+description: |
+  The Venus IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+properties:
+  compatible:
+    const: qcom,sdm660-venus
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 5
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: bus_throttle
+      - const: vcodec0_core
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  iommus:
+    maxItems: 20
Perhaps some explanation as to what all these are. Looks like it is just 
1 iommu, but lots of ids?
+
+  memory-region:
+    maxItems: 1
+
+  power-domains:
+    minItems: 3
+
+  power-domain-names:
+    items:
+      - const: cx
+      - const: vcodec0
+      - const: venus
+
+  video-decoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-decoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-encoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-encoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-firmware:
+    type: object
+
+    description: |
+      Firmware subnode is needed when the platform does not
+      have TrustZone.
+
+    properties:
+      iommus:
+        maxItems: 2
+
+    required:
+      - iommus
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - power-domains
+  - power-domain-names
+  - clocks
+  - clock-names
+  - iommus
+  - memory-region
+  - video-decoder
+  - video-encoder
+
+additionalProperties: false
+
+examples:
+  - |
+        #include <dt-bindings/interrupt-controller/arm-gic.h>
+        #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
+        #include <dt-bindings/power/qcom-rpmpd.h>
+
+        video-codec@cc00000 {
+                compatible = "qcom,sdm660-venus";
+                reg = <0x0cc00000 0xff000>;
+                interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>;
+                power-domains = <&rpmpd SDM660_VDDCX>,
+                                <&mmcc VENUS_CORE0_GDSC>,
+                                <&mmcc VENUS_GDSC>;
+                power-domain-names = "cx", "vcodec0", "venus";
+                clocks = <&mmcc VIDEO_CORE_CLK>,
+                         <&mmcc VIDEO_AHB_CLK>,
+                         <&mmcc VIDEO_AXI_CLK>,
+                         <&mmcc THROTTLE_VIDEO_AXI_CLK>,
+                         <&mmcc VIDEO_SUBCORE0_CLK>;
+                clock-names = "core", "iface", "bus", "bus_throttle",
+                              "vcodec0_core";
+                iommus = <&mmss_smmu 0x400>,
+                         <&mmss_smmu 0x401>,
+                         <&mmss_smmu 0x40a>,
+                         <&mmss_smmu 0x407>,
+                         <&mmss_smmu 0x40e>,
+                         <&mmss_smmu 0x40f>,
+                         <&mmss_smmu 0x408>,
+                         <&mmss_smmu 0x409>,
+                         <&mmss_smmu 0x40b>,
+                         <&mmss_smmu 0x40c>,
+                         <&mmss_smmu 0x40d>,
+                         <&mmss_smmu 0x410>,
+                         <&mmss_smmu 0x421>,
+                         <&mmss_smmu 0x428>,
+                         <&mmss_smmu 0x429>,
+                         <&mmss_smmu 0x42b>,
+                         <&mmss_smmu 0x42c>,
+                         <&mmss_smmu 0x42d>,
+                         <&mmss_smmu 0x411>,
+                         <&mmss_smmu 0x431>;
+                memory-region = <&venus_region>;
+
+                video-decoder {
+                        compatible = "venus-decoder";
+                };
+
+                video-encoder {
+                        compatible = "venus-encoder";
+                };
+        };
-- 
2.29.2

Re: [PATCH 2/2] media: dt-bindings: media: venus: Add sdm660 DT schema

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-19 23:21:27

Il 20/01/21 00:17, Rob Herring ha scritto:
On Fri, Jan 15, 2021 at 07:52:52PM +0100, AngeloGioacchino Del Regno wrote:
quoted
Add new qcom,sdm660-venus DT binding schema.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
  .../bindings/media/qcom,sdm660-venus.yaml     | 164 ++++++++++++++++++
  1 file changed, 164 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml

base-commit: 012bd807cf654b992cdc4db7eab85c1e95f9d571
prerequisite-patch-id: 734bdefdb043a8f91a48916246cc9a36fb5966e5
prerequisite-patch-id: 999517c02973237996492a41ed5bfc2990083932
prerequisite-patch-id: a48910425fac61948a7a26bec4d40d63e3368569
prerequisite-patch-id: b1a1a4216eed0d04dd16e6e8e1053dee185d06d8
prerequisite-patch-id: dff12be2631cc21ef1c3c930fba49d979f5055fe
diff --git a/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
new file mode 100644
index 000000000000..e7568d4007af
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml
@@ -0,0 +1,164 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/media/qcom,sdm660-venus.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Qualcomm Venus video encode and decode accelerators
+
+maintainers:
+  - Stanimir Varbanov <stanimir.varbanov@linaro.org>
+
+description: |
+  The Venus IP is a video encode and decode accelerator present
+  on Qualcomm platforms
+
+properties:
+  compatible:
+    const: qcom,sdm660-venus
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 5
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: bus_throttle
+      - const: vcodec0_core
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  iommus:
+    maxItems: 20
Perhaps some explanation as to what all these are. Looks like it is just
1 iommu, but lots of ids?
Sincerely? I have no idea. These are all of the non-secure IDs that
are used downstream, but as you can imagine, there is zero documentation
about them.

Though, that's what works and that's what I've pushed... that's all :\
quoted
+
+  memory-region:
+    maxItems: 1
+
+  power-domains:
+    minItems: 3
+
+  power-domain-names:
+    items:
+      - const: cx
+      - const: vcodec0
+      - const: venus
+
+  video-decoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-decoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-encoder:
+    type: object
+
+    properties:
+      compatible:
+        const: venus-encoder
+
+    required:
+      - compatible
+
+    additionalProperties: false
+
+  video-firmware:
+    type: object
+
+    description: |
+      Firmware subnode is needed when the platform does not
+      have TrustZone.
+
+    properties:
+      iommus:
+        maxItems: 2
+
+    required:
+      - iommus
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - power-domains
+  - power-domain-names
+  - clocks
+  - clock-names
+  - iommus
+  - memory-region
+  - video-decoder
+  - video-encoder
+
+additionalProperties: false
+
+examples:
+  - |
+        #include <dt-bindings/interrupt-controller/arm-gic.h>
+        #include <dt-bindings/clock/qcom,mmcc-sdm660.h>
+        #include <dt-bindings/power/qcom-rpmpd.h>
+
+        video-codec@cc00000 {
+                compatible = "qcom,sdm660-venus";
+                reg = <0x0cc00000 0xff000>;
+                interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>;
+                power-domains = <&rpmpd SDM660_VDDCX>,
+                                <&mmcc VENUS_CORE0_GDSC>,
+                                <&mmcc VENUS_GDSC>;
+                power-domain-names = "cx", "vcodec0", "venus";
+                clocks = <&mmcc VIDEO_CORE_CLK>,
+                         <&mmcc VIDEO_AHB_CLK>,
+                         <&mmcc VIDEO_AXI_CLK>,
+                         <&mmcc THROTTLE_VIDEO_AXI_CLK>,
+                         <&mmcc VIDEO_SUBCORE0_CLK>;
+                clock-names = "core", "iface", "bus", "bus_throttle",
+                              "vcodec0_core";
+                iommus = <&mmss_smmu 0x400>,
+                         <&mmss_smmu 0x401>,
+                         <&mmss_smmu 0x40a>,
+                         <&mmss_smmu 0x407>,
+                         <&mmss_smmu 0x40e>,
+                         <&mmss_smmu 0x40f>,
+                         <&mmss_smmu 0x408>,
+                         <&mmss_smmu 0x409>,
+                         <&mmss_smmu 0x40b>,
+                         <&mmss_smmu 0x40c>,
+                         <&mmss_smmu 0x40d>,
+                         <&mmss_smmu 0x410>,
+                         <&mmss_smmu 0x421>,
+                         <&mmss_smmu 0x428>,
+                         <&mmss_smmu 0x429>,
+                         <&mmss_smmu 0x42b>,
+                         <&mmss_smmu 0x42c>,
+                         <&mmss_smmu 0x42d>,
+                         <&mmss_smmu 0x411>,
+                         <&mmss_smmu 0x431>;
+                memory-region = <&venus_region>;
+
+                video-decoder {
+                        compatible = "venus-decoder";
+                };
+
+                video-encoder {
+                        compatible = "venus-encoder";
+                };
+        };
-- 
2.29.2

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: Hans Verkuil <hidden>
Date: 2021-01-25 11:08:39

On 18/01/2021 18:45, AngeloGioacchino Del Regno wrote:
Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
quoted
Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
  drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
  1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
  	.fwname = "qcom/venus-5.2/venus.mdt",
  };
  
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
No I haven't.. and I can't... my Sony devices (but I think that this is
a practice of all OEMs/ODMs) are using a Sony signed venus firmware, so
I am totally limited to use the firmware that comes with the device.

Besides that, the version is still different so, even if I had any
possibility to try that, I don't think that it would work anyway...
I'm a bit confused. "qcom/venus-4.4/venus.mdt" is the Sony signed FW?

This patch can't be merged unless there is a corresponding firmware available
in linux-firmware. Is the current 4.2 firmware in linux-firmware signed by
Qualcomm? Can they provided 4.4 firmware as well?

I have no idea how this works for the venus driver, but I hope Stanimir does.

Regards,

	Hans
quoted
quoted
+};
+
  static const struct freq_tbl sc7180_freq_table[] = {
  	{  0, 500000000 },
  	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
  static const struct of_device_id venus_dt_match[] = {
  	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
  	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
  	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
  	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
  	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
Reviewed-by: Stanimir Varbanov <redacted>
Thank you!
- Angelo

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: AngeloGioacchino Del Regno <hidden>
Date: 2021-01-25 15:13:55

Il 25/01/21 11:40, Hans Verkuil ha scritto:
On 18/01/2021 18:45, AngeloGioacchino Del Regno wrote:
quoted
Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
quoted
Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
   drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
   1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
   	.fwname = "qcom/venus-5.2/venus.mdt",
   };
   
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
No I haven't.. and I can't... my Sony devices (but I think that this is
a practice of all OEMs/ODMs) are using a Sony signed venus firmware, so
I am totally limited to use the firmware that comes with the device.

Besides that, the version is still different so, even if I had any
possibility to try that, I don't think that it would work anyway...
Hello!
I'm a bit confused. "qcom/venus-4.4/venus.mdt" is the Sony signed FW?
In my case it is, but this follows the generic firmware path as was done
for all the other Venus firmwares, so my code is not pointing at Sony
specific things, but just generic ones.

Every Qualcomm-powered consumer device (smartphones, tablets etc) have
got a double sigcheck: one for qcom, one for OEM specific and most of
the times the TZ is configured to accept only firmwares that also have
the OEM signature.

This is not true for all the firmwares - for example, Adreno has this
mechanism only for the ZAP part - but unfortunately I'm not aware of
any consumer device accepting a Venus firmware with the "generic"
Qualcomm signature only (so - without the OEM signature).

Short answer:
1. qcom/venus-4.4/venus.mdt is a generic firmware for Venus
2. 99% of the people needs a different firmware for signature issues

This patch can't be merged unless there is a corresponding firmware available
in linux-firmware. Is the current 4.2 firmware in linux-firmware signed by
Qualcomm? Can they provided 4.4 firmware as well?
If there is such issue, then maybe we should do "something" about it: I
would then propose to remove all references to fwname and just get this
done in DT, where every qcom board already specifies its own path for
its own firmware.

In any case, the issue that you're raising here has been raised multiple
times on LKML, I don't precisely remember, but I recall seeing this for
something like 4 years (or even more) being raised every now and then...
I have no idea how this works for the venus driver, but I hope Stanimir does.
As far as I've understood, this driver just uses the firmware which
path is hardcoded in fwname, even though at this point I would like
to get an opinion from Stanimir.

Would you be ok if we start parsing firmware-name from DT for this
driver? The flow would be something like:

Is firmware-name DT property present?
    Yes -> Use FW path from firmware-name property
    No  -> Use the FW path from the fwname field of struct
           venus_resources

This is a common flow in at least freedreno and remoteproc (modem).

-- Angelo
Regards,

	Hans
quoted
quoted
quoted
+};
+
   static const struct freq_tbl sc7180_freq_table[] = {
   	{  0, 500000000 },
   	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
   static const struct of_device_id venus_dt_match[] = {
   	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
   	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
   	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
   	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
   	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
Reviewed-by: Stanimir Varbanov <redacted>
Thank you!
- Angelo

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: Hans Verkuil <hidden>
Date: 2021-01-26 07:00:35

On 25/01/2021 15:51, AngeloGioacchino Del Regno wrote:
Il 25/01/21 11:40, Hans Verkuil ha scritto:
quoted
On 18/01/2021 18:45, AngeloGioacchino Del Regno wrote:
quoted
Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
quoted
Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
   drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
   1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
   	.fwname = "qcom/venus-5.2/venus.mdt",
   };
   
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
No I haven't.. and I can't... my Sony devices (but I think that this is
a practice of all OEMs/ODMs) are using a Sony signed venus firmware, so
I am totally limited to use the firmware that comes with the device.

Besides that, the version is still different so, even if I had any
possibility to try that, I don't think that it would work anyway...
Hello!
quoted
I'm a bit confused. "qcom/venus-4.4/venus.mdt" is the Sony signed FW?
In my case it is, but this follows the generic firmware path as was done
for all the other Venus firmwares, so my code is not pointing at Sony
specific things, but just generic ones.

Every Qualcomm-powered consumer device (smartphones, tablets etc) have
got a double sigcheck: one for qcom, one for OEM specific and most of
the times the TZ is configured to accept only firmwares that also have
the OEM signature.

This is not true for all the firmwares - for example, Adreno has this
mechanism only for the ZAP part - but unfortunately I'm not aware of
any consumer device accepting a Venus firmware with the "generic"
Qualcomm signature only (so - without the OEM signature).

Short answer:
1. qcom/venus-4.4/venus.mdt is a generic firmware for Venus
So can this FW be made available in the linux-firmware repo? Stanimir?
2. 99% of the people needs a different firmware for signature issues

quoted
This patch can't be merged unless there is a corresponding firmware available
in linux-firmware. Is the current 4.2 firmware in linux-firmware signed by
Qualcomm? Can they provided 4.4 firmware as well?
If there is such issue, then maybe we should do "something" about it: I
would then propose to remove all references to fwname and just get this
done in DT, where every qcom board already specifies its own path for
its own firmware.

In any case, the issue that you're raising here has been raised multiple
times on LKML, I don't precisely remember, but I recall seeing this for
something like 4 years (or even more) being raised every now and then...
quoted
I have no idea how this works for the venus driver, but I hope Stanimir does.
As far as I've understood, this driver just uses the firmware which
path is hardcoded in fwname, even though at this point I would like
to get an opinion from Stanimir.

Would you be ok if we start parsing firmware-name from DT for this
driver? The flow would be something like:

Is firmware-name DT property present?
    Yes -> Use FW path from firmware-name property
    No  -> Use the FW path from the fwname field of struct
           venus_resources

This is a common flow in at least freedreno and remoteproc (modem).
I would have no problem with this, but it is up to Stanimir to decide.

Regards,

	Hans
-- Angelo
quoted
Regards,

	Hans
quoted
quoted
quoted
+};
+
   static const struct freq_tbl sc7180_freq_table[] = {
   	{  0, 500000000 },
   	{  0, 434000000 },
@@ -613,6 +678,7 @@ static const struct venus_resources sc7180_res = {
   static const struct of_device_id venus_dt_match[] = {
   	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
   	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
+	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
   	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
   	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
   	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
Reviewed-by: Stanimir Varbanov <redacted>
Thank you!
- Angelo

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: Bjorn Andersson <hidden>
Date: 2021-01-26 07:26:18

On Mon 25 Jan 08:51 CST 2021, AngeloGioacchino Del Regno wrote:
Il 25/01/21 11:40, Hans Verkuil ha scritto:
quoted
On 18/01/2021 18:45, AngeloGioacchino Del Regno wrote:
quoted
Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
quoted
quoted
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
[..]
quoted
quoted
quoted
quoted
+	.fwname = "qcom/venus-4.4/venus.mdt",
[..]
quoted
This patch can't be merged unless there is a corresponding firmware available
in linux-firmware. Is the current 4.2 firmware in linux-firmware signed by
Qualcomm? Can they provided 4.4 firmware as well?
If there is such issue, then maybe we should do "something" about it: I
would then propose to remove all references to fwname and just get this
done in DT, where every qcom board already specifies its own path for
its own firmware.
We have the same problem with production devices on e.g. SDM845, where
the firmware referenced by fw_name and present in linux-firmware won't
work on any real devices.

As such, providing means for specifying the firmware name in DT would be
a very reasonable thing, and in line with how we handle this in other
subsystems (using the firmware-name property, containing the full
relative path).

Regards,
Bjorn

Re: [PATCH 1/2] media: venus: core: Add sdm660 DT compatible and resource struct

From: Stanimir Varbanov <hidden>
Date: 2021-01-26 17:54:18


On 1/25/21 5:01 PM, Hans Verkuil wrote:
On 25/01/2021 15:51, AngeloGioacchino Del Regno wrote:
quoted
Il 25/01/21 11:40, Hans Verkuil ha scritto:
quoted
On 18/01/2021 18:45, AngeloGioacchino Del Regno wrote:
quoted
Il 18/01/21 18:21, Stanimir Varbanov ha scritto:
quoted
Hi Angelo,

Thanks for the patch!

On 1/15/21 8:52 PM, AngeloGioacchino Del Regno wrote:
quoted
Add the SDM660 DT compatible and its resource structure, also
including support for the Venus pmdomains, in order to support
the Venus block in SDM630, SDM636, SDM660 and SDA variants.

This SoC features Venus 4.4 (HFI3XX), with one vcodec used for
both encoding and decoding, switched on through two GDSCs.
The core clock for this Venus chip is powered by the RPM VDD_CX
power domain.

Signed-off-by: AngeloGioacchino Del Regno <redacted>
---
   drivers/media/platform/qcom/venus/core.c | 66 ++++++++++++++++++++++++
   1 file changed, 66 insertions(+)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index bdd293faaad0..83ca86a63241 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -565,6 +565,71 @@ static const struct venus_resources sdm845_res_v2 = {
   	.fwname = "qcom/venus-5.2/venus.mdt",
   };
   
+static const struct freq_tbl sdm660_freq_table[] = {
+	{ 0, 518400000 },
+	{ 0, 441600000 },
+	{ 0, 404000000 },
+	{ 0, 320000000 },
+	{ 0, 269330000 },
+	{ 0, 133330000 },
+};
+
+static const struct reg_val sdm660_reg_preset[] = {
+	{ 0x80010, 0x001f001f },
+	{ 0x80018, 0x00000156 },
+	{ 0x8001C, 0x00000156 },
+};
+
+static const struct bw_tbl sdm660_bw_table_enc[] = {
+	{  979200,  1044000, 0, 2446336, 0 },	/* 4k UHD @ 30 */
+	{  864000,   887000, 0, 2108416, 0 },	/* 720p @ 240 */
+	{  489600,   666000, 0, 1207296, 0 },	/* 1080p @ 60 */
+	{  432000,   578000, 0, 1058816, 0 },	/* 720p @ 120 */
+	{  244800,   346000, 0,  616448, 0 },	/* 1080p @ 30 */
+	{  216000,   293000, 0,  534528, 0 },	/* 720p @ 60 */
+	{  108000,   151000, 0,  271360, 0 },	/* 720p @ 30 */
+};
+
+static const struct bw_tbl sdm660_bw_table_dec[] = {
+	{  979200,  2365000, 0, 1892000, 0 },	/* 4k UHD @ 30 */
+	{  864000,  1978000, 0, 1554000, 0 },	/* 720p @ 240 */
+	{  489600,  1133000, 0,  895000, 0 },	/* 1080p @ 60 */
+	{  432000,   994000, 0,  781000, 0 },	/* 720p @ 120 */
+	{  244800,   580000, 0,  460000, 0 },	/* 1080p @ 30 */
+	{  216000,   501000, 0,  301000, 0 },	/* 720p @ 60 */
+	{  108000,   255000, 0,  202000, 0 },	/* 720p @ 30 */
+};
+
+static const struct venus_resources sdm660_res = {
+	.freq_tbl = sdm660_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sdm660_freq_table),
+	.reg_tbl = sdm660_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(sdm660_reg_preset),
+	.bw_tbl_enc = sdm660_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sdm660_bw_table_enc),
+	.bw_tbl_dec = sdm660_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sdm660_bw_table_dec),
+	.clks = {"core", "iface", "bus_throttle", "bus" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core" },
+	.vcodec_clks_num = 1,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx", NULL },
+	.vcodec_num = 1,
+	.max_load = 1036800,
+	.hfi_version = HFI_VERSION_3XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x79000000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x28000000,
+	.dma_mask = 0xd9000000 - 1,
+	.fwname = "qcom/venus-4.4/venus.mdt",
Did you try venus-4.2 firmware from linux-firmware tree [1] ?
No I haven't.. and I can't... my Sony devices (but I think that this is
a practice of all OEMs/ODMs) are using a Sony signed venus firmware, so
I am totally limited to use the firmware that comes with the device.

Besides that, the version is still different so, even if I had any
possibility to try that, I don't think that it would work anyway...
Hello!
quoted
I'm a bit confused. "qcom/venus-4.4/venus.mdt" is the Sony signed FW?
In my case it is, but this follows the generic firmware path as was done
for all the other Venus firmwares, so my code is not pointing at Sony
specific things, but just generic ones.

Every Qualcomm-powered consumer device (smartphones, tablets etc) have
got a double sigcheck: one for qcom, one for OEM specific and most of
the times the TZ is configured to accept only firmwares that also have
the OEM signature.

This is not true for all the firmwares - for example, Adreno has this
mechanism only for the ZAP part - but unfortunately I'm not aware of
any consumer device accepting a Venus firmware with the "generic"
Qualcomm signature only (so - without the OEM signature).

Short answer:
1. qcom/venus-4.4/venus.mdt is a generic firmware for Venus
So can this FW be made available in the linux-firmware repo? Stanimir?
quoted
2. 99% of the people needs a different firmware for signature issues

quoted
This patch can't be merged unless there is a corresponding firmware available
in linux-firmware. Is the current 4.2 firmware in linux-firmware signed by
Qualcomm? Can they provided 4.4 firmware as well?
If there is such issue, then maybe we should do "something" about it: I
would then propose to remove all references to fwname and just get this
done in DT, where every qcom board already specifies its own path for
its own firmware.

In any case, the issue that you're raising here has been raised multiple
times on LKML, I don't precisely remember, but I recall seeing this for
something like 4 years (or even more) being raised every now and then...
quoted
I have no idea how this works for the venus driver, but I hope Stanimir does.
As far as I've understood, this driver just uses the firmware which
path is hardcoded in fwname, even though at this point I would like
to get an opinion from Stanimir.

Would you be ok if we start parsing firmware-name from DT for this
driver? The flow would be something like:

Is firmware-name DT property present?
    Yes -> Use FW path from firmware-name property
    No  -> Use the FW path from the fwname field of struct
           venus_resources

This is a common flow in at least freedreno and remoteproc (modem).
I would have no problem with this, but it is up to Stanimir to decide.
I sent a patch for that. Thanks for raising this issue.

-- 
regards,
Stan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help