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
103 changes: 103 additions & 0 deletions Documentation/devicetree/bindings/media/qcom,msm8939-venus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# 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:
- Erikas Bitovtas <[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: 2

clock-names:
items:
- const: core0
- const: core1

power-domains:
maxItems: 2

power-domain-names:
items:
- const: core0
- const: core1

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

additionalProperties: false

required:
- compatible
- iommus
- video-decoder

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>,
<&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>;
clock-names = "core0", "core1";
power-domains = <&gcc VENUS_CORE0_GDSC>,
<&gcc VENUS_CORE1_GDSC>;
power-domain-names = "vcodec_core0", "vcodec_core1";
};
};
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 @@ -312,6 +312,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
24 changes: 24 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8939.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,30 @@
};
};

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>,
<&gcc GCC_VENUS0_CORE1_VCODEC0_CLK>;
clock-names = "core0", "core1";
power-domains = <&gcc VENUS_CORE0_GDSC>,
<&gcc VENUS_CORE1_GDSC>;
power-domain-names = "core0", "core1";
};
};

apps_iommu: iommu@1ef0000 {
compatible = "qcom,msm8916-iommu", "qcom,msm-iommu-v1";
reg = <0x01ef0000 0x3000>;
Expand Down
6 changes: 6 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 @@ -3753,6 +3755,8 @@ static struct gdsc venus_core0_gdsc = {
.pd = {
.name = "venus_core0",
},
.parent = &venus_gdsc.pd,
.flags = HW_CTRL,
.pwrsts = PWRSTS_OFF_ON,
};

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

Expand Down
39 changes: 39 additions & 0 deletions drivers/media/platform/qcom/venus/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,44 @@ 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,
.vcodec0_pmdomains = (const char *[]) { "core0", "core1" },
.vcodec0_pmdomains_num = 2,
.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,
.fwname = "qcom/venus-1.8/venus.mbn",
.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 +1159,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
8 changes: 8 additions & 0 deletions drivers/media/platform/qcom/venus/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ struct venus_resources {
const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX];
const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX];
unsigned int vcodec_clks_num;
const char **vcodec0_pmdomains;
unsigned int vcodec0_pmdomains_num;
const char **vcodec1_pmdomains;
unsigned int vcodec1_pmdomains_num;
const char **vcodec_pmdomains;
unsigned int vcodec_pmdomains_num;
const char **opp_pmdomain;
Expand Down Expand Up @@ -144,6 +148,8 @@ struct venus_format {
* @vcodec1_clks: an array of vcodec1 struct clk pointers
* @video_path: an interconnect handle to video to/from memory path
* @cpucfg_path: an interconnect handle to cpu configuration path
* @vcodec0_pmdomans: a pointer to a list of pmdomains for vcodec0 cores
* @vcodec1_pmdomans: a pointer to a list of pmdomains for vcodec1 cores
* @pmdomains: a pointer to a list of pmdomains
* @opp_pmdomain: an OPP power-domain
* @resets: an array of reset signals
Expand Down Expand Up @@ -198,6 +204,8 @@ struct venus_core {
struct clk *vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX];
struct icc_path *video_path;
struct icc_path *cpucfg_path;
struct dev_pm_domain_list *vcodec0_pmdomains;
struct dev_pm_domain_list *vcodec1_pmdomains;
struct dev_pm_domain_list *pmdomains;
struct dev_pm_domain_list *opp_pmdomain;
struct reset_control *resets[VIDC_RESETS_NUM_MAX];
Expand Down
Loading