Skip to contentSkip to conversation

media: venus: Add QCM2290 support with AR50_LITE core

PATCH Superseded Jorge Ramirez-Ortiz 5 participants 36 messages Aug 5, 2025 – Aug 9, 2025

Subsystems (6)

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v8 cover media: venus: Add QCM2290 support with AR50_LITE core

Changes since v7:
v7: https://lore.kernel.org/all/[email protected]/
- patch 1/7: Add qcm2290 dt schema
- extend commit message to cover IOMMU order, remove iommus minItems, alphabetic order for includes
- added myself as the file maintainer
- patch 2/7: media: venus: Define minimum valid firmware version
- Replaces previous patch that was able to distinguish encoder vs decoder firmware version support
- Now it is an all or nothing implementation (the firmware either support enc and dec or it doesn't)
- patch 3/7: Add Support for AR50 LITE video core
- remove EOS support for older firmwares since we will drop support for fw < 6.0.55
- patch 4/7: HFI platform V4 capabilities
- remove some hardcoded values and some ternary operations
- added reviewed by Bryan O'Donoghue <[email protected]>
- patch 5/7: Add DT compatible and capabilities
- only min_fw now required since we dont support encode/decode indepedently after 2/7
- added reviewed by Dikshita Agarwal <[email protected]>
- patch 6/7: Add Venus video node for 2290
- no change
- patch 7/7: Enable Venus on 2210 RB1 board
- fix alphabetical order

Changes since v6:
v6: https://lore.kernel.org/all/[email protected]/
- patch 1/7: Add qcm2290 dt schema
- no change
- patch 2/7: Conditionally register video nodes
- fixed potential NULL dereference on handling firmware errors when the encoder is not present.
- patch 3/7: Add Support for AR50 LITE video core
- applied Dikshita Agarwal review comments: do not handle no-tz case, fix WD mask
- replaced EOS buffers for a work around (firmware should not access the eos buffers) renamed venus_helper_alloc_eos_buf to venus_helper_prepare_eos_data
- patch 4/7: HFI platform V4 capabilities
- removed 10 bit encoder support as per Dikshita Agarwal review
- patch 5/7: Add DT compatible and capabilities
- removed frequency table as per Konrad Dybcio review (driver now uses opp)
- fixed bw_tables for the supported loads (remove 10 bit support)
- patch 6/7: Add Venus video node for 2290
- no change
- patch 7/7: Enable Venus on 2210 RB1 board
- no change

Changes since v5:
Two additional new patches added to the set to support video encoding.

- patch 1/7: Add qcm2290 dt schema
- added reviewed by: Bryan O'Donoghue
- added reviewed by: Krzysztof Kozlowski
- patch 2/7: Conditionally register video nodes
- new functionality required to support AR50_LITE
- patch 3/7: Add Support for AR50 LITE video core
- completely rewritten - lite platforms are extensions of previous HFI_XXX
- patch 4/7: HFI platform V4 capabilities
- use HFI 4XX instead of HFI 6XX as per review
- patch 5/7: Add DT compatible and capabilities
- added reviewed by: Bryan O'Donoghue
- enabled new option min_fw_version
- patch 6/7: Add Venus video node for 2290
- added reviewed by: Konrad Dybcio
- removed status property
- patch 7/7: Enable Venus on 2210 RB1 board
- new

Changes since v4:
- patch 1/5:
- added reviewed by: Krzysztof Kozlowski
- updated example section
- patch 2/5:
- added reviewed by: Bryan O'Donoghue
- Fixed Co-developed-by order
- patch 3/5:
- patch 4/5:
- removed encode-node (userspace exposure)
- fixed Co-developed-by order
- patch 5/5:
- fixed venus register region
- power-domain-names: one per line
- clock-names: one per line
- fixed interconnect tags
- empty line before subnode
- enable the venus node

Changes since v3:
- Fixed schema commit subject.

Changes since v2:
- Removed IS_HFI/IS_VPU macros
- checkpatch.pl --strict fixes:
- convert macro to static inline to avoid argument reuse side effect

Changes since v1:
- Added IS_HFI macro usage
- Moved schema patch to top
- Fixed commit messages

This patch series adds support for the Venus video decoder/encoder block present on the Qualcomm QCM2290.

This series functionally depends on the following patch:

clk: qcom: gcc-qcm2290: Set HW_CTRL_TRIGGER for video GDSC
https://lore.kernel.org/all/[email protected]/

Please ensure the above patch is applied before this series.

The QCM2290 integrates an AR50_LITE core, a low-power implementation of Venus supporting H.264, HEVC (H.265), and VP9 decoding as well as H.264 and H.265 encoding.

The series includes:
- DT binding schema for qcom,qcm2290-venus
- SoC integration via qcm2290.dtsi
- Resource table definitions and frequency scaling
- Platform capability registration for the AR50_LITE core decoding block.

Limitations:
- The hardware does not support concurrent operation at FullHD.
- Encoding is not supported in firmware version before 6.0.54

Firmware:
- This code has been tested with 6.0.52, 6.0.53, 6.0.54-PRERELEASE

Some basic Tests:

Decoding and Encoding were verified on the QCOM RB1 platform using GStreamer with V4L2-based decode plugins.

The following pipelines were used for playback 1280x720 and 1920x1080 H.264, HEVC and VP9 videos from https://www.elecard.com/videos.

Decoding:
[H.264]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h264parse ! v4l2h264dec \
! videoconvert ! autovideosink

[H.265]
gst-launch-1.0 filesrc location=videos/xxxxx.mp4 \
! qtdemux name=demux demux.video_0 ! queue ! h265parse ! v4l2h265dec \
! videoconvert ! autovideosink

[VP9]
gst-launch-1.0 filesrc location=videos/xxxxx.webm \
! matroskademux ! queue ! v4l2vp9dec \
! videoconvert ! autovideosink

Encoding:
[H.264]
gst-launch-1.0 videotestsrc num-buffers=30 \
! video/x-raw,width=1280,height=720,framerate=30/1 \
! v4l2h264enc ! h264parse ! mp4mux ! filesink location=/tmp/output.mp4

[H.265]
gst-launch-1.0 videotestsrc num-buffers=30 \
! video/x-raw,width=1920,height=1080,framerate=30/1 \
! v4l2h265enc ! h265parse ! mp4mux ! filesink location=/tmp/output.mp4

Concurrency:
gst-launch-1.0 -v videotestsrc num-buffers=1000 \
! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 \
! v4l2h264enc capture-io-mode=4 output-io-mode=2 ! h264parse \
! v4l2h264dec capture-io-mode=4 output-io-mode=2 ! videoconvert \
! autovideosink

[Fluster]
The H.264 decoder was also tested using the Fluster test suite (version: v0.4.0-12-g33566abd0964).
Target: GStreamer-H.264-V4L2-Gst1.0, Test Suite: JVT-AVC_V1
Result: 126/135 tests passed
Failures:
FM1_BT_B, FM1_FT_E, FM2_SVA_C, BA3_SVA_C, SP1_BT_A, SP2_BT_B, MR6_BT_B, MR7_BT_B, MR8_BT_B

---

Jorge Ramirez-Ortiz (7):
media: dt-bindings: venus: Add qcm2290 dt schema
media: venus: Define minimum valid firmware version
media: venus: Add support for AR50_LITE video core
media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core
media: venus: core: Add qcm2290 DT compatible and resource data
arm64: dts: qcom: qcm2290: Add Venus video node
arm64: dts: qcom: qrb2210-rb1: Enable Venus

 .../bindings/media/qcom,qcm2290-venus.yaml    | 130 +++++++++++++
 arch/arm64/boot/dts/qcom/qcm2290.dtsi         |  55 ++++++
 arch/arm64/boot/dts/qcom/qrb2210-rb1.dts      |   4 +
 drivers/media/platform/qcom/venus/core.c      | 105 ++++++++--
 drivers/media/platform/qcom/venus/core.h      |  12 ++
 drivers/media/platform/qcom/venus/firmware.c  |  23 +++
 drivers/media/platform/qcom/venus/firmware.h  |   2 +
 drivers/media/platform/qcom/venus/helpers.c   |  12 +-
 .../media/platform/qcom/venus/hfi_parser.c    |   5 +-
 .../media/platform/qcom/venus/hfi_platform.c  |  20 +-
 .../media/platform/qcom/venus/hfi_platform.h  |  25 +--
 .../platform/qcom/venus/hfi_platform_v4.c     | 183 ++++++++++++++++--
 .../platform/qcom/venus/hfi_platform_v6.c     |  32 ++-
 drivers/media/platform/qcom/venus/hfi_venus.c |  25 ++-
 .../media/platform/qcom/venus/hfi_venus_io.h  |   4 +
 .../media/platform/qcom/venus/pm_helpers.c    |   2 +-
 16 files changed, 557 insertions(+), 82 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Signature · 1 line
2.34.1
#1 lore raw

PATCH v8 1/7 media: dt-bindings: venus: Add qcm2290 dt schema

Add a schema for the venus video encoder/decoder on the qcm2290.

The order of the IOMMU list is strict: the first two entries correspond to non-secure IOMMUs, and the remaining three to secure IOMMUs.

---
 .../bindings/media/qcom,qcm2290-venus.yaml    | 130 ++++++++++++++++++
 1 file changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml new file +130 -0
new file mode 100644
index 000000000000..3f3ee82fc878
@@ -0,0 +1,130 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/qcom,qcm2290-venus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm QCM2290 Venus video encode and decode accelerators
+
+maintainers:
+  - Jorge Ramirez-Ortiz <[email protected]>
+
+description:
+  The Venus AR50_LITE IP is a video encode and decode accelerator present
+  on Qualcomm platforms.
+
+allOf:
+  - $ref: qcom,venus-common.yaml#
+
+properties:
+  compatible:
+    const: qcom,qcm2290-venus
+
+  power-domains:
+    maxItems: 3
+
+  power-domain-names:
+    items:
+      - const: venus
+      - const: vcodec0
+      - const: cx
+
+  clocks:
+    maxItems: 6
+
+  clock-names:
+    items:
+      - const: core
+      - const: iface
+      - const: bus
+      - const: throttle
+      - const: vcodec0_core
+      - const: vcodec0_bus
+
+  iommus:
+    maxItems: 5
+
+  interconnects:
+    maxItems: 2
+
+  interconnect-names:
+    items:
+      - const: video-mem
+      - const: cpu-cfg
+
+  operating-points-v2: true
+  opp-table:
+    type: object
+
+required:
+  - compatible
+  - power-domain-names
+  - iommus
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/qcom,gcc-qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,qcm2290.h>
+    #include <dt-bindings/interconnect/qcom,rpm-icc.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/power/qcom-rpmpd.h>
+
+    venus: video-codec@5a00000 {
+        compatible = "qcom,qcm2290-venus";
+        reg = <0x5a00000 0xf0000>;
+
+        interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+        power-domains = <&gcc GCC_VENUS_GDSC>,
+                        <&gcc GCC_VCODEC0_GDSC>,
+                        <&rpmpd QCM2290_VDDCX>;
+        power-domain-names = "venus",
+                             "vcodec0",
+                             "cx";
+
+        operating-points-v2 = <&venus_opp_table>;
+
+        clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+                 <&gcc GCC_VIDEO_AHB_CLK>,
+                 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+                 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+                 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+                 <&gcc GCC_VCODEC0_AXI_CLK>;
+        clock-names = "core",
+                       "iface",
+                       "bus",
+                       "throttle",
+                       "vcodec0_core",
+                       "vcodec0_bus";
+
+        memory-region = <&pil_video_mem>;
+
+        iommus = <&apps_smmu 0x860 0x0>,
+                 <&apps_smmu 0x880 0x0>,
+                 <&apps_smmu 0x861 0x04>,
+                 <&apps_smmu 0x863 0x0>,
+                 <&apps_smmu 0x804 0xe0>;
+
+        interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+                         &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+                        <&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+                         &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+        interconnect-names = "video-mem",
+                             "cpu-cfg";
+
+        venus_opp_table: opp-table {
+            compatible = "operating-points-v2";
+
+            opp-133333333 {
+                opp-hz = /bits/ 64 <133333333>;
+                required-opps = <&rpmpd_opp_low_svs>;
+            };
+
+            opp-240000000 {
+                opp-hz = /bits/ 64 <240000000>;
+                required-opps = <&rpmpd_opp_svs>;
+            };
+        };
+    };
Signature · 1 line
2.34.1
#2 lore raw

PATCH v8 2/7 media: venus: Define minimum valid firmware version

In reply to Jorge Ramirez-Ortiz

Add support for specifying the minimum firmware version required for correct operation.

When set, the driver compares this value against the version reported by the firmware: if the firmware is older than required, driver initialization will fail.

The version check is performed before creating dynamic device tree nodes, to avoid the need for reverting nodes on failure.

---
 drivers/media/platform/qcom/venus/core.c     | 40 +++++++++++---------
 drivers/media/platform/qcom/venus/core.h     |  7 ++++
 drivers/media/platform/qcom/venus/firmware.c | 13 +++++++
 drivers/media/platform/qcom/venus/firmware.h |  1 +
 4 files changed, 43 insertions(+), 18 deletions(-)
drivers/media/platform/qcom/venus/core.c +22 -18
index 4c049c694d9c..f45715c9b222 100644
@@ -448,19 +448,9 @@ static int venus_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_runtime_disable;
 
-	if (core->res->dec_nodename || core->res->enc_nodename) {
-		ret = venus_add_dynamic_nodes(core);
-		if (ret)
-			goto err_runtime_disable;
-	}
-
-	ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
-	if (ret)
-		goto err_remove_dynamic_nodes;
-
 	ret = venus_firmware_init(core);
 	if (ret)
-		goto err_of_depopulate;
+		goto err_runtime_disable;
 
 	ret = venus_boot(core);
 	if (ret)
@@ -474,34 +464,48 @@ static int venus_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_venus_shutdown;
 
-	ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC);
+	ret = venus_firmware_check(core);
 	if (ret)
 		goto err_core_deinit;
 
+	if (core->res->dec_nodename || core->res->enc_nodename) {
+		ret = venus_add_dynamic_nodes(core);
+		if (ret)
+			goto err_core_deinit;
+	}
+
+	ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
+	if (ret)
+		goto err_remove_dynamic_nodes;
+
+	ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_DEC);
+	if (ret)
+		goto err_of_depopulate;
+
 	ret = venus_enumerate_codecs(core, VIDC_SESSION_TYPE_ENC);
 	if (ret)
-		goto err_core_deinit;
+		goto err_of_depopulate;
 
 	ret = pm_runtime_put_sync(dev);
 	if (ret) {
 		pm_runtime_get_noresume(dev);
-		goto err_core_deinit;
+		goto err_of_depopulate;
 	}
 
 	venus_dbgfs_init(core);
 
 	return 0;
 
+err_of_depopulate:
+	of_platform_depopulate(dev);
+err_remove_dynamic_nodes:
+	venus_remove_dynamic_nodes(core);
 err_core_deinit:
 	hfi_core_deinit(core, false);
 err_venus_shutdown:
 	venus_shutdown(core);
 err_firmware_deinit:
 	venus_firmware_deinit(core);
-err_of_depopulate:
-	of_platform_depopulate(dev);
-err_remove_dynamic_nodes:
-	venus_remove_dynamic_nodes(core);
 err_runtime_disable:
 	pm_runtime_put_noidle(dev);
 	pm_runtime_disable(dev);
drivers/media/platform/qcom/venus/core.h +7 -0
index 5b1ba1c69adb..2d3cf920198f 100644
@@ -58,6 +58,12 @@ enum vpu_version {
 	VPU_VERSION_IRIS2_1,
 };
 
+struct firmware_version {
+	u32 major;
+	u32 minor;
+	u32 rev;
+};
+
 struct venus_resources {
 	u64 dma_mask;
 	const struct freq_tbl *freq_tbl;
@@ -94,6 +100,7 @@ struct venus_resources {
 	const char *fwname;
 	const char *enc_nodename;
 	const char *dec_nodename;
+	const struct firmware_version *min_fw;
 };
 
 enum venus_fmt {
drivers/media/platform/qcom/venus/firmware.c +13 -0
index 66a18830e66d..503dd270a14a 100644
@@ -280,6 +280,19 @@ int venus_shutdown(struct venus_core *core)
 	return ret;
 }
 
+int venus_firmware_check(struct venus_core *core)
+{
+	const struct firmware_version *ver = core->res->min_fw;
+
+	if (!ver)
+		return 0;
+
+	if (!is_fw_rev_or_newer(core, ver->major, ver->minor, ver->rev))
+		return -EINVAL;
+
+	return 0;
+}
+
 int venus_firmware_init(struct venus_core *core)
 {
 	struct platform_device_info info;
drivers/media/platform/qcom/venus/firmware.h +1 -0
index aaccd847fa30..ead39e3797f0 100644
@@ -9,6 +9,7 @@ struct device;
 
 int venus_firmware_init(struct venus_core *core);
 void venus_firmware_deinit(struct venus_core *core);
+int venus_firmware_check(struct venus_core *core);
 int venus_boot(struct venus_core *core);
 int venus_shutdown(struct venus_core *core);
 int venus_set_hw_state(struct venus_core *core, bool suspend);
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v8 2/7] media: venus: Define minimum valid firmware version

drivers/media/platform/qcom/venus/firmware.c int venus_shutdown(struct venus_core *core) · line 292

Quoted 3 lines · Jorge Ramirez-Ortiz
drivers/media/platform/qcom/venus/firmware.c +3 -0
+	if (!is_fw_rev_or_newer(core, ver->major, ver->minor, ver->rev))
+		return -EINVAL;
+

This is the sort of error case that deserves a kernel log.

dev_err(dev, "Firmware version %d.%d < minimum version %d.%d\n, etc);

If I were to try booting venus with an old/unsupported I wouldn't know why the probe was failing.

---
bod

#4 lore raw

Re: [PATCH v8 2/7] media: venus: Define minimum valid firmware version

Quoted 11 lines · Bryan O'Donoghue

drivers/media/platform/qcom/venus/firmware.c int venus_shutdown(struct venus_core *core) · line 292

Quoted 3 lines · Jorge Ramirez-Ortiz
drivers/media/platform/qcom/venus/firmware.c +3 -0
+	if (!is_fw_rev_or_newer(core, ver->major, ver->minor, ver->rev))
+		return -EINVAL;
+

This is the sort of error case that deserves a kernel log.

dev_err(dev, "Firmware version %d.%d < minimum version %d.%d\n, etc);

If I were to try booting venus with an old/unsupported I wouldn't know why the probe was failing.

ok

Quoted 3 lines

---
bod

#5 lore raw

PATCH v8 3/7 media: venus: Add support for AR50_LITE video core

In reply to Jorge Ramirez-Ortiz

The AR50_LITE is a simplified variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats, and provides encoding support for H.264 and HEVC.

---
 drivers/media/platform/qcom/venus/core.c      | 15 +++++++--
 drivers/media/platform/qcom/venus/core.h      |  5 +++
 drivers/media/platform/qcom/venus/firmware.c  | 10 ++++++
 drivers/media/platform/qcom/venus/firmware.h  |  1 +
 drivers/media/platform/qcom/venus/helpers.c   | 12 +++++--
 .../media/platform/qcom/venus/hfi_parser.c    |  5 +--
 .../media/platform/qcom/venus/hfi_platform.c  | 20 +++++++-----
 .../media/platform/qcom/venus/hfi_platform.h  | 25 ++++++++-------
 .../platform/qcom/venus/hfi_platform_v4.c     | 31 ++++++++++++------
 .../platform/qcom/venus/hfi_platform_v6.c     | 32 +++++++++++++------
 drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++----
 .../media/platform/qcom/venus/hfi_venus_io.h  |  4 +++
 .../media/platform/qcom/venus/pm_helpers.c    |  2 +-
 13 files changed, 133 insertions(+), 54 deletions(-)
drivers/media/platform/qcom/venus/core.c +12 -3
index f45715c9b222..adc38fbc9d79 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
 static void venus_assign_register_offsets(struct venus_core *core)
 {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
 		core->cpu_base = core->base + CPU_BASE_V6;
 		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
 		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
 		core->wrapper_base = core->base + WRAPPER_BASE_V6;
 		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
 	} else {
 		core->vbif_base = core->base + VBIF_BASE;
 		core->cpu_base = core->base + CPU_BASE;
@@ -456,6 +461,10 @@ static int venus_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_firmware_deinit;
 
+	ret = venus_firmware_cfg(core);
+	if (ret)
+		goto err_venus_shutdown;
+
 	ret = hfi_core_resume(core, true);
 	if (ret)
 		goto err_venus_shutdown;
drivers/media/platform/qcom/venus/core.h +5 -0
index 2d3cf920198f..f8602735d6c2 100644
@@ -537,6 +537,11 @@ struct venus_inst {
 #define IS_IRIS2(core)		((core)->res->vpu_version == VPU_VERSION_IRIS2)
 #define IS_IRIS2_1(core)	((core)->res->vpu_version == VPU_VERSION_IRIS2_1)
 
+static inline bool is_lite(struct venus_core *core)
+{
+	return IS_AR50_LITE(core);
+}
+
 #define ctrl_to_inst(ctrl)	\
 	container_of((ctrl)->handler, struct venus_inst, ctrl_handler)
 
drivers/media/platform/qcom/venus/firmware.c +10 -0
index 503dd270a14a..2e5d85e25d0f 100644
@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)
 	return 0;
 }
 
+int venus_firmware_cfg(struct venus_core *core)
+{
+	void __iomem *cpu_cs_base = core->cpu_cs_base;
+
+	if (IS_AR50_LITE(core))
+		writel(CPU_CS_VCICMD_ARP_OFF, cpu_cs_base + CPU_CS_VCICMD);
+
+	return 0;
+}
+
 int venus_boot(struct venus_core *core)
 {
 	struct device *dev = core->dev;
drivers/media/platform/qcom/venus/firmware.h +1 -0
index ead39e3797f0..87e1d922b369 100644
@@ -10,6 +10,7 @@ struct device;
 int venus_firmware_init(struct venus_core *core);
 void venus_firmware_deinit(struct venus_core *core);
 int venus_firmware_check(struct venus_core *core);
+int venus_firmware_cfg(struct venus_core *core);
 int venus_boot(struct venus_core *core);
 int venus_shutdown(struct venus_core *core);
 int venus_set_hw_state(struct venus_core *core, bool suspend);
drivers/media/platform/qcom/venus/helpers.c +9 -3
index 8295542e1a7c..3a761b5415c5 100644
@@ -1715,11 +1715,17 @@ int venus_helper_session_init(struct venus_inst *inst)
 	if (ret)
 		return ret;
 
-	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec,
+	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version,
+								  is_lite(inst->core),
+								  codec,
 								  session_type);
-	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version, codec,
+	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version,
+								  is_lite(inst->core),
+								  codec,
 								  session_type);
-	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version, codec,
+	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version,
+								       is_lite(inst->core),
+								       codec,
 								       session_type);
 
 	return 0;
drivers/media/platform/qcom/venus/hfi_parser.c +3 -2
index 1b3db2caa99f..55cee1c786a0 100644
@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)
 	if (inst)
 		return 0;
 
-	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count);
+	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count,
+				      is_lite(core));
 	if (ret)
 		return ret;
 
 	if (plat->capabilities)
-		caps = plat->capabilities(&entries);
+		caps = plat->capabilities(&entries, is_lite(core));
 
 	if (!caps || !entries || !count)
 		return -EINVAL;
drivers/media/platform/qcom/venus/hfi_platform.c +12 -8
index 643e5aa138f5..c6c248561793 100644
@@ -21,7 +21,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
 }
 
 unsigned long
-hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
 {
 	const struct hfi_platform *plat;
 	unsigned long freq = 0;
@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session
 		return 0;
 
 	if (plat->codec_vpp_freq)
-		freq = plat->codec_vpp_freq(session_type, codec);
+		freq = plat->codec_vpp_freq(session_type, codec, lite);
 
 	return freq;
 }
 
 unsigned long
-hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
 {
 	const struct hfi_platform *plat;
 	unsigned long freq = 0;
@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session
 		return 0;
 
 	if (plat->codec_vpp_freq)
-		freq = plat->codec_vsp_freq(session_type, codec);
+		freq = plat->codec_vsp_freq(session_type, codec, lite);
 
 	return freq;
 }
 
 unsigned long
-hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite, u32 codec,
+			       u32 session_type)
 {
 	const struct hfi_platform *plat;
 	unsigned long freq = 0;
@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_
 		return 0;
 
 	if (plat->codec_lp_freq)
-		freq = plat->codec_lp_freq(session_type, codec);
+		freq = plat->codec_lp_freq(session_type, codec, lite);
 
 	return freq;
 }
 
 int
-hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+			bool lite)
 {
 	const struct hfi_platform *plat;
 
@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codec
 		return -EINVAL;
 
 	if (plat->codecs)
-		plat->codecs(enc_codecs, dec_codecs, count);
+		plat->codecs(enc_codecs, dec_codecs, count, lite);
 
 	if (IS_IRIS2_1(core)) {
 		*enc_codecs &= ~HFI_VIDEO_CODEC_VP8;
drivers/media/platform/qcom/venus/hfi_platform.h +13 -12
index ec89a90a8129..a9f1ead18084 100644
@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data {
 };
 
 struct hfi_platform {
-	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec);
-	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec);
-	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec);
-	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count);
-	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries);
+	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec, bool lite);
+	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec, bool lite);
+	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec, bool lite);
+	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite);
+	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries,
+						    bool lite);
 	int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type,
 		      u32 buftype, struct hfi_buffer_requirements *bufreq);
 };
@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;
 extern const struct hfi_platform hfi_plat_v6;
 
 const struct hfi_platform *hfi_platform_get(enum hfi_version version);
-unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec,
-					     u32 session_type);
+unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite,
+					     u32 codec, u32 session_type);
 int hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs,
-			    u32 *count);
+			    u32 *count, bool lite);
 #endif
drivers/media/platform/qcom/venus/hfi_platform_v4.c +22 -9
index e3f0a90a567b..4ae7ed476c48 100644
@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = {
 	.num_fmts = 4,
 } };
 
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
 {
+	WARN_ON(lite);
+
 	*entries = ARRAY_SIZE(caps);
 	return caps;
 }
 
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite)
 {
+	WARN_ON(lite);
+
 	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
 		      HFI_VIDEO_CODEC_VP8;
 	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
 };
 
 static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
 	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
 	const struct hfi_platform_codec_freq_data *found = NULL;
 
+	WARN_ON(lite);
+
 	for (i = 0; i < data_size; i++) {
 		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
 			found = &data[i];
@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
 	return found;
 }
 
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vpp_freq;
 
 	return 0;
 }
 
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vsp_freq;
 
 	return 0;
 }
 
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->low_power_freq;
 
drivers/media/platform/qcom/venus/hfi_platform_v6.c +23 -9
index 4e8af645f8b9..ad08d26cd7ba 100644
@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = {
 	.num_fmts = 4,
 } };
 
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
 {
+	WARN_ON(lite);
+
 	*entries = ARRAY_SIZE(caps);
 	return caps;
 }
 
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+		       bool lite)
 {
+	WARN_ON(lite);
+
 	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
 		      HFI_VIDEO_CODEC_VP8;
 	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
 };
 
 static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
 	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
 	const struct hfi_platform_codec_freq_data *found = NULL;
 
+	WARN_ON(lite);
+
 	for (i = 0; i < data_size; i++) {
 		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
 			found = &data[i];
@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
 	return found;
 }
 
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vpp_freq;
 
 	return 0;
 }
 
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vsp_freq;
 
 	return 0;
 }
 
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->low_power_freq;
 
drivers/media/platform/qcom/venus/hfi_venus.c +18 -7
index cec7f5964d3d..d3da35f67fd5 100644
@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)
 	void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;
 	u32 clear_bit;
 
-	if (IS_V6(hdev->core))
+	if (IS_V6(hdev->core) || (IS_V4(hdev->core) && is_lite(hdev->core)))
 		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT_V6);
 	else
 		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT);
@@ -501,9 +501,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
 	if (count >= max_tries)
 		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
 		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
-		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
+
+		if (!IS_AR50_LITE(hdev->core))
+			writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
 	}
 
 	return ret;
@@ -569,6 +571,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
 	u32 mask_val;
 	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
 	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
 		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 
@@ -1138,7 +1143,13 @@ static irqreturn_t venus_isr(struct venus_core *core)
 	wrapper_base = hdev->core->wrapper_base;
 
 	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_AR50_LITE(core)) {
+		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
+		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE ||
+		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
+			hdev->irq_status = status;
+	} else if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
 		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
 		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
 		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1150,7 +1161,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
 			hdev->irq_status = status;
 	}
 	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
 		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
 	return IRQ_WAKE_THREAD;
@@ -1535,7 +1546,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1555,7 +1566,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
 	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
 	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
 		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
 	else
 		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/hfi_venus_io.h +4 -0
index 9735a246ce36..f2c3064c44ae 100644
@@ -51,6 +51,9 @@
 /* Venus cpu */
 #define CPU_CS_SCIACMDARG3			0x58
 
+#define CPU_CS_VCICMD				0x20
+#define CPU_CS_VCICMD_ARP_OFF			BIT(0)
+
 #define SFR_ADDR				0x5c
 #define MMAP_ADDR				0x60
 #define UC_REGION_ADDR				0x64
@@ -100,6 +103,7 @@
 #define WRAPPER_INTR_MASK_A2HCPU_MASK		0x4
 #define WRAPPER_INTR_MASK_A2HCPU_SHIFT		0x2
 
+#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE	0x10
 #define WRAPPER_INTR_STATUS_A2HWD_MASK_V6	0x8
 #define WRAPPER_INTR_MASK_A2HWD_BASK_V6		0x8
 
drivers/media/platform/qcom/venus/pm_helpers.c +1 -1
index 8dd5a9b0d060..e09b0d9ae610 100644
@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)
 	dev_pm_opp_put(opp);
 
 	for (i = 0; i < res->clks_num; i++) {
-		if (IS_V6(core)) {
+		if (IS_V6(core) || (IS_V4(core) && is_lite(core))) {
 			ret = clk_set_rate(core->clks[i], freq);
 			if (ret)
 				goto err;
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v8 3/7] media: venus: Add support for AR50_LITE video core

Quoted 140 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a simplified variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats, and provides encoding support for H.264 and HEVC.

---
  drivers/media/platform/qcom/venus/core.c      | 15 +++++++--
  drivers/media/platform/qcom/venus/core.h      |  5 +++
  drivers/media/platform/qcom/venus/firmware.c  | 10 ++++++
  drivers/media/platform/qcom/venus/firmware.h  |  1 +
  drivers/media/platform/qcom/venus/helpers.c   | 12 +++++--
  .../media/platform/qcom/venus/hfi_parser.c    |  5 +--
  .../media/platform/qcom/venus/hfi_platform.c  | 20 +++++++-----
  .../media/platform/qcom/venus/hfi_platform.h  | 25 ++++++++-------
  .../platform/qcom/venus/hfi_platform_v4.c     | 31 ++++++++++++------
  .../platform/qcom/venus/hfi_platform_v6.c     | 32 +++++++++++++------
  drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++----
  .../media/platform/qcom/venus/hfi_venus_io.h  |  4 +++
  .../media/platform/qcom/venus/pm_helpers.c    |  2 +-
  13 files changed, 133 insertions(+), 54 deletions(-)
drivers/media/platform/qcom/venus/core.c +12 -3
index f45715c9b222..adc38fbc9d79 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
 
  static void venus_assign_register_offsets(struct venus_core *core)
  {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
  		core->cpu_base = core->base + CPU_BASE_V6;
  		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
  		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
  		core->wrapper_base = core->base + WRAPPER_BASE_V6;
  		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
  	} else {
  		core->vbif_base = core->base + VBIF_BASE;
  		core->cpu_base = core->base + CPU_BASE;
@@ -456,6 +461,10 @@ static int venus_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_firmware_deinit;
 
+	ret = venus_firmware_cfg(core);
+	if (ret)
+		goto err_venus_shutdown;
+
  	ret = hfi_core_resume(core, true);
  	if (ret)
  		goto err_venus_shutdown;
drivers/media/platform/qcom/venus/core.h +5 -0
index 2d3cf920198f..f8602735d6c2 100644
@@ -537,6 +537,11 @@ struct venus_inst {
  #define IS_IRIS2(core)		((core)->res->vpu_version == VPU_VERSION_IRIS2)
  #define IS_IRIS2_1(core)	((core)->res->vpu_version == VPU_VERSION_IRIS2_1)
 
+static inline bool is_lite(struct venus_core *core)
+{
+	return IS_AR50_LITE(core);
+}
+
  #define ctrl_to_inst(ctrl)	\
  	container_of((ctrl)->handler, struct venus_inst, ctrl_handler)
 
drivers/media/platform/qcom/venus/firmware.c +10 -0
index 503dd270a14a..2e5d85e25d0f 100644
@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)
  	return 0;
  }
 
+int venus_firmware_cfg(struct venus_core *core)
+{
+	void __iomem *cpu_cs_base = core->cpu_cs_base;
+
+	if (IS_AR50_LITE(core))
+		writel(CPU_CS_VCICMD_ARP_OFF, cpu_cs_base + CPU_CS_VCICMD);
+
+	return 0;
+}
+
  int venus_boot(struct venus_core *core)
  {
  	struct device *dev = core->dev;
drivers/media/platform/qcom/venus/firmware.h +1 -0
index ead39e3797f0..87e1d922b369 100644
@@ -10,6 +10,7 @@ struct device;
  int venus_firmware_init(struct venus_core *core);
  void venus_firmware_deinit(struct venus_core *core);
  int venus_firmware_check(struct venus_core *core);
+int venus_firmware_cfg(struct venus_core *core);
  int venus_boot(struct venus_core *core);
  int venus_shutdown(struct venus_core *core);
  int venus_set_hw_state(struct venus_core *core, bool suspend);
drivers/media/platform/qcom/venus/helpers.c +9 -3
index 8295542e1a7c..3a761b5415c5 100644
@@ -1715,11 +1715,17 @@ int venus_helper_session_init(struct venus_inst *inst)
  	if (ret)
  		return ret;
 
-	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec,
+	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version,
+								  is_lite(inst->core),
+								  codec,
  								  session_type);
-	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version, codec,
+	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version,
+								  is_lite(inst->core),
+								  codec,
  								  session_type);
-	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version, codec,
+	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version,
+								       is_lite(inst->core),
+								       codec,
  								       session_type);
 
  	return 0;
drivers/media/platform/qcom/venus/hfi_parser.c +0 -0
index 1b3db2caa99f..55cee1c786a0 100644

drivers/media/platform/qcom/venus/hfi_parser.c static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst) · line 281

Quoted 6 lines
drivers/media/platform/qcom/venus/hfi_parser.c +2 -1
@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)
  	if (inst)
  		return 0;
 
-	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count);
+	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count,
+				      is_lite(core));

As I say below, if you pass the core pointer you don't have to macro all of this stuff.

Quoted 92 lines
drivers/media/platform/qcom/venus/hfi_parser.c +1 -1
  	if (ret)
  		return ret;
 
  	if (plat->capabilities)
-		caps = plat->capabilities(&entries);
+		caps = plat->capabilities(&entries, is_lite(core));
 
  	if (!caps || !entries || !count)
  		return -EINVAL;
drivers/media/platform/qcom/venus/hfi_platform.c +12 -8
index 643e5aa138f5..c6c248561793 100644
@@ -21,7 +21,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
  }
 
  unsigned long
-hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session
  		return 0;
 
  	if (plat->codec_vpp_freq)
-		freq = plat->codec_vpp_freq(session_type, codec);
+		freq = plat->codec_vpp_freq(session_type, codec, lite);
 
  	return freq;
  }
 
  unsigned long
-hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session
  		return 0;
 
  	if (plat->codec_vpp_freq)
-		freq = plat->codec_vsp_freq(session_type, codec);
+		freq = plat->codec_vsp_freq(session_type, codec, lite);
 
  	return freq;
  }
 
  unsigned long
-hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite, u32 codec,
+			       u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_
  		return 0;
 
  	if (plat->codec_lp_freq)
-		freq = plat->codec_lp_freq(session_type, codec);
+		freq = plat->codec_lp_freq(session_type, codec, lite);
 
  	return freq;
  }
 
  int
-hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+			bool lite)
  {
  	const struct hfi_platform *plat;
 
@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codec
  		return -EINVAL;
 
  	if (plat->codecs)
-		plat->codecs(enc_codecs, dec_codecs, count);
+		plat->codecs(enc_codecs, dec_codecs, count, lite);
 
  	if (IS_IRIS2_1(core)) {
  		*enc_codecs &= ~HFI_VIDEO_CODEC_VP8;
drivers/media/platform/qcom/venus/hfi_platform.h +0 -1
index ec89a90a8129..a9f1ead18084 100644
@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data {
  };
 
  struct hfi_platform {
-	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec);

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform_codec_freq_data { · line 55

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform.h +6 -4
-	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec);
-	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec);
-	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count);
-	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries);
+	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec, bool lite);
+	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec, bool lite);
+	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec, bool lite);
+	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite);
+	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries,
+						    bool lite);

I think you should pass a *core pointer instead of a bool, that allows for more flexibility in the future.

Quoted 36 lines
drivers/media/platform/qcom/venus/hfi_platform.h +7 -7
  	int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type,
  		      u32 buftype, struct hfi_buffer_requirements *bufreq);
  };
@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;
  extern const struct hfi_platform hfi_plat_v6;
 
  const struct hfi_platform *hfi_platform_get(enum hfi_version version);
-unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec,
-					     u32 session_type);
+unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite,
+					     u32 codec, u32 session_type);
  int hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs,
-			    u32 *count);
+			    u32 *count, bool lite);
  #endif
drivers/media/platform/qcom/venus/hfi_platform_v4.c +3 -1
index e3f0a90a567b..4ae7ed476c48 100644
@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = {
  	.num_fmts = 4,
  } };
 
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
  {
+	WARN_ON(lite);

drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 260

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +4 -1
+
  	*entries = ARRAY_SIZE(caps);
  	return caps;
  }
 
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite)
  {
+	WARN_ON(lite);
+

Why are these warnings here, is it acceptable for these to run on lite or not, if not return out ?

WARN seems a bit odd to me here.

Quoted 268 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +15 -7
  	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
  		      HFI_VIDEO_CODEC_VP8;
  	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
  };
 
  static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
  	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
  	const struct hfi_platform_codec_freq_data *found = NULL;
 
+	WARN_ON(lite);
+
  	for (i = 0; i < data_size; i++) {
  		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
  			found = &data[i];
@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
  	return found;
  }
 
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vpp_freq;
 
  	return 0;
  }
 
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vsp_freq;
 
  	return 0;
  }
 
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->low_power_freq;
 
drivers/media/platform/qcom/venus/hfi_platform_v6.c +23 -9
index 4e8af645f8b9..ad08d26cd7ba 100644
@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = {
  	.num_fmts = 4,
  } };
 
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
  {
+	WARN_ON(lite);
+
  	*entries = ARRAY_SIZE(caps);
  	return caps;
  }
 
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+		       bool lite)
  {
+	WARN_ON(lite);
+
  	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
  		      HFI_VIDEO_CODEC_VP8;
  	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
  };
 
  static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
  	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
  	const struct hfi_platform_codec_freq_data *found = NULL;
 
+	WARN_ON(lite);
+
  	for (i = 0; i < data_size; i++) {
  		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
  			found = &data[i];
@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
  	return found;
  }
 
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vpp_freq;
 
  	return 0;
  }
 
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vsp_freq;
 
  	return 0;
  }
 
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
 
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->low_power_freq;
 
drivers/media/platform/qcom/venus/hfi_venus.c +18 -7
index cec7f5964d3d..d3da35f67fd5 100644
@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)
  	void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;
  	u32 clear_bit;
 
-	if (IS_V6(hdev->core))
+	if (IS_V6(hdev->core) || (IS_V4(hdev->core) && is_lite(hdev->core)))
  		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT_V6);
  	else
  		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT);
@@ -501,9 +501,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
  	if (count >= max_tries)
  		ret = -ETIMEDOUT;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
  		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
-		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
+
+		if (!IS_AR50_LITE(hdev->core))
+			writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
  	}
 
  	return ret;
@@ -569,6 +571,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
  	u32 mask_val;
  	int ret;
 
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
  	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
  		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
 
@@ -1138,7 +1143,13 @@ static irqreturn_t venus_isr(struct venus_core *core)
  	wrapper_base = hdev->core->wrapper_base;
 
  	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_AR50_LITE(core)) {
+		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
+		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE ||
+		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
+			hdev->irq_status = status;
+	} else if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
  		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
  		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
  		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1150,7 +1161,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
  			hdev->irq_status = status;
  	}
  	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
  		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
 
  	return IRQ_WAKE_THREAD;
@@ -1535,7 +1546,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
  	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
  	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
  		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
  	else
  		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1555,7 +1566,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
  	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
  	u32 ctrl_status, cpu_status;
 
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
  		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
  	else
  		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/hfi_venus_io.h +4 -0
index 9735a246ce36..f2c3064c44ae 100644
@@ -51,6 +51,9 @@
  /* Venus cpu */
  #define CPU_CS_SCIACMDARG3			0x58
 
+#define CPU_CS_VCICMD				0x20
+#define CPU_CS_VCICMD_ARP_OFF			BIT(0)
+
  #define SFR_ADDR				0x5c
  #define MMAP_ADDR				0x60
  #define UC_REGION_ADDR				0x64
@@ -100,6 +103,7 @@
  #define WRAPPER_INTR_MASK_A2HCPU_MASK		0x4
  #define WRAPPER_INTR_MASK_A2HCPU_SHIFT		0x2
 
+#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE	0x10
  #define WRAPPER_INTR_STATUS_A2HWD_MASK_V6	0x8
  #define WRAPPER_INTR_MASK_A2HWD_BASK_V6		0x8
 
drivers/media/platform/qcom/venus/pm_helpers.c +1 -1
index 8dd5a9b0d060..e09b0d9ae610 100644
@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)
  	dev_pm_opp_put(opp);
 
  	for (i = 0; i < res->clks_num; i++) {
-		if (IS_V6(core)) {
+		if (IS_V6(core) || (IS_V4(core) && is_lite(core))) {
  			ret = clk_set_rate(core->clks[i], freq);
  			if (ret)
  				goto err;
#7 lore raw

Re: [PATCH v8 3/7] media: venus: Add support for AR50_LITE video core

Quoted 134 lines · Bryan O'Donoghue
Quoted 133 lines · Jorge Ramirez-Ortiz

The AR50_LITE is a simplified variant of the AR50 video core, designed for power and cost-efficient platforms.

It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats, and provides encoding support for H.264 and HEVC.

---
  drivers/media/platform/qcom/venus/core.c      | 15 +++++++--
  drivers/media/platform/qcom/venus/core.h      |  5 +++
  drivers/media/platform/qcom/venus/firmware.c  | 10 ++++++
  drivers/media/platform/qcom/venus/firmware.h  |  1 +
  drivers/media/platform/qcom/venus/helpers.c   | 12 +++++--
  .../media/platform/qcom/venus/hfi_parser.c    |  5 +--
  .../media/platform/qcom/venus/hfi_platform.c  | 20 +++++++-----
  .../media/platform/qcom/venus/hfi_platform.h  | 25 ++++++++-------
  .../platform/qcom/venus/hfi_platform_v4.c     | 31 ++++++++++++------
  .../platform/qcom/venus/hfi_platform_v6.c     | 32 +++++++++++++------
  drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++----
  .../media/platform/qcom/venus/hfi_venus_io.h  |  4 +++
  .../media/platform/qcom/venus/pm_helpers.c    |  2 +-
  13 files changed, 133 insertions(+), 54 deletions(-)
drivers/media/platform/qcom/venus/core.c +12 -3
index f45715c9b222..adc38fbc9d79 100644
@@ -254,14 +254,19 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type)
  static void venus_assign_register_offsets(struct venus_core *core)
  {
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
-		core->vbif_base = core->base + VBIF_BASE;
+	if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) {
  		core->cpu_base = core->base + CPU_BASE_V6;
  		core->cpu_cs_base = core->base + CPU_CS_BASE_V6;
  		core->cpu_ic_base = core->base + CPU_IC_BASE_V6;
  		core->wrapper_base = core->base + WRAPPER_BASE_V6;
  		core->wrapper_tz_base = core->base + WRAPPER_TZ_BASE_V6;
-		core->aon_base = core->base + AON_BASE_V6;
+		if (IS_AR50_LITE(core)) {
+			core->vbif_base = NULL;
+			core->aon_base = NULL;
+		} else {
+			core->vbif_base = core->base + VBIF_BASE;
+			core->aon_base = core->base + AON_BASE_V6;
+		}
  	} else {
  		core->vbif_base = core->base + VBIF_BASE;
  		core->cpu_base = core->base + CPU_BASE;
@@ -456,6 +461,10 @@ static int venus_probe(struct platform_device *pdev)
  	if (ret)
  		goto err_firmware_deinit;
+	ret = venus_firmware_cfg(core);
+	if (ret)
+		goto err_venus_shutdown;
+
  	ret = hfi_core_resume(core, true);
  	if (ret)
  		goto err_venus_shutdown;
drivers/media/platform/qcom/venus/core.h +5 -0
index 2d3cf920198f..f8602735d6c2 100644
@@ -537,6 +537,11 @@ struct venus_inst {
  #define IS_IRIS2(core)		((core)->res->vpu_version == VPU_VERSION_IRIS2)
  #define IS_IRIS2_1(core)	((core)->res->vpu_version == VPU_VERSION_IRIS2_1)
+static inline bool is_lite(struct venus_core *core)
+{
+	return IS_AR50_LITE(core);
+}
+
  #define ctrl_to_inst(ctrl)	\
  	container_of((ctrl)->handler, struct venus_inst, ctrl_handler)
drivers/media/platform/qcom/venus/firmware.c +10 -0
index 503dd270a14a..2e5d85e25d0f 100644
@@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *core)
  	return 0;
  }
+int venus_firmware_cfg(struct venus_core *core)
+{
+	void __iomem *cpu_cs_base = core->cpu_cs_base;
+
+	if (IS_AR50_LITE(core))
+		writel(CPU_CS_VCICMD_ARP_OFF, cpu_cs_base + CPU_CS_VCICMD);
+
+	return 0;
+}
+
  int venus_boot(struct venus_core *core)
  {
  	struct device *dev = core->dev;
drivers/media/platform/qcom/venus/firmware.h +1 -0
index ead39e3797f0..87e1d922b369 100644
@@ -10,6 +10,7 @@ struct device;
  int venus_firmware_init(struct venus_core *core);
  void venus_firmware_deinit(struct venus_core *core);
  int venus_firmware_check(struct venus_core *core);
+int venus_firmware_cfg(struct venus_core *core);
  int venus_boot(struct venus_core *core);
  int venus_shutdown(struct venus_core *core);
  int venus_set_hw_state(struct venus_core *core, bool suspend);
drivers/media/platform/qcom/venus/helpers.c +9 -3
index 8295542e1a7c..3a761b5415c5 100644
@@ -1715,11 +1715,17 @@ int venus_helper_session_init(struct venus_inst *inst)
  	if (ret)
  		return ret;
-	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version, codec,
+	inst->clk_data.vpp_freq = hfi_platform_get_codec_vpp_freq(version,
+								  is_lite(inst->core),
+								  codec,
  								  session_type);
-	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version, codec,
+	inst->clk_data.vsp_freq = hfi_platform_get_codec_vsp_freq(version,
+								  is_lite(inst->core),
+								  codec,
  								  session_type);
-	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version, codec,
+	inst->clk_data.low_power_freq = hfi_platform_get_codec_lp_freq(version,
+								       is_lite(inst->core),
+								       codec,
  								       session_type);
  	return 0;
drivers/media/platform/qcom/venus/hfi_parser.c +0 -0
index 1b3db2caa99f..55cee1c786a0 100644
@@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_parser.c static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst) · line 281

Quoted 5 lines
drivers/media/platform/qcom/venus/hfi_parser.c +2 -1
  	if (inst)
  		return 0;
-	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count);
+	ret = hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count,
+				      is_lite(core));

As I say below, if you pass the core pointer you don't have to macro all of this stuff.

true, IMO the code was easier to read this way but dont mind abstracting it. I will change, not a problem.

Quoted 82 lines
Quoted 82 lines
drivers/media/platform/qcom/venus/hfi_parser.c +1 -1
  	if (ret)
  		return ret;
  	if (plat->capabilities)
-		caps = plat->capabilities(&entries);
+		caps = plat->capabilities(&entries, is_lite(core));
  	if (!caps || !entries || !count)
  		return -EINVAL;
drivers/media/platform/qcom/venus/hfi_platform.c +12 -8
index 643e5aa138f5..c6c248561793 100644
@@ -21,7 +21,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_version version)
  }
  unsigned long
-hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 session
  		return 0;
  	if (plat->codec_vpp_freq)
-		freq = plat->codec_vpp_freq(session_type, codec);
+		freq = plat->codec_vpp_freq(session_type, codec, lite);
  	return freq;
  }
  unsigned long
-hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite, u32 codec,
+				u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 session
  		return 0;
  	if (plat->codec_vpp_freq)
-		freq = plat->codec_vsp_freq(session_type, codec);
+		freq = plat->codec_vsp_freq(session_type, codec, lite);
  	return freq;
  }
  unsigned long
-hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_type)
+hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite, u32 codec,
+			       u32 session_type)
  {
  	const struct hfi_platform *plat;
  	unsigned long freq = 0;
@@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 session_
  		return 0;
  	if (plat->codec_lp_freq)
-		freq = plat->codec_lp_freq(session_type, codec);
+		freq = plat->codec_lp_freq(session_type, codec, lite);
  	return freq;
  }
  int
-hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+			bool lite)
  {
  	const struct hfi_platform *plat;
@@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codec
  		return -EINVAL;
  	if (plat->codecs)
-		plat->codecs(enc_codecs, dec_codecs, count);
+		plat->codecs(enc_codecs, dec_codecs, count, lite);
  	if (IS_IRIS2_1(core)) {
  		*enc_codecs &= ~HFI_VIDEO_CODEC_VP8;
drivers/media/platform/qcom/venus/hfi_platform.h +1 -5
index ec89a90a8129..a9f1ead18084 100644
@@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data {
  };
  struct hfi_platform {
-	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec);
-	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec);
-	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec);
-	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count);
-	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries);
+	unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec, bool lite);
Quoted 8 lines

drivers/media/platform/qcom/venus/hfi_platform.h struct hfi_platform_codec_freq_data { · line 55

Quoted 5 lines
drivers/media/platform/qcom/venus/hfi_platform.h +5 -0
+	unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec, bool lite);
+	unsigned long (*codec_lp_freq)(u32 session_type, u32 codec, bool lite);
+	void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite);
+	const struct hfi_plat_caps *(*capabilities)(unsigned int *entries,
+						    bool lite);

I think you should pass a *core pointer instead of a bool, that allows for more flexibility in the future.

I did consider it but for me it kind of broke the idea of encapsulation exposing the function to everything under the venus' innenwelt

if encapsulation and meaning is not an issue I'll pass core then, I do agree it will make future extension way simpler.

Quoted 48 lines
Quoted 34 lines
drivers/media/platform/qcom/venus/hfi_platform.h +7 -7
  	int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type,
  		      u32 buftype, struct hfi_buffer_requirements *bufreq);
  };
@@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4;
  extern const struct hfi_platform hfi_plat_v6;
  const struct hfi_platform *hfi_platform_get(enum hfi_version version);
-unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec,
-					      u32 session_type);
-unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec,
-					     u32 session_type);
+unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite,
+					      u32 codec, u32 session_type);
+unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite,
+					     u32 codec, u32 session_type);
  int hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec_codecs,
-			    u32 *count);
+			    u32 *count, bool lite);
  #endif
drivers/media/platform/qcom/venus/hfi_platform_v4.c +2 -1
index e3f0a90a567b..4ae7ed476c48 100644
@@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] = {
  	.num_fmts = 4,
  } };
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
  {

drivers/media/platform/qcom/venus/hfi_platform_v4.c static const struct hfi_plat_caps caps[] = { · line 258

Quoted 10 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +5 -1
+	WARN_ON(lite);
+
  	*entries = ARRAY_SIZE(caps);
  	return caps;
  }
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite)
  {
+	WARN_ON(lite);
+

Why are these warnings here, is it acceptable for these to run on lite or not, if not return out ?

Quoted 1 line

WARN seems a bit odd to me here.

sure, but not at this point in time - 'lite' only matters when there is a platform that supports it (ie, after the next commit when we enable the AR50_LITE support)

I think I am going to remove these warnings anyway...seem to be confusing everyone.

Quoted 233 lines
Quoted 232 lines
drivers/media/platform/qcom/venus/hfi_platform_v4.c +15 -7
  	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
  		      HFI_VIDEO_CODEC_VP8;
  	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
  };
  static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
  	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
  	const struct hfi_platform_codec_freq_data *found = NULL;
+	WARN_ON(lite);
+
  	for (i = 0; i < data_size; i++) {
  		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
  			found = &data[i];
@@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
  	return found;
  }
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vpp_freq;
  	return 0;
  }
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vsp_freq;
  	return 0;
  }
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->low_power_freq;
drivers/media/platform/qcom/venus/hfi_platform_v6.c +23 -9
index 4e8af645f8b9..ad08d26cd7ba 100644
@@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] = {
  	.num_fmts = 4,
  } };
-static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
+static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
+						    bool lite)
  {
+	WARN_ON(lite);
+
  	*entries = ARRAY_SIZE(caps);
  	return caps;
  }
-static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
+static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count,
+		       bool lite)
  {
+	WARN_ON(lite);
+
  	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
  		      HFI_VIDEO_CODEC_VP8;
  	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
@@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
  };
  static const struct hfi_platform_codec_freq_data *
-get_codec_freq_data(u32 session_type, u32 pixfmt)
+get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
  	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
  	const struct hfi_platform_codec_freq_data *found = NULL;
+	WARN_ON(lite);
+
  	for (i = 0; i < data_size; i++) {
  		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
  			found = &data[i];
@@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt)
  	return found;
  }
-static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vpp_freq;
  	return 0;
  }
-static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
+static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->vsp_freq;
  	return 0;
  }
-static unsigned long codec_lp_freq(u32 session_type, u32 codec)
+static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
  {
  	const struct hfi_platform_codec_freq_data *data;
-	data = get_codec_freq_data(session_type, codec);
+	WARN_ON(lite);
+
+	data = get_codec_freq_data(session_type, codec, lite);
  	if (data)
  		return data->low_power_freq;
drivers/media/platform/qcom/venus/hfi_venus.c +18 -7
index cec7f5964d3d..d3da35f67fd5 100644
@@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hdev)
  	void __iomem *cpu_ic_base = hdev->core->cpu_ic_base;
  	u32 clear_bit;
-	if (IS_V6(hdev->core))
+	if (IS_V6(hdev->core) || (IS_V4(hdev->core) && is_lite(hdev->core)))
  		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT_V6);
  	else
  		clear_bit = BIT(CPU_IC_SOFTINT_H2A_SHIFT);
@@ -501,9 +501,11 @@ static int venus_boot_core(struct venus_hfi_device *hdev)
  	if (count >= max_tries)
  		ret = -ETIMEDOUT;
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core)) {
  		writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6);
-		writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
+
+		if (!IS_AR50_LITE(hdev->core))
+			writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6);
  	}
  	return ret;
@@ -569,6 +571,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev)
  	u32 mask_val;
  	int ret;
+	if (IS_AR50_LITE(hdev->core))
+		return 0;
+
  	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) {
  		writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6);
@@ -1138,7 +1143,13 @@ static irqreturn_t venus_isr(struct venus_core *core)
  	wrapper_base = hdev->core->wrapper_base;
  	status = readl(wrapper_base + WRAPPER_INTR_STATUS);
-	if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
+
+	if (IS_AR50_LITE(core)) {
+		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
+		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE ||
+		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
+			hdev->irq_status = status;
+	} else if (IS_IRIS2(core) || IS_IRIS2_1(core)) {
  		if (status & WRAPPER_INTR_STATUS_A2H_MASK ||
  		    status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 ||
  		    status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK)
@@ -1150,7 +1161,7 @@ static irqreturn_t venus_isr(struct venus_core *core)
  			hdev->irq_status = status;
  	}
  	writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR);
-	if (!(IS_IRIS2(core) || IS_IRIS2_1(core)))
+	if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)))
  		writel(status, wrapper_base + WRAPPER_INTR_CLEAR);
  	return IRQ_WAKE_THREAD;
@@ -1535,7 +1546,7 @@ static bool venus_cpu_and_video_core_idle(struct venus_hfi_device *hdev)
  	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
  	u32 ctrl_status, cpu_status;
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
  		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
  	else
  		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
@@ -1555,7 +1566,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_hfi_device *hdev)
  	void __iomem *cpu_cs_base = hdev->core->cpu_cs_base;
  	u32 ctrl_status, cpu_status;
-	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core))
+	if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->core))
  		cpu_status = readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6);
  	else
  		cpu_status = readl(wrapper_base + WRAPPER_CPU_STATUS);
drivers/media/platform/qcom/venus/hfi_venus_io.h +4 -0
index 9735a246ce36..f2c3064c44ae 100644
@@ -51,6 +51,9 @@
  /* Venus cpu */
  #define CPU_CS_SCIACMDARG3			0x58
+#define CPU_CS_VCICMD				0x20
+#define CPU_CS_VCICMD_ARP_OFF			BIT(0)
+
  #define SFR_ADDR				0x5c
  #define MMAP_ADDR				0x60
  #define UC_REGION_ADDR				0x64
@@ -100,6 +103,7 @@
  #define WRAPPER_INTR_MASK_A2HCPU_MASK		0x4
  #define WRAPPER_INTR_MASK_A2HCPU_SHIFT		0x2
+#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE	0x10
  #define WRAPPER_INTR_STATUS_A2HWD_MASK_V6	0x8
  #define WRAPPER_INTR_MASK_A2HWD_BASK_V6		0x8
drivers/media/platform/qcom/venus/pm_helpers.c +1 -1
index 8dd5a9b0d060..e09b0d9ae610 100644
@@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core)
  	dev_pm_opp_put(opp);
  	for (i = 0; i < res->clks_num; i++) {
-		if (IS_V6(core)) {
+		if (IS_V6(core) || (IS_V4(core) && is_lite(core))) {
  			ret = clk_set_rate(core->clks[i], freq);
  			if (ret)
  				goto err;
#8 lore raw

PATCH v8 4/7 media: venus: hfi_plat_v4: Add capabilities for the 4XX lite core

In reply to Jorge Ramirez-Ortiz

Populate the HFI v4 lite capability set used by the AR50_LITE video core.

These capabilities define the supported codec formats and operational limits specific to this streamlined VPU variant.

---
 .../platform/qcom/venus/hfi_platform_v4.c     | 170 ++++++++++++++++--
 1 file changed, 151 insertions(+), 19 deletions(-)
drivers/media/platform/qcom/venus/hfi_platform_v4.c +151 -19
index 4ae7ed476c48..2bb6cb6a70f3 100644
@@ -245,25 +245,149 @@ static const struct hfi_plat_caps caps[] = {
 	.num_fmts = 4,
 } };
 
+static const struct hfi_plat_caps caps_lite[] = {
+{
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = { HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_5},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_5},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_5},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_5},
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_HIGH0 << 28 },
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_HIGH0 << 28 },
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_VP9,
+	.domain = VIDC_SESSION_TYPE_DEC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.num_caps = 7,
+	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
+	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
+	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
+	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
+	.num_fmts = 4,
+}, {
+	.codec = HFI_VIDEO_CODEC_H264,
+	.domain = VIDC_SESSION_TYPE_ENC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.caps[7] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS, 0, 6, 1},
+	.caps[8] = {HFI_CAPABILITY_ENC_LTR_COUNT, 0, 4, 1},
+	.caps[9] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE, 0, 244800, 1},
+	.caps[10] = {HFI_CAPABILITY_I_FRAME_QP, 0, 51, 1},
+	.caps[11] = {HFI_CAPABILITY_P_FRAME_QP, 0, 51, 1},
+	.caps[12] = {HFI_CAPABILITY_B_FRAME_QP, 0, 51, 1},
+	.caps[13] = {HFI_CAPABILITY_SLICE_BYTE, 1, 10, 1},
+	.caps[14] = {HFI_CAPABILITY_SLICE_MB, 1, 10, 1},
+	.num_caps = 15,
+	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_5},
+	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_5},
+	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_5},
+	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_5},
+	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_5},
+	.num_pl = 5,
+	.fmts[0] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12},
+	.fmts[1] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.num_fmts = 2,
+}, {
+	.codec = HFI_VIDEO_CODEC_HEVC,
+	.domain = VIDC_SESSION_TYPE_ENC,
+	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
+	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
+	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
+	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 60000000, 1 },
+	.caps[4] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 244800, 1},
+	.caps[5] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
+	.caps[6] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
+	.caps[7] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS, 0, 6, 1},
+	.caps[8] = {HFI_CAPABILITY_ENC_LTR_COUNT, 0, 4, 1},
+	.caps[9] = {HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE, 0, 244800, 1},
+	.caps[10] = {HFI_CAPABILITY_I_FRAME_QP, 0, 51, 1},
+	.caps[11] = {HFI_CAPABILITY_P_FRAME_QP, 0, 51, 1},
+	.caps[12] = {HFI_CAPABILITY_B_FRAME_QP, 0, 51, 1},
+	.caps[13] = {HFI_CAPABILITY_SLICE_BYTE, 1, 10, 1},
+	.caps[14] = {HFI_CAPABILITY_SLICE_MB, 1, 10, 1},
+	.num_caps = 15,
+	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_HIGH0},
+	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_5 | HFI_HEVC_TIER_HIGH0},
+	.num_pl = 2,
+	.fmts[0] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12},
+	.fmts[1] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12_UBWC},
+	.num_fmts = 2,
+} };
+
 static const struct hfi_plat_caps *get_capabilities(unsigned int *entries,
 						    bool lite)
 {
-	WARN_ON(lite);
+	*entries = lite ? ARRAY_SIZE(caps_lite) : ARRAY_SIZE(caps);
 
-	*entries = ARRAY_SIZE(caps);
-	return caps;
+	return lite ? caps_lite : caps;
 }
 
 static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite)
 {
-	WARN_ON(lite);
+	const struct hfi_plat_caps *caps;
+	unsigned int num;
+	size_t i;
+
+	*enc_codecs = 0;
+	*dec_codecs = 0;
+
+	caps = get_capabilities(&num, lite);
 
-	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
-		      HFI_VIDEO_CODEC_VP8;
-	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
-		      HFI_VIDEO_CODEC_VP8 | HFI_VIDEO_CODEC_VP9 |
-		      HFI_VIDEO_CODEC_MPEG2;
-	*count = 8;
+	for (i = 0; i < num; caps++, i++) {
+		if (caps->domain == VIDC_SESSION_TYPE_ENC)
+			*enc_codecs |= caps->codec;
+		else
+			*dec_codecs |= caps->codec;
+	}
+
+	*count = num;
 }
 
 static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
@@ -277,14 +401,28 @@ static const struct hfi_platform_codec_freq_data codec_freq_data[] =  {
 	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10, 200 },
 };
 
+static const struct hfi_platform_codec_freq_data codec_freq_data_lite[] = {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 440, 0, 440 },
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 0, 675 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 0, 675 },
+};
+
 static const struct hfi_platform_codec_freq_data *
 get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite)
 {
-	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
-	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
+	const struct hfi_platform_codec_freq_data *data;
+	unsigned int i, data_size;
 	const struct hfi_platform_codec_freq_data *found = NULL;
 
-	WARN_ON(lite);
+	if (lite) {
+		data = codec_freq_data_lite;
+		data_size = ARRAY_SIZE(codec_freq_data_lite);
+	} else {
+		data = codec_freq_data;
+		data_size = ARRAY_SIZE(codec_freq_data);
+	}
 
 	for (i = 0; i < data_size; i++) {
 		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
@@ -300,8 +438,6 @@ static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	WARN_ON(lite);
-
 	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vpp_freq;
@@ -313,8 +449,6 @@ static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	WARN_ON(lite);
-
 	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->vsp_freq;
@@ -326,8 +460,6 @@ static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite)
 {
 	const struct hfi_platform_codec_freq_data *data;
 
-	WARN_ON(lite);
-
 	data = get_codec_freq_data(session_type, codec, lite);
 	if (data)
 		return data->low_power_freq;
Signature · 1 line
2.34.1
#9 lore raw

PATCH v8 5/7 media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +50 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
+	.major = 6, .minor = 0, .rev = 55,
+};
+
+static const struct venus_resources qcm2290_res = {
+	.bw_tbl_dec = qcm2290_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(qcm2290_bw_table_dec),
+	.bw_tbl_enc = qcm2290_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(qcm2290_bw_table_enc),
+	.clks = { "core", "iface", "bus", "throttle" },
+	.clks_num = 4,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = (const char *[]) { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.opp_pmdomain = (const char *[]) { "cx" },
+	.vcodec_num = 1,
+	.hfi_version = HFI_VERSION_4XX,
+	.vpu_version = VPU_VERSION_AR50_LITE,
+	.max_load = 352800,
+	.num_vpp_pipes = 1,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.cp_start = 0,
+	.cp_size = 0x70800000,
+	.cp_nonpixel_start = 0x1000000,
+	.cp_nonpixel_size = 0x24800000,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-6.0/venus.mbn",
+	.dec_nodename = "video-decoder",
+	.enc_nodename = "video-encoder",
+	.min_fw = &min_fw,
+};
+
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
@@ -1080,6 +1129,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
Signature · 1 line
2.34.1
#10 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 35 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +7 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +10 -0
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

drivers/media/platform/qcom/venus/core.c static const struct of_device_id venus_dt_match[] = { · line 1132

Quoted 5 lines
drivers/media/platform/qcom/venus/core.c +1 -0
@@ -1080,6 +1129,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },

Please keep the table sorted.

Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +0 -0
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
#11 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

This added some complexity to the driver. And so in internal discussions it was agreed that it was not worth to carry it and that it should be dropped.

I'll let Vikash and Bryan comment on the decision.

Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct of_device_id venus_dt_match[] = { · line 1132

Quoted 6 lines
drivers/media/platform/qcom/venus/core.c +1 -0
@@ -1080,6 +1129,7 @@ static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
 	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
+	{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },

Please keep the table sorted.

argh...sure

Quoted 11 lines
Quoted 7 lines
drivers/media/platform/qcom/venus/core.c +0 -0
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
#12 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 54 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

Quoted 2 lines

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

#13 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 55 lines · Jorge Ramirez
Quoted 54 lines · Jorge Ramirez
Quoted 52 lines · Dmitry Baryshkov
Quoted 35 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +7 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +10 -0
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

Quoted 7 lines
Quoted 2 lines

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Signature · 2 lines
With best wishes
Dmitry
#14 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

At this point, I have v9 ready based on v8, addressing the latest round of comments. However, if we need to revert to the features in v7, it will require reworking a significant amount of code.

To avoid going in circles, I’d appreciate some clarity on the direction from Vikash, Bryan, and Dkishita:

ok to post v9 based on v8 or should I bring back v7 support (decoding) for firmwares before 6.0.55?

#15 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 69 lines · Jorge Ramirez
Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Quoted 5 lines

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

+$0.05

I thought we were going to eventually relax/drop the fw requirement when the driver learns some new cool tricks, but are we now straying away from that? (particularly thinking about the EOS part)

Konrad

#16 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 76 lines · Konrad Dybcio
Quoted 69 lines · Jorge Ramirez
Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Quoted 5 lines

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

Quoted 6 lines

+$0.05

I thought we were going to eventually relax/drop the fw requirement when the driver learns some new cool tricks, but are we now straying away from that? (particularly thinking about the EOS part)

um, no not really: the decision was to simply drop support for pre 6.0.55 firmwares for the AR50_LITE.

Pre 6.0.55:

-  has a requirement for secure buffers to support encoding
-  requires a driver workaround for EOS (providing a dummy length)
-  during video encoding.

To support < 6.0.55, v7 of the driver patchset:

- uses the version to disable the encode node
- enables the video decode node
- implements the EOS workaround.

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

#17 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 99 lines · Jorge Ramirez
Quoted 76 lines · Konrad Dybcio
Quoted 69 lines · Jorge Ramirez
Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Quoted 5 lines

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

Quoted 6 lines

+$0.05

I thought we were going to eventually relax/drop the fw requirement when the driver learns some new cool tricks, but are we now straying away from that? (particularly thinking about the EOS part)

um, no not really: the decision was to simply drop support for pre 6.0.55 firmwares for the AR50_LITE.

Pre 6.0.55:

(quoted diff) +0 -3
-  has a requirement for secure buffers to support encoding
-  requires a driver workaround for EOS (providing a dummy length)
-  during video encoding.

To support < 6.0.55, v7 of the driver patchset:

- uses the version to disable the encode node
- enables the video decode node
- implements the EOS workaround.

Quoted 8 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

Regards,
Vikash

#18 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 7 lines · Vikash Garodia
Quoted 7 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Quoted 7 lines
Quoted 2 lines

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

#19 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 11 lines · Jorge Ramirez
Quoted 10 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Quoted 6 lines
Quoted 4 lines

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

Regards,
Vikash

#20 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 19 lines · Vikash Garodia
Quoted 16 lines · Jorge Ramirez
Quoted 14 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

Quoted 4 lines
Quoted 1 line

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

sure I agree with that, just that I dont call that a hack (more a quirk or workaround)

Quoted 4 lines

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

The way I see it—and as we discussed the other day—I was fine with dropping decoding support for firmware versions < 6.0.55, as long as someone with internal insight could confirm we won't upset users. Maybe I’m overthinking it, but coming from OTA, I’ve seen how nice it is when users upgrade their kernel and suddenly get hardware video decode without having to worry about firmware upgrades.

Quoted 4 lines

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

100% , I saw it!

Quoted 3 lines

Regards,
Vikash

Dmitry, all ok then?

#21 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Vikash Garodia
Quoted 24 lines · Vikash Garodia
Quoted 11 lines · Jorge Ramirez
Quoted 10 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Quoted 6 lines
Quoted 4 lines

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

Quoted 7 lines

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

Migrating to Iris won't bring gen2 HFI. Think about users which have OEM-fused hardware. For them it's not possible to switch firmware from gen1 to gen2. Thus, if the SoC has been released using gen1 HFI, we should think twice before upgrading it to gen2.

Signature · 2 lines
With best wishes
Dmitry
#22 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 29 lines · Dmitry Baryshkov
Quoted 28 lines · Vikash Garodia
Quoted 11 lines · Jorge Ramirez
Quoted 10 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Quoted 6 lines
Quoted 4 lines

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

Quoted 9 lines
Quoted 3 lines

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

Migrating to Iris won't bring gen2 HFI. Think about users which have OEM-fused hardware. For them it's not possible to switch firmware from gen1 to gen2. Thus, if the SoC has been released using gen1 HFI, we should think twice before upgrading it to gen2.

As I understand it now after the thread, any driver developer working on new features should not be constrained by users with OEM-fused hardware.

Since only the OEM can provide signed firmware updates, it is their responsibility—not ours—to figure out how to deliver those updates if they want their users to benefit from new features (or new fixes).

The EU Cyber Resilience Act supports this view by placing the update obligation on manufacturers (at least that is what I understand it, let me know if you understand it differently)

Breaking backward compatibility is something we must avoid of course. However, guaranteeing compatibility between old firmwares (whether signed or not) and _new_ features is a separate matter...

#23 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 40 lines · Jorge Ramirez
Quoted 29 lines · Dmitry Baryshkov
Quoted 28 lines · Vikash Garodia
Quoted 11 lines · Jorge Ramirez
Quoted 10 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Quoted 6 lines
Quoted 4 lines

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

Quoted 9 lines
Quoted 3 lines

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

Migrating to Iris won't bring gen2 HFI. Think about users which have OEM-fused hardware. For them it's not possible to switch firmware from gen1 to gen2. Thus, if the SoC has been released using gen1 HFI, we should think twice before upgrading it to gen2.

Quoted 6 lines

As I understand it now after the thread, any driver developer working on new features should not be constrained by users with OEM-fused hardware.

Since only the OEM can provide signed firmware updates, it is their responsibility—not ours—to figure out how to deliver those updates if they want their users to benefit from new features (or new fixes).

The OEMs might go bankrupt, might stop supporting hardware, might not be bound by EU laws, etc. If the platform was shipped with gen1 HFI and we suddently provide gen2 HFI, the driver must support both firmware interfaces for that platform.

Quoted 7 lines

The EU Cyber Resilience Act supports this view by placing the update obligation on manufacturers (at least that is what I understand it, let me know if you understand it differently)

Breaking backward compatibility is something we must avoid of course. However, guaranteeing compatibility between old firmwares (whether signed or not) and _new_ features is a separate matter...

Anyway, the kernel is provided separately from the firmware. If we supported a particular firmware set, we can not break that.

AR50_LITE is a corner case, as we have been shipping the firmware, but there was no corresponding open-source driver for that platform.

Signature · 2 lines
With best wishes
Dmitry
#24 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez
Quoted 29 lines · Dmitry Baryshkov
Quoted 28 lines · Vikash Garodia
Quoted 11 lines · Jorge Ramirez
Quoted 10 lines · Vikash Garodia
Quoted 9 lines

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Quoted 6 lines
Quoted 4 lines

the issue is in firmware for both encoder and decoder. Didn't like the idea of driver carrying the hack for a firmware issue. Just because, for encoder, we are unable to hack it in driver, we are ok to have it enabled in a newer version of the firmware, we can follow the same for decoders as well.

if that is the only reason please do explain what do you mean by hack.

I meant that the EOS handling was not needed in driver after fixing it in firmware, isn't it ? Was trying to avoid carrying this in driver.

I tend to agree with the comment made by Dmitry in another thread to have decode enabled with existing firmware, no option but to support the *already* published bins.

Quoted 9 lines
Quoted 3 lines

Having said that, these limitation of having a separate EOS dummy buffer is well sorted out in gen2 HFI which have an explicit DRAIN cmd for it. Hope this motivates you to migrate to iris soon for AR50LITE variants :)

Migrating to Iris won't bring gen2 HFI. Think about users which have OEM-fused hardware. For them it's not possible to switch firmware from gen1 to gen2. Thus, if the SoC has been released using gen1 HFI, we should think twice before upgrading it to gen2.

As I understand it now after the thread, any driver developer working on new features should not be constrained by users with OEM-fused hardware.

Quoted 8 lines
Quoted 3 lines

Since only the OEM can provide signed firmware updates, it is their responsibility—not ours—to figure out how to deliver those updates if they want their users to benefit from new features (or new fixes).

The OEMs might go bankrupt, might stop supporting hardware, might not be bound by EU laws, etc. If the platform was shipped with gen1 HFI and we suddently provide gen2 HFI, the driver must support both firmware interfaces for that platform.

sure, that is backwards compatibility

Quoted 9 lines
Quoted 8 lines

The EU Cyber Resilience Act supports this view by placing the update obligation on manufacturers (at least that is what I understand it, let me know if you understand it differently)

Breaking backward compatibility is something we must avoid of course. However, guaranteeing compatibility between old firmwares (whether signed or not) and _new_ features is a separate matter...

Quoted 5 lines

Anyway, the kernel is provided separately from the firmware. If we supported a particular firmware set, we can not break that.

AR50_LITE is a corner case, as we have been shipping the firmware, but there was no corresponding open-source driver for that platform.

right

Quoted 4 lines
Signature · 3 lines
-- 
With best wishes
Dmitry
#25 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez
Quoted 89 lines · Jorge Ramirez
Quoted 76 lines · Konrad Dybcio
Quoted 69 lines · Jorge Ramirez
Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Quoted 5 lines

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

Quoted 6 lines

+$0.05

I thought we were going to eventually relax/drop the fw requirement when the driver learns some new cool tricks, but are we now straying away from that? (particularly thinking about the EOS part)

um, no not really: the decision was to simply drop support for pre 6.0.55 firmwares for the AR50_LITE.

Pre 6.0.55:

Review

Quoted 3 lines
(quoted diff) +0 -3
-  has a requirement for secure buffers to support encoding
-  requires a driver workaround for EOS (providing a dummy length)
-  during video encoding.

If it requires secure buffers to support encoding (which we do not implement), then EOS workaround is also not required (at this point).

When we get secure buffers support, we can either lift the requirement on encode side (and add EOS workaround) or keep the requirement for newer firmware.

Quoted 10 lines

To support < 6.0.55, v7 of the driver patchset:

- uses the version to disable the encode node
- enables the video decode node
- implements the EOS workaround.

It was agreed that this complexity was not necessary and that we should just drop <6.0.55 firmware support (which would in any case only include video decode).

Limiting < 6.0.55 to decode only sounds fine.

Quoted 5 lines

And so on v8, I removed the above.

Now I have v9 ready to post it, but Dmitry is asking why cant we have the v7 functionality so I am waiting for direction.

Signature · 2 lines
With best wishes
Dmitry
#26 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 88 lines · Dmitry Baryshkov
Quoted 87 lines · Jorge Ramirez
Quoted 76 lines · Konrad Dybcio
Quoted 69 lines · Jorge Ramirez
Quoted 59 lines · Dmitry Baryshkov
Quoted 58 lines · Jorge Ramirez
Quoted 56 lines · Jorge Ramirez
Quoted 44 lines · Dmitry Baryshkov
Quoted 43 lines · Jorge Ramirez-Ortiz

Add a qcm2290 compatible binding to the Cenus core.

The maximum concurrency is video decode at 1920x1080 (FullHD) with video encode at 1280x720 (HD).

The driver is not available to firmware versions below 6.0.55 due to an internal requirement for secure buffers.

The bandwidth tables incorporate a conservative safety margin to ensure stability under peak DDR and interconnect load conditions.

---
 drivers/media/platform/qcom/venus/core.c | 50 ++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
drivers/media/platform/qcom/venus/core.c +15 -0
index adc38fbc9d79..753a16f53622 100644
@@ -1070,6 +1070,55 @@ static const struct venus_resources sc7280_res = {
 	.enc_nodename = "video-encoder",
 };
 
+static const struct bw_tbl qcm2290_bw_table_dec[] = {
+	{ 352800, 597000, 0, 746000, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 413000, 0, 516000, 0 }, /* 1080p@30 */
+	{ 216000, 364000, 0, 454000, 0 }, /* 720p@60  */
+	{ 108000, 182000, 0, 227000, 0 }, /* 720p@30  */
+};
+
+static const struct bw_tbl qcm2290_bw_table_enc[] = {
+	{ 352800, 396000, 0, 0, 0 }, /* 1080p@30 + 720p@30 */
+	{ 244800, 275000, 0, 0, 0 }, /* 1080p@30 */
+	{ 216000, 242000, 0, 0, 0 }, /* 720p@60  */
+	{ 108000, 121000, 0, 0, 0 }, /* 720p@30  */
+};
+
+static const struct firmware_version min_fw = {
Quoted 8 lines

drivers/media/platform/qcom/venus/core.c static const struct venus_resources sc7280_res = { · line 1089

Quoted 2 lines
drivers/media/platform/qcom/venus/core.c +2 -0
+	.major = 6, .minor = 0, .rev = 55,
+};

This will make venus driver error out with the firmware which is available in Debian trixie (and possibly other distributions). If I remember correctly, the driver can work with that firmware with the limited functionality. Can we please support that instead of erroring out completely?

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

Quoted 7 lines
Quoted 4 lines

just re-reading your note, in case this was not clear, the _current_ driver upstream will never work with the current firmware if that is what you were thinking (it would need v7 of this series to enable video decoding).

I'd really prefer if we could support firmware that is present in Debian trixie and that has been upstreamed more than a year ago.

Quoted 5 lines

I share your view — which is why I put the effort into v7 — but I also understand that maintaining the extra code and EOS workaround for decoding needs to be justifiable. So I chose to align with the maintainers' perspective on this and removed it on v8 (partially also because I wanted to unblock the current EOS discussion).

Quoted 6 lines

+$0.05

I thought we were going to eventually relax/drop the fw requirement when the driver learns some new cool tricks, but are we now straying away from that? (particularly thinking about the EOS part)

um, no not really: the decision was to simply drop support for pre 6.0.55 firmwares for the AR50_LITE.

Quoted 8 lines

Review

Quoted 5 lines

Pre 6.0.55:

(quoted diff) +0 -3
-  has a requirement for secure buffers to support encoding
-  requires a driver workaround for EOS (providing a dummy length)
-  during video encoding.

If it requires secure buffers to support encoding (which we do not implement), then EOS workaround is also not required (at this point).

My bad earlier — the EOS workaround applies to video decoding, not encoding.

Video decoding does NOT require secure buffers, which is why it can be enabled independently of the firmware update.

to clarify, the EOS workaround is necessary for decoding because:

- The current driver doesn't fully follow to the HFI spec WRT EOS handling, which leads to issues like the one we're seeing.

- The firmware we're using doesn't accept the upstream driver's existing workarounds — such as hardcoded buffer addresses like 0x0 or 0xdeadb000, which vary across firmware versions.

The way I see it sticking to the spec — that is, always passing a valid buffer which was my preferred choice and my first implementation — would make the driver more robust and less prone to this kind of problems.

Failing that, I dont see the issue with adding workarounds/quirks to the EOS handling (in this case).

if (IS_AR50_LITE(core) && is_fw_rev_or_older(core, 6, 0, 53))

	data->alloc_len = 1;

Even more considering we already have:

if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87))

	data->device_addr = 0x0;
else	
        data->device_addr = 0xdeadb000;

In terms of an abstration, there is no meaning to these values since these are not valid buffers: we are just filling whatever it makes the firmware work.

#27 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Jorge Ramirez
Quoted 7 lines · Jorge Ramirez

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

This added some complexity to the driver. And so in internal discussions it was agreed that it was not worth to carry it and that it should be dropped.

I'll let Vikash and Bryan comment on the decision.

TBH I think there's not alot of value in supporting a broken firmware which only does decode.

There's not alot of value to the user in that configuration.

Provided you have done the work to get the fixed firmware into linux-firmware just cut at that point and have the driver reject lesser versions.

I as a user have no use-case or value in a broken old firmware which supports decode only, I'd much rather have the full transcoder.

Its Vikash/Dikshita's call though.

---
bod

#28 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 7 lines · Bryan O'Donoghue
Quoted 6 lines · Jorge Ramirez

yes, in V7 I did implement this functionality plus a fix for EOS handling (broken in pre 6.0.55 firmwares).

This added some complexity to the driver. And so in internal discussions it was agreed that it was not worth to carry it and that it should be dropped.

Quoted 6 lines
Quoted 1 line

I'll let Vikash and Bryan comment on the decision.

TBH I think there's not alot of value in supporting a broken firmware which only does decode.

There's not alot of value to the user in that configuration.

I dont know the user base but when I originally did the code (v7) I was thinking about security conscious users (signed firmwares) who might not be able to switch to the new fw release so easily (unnaccessible key management and updates).

But I dont have those numbers so it might be none.

Quoted 4 lines

Provided you have done the work to get the fixed firmware into linux-firmware just cut at that point and have the driver reject lesser versions.

yep, that went smoothly:

https://gitlab.com/kernel-firmware/linux-firmware/-/commit/8ecf764788f8dbf33fc1c483ddf91f882ad792b6

Quoted 5 lines

I as a user have no use-case or value in a broken old firmware which supports decode only, I'd much rather have the full transcoder.

Its Vikash/Dikshita's call though.

I'll keep on holding v9 until then.

#29 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 5 lines · Jorge Ramirez
Quoted 1 line

There's not alot of value to the user in that configuration.

I dont know the user base but when I originally did the code (v7) I was thinking about security conscious users (signed firmwares) who might not be able to switch to the new fw release so easily (unnaccessible key management and updates).

Since the driver for the LITE hasn't been upstreamed the # of users must be ... zero

---
bod

#30 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

Quoted 9 lines · Bryan O'Donoghue
Quoted 5 lines · Jorge Ramirez
Quoted 1 line

There's not alot of value to the user in that configuration.

I dont know the user base but when I originally did the code (v7) I was thinking about security conscious users (signed firmwares) who might not be able to switch to the new fw release so easily (unnaccessible key management and updates).

Since the driver for the LITE hasn't been upstreamed the # of users must be ... zero

sure but that is just one dimension of the problem isnt it? the other dimension is the number of users with a signed firmware that could _now_ enable the driver and have a working decoder.

that could be zero or plenty (I have no clue)

Quoted 3 lines

---
bod

#31 lore raw

Re: [PATCH v8 5/7] media: venus: core: Add qcm2290 DT compatible and resource data

In reply to Bryan O'Donoghue
Quoted 9 lines · Bryan O'Donoghue
Quoted 5 lines · Jorge Ramirez
Quoted 1 line

There's not alot of value to the user in that configuration.

I dont know the user base but when I originally did the code (v7) I was thinking about security conscious users (signed firmwares) who might not be able to switch to the new fw release so easily (unnaccessible key management and updates).

Since the driver for the LITE hasn't been upstreamed the # of users must be ... zero

The question is about the firmware side: if we support decoder for 6.0.55, users can get video decoding using existing distro firmware (and just update the kernel).

Signature · 2 lines
With best wishes
Dmitry
#32 lore raw

PATCH v8 6/7 arm64: dts: qcom: qcm2290: Add Venus video node

In reply to Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 Venus encoder/decoder.

---
 arch/arm64/boot/dts/qcom/qcm2290.dtsi | 55 +++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +55 -0
index f49ac1c1f8a3..7cfacd189a10 100644
@@ -1628,6 +1628,61 @@ adreno_smmu: iommu@59a0000 {
 			#iommu-cells = <2>;
 		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133333333 {
+					opp-hz = /bits/ 64 <133333333>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};
+
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
 		mdss: display-subsystem@5e00000 {
 			compatible = "qcom,qcm2290-mdss";
 			reg = <0x0 0x05e00000 0x0 0x1000>;
Signature · 1 line
2.34.1
Reviewed-by on v8 6/7
#33 lore raw

Re: [PATCH v8 6/7] arm64: dts: qcom: qcm2290: Add Venus video node

Quoted 66 lines · Jorge Ramirez-Ortiz

Add DT entries for the qcm2290 Venus encoder/decoder.

---
  arch/arm64/boot/dts/qcom/qcm2290.dtsi | 55 +++++++++++++++++++++++++++
  1 file changed, 55 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +48 -0
index f49ac1c1f8a3..7cfacd189a10 100644
@@ -1628,6 +1628,61 @@ adreno_smmu: iommu@59a0000 {
  			#iommu-cells = <2>;
  		};
 
+		venus: video-codec@5a00000 {
+			compatible = "qcom,qcm2290-venus";
+			reg = <0 0x5a00000 0 0xf0000>;
+			interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>;
+
+			power-domains = <&gcc GCC_VENUS_GDSC>,
+					<&gcc GCC_VCODEC0_GDSC>,
+					<&rpmpd QCM2290_VDDCX>;
+			power-domain-names = "venus",
+					     "vcodec0",
+					     "cx";
+			operating-points-v2 = <&venus_opp_table>;
+
+			clocks = <&gcc GCC_VIDEO_VENUS_CTL_CLK>,
+				 <&gcc GCC_VIDEO_AHB_CLK>,
+				 <&gcc GCC_VENUS_CTL_AXI_CLK>,
+				 <&gcc GCC_VIDEO_THROTTLE_CORE_CLK>,
+				 <&gcc GCC_VIDEO_VCODEC0_SYS_CLK>,
+				 <&gcc GCC_VCODEC0_AXI_CLK>;
+			clock-names = "core",
+				      "iface",
+				      "bus",
+				      "throttle",
+				      "vcodec0_core",
+				      "vcodec0_bus";
+
+			memory-region = <&pil_video_mem>;
+			iommus = <&apps_smmu 0x860 0x0>,
+				 <&apps_smmu 0x880 0x0>,
+				 <&apps_smmu 0x861 0x04>,
+				 <&apps_smmu 0x863 0x0>,
+				 <&apps_smmu 0x804 0xe0>;
+
+			interconnects = <&mmnrt_virt MASTER_VIDEO_P0 RPM_ALWAYS_TAG
+					 &bimc SLAVE_EBI1 RPM_ALWAYS_TAG>,
+					<&bimc MASTER_APPSS_PROC RPM_ACTIVE_TAG
+					 &config_noc SLAVE_VENUS_CFG RPM_ACTIVE_TAG>;
+			interconnect-names = "video-mem",
+					     "cpu-cfg";
+
+			venus_opp_table: opp-table {
+				compatible = "operating-points-v2";
+
+				opp-133333333 {
+					opp-hz = /bits/ 64 <133333333>;
+					required-opps = <&rpmpd_opp_low_svs>;
+				};
+

arch/arm64/boot/dts/qcom/qcm2290.dtsi adreno_smmu: iommu@59a0000 { · line 1688

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
+				opp-240000000 {
+					opp-hz = /bits/ 64 <240000000>;
+					required-opps = <&rpmpd_opp_svs>;
+				};
+			};
+		};
+
  		mdss: display-subsystem@5e00000 {
  			compatible = "qcom,qcm2290-mdss";
  			reg = <0x0 0x05e00000 0x0 0x1000>;
#34 lore raw

PATCH v8 7/7 arm64: dts: qcom: qrb2210-rb1: Enable Venus

In reply to Jorge Ramirez-Ortiz

Enable Venus on the QRB2210 RB1 development board.

---
 arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +4 -0
index b2e0fc5501c1..e92d0d6ad1b8 100644
@@ -698,6 +698,10 @@ &usb_qmpphy_out {
 	remote-endpoint = <&pm4125_ss_in>;
 };
 
+&venus {
+	status = "okay";
+};
+
 &wifi {
 	vdd-0.8-cx-mx-supply = <&pm4125_l7>;
 	vdd-1.8-xo-supply = <&pm4125_l13>;
Signature · 1 line
2.34.1
Reviewed-by on v8 7/7
#35 lore raw

Re: [PATCH v8 7/7] arm64: dts: qcom: qrb2210-rb1: Enable Venus

Quoted 12 lines · Jorge Ramirez-Ortiz

Enable Venus on the QRB2210 RB1 development board.

---
  arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +0 -0
index b2e0fc5501c1..e92d0d6ad1b8 100644

arch/arm64/boot/dts/qcom/qrb2210-rb1.dts &usb_qmpphy_out { · line 707

Quoted 10 lines
arch/arm64/boot/dts/qcom/qrb2210-rb1.dts +4 -0
@@ -698,6 +698,10 @@ &usb_qmpphy_out {
  	remote-endpoint = <&pm4125_ss_in>;
  };
 
+&venus {
+	status = "okay";
+};
+
  &wifi {
  	vdd-0.8-cx-mx-supply = <&pm4125_l7>;
  	vdd-1.8-xo-supply = <&pm4125_l13>;