Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 <stanimir.varbanov@linaro.org>

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-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
28 changes: 28 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1514,6 +1514,34 @@
};
};

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>;
clock-names = "core", "iface", "bus";
power-domains = <&gcc VENUS_GDSC>;
iommus = <&apps_iommu 5>;
memory-region = <&venus_mem>;
status = "disabled";

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>;
};
};

apps_iommu: iommu@1ef0000 {
compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
reg = <0x01ef0000 0x3000>;
Expand Down
2 changes: 2 additions & 0 deletions drivers/clk/qcom/gcc-msm8939.c
Original file line number Diff line number Diff line change
Expand Up @@ -3753,6 +3753,7 @@ static struct gdsc venus_core0_gdsc = {
.pd = {
.name = "venus_core0",
},
.parent = &venus_gdsc.pd,
.pwrsts = PWRSTS_OFF_ON,
};

Expand All @@ -3761,6 +3762,7 @@ static struct gdsc venus_core1_gdsc = {
.pd = {
.name = "venus_core1",
},
.parent = &venus_gdsc.pd,
.pwrsts = PWRSTS_OFF_ON,
};

Expand Down
37 changes: 37 additions & 0 deletions drivers/media/platform/qcom/venus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,42 @@ 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 = { "core" },
.vcodec1_clks = { "core" },
.vcodec_clks_num = 1,
.max_load = 489600, /* 1080p@30 + 1080p@30 */
.hfi_version = HFI_VERSION_1XX,
.vmem_id = VIDC_RESOURCE_NONE,
.vmem_size = 0,
.vmem_addr = 0,
.dma_mask = 0xddc00000 - 1,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value still needs to be verified. Where to find it in downstream?

.fwname = "qcom/venus-1.8/venus.mbn",
};

static const struct freq_tbl msm8996_freq_table[] = {
{ 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
{ 972000, 520000000 }, /* 4k UHD @ 30 */
Expand Down Expand Up @@ -1059,6 +1095,7 @@ static const struct venus_resources sc7280_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,sdm660-venus", .data = &sdm660_res, },
Expand Down