Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
374fd87
media: dt-bindings: media: venus: Add msm8939 dt schema
May 24, 2025
906fa3d
media: venus: core: Add msm8939 resource struct
May 24, 2025
3e21750
arm64: dts: qcom: msm8939: Add venus node
May 22, 2025
33343a8
arm64: dts: qcom: msm8939-longcheer-l9100: Enable venus node
May 22, 2025
479e22e
clk: qcom: gcc-msm8939: make VENUS_GDSC parent of VENUS_COREx_GDSC
May 26, 2025
9917d42
arm64: dts: qcom: msm8939-asus-z00t: add venus
erikas9987 Nov 12, 2025
e04ae2b
clk: qcom: gcc-msm8939: add HW_CTRL flag to hardware trigger cores
erikas9987 Nov 24, 2025
e8a7078
clk: qcom: gcc-msm8939: add cxcs to GDSCs
erikas9987 Nov 24, 2025
7efbf43
media: venus: core: add cp sizes to msm8939 struct
erikas9987 Nov 25, 2025
5592286
clk: qcom: gcc-msm8939: set all undefined halt checks to BRANCH_HALT
erikas9987 Nov 25, 2025
27b60bf
Revert "clk: qcom: gcc-msm8939: set all undefined halt checks to BRAN…
erikas9987 Nov 26, 2025
1c8cbc9
arm64: boot: dts: qcom: msm8939: remove video decoding nodes on Venus
erikas9987 Nov 28, 2025
2b64f1e
media: qcom: venus: add separate cores for HFI_VERSION_1 to struct
erikas9987 Nov 28, 2025
1480e76
media: qcom: venus: get core_power_v1 to enable additional cores as well
erikas9987 Nov 28, 2025
b2a64d5
clk: qcom: gcc-msm8939: set vcodec core clks to BRANCH_HALT_SKIP
erikas9987 Nov 28, 2025
ed12569
HACK: media: qcom: venus: add HEVC decoding support
erikas9987 Nov 30, 2025
9b64619
media: qcom: venus: add dev_info logs for tracing down what's broken
erikas9987 Dec 1, 2025
705d8d6
media: qcom: venus: replace core_clks with vcodec0_clks
erikas9987 Dec 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/media/qcom,msm8939-venus.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm MSM8939 Venus video encode and decode accelerators

maintainers:
- Stanimir Varbanov <[email protected]>

description: |
The Venus IP is a video encode and decode accelerator present
on Qualcomm platforms

allOf:
- $ref: qcom,venus-common.yaml#

properties:
compatible:
const: qcom,msm8939-venus

power-domains:
maxItems: 1

clocks:
maxItems: 3

clock-names:
items:
- const: core
- const: iface
- const: bus

iommus:
maxItems: 1

video-decoder:
type: object

properties:
compatible:
const: venus-decoder

clocks:
maxItems: 1

clock-names:
items:
- const: core

power-domains:
maxItems: 1

required:
- compatible
- clocks
- clock-names
- power-domains

additionalProperties: false

video-encoder:
type: object

properties:
compatible:
const: venus-encoder

clocks:
maxItems: 1

clock-names:
items:
- const: core

power-domains:
maxItems: 1

required:
- compatible
- clocks
- clock-names
- power-domains

additionalProperties: false

required:
- compatible
- iommus
- video-decoder
- video-encoder

unevaluatedProperties: false

examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/clock/qcom,gcc-msm8939.h>

video-codec@1d00000 {
compatible = "qcom,msm8939-venus";
reg = <0x01d00000 0xff000>;
interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>,
<&gcc GCC_VENUS0_AHB_CLK>,
<&gcc GCC_VENUS0_AXI_CLK>;
clock-names = "core", "iface", "bus";
power-domains = <&gcc VENUS_GDSC>;
iommus = <&apps_iommu 5>;
memory-region = <&venus_mem>;

video-decoder {
compatible = "venus-decoder";
clocks = <&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>;
clock-names = "core";
power-domains = <&gcc VENUS_CORE0_GDSC>;
};

video-encoder {
compatible = "venus-encoder";
clocks = <&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>;
clock-names = "core";
power-domains = <&gcc VENUS_CORE1_GDSC>;
};
};
8 changes: 8 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939-asus-z00t.dts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,14 @@
extcon = <&usb_id>;
};

&venus {
status = "okay";
};

&venus_mem {
status = "okay";
};

&wcnss {
status = "okay";
};
Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,14 @@
extcon = <&charger>;
};

&venus {
status = "okay";
};

&venus_mem {
status = "okay";
};

&wcnss {
status = "okay";
};
Expand Down
19 changes: 19 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,25 @@
};
};

venus: video-codec@1d00000 {
compatible = "qcom,msm8939-venus";
reg = <0x01d00000 0xff000>;
interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&gcc GCC_VENUS0_VCODEC0_CLK>,
<&gcc GCC_VENUS0_AHB_CLK>,
<&gcc GCC_VENUS0_AXI_CLK>,
<&gcc GCC_VENUS0_CORE0_VCODEC0_CLK>,
<&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>;
clock-names = "core", "iface", "bus", "core0", "core1";
power-domains = <&gcc VENUS_GDSC>,
<&gcc VENUS_CORE0_GDSC>,
<&gcc VENUS_CORE1_GDSC>;
power-domain-names = "venus", "core0", "core1";
iommus = <&apps_iommu 5>;
memory-region = <&venus_mem>;
status = "disabled";
};

apps_iommu: iommu@1ef0000 {
compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
reg = <0x01ef0000 0x3000>;
Expand Down
20 changes: 20 additions & 0 deletions drivers/clk/qcom/gcc-msm8939.c
Original file line number Diff line number Diff line change
Expand Up @@ -3664,6 +3664,7 @@ static struct clk_branch gcc_venus0_vcodec0_clk = {

static struct clk_branch gcc_venus0_core0_vcodec0_clk = {
.halt_reg = 0x4c02c,
.halt_check = BRANCH_HALT_SKIP,
.clkr = {
.enable_reg = 0x4c02c,
.enable_mask = BIT(0),
Expand All @@ -3681,6 +3682,7 @@ static struct clk_branch gcc_venus0_core0_vcodec0_clk = {

static struct clk_branch gcc_venus0_core1_vcodec0_clk = {
.halt_reg = 0x4c034,
.halt_check = BRANCH_HALT_SKIP,
.clkr = {
.enable_reg = 0x4c034,
.enable_mask = BIT(0),
Expand Down Expand Up @@ -3710,6 +3712,8 @@ static struct clk_branch gcc_oxili_timer_clk = {

static struct gdsc venus_gdsc = {
.gdscr = 0x4c018,
.cxcs = (unsigned int []) { 0x4c024, 0x4c01c },
.cxc_count = 2,
.pd = {
.name = "venus",
},
Expand All @@ -3718,6 +3722,8 @@ static struct gdsc venus_gdsc = {

static struct gdsc mdss_gdsc = {
.gdscr = 0x4d078,
.cxcs = (unsigned int []) { 0x4d080, 0x4d088 },
.cxc_count = 2,
.pd = {
.name = "mdss",
},
Expand All @@ -3726,6 +3732,8 @@ static struct gdsc mdss_gdsc = {

static struct gdsc jpeg_gdsc = {
.gdscr = 0x5701c,
.cxcs = (unsigned int []) { 0x57020, 0x57028 },
.cxc_count = 2,
.pd = {
.name = "jpeg",
},
Expand All @@ -3734,6 +3742,8 @@ static struct gdsc jpeg_gdsc = {

static struct gdsc vfe_gdsc = {
.gdscr = 0x58034,
.cxcs = (unsigned int []) { 0x58038, 0x58048, 0x58050 },
.cxc_count = 3,
.pd = {
.name = "vfe",
},
Expand All @@ -3742,6 +3752,8 @@ static struct gdsc vfe_gdsc = {

static struct gdsc oxili_gdsc = {
.gdscr = 0x5901c,
.cxcs = (unsigned int []) { 0x59020 },
.cxc_count = 1,
.pd = {
.name = "oxili",
},
Expand All @@ -3750,17 +3762,25 @@ static struct gdsc oxili_gdsc = {

static struct gdsc venus_core0_gdsc = {
.gdscr = 0x4c028,
.cxcs = (unsigned int []) { 0x4c02c },
.cxc_count = 1,
.pd = {
.name = "venus_core0",
},
.parent = &venus_gdsc.pd,
.flags = HW_CTRL,
.pwrsts = PWRSTS_OFF_ON,
};

static struct gdsc venus_core1_gdsc = {
.gdscr = 0x4c030,
.cxcs = (unsigned int []) { 0x4c034 },
.cxc_count = 1,
.pd = {
.name = "venus_core1",
},
.parent = &venus_gdsc.pd,
.flags = HW_CTRL,
.pwrsts = PWRSTS_OFF_ON,
};

Expand Down
47 changes: 47 additions & 0 deletions drivers/media/platform/qcom/venus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
* Copyright (C) 2017 Linaro Ltd.
*/
#include "linux/videodev2.h"
#include <linux/init.h>
#include <linux/interconnect.h>
#include <linux/io.h>
Expand Down Expand Up @@ -178,6 +179,8 @@ static void venus_sys_error_handler(struct work_struct *work)
static u32 to_v4l2_codec_type(u32 codec)
{
switch (codec) {
case HFI_VIDEO_CODEC_HEVC:
return V4L2_PIX_FMT_HEVC;
case HFI_VIDEO_CODEC_H264:
return V4L2_PIX_FMT_H264;
case HFI_VIDEO_CODEC_H263:
Expand Down Expand Up @@ -688,6 +691,49 @@ static const struct venus_resources msm8916_res = {
.enc_nodename = "video-encoder",
};

static const struct freq_tbl msm8939_freq_table[] = {
{ 489600, 266670000 }, /* 1080p @ 60 */
{ 244800, 133330000 }, /* 1080p @ 30 */
{ 244800, 200000000 }, /* 1080p @ 30 */
{ 220800, 133330000 }, /* 720p @ 60 */
{ 108000, 133330000 }, /* 720p @ 30 */
{ 108000, 200000000 }, /* 720p @ 30 */
{ 72000, 133330000 }, /* VGA @ 60 */
{ 36000, 133330000 }, /* VGA @ 30 */
};

static const struct reg_val msm8939_reg_preset[] = {
{ 0xe0020, 0x0aaaaaaa },
{ 0xe0024, 0x0aaaaaaa },
{ 0x80124, 0x00000003 },
};

static const struct venus_resources msm8939_res = {
.freq_tbl = msm8939_freq_table,
.freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
.reg_tbl = msm8939_reg_preset,
.reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
.clks = { "core", "iface", "bus", },
.clks_num = 3,
.vcodec0_clks = { "core0", "core1" },
.vcodec_clks_num = 2,
.vcodec_pmdomains = (const char *[]) { "venus", "core0", "core1", },
.vcodec_pmdomains_num = 3,
.max_load = 489600, /* 1080p@30 + 1080p@30 */
.hfi_version = HFI_VERSION_1XX,
.vmem_id = VIDC_RESOURCE_NONE,
.vmem_size = 0,
.vmem_addr = 0,
.cp_start = 0,
.cp_size = 0x5dc00000,
.cp_nonpixel_start = 0x1000000,
.cp_nonpixel_size = 0x25800000,
.dma_mask = 0xddc00000 - 1,
.fwname = "qcom/venus-1.8/venus.mbn",
.dec_nodename = "video-decoder",
.enc_nodename = "video-encoder",
};

static const struct freq_tbl msm8996_freq_table[] = {
{ 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
{ 972000, 520000000 }, /* 4k UHD @ 30 */
Expand Down Expand Up @@ -1121,6 +1167,7 @@ static const struct venus_resources qcm2290_res = {

static const struct of_device_id venus_dt_match[] = {
{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
{ .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
{ .compatible = "qcom,msm8998-venus", .data = &msm8998_res, },
{ .compatible = "qcom,qcm2290-venus", .data = &qcm2290_res, },
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/qcom/venus/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ bool venus_helper_check_codec(struct venus_inst *inst, u32 v4l2_pixfmt)
return false;
}

dev_info(core->dev_enc, "%s: codec = %x, session_type = %x, enc_codecs = %lx", __func__, codec, session_type, core->enc_codecs);
if (session_type == VIDC_SESSION_TYPE_ENC && core->enc_codecs & codec)
return true;

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/qcom/venus/hfi_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static int parse_codecs(struct venus_core *core, void *data)
core->enc_codecs = codecs->enc_codecs;

if (IS_V1(core)) {
core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC;
// core->dec_codecs &= ~HFI_VIDEO_CODEC_HEVC;
core->dec_codecs &= ~HFI_VIDEO_CODEC_SPARK;
core->enc_codecs &= ~HFI_VIDEO_CODEC_HEVC;
}
Expand Down
Loading