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

Commit d95bcfe8 authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi
Browse files

msm: vidc: Add support for sdmmagpie video device



Add support for sdmmagpie by adding platform specific
data in video driver as per H/W and spec.

CRs-Fixed: 2328068
Change-Id: I70adb1d4185a65916721245262347d56af283465
Signed-off-by: default avatarManikanta Kanamarlapudi <kmanikan@codeaurora.org>
parent c7cf52ef
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.

+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: