Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14c4701c authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: Add video device to sdmmagpie"

parents 42f357fa 832b02ad
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ Required properties:
	- "qcom,sm6150-vidc" : Invokes driver specific data for SM6150.
        - "qcom,sm8150-vidc" : Invokes driver specific data for SM8150.
        - "qcom,sm6150-vidc" : Invokes driver specific data for SM6150.
        - "qcom,sdmmagpie-vidc" : Invokes driver specific data for sdmmagpie.
        - "qcom,sdm845-vidc" : Invokes driver specific data for SDM845.
        - "qcom,sdm670-vidc" : Invokes driver specific data for SDM670.

+217 −0
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/msm/msm-bus-ids.h>
#include <dt-bindings/clock/qcom,videocc-sdmmagpie.h>

&soc {
	msm_vidc0: qcom,vidc0 {
		compatible = "qcom,msm-vidc", "qcom,sdmmagpie-vidc";
		status = "ok";
		sku-index = <0>;
		reg = <0xaa00000 0x200000>;
		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;

		/* Supply */
		iris-ctl-supply = <&mvsc_gdsc>;
		vcodec-supply = <&mvs0_gdsc>;
		cvp-supply = <&mvs1_gdsc>;

		/* Clocks */
		clock-names =  "video_cc_mvsc_ctl_axi", "video_cc_mvs0_ctl_axi",
			"video_cc_mvs1_ctl_axi", "core_clk", "vcodec_clk",
			"cvp_clk";
		clocks = <&clock_videocc VIDEO_CC_MVSC_CTL_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVS0_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVS1_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVSC_CORE_CLK>,
			<&clock_videocc VIDEO_CC_MVS0_CORE_CLK>,
			<&clock_videocc VIDEO_CC_MVS1_CORE_CLK>;
		qcom,proxy-clock-names = "video_cc_mvsc_ctl_axi",
			"video_cc_mvs0_ctl_axi", "video_cc_mvs1_ctl_axi",
			"core_clk", "vcodec_clk", "cvp_clk";

		qcom,clock-configs = <0x0 0x0 0x0 0x1 0x1 0x1>;
		qcom,allowed-clock-rates = <240000000 338000000
			365000000 444000000 533000000>;

		/* Buses */
		bus_cnoc {
			compatible = "qcom,msm-vidc,bus";
			label = "cnoc";
			qcom,bus-master = <MSM_BUS_MASTER_AMPSS_M0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_VENUS_CFG>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		venus_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "msm-vidc-ddr";
			qcom,bus-range-kbps = <1000 6533000>;
		};
		arm9_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-arm9-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		/* MMUs */
		non_secure_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_ns";
			iommus = <&apps_smmu 0x2300 0x60>;
			buffer-types = <0xfff>;
			virtual-addr-pool = <0x25800000 0xba800000>;
		};

		secure_non_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_non_pixel";
			iommus = <&apps_smmu 0x2304 0x60>;
			buffer-types = <0x480>;
			virtual-addr-pool = <0x1000000 0x24800000>;
			qcom,secure-context-bank;
		};

		secure_bitstream_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_bitstream";
			iommus = <&apps_smmu 0x2301 0x4>;
			buffer-types = <0x241>;
			virtual-addr-pool = <0x0 0xe0000000>;
			qcom,secure-context-bank;
		};

		secure_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_pixel";
			iommus = <&apps_smmu 0x2303 0x20>;
			buffer-types = <0x106>;
			virtual-addr-pool = <0x0 0xe0000000>;
			qcom,secure-context-bank;
		};

		/* Memory Heaps */
		qcom,msm-vidc,mem_cdsp {
			compatible = "qcom,msm-vidc,mem-cdsp";
			memory-region = <&cdsp_mem>;
		};
	};

	msm_vidc1: qcom,vidc1 {
		compatible = "qcom,msm-vidc", "qcom,sdmmagpie-vidc";
		status = "ok";
		sku-index = <1>;
		reg = <0xaa00000 0x200000>;
		interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;

		/* Supply */
		iris-ctl-supply = <&mvsc_gdsc>;
		vcodec-supply = <&mvs0_gdsc>;
		cvp-supply = <&mvs1_gdsc>;

		/* Clocks */
		clock-names =  "gcc_video_axic", "gcc_video_axi0",
			"gcc_video_axi1", "core_clk", "vcodec_clk",
			"cvp_clk";
		clocks = <&clock_videocc VIDEO_CC_MVSC_CTL_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVS0_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVS1_AXI_CLK>,
			<&clock_videocc VIDEO_CC_MVSC_CORE_CLK>,
			<&clock_videocc VIDEO_CC_MVS0_CORE_CLK>,
			<&clock_videocc VIDEO_CC_MVS1_CORE_CLK>;
		qcom,proxy-clock-names = "gcc_video_axic",
			"gcc_video_axi0", "gcc_video_axi1",
			"core_clk", "vcodec_clk", "cvp_clk";

		qcom,clock-configs = <0x0 0x0 0x0 0x1 0x1 0x1>;
		qcom,allowed-clock-rates = <240000000 338000000
			365000000 444000000 533000000>;

		/* Buses */
		bus_cnoc {
			compatible = "qcom,msm-vidc,bus";
			label = "cnoc";
			qcom,bus-master = <MSM_BUS_MASTER_AMPSS_M0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_VENUS_CFG>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		venus_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "msm-vidc-ddr";
			qcom,bus-range-kbps = <1000 6533000>;
		};
		arm9_bus_ddr {
			compatible = "qcom,msm-vidc,bus";
			label = "venus-arm9-ddr";
			qcom,bus-master = <MSM_BUS_MASTER_VIDEO_P0>;
			qcom,bus-slave = <MSM_BUS_SLAVE_EBI_CH0>;
			qcom,bus-governor = "performance";
			qcom,bus-range-kbps = <1000 1000>;
		};

		/* MMUs */
		non_secure_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_ns";
			iommus = <&apps_smmu 0x2300 0x60>;
			buffer-types = <0xfff>;
			virtual-addr-pool = <0x25800000 0xba800000>;
		};

		secure_non_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_non_pixel";
			iommus = <&apps_smmu 0x2304 0x60>;
			buffer-types = <0x480>;
			virtual-addr-pool = <0x1000000 0x24800000>;
			qcom,secure-context-bank;
		};

		secure_bitstream_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_bitstream";
			iommus = <&apps_smmu 0x2301 0x4>;
			buffer-types = <0x241>;
			virtual-addr-pool = <0x0 0xe0000000>;
			qcom,secure-context-bank;
		};

		secure_pixel_cb {
			compatible = "qcom,msm-vidc,context-bank";
			label = "venus_sec_pixel";
			iommus = <&apps_smmu 0x2303 0x20>;
			buffer-types = <0x106>;
			virtual-addr-pool = <0x0 0xe0000000>;
			qcom,secure-context-bank;
		};

		/* Memory Heaps */
		qcom,msm-vidc,mem_cdsp {
			compatible = "qcom,msm-vidc,mem-cdsp";
			memory-region = <&cdsp_mem>;
		};
	};
};
+1 −0
Original line number Diff line number Diff line
@@ -2301,6 +2301,7 @@
#include "sdmmagpie-gdsc.dtsi"
#include "sdmmagpie-bus.dtsi"
#include "sdmmagpie-qupv3.dtsi"
#include "sdmmagpie-vidc.dtsi"

&pcie_0_gdsc {
	status = "ok";
+190 −0
Original line number Diff line number Diff line
@@ -79,6 +79,18 @@ static struct msm_vidc_codec_data sm8150_codec_data[] = {
	CODEC_ENTRY(V4L2_PIX_FMT_VP9, MSM_VIDC_DECODER, 10, 200, 200),
};

static struct msm_vidc_codec_data sdmmagpie_codec_data[] =  {
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_ENCODER, 10, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_ENCODER, 10, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_ENCODER, 10, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_TME, MSM_VIDC_ENCODER, 0, 540, 540),
	CODEC_ENTRY(V4L2_PIX_FMT_MPEG2, MSM_VIDC_DECODER, 10, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_DECODER, 10, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_DECODER, 10, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP8, MSM_VIDC_DECODER, 10, 200, 200),
	CODEC_ENTRY(V4L2_PIX_FMT_VP9, MSM_VIDC_DECODER, 10, 200, 200),
};

static struct msm_vidc_codec_data sdm845_codec_data[] =  {
	CODEC_ENTRY(V4L2_PIX_FMT_H264, MSM_VIDC_ENCODER, 125, 675, 320),
	CODEC_ENTRY(V4L2_PIX_FMT_HEVC, MSM_VIDC_ENCODER, 125, 675, 320),
@@ -264,6 +276,154 @@ static struct msm_vidc_common_data sm8150_common_data[] = {
	},
};

static struct msm_vidc_common_data sdmmagpie_common_data_v0[] = {
	{
		.key = "qcom,never-unload-fw",
		.value = 1,
	},
	{
		.key = "qcom,sw-power-collapse",
		.value = 1,
	},
	{
		.key = "qcom,domain-attr-non-fatal-faults",
		.value = 1,
	},
	{
		.key = "qcom,max-secure-instances",
		.value = 2,             /*
					 * As per design driver allows 3rd
					 * instance as well since the secure
					 * flags were updated later for the
					 * current instance. Hence total
					 * secure sessions would be
					 * max-secure-instances + 1.
					 */
	},
	{
		.key = "qcom,max-hw-load",
		.value = 3110400,	/* 4096x2160@90 */
	},
	{
		.key = "qcom,max-hq-mbs-per-frame",
		.value = 8160,
	},
	{
		.key = "qcom,max-hq-frames-per-sec",
		.value = 60,
	},
	{
		.key = "qcom,max-b-frame-size",
		.value = 8160,
	},
	{
		.key = "qcom,max-b-frames-per-sec",
		.value = 60,
	},
	{
		.key = "qcom,power-collapse-delay",
		.value = 1500,
	},
	{
		.key = "qcom,hw-resp-timeout",
		.value = 1000,
	},
	{
		.key = "qcom,debug-timeout",
		.value = 0,
	},
	{
		.key = "qcom,domain-cvp",
		.value = 1,
	},
	{
		.key = "qcom,decode-batching",
		.value = 1,
	},
	{
		.key = "qcom,dcvs",
		.value = 1,
	},
	{
		.key = "qcom,fw-cycles",
		.value = 733003,
	},
};

static struct msm_vidc_common_data sdmmagpie_common_data_v1[] = {
	{
		.key = "qcom,never-unload-fw",
		.value = 1,
	},
	{
		.key = "qcom,sw-power-collapse",
		.value = 1,
	},
	{
		.key = "qcom,domain-attr-non-fatal-faults",
		.value = 1,
	},
	{
		.key = "qcom,max-secure-instances",
		.value = 2,             /*
					 * As per design driver allows 3rd
					 * instance as well since the secure
					 * flags were updated later for the
					 * current instance. Hence total
					 * secure sessions would be
					 * max-secure-instances + 1.
					 */
	},
	{
		.key = "qcom,max-hw-load",
		.value = 1281600,	/* 4k@30 Decode + 1080p@30 Encode */
	},
	{
		.key = "qcom,max-hq-mbs-per-frame",
		.value = 8160,
	},
	{
		.key = "qcom,max-hq-frames-per-sec",
		.value = 60,
	},
	{
		.key = "qcom,max-b-frame-size",
		.value = 8160,
	},
	{
		.key = "qcom,max-b-frames-per-sec",
		.value = 60,
	},
	{
		.key = "qcom,power-collapse-delay",
		.value = 1500,
	},
	{
		.key = "qcom,hw-resp-timeout",
		.value = 1000,
	},
	{
		.key = "qcom,debug-timeout",
		.value = 0,
	},
	{
		.key = "qcom,domain-cvp",
		.value = 1,
	},
	{
		.key = "qcom,decode-batching",
		.value = 1,
	},
	{
		.key = "qcom,dcvs",
		.value = 1,
	},
	{
		.key = "qcom,fw-cycles",
		.value = 733003,
	},
};

static struct msm_vidc_common_data sdm845_common_data[] = {
	{
		.key = "qcom,never-unload-fw",
@@ -477,6 +637,22 @@ static struct msm_vidc_platform_data sm8150_data = {
	.vpu_ver = VPU_VERSION_5,
};

static struct msm_vidc_platform_data sdmmagpie_data = {
	.codec_data = sdmmagpie_codec_data,
	.codec_data_length =  ARRAY_SIZE(sdmmagpie_codec_data),
	.common_data = sdmmagpie_common_data_v0,
	.common_data_length =  ARRAY_SIZE(sdmmagpie_common_data_v0),
	.csc_data.vpe_csc_custom_bias_coeff = vpe_csc_custom_bias_coeff,
	.csc_data.vpe_csc_custom_matrix_coeff = vpe_csc_custom_matrix_coeff,
	.csc_data.vpe_csc_custom_limit_coeff = vpe_csc_custom_limit_coeff,
	.efuse_data = NULL,
	.efuse_data_length = 0,
	.sku_version = 0,
	.gcc_register_base = GCC_VIDEO_AXI_REG_START_ADDR,
	.gcc_register_size = GCC_VIDEO_AXI_REG_SIZE,
	.vpu_ver = VPU_VERSION_5,
};

static struct msm_vidc_platform_data sdm845_data = {
	.codec_data = sdm845_codec_data,
	.codec_data_length =  ARRAY_SIZE(sdm845_codec_data),
@@ -518,6 +694,10 @@ static const struct of_device_id msm_vidc_dt_match[] = {
		.compatible = "qcom,sm8150-vidc",
		.data = &sm8150_data,
	},
	{
		.compatible = "qcom,sdmmagpie-vidc",
		.data = &sdmmagpie_data,
	},
	{
		.compatible = "qcom,sdm845-vidc",
		.data = &sdm845_data,
@@ -603,6 +783,16 @@ void *vidc_get_drv_data(struct device *dev)
			driver_data->common_data_length =
					ARRAY_SIZE(sdm670_common_data_v1);
		}
	} else if (!strcmp(match->compatible, "qcom,sdmmagpie-vidc")) {
		rc = msm_vidc_read_efuse(driver_data, dev);
		if (rc)
			goto exit;

		if (driver_data->sku_version == SKU_VERSION_1) {
			driver_data->common_data = sdmmagpie_common_data_v1;
			driver_data->common_data_length =
					ARRAY_SIZE(sdmmagpie_common_data_v1);
		}
	}

exit: