mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
rk3288: modify vcodec driver to meet request of new vpu version
This commit is contained in:
parent
123090e4fa
commit
8429794ed9
|
|
@ -1500,12 +1500,13 @@ static void get_hw_info(struct vpu_service_info *pservice)
|
|||
dec->sorensonSparkSupport = (configReg >> DWL_SORENSONSPARK_E) & 0x01U;
|
||||
dec->refBufSupport = (configReg >> DWL_REF_BUFF_E) & 0x01U;
|
||||
dec->vp6Support = (configReg >> DWL_VP6_E) & 0x01U;
|
||||
#if !defined(CONFIG_ARCH_RK319X)
|
||||
/// invalidate max decode picture width value in rk319x vpu
|
||||
dec->maxDecPicWidth = configReg & 0x07FFU;
|
||||
#else
|
||||
dec->maxDecPicWidth = 3840;
|
||||
#endif
|
||||
|
||||
if (!soc_is_rk3190() && !soc_is_rk3288()) {
|
||||
dec->maxDecPicWidth = configReg & 0x07FFU;
|
||||
} else {
|
||||
// vpu after rk3190
|
||||
dec->maxDecPicWidth = 3840;
|
||||
}
|
||||
|
||||
/* 2nd Config register */
|
||||
configReg = pservice->dec_dev.hwregs[VPU_DEC_HWCFG1];
|
||||
|
|
@ -1539,121 +1540,120 @@ static void get_hw_info(struct vpu_service_info *pservice)
|
|||
dec->refBufSupport |= 8; /* enable HW support for offset */
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_ARCH_RK319X)
|
||||
/// invalidate fuse register value in rk319x vpu
|
||||
{
|
||||
VPUHwFuseStatus_t hwFuseSts;
|
||||
/* Decoder fuse configuration */
|
||||
u32 fuseReg = pservice->dec_dev.hwregs[VPU_DEC_HW_FUSE_CFG];
|
||||
if (!soc_is_rk3190() && !soc_is_rk3288()) {
|
||||
VPUHwFuseStatus_t hwFuseSts;
|
||||
/* Decoder fuse configuration */
|
||||
u32 fuseReg = pservice->dec_dev.hwregs[VPU_DEC_HW_FUSE_CFG];
|
||||
|
||||
hwFuseSts.h264SupportFuse = (fuseReg >> DWL_H264_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mpeg4SupportFuse = (fuseReg >> DWL_MPEG4_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mpeg2SupportFuse = (fuseReg >> DWL_MPEG2_FUSE_E) & 0x01U;
|
||||
hwFuseSts.sorensonSparkSupportFuse = (fuseReg >> DWL_SORENSONSPARK_FUSE_E) & 0x01U;
|
||||
hwFuseSts.jpegSupportFuse = (fuseReg >> DWL_JPEG_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp6SupportFuse = (fuseReg >> DWL_VP6_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vc1SupportFuse = (fuseReg >> DWL_VC1_FUSE_E) & 0x01U;
|
||||
hwFuseSts.jpegProgSupportFuse = (fuseReg >> DWL_PJPEG_FUSE_E) & 0x01U;
|
||||
hwFuseSts.rvSupportFuse = (fuseReg >> DWL_RV_FUSE_E) & 0x01U;
|
||||
hwFuseSts.avsSupportFuse = (fuseReg >> DWL_AVS_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp7SupportFuse = (fuseReg >> DWL_VP7_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp8SupportFuse = (fuseReg >> DWL_VP8_FUSE_E) & 0x01U;
|
||||
hwFuseSts.customMpeg4SupportFuse = (fuseReg >> DWL_CUSTOM_MPEG4_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mvcSupportFuse = (fuseReg >> DWL_MVC_FUSE_E) & 0x01U;
|
||||
hwFuseSts.h264SupportFuse = (fuseReg >> DWL_H264_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mpeg4SupportFuse = (fuseReg >> DWL_MPEG4_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mpeg2SupportFuse = (fuseReg >> DWL_MPEG2_FUSE_E) & 0x01U;
|
||||
hwFuseSts.sorensonSparkSupportFuse = (fuseReg >> DWL_SORENSONSPARK_FUSE_E) & 0x01U;
|
||||
hwFuseSts.jpegSupportFuse = (fuseReg >> DWL_JPEG_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp6SupportFuse = (fuseReg >> DWL_VP6_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vc1SupportFuse = (fuseReg >> DWL_VC1_FUSE_E) & 0x01U;
|
||||
hwFuseSts.jpegProgSupportFuse = (fuseReg >> DWL_PJPEG_FUSE_E) & 0x01U;
|
||||
hwFuseSts.rvSupportFuse = (fuseReg >> DWL_RV_FUSE_E) & 0x01U;
|
||||
hwFuseSts.avsSupportFuse = (fuseReg >> DWL_AVS_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp7SupportFuse = (fuseReg >> DWL_VP7_FUSE_E) & 0x01U;
|
||||
hwFuseSts.vp8SupportFuse = (fuseReg >> DWL_VP8_FUSE_E) & 0x01U;
|
||||
hwFuseSts.customMpeg4SupportFuse = (fuseReg >> DWL_CUSTOM_MPEG4_FUSE_E) & 0x01U;
|
||||
hwFuseSts.mvcSupportFuse = (fuseReg >> DWL_MVC_FUSE_E) & 0x01U;
|
||||
|
||||
/* check max. decoder output width */
|
||||
/* check max. decoder output width */
|
||||
|
||||
if (fuseReg & 0x8000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 1920;
|
||||
else if (fuseReg & 0x4000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 1280;
|
||||
else if (fuseReg & 0x2000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 720;
|
||||
else if (fuseReg & 0x1000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 352;
|
||||
else /* remove warning */
|
||||
hwFuseSts.maxDecPicWidthFuse = 352;
|
||||
if (fuseReg & 0x8000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 1920;
|
||||
else if (fuseReg & 0x4000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 1280;
|
||||
else if (fuseReg & 0x2000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 720;
|
||||
else if (fuseReg & 0x1000U)
|
||||
hwFuseSts.maxDecPicWidthFuse = 352;
|
||||
else /* remove warning */
|
||||
hwFuseSts.maxDecPicWidthFuse = 352;
|
||||
|
||||
hwFuseSts.refBufSupportFuse = (fuseReg >> DWL_REF_BUFF_FUSE_E) & 0x01U;
|
||||
hwFuseSts.refBufSupportFuse = (fuseReg >> DWL_REF_BUFF_FUSE_E) & 0x01U;
|
||||
|
||||
/* Pp configuration */
|
||||
configReg = pservice->dec_dev.hwregs[VPU_PP_HW_SYNTH_CFG];
|
||||
|
||||
if ((configReg >> DWL_PP_E) & 0x01U) {
|
||||
dec->ppSupport = 1;
|
||||
dec->maxPpOutPicWidth = configReg & 0x07FFU;
|
||||
/*pHwCfg->ppConfig = (configReg >> DWL_CFG_E) & 0x0FU; */
|
||||
dec->ppConfig = configReg;
|
||||
} else {
|
||||
dec->ppSupport = 0;
|
||||
dec->maxPpOutPicWidth = 0;
|
||||
dec->ppConfig = 0;
|
||||
}
|
||||
|
||||
/* check the HW versio */
|
||||
if (((asicID >> 16) >= 0x8190U) || ((asicID >> 16) == 0x6731U)) {
|
||||
/* Pp configuration */
|
||||
configReg = pservice->dec_dev.hwregs[VPU_DEC_HW_FUSE_CFG];
|
||||
configReg = pservice->dec_dev.hwregs[VPU_PP_HW_SYNTH_CFG];
|
||||
|
||||
if ((configReg >> DWL_PP_E) & 0x01U) {
|
||||
/* Pp fuse configuration */
|
||||
u32 fuseRegPp = pservice->dec_dev.hwregs[VPU_PP_HW_FUSE_CFG];
|
||||
dec->ppSupport = 1;
|
||||
dec->maxPpOutPicWidth = configReg & 0x07FFU;
|
||||
/*pHwCfg->ppConfig = (configReg >> DWL_CFG_E) & 0x0FU; */
|
||||
dec->ppConfig = configReg;
|
||||
} else {
|
||||
dec->ppSupport = 0;
|
||||
dec->maxPpOutPicWidth = 0;
|
||||
dec->ppConfig = 0;
|
||||
}
|
||||
|
||||
if ((fuseRegPp >> DWL_PP_FUSE_E) & 0x01U) {
|
||||
hwFuseSts.ppSupportFuse = 1;
|
||||
/* check max. pp output width */
|
||||
if (fuseRegPp & 0x8000U) hwFuseSts.maxPpOutPicWidthFuse = 1920;
|
||||
else if (fuseRegPp & 0x4000U) hwFuseSts.maxPpOutPicWidthFuse = 1280;
|
||||
else if (fuseRegPp & 0x2000U) hwFuseSts.maxPpOutPicWidthFuse = 720;
|
||||
else if (fuseRegPp & 0x1000U) hwFuseSts.maxPpOutPicWidthFuse = 352;
|
||||
else hwFuseSts.maxPpOutPicWidthFuse = 352;
|
||||
hwFuseSts.ppConfigFuse = fuseRegPp;
|
||||
/* check the HW versio */
|
||||
if (((asicID >> 16) >= 0x8190U) || ((asicID >> 16) == 0x6731U)) {
|
||||
/* Pp configuration */
|
||||
configReg = pservice->dec_dev.hwregs[VPU_DEC_HW_FUSE_CFG];
|
||||
|
||||
if ((configReg >> DWL_PP_E) & 0x01U) {
|
||||
/* Pp fuse configuration */
|
||||
u32 fuseRegPp = pservice->dec_dev.hwregs[VPU_PP_HW_FUSE_CFG];
|
||||
|
||||
if ((fuseRegPp >> DWL_PP_FUSE_E) & 0x01U) {
|
||||
hwFuseSts.ppSupportFuse = 1;
|
||||
/* check max. pp output width */
|
||||
if (fuseRegPp & 0x8000U) hwFuseSts.maxPpOutPicWidthFuse = 1920;
|
||||
else if (fuseRegPp & 0x4000U) hwFuseSts.maxPpOutPicWidthFuse = 1280;
|
||||
else if (fuseRegPp & 0x2000U) hwFuseSts.maxPpOutPicWidthFuse = 720;
|
||||
else if (fuseRegPp & 0x1000U) hwFuseSts.maxPpOutPicWidthFuse = 352;
|
||||
else hwFuseSts.maxPpOutPicWidthFuse = 352;
|
||||
hwFuseSts.ppConfigFuse = fuseRegPp;
|
||||
} else {
|
||||
hwFuseSts.ppSupportFuse = 0;
|
||||
hwFuseSts.maxPpOutPicWidthFuse = 0;
|
||||
hwFuseSts.ppConfigFuse = 0;
|
||||
}
|
||||
} else {
|
||||
hwFuseSts.ppSupportFuse = 0;
|
||||
hwFuseSts.maxPpOutPicWidthFuse = 0;
|
||||
hwFuseSts.ppConfigFuse = 0;
|
||||
}
|
||||
} else {
|
||||
hwFuseSts.ppSupportFuse = 0;
|
||||
hwFuseSts.maxPpOutPicWidthFuse = 0;
|
||||
hwFuseSts.ppConfigFuse = 0;
|
||||
|
||||
if (dec->maxDecPicWidth > hwFuseSts.maxDecPicWidthFuse)
|
||||
dec->maxDecPicWidth = hwFuseSts.maxDecPicWidthFuse;
|
||||
if (dec->maxPpOutPicWidth > hwFuseSts.maxPpOutPicWidthFuse)
|
||||
dec->maxPpOutPicWidth = hwFuseSts.maxPpOutPicWidthFuse;
|
||||
if (!hwFuseSts.h264SupportFuse) dec->h264Support = H264_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.mpeg4SupportFuse) dec->mpeg4Support = MPEG4_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.customMpeg4SupportFuse) dec->customMpeg4Support = MPEG4_CUSTOM_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.jpegSupportFuse) dec->jpegSupport = JPEG_NOT_SUPPORTED;
|
||||
if ((dec->jpegSupport == JPEG_PROGRESSIVE) && !hwFuseSts.jpegProgSupportFuse)
|
||||
dec->jpegSupport = JPEG_BASELINE;
|
||||
if (!hwFuseSts.mpeg2SupportFuse) dec->mpeg2Support = MPEG2_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vc1SupportFuse) dec->vc1Support = VC1_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp6SupportFuse) dec->vp6Support = VP6_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp7SupportFuse) dec->vp7Support = VP7_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp8SupportFuse) dec->vp8Support = VP8_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.ppSupportFuse) dec->ppSupport = PP_NOT_SUPPORTED;
|
||||
|
||||
/* check the pp config vs fuse status */
|
||||
if ((dec->ppConfig & 0xFC000000) && ((hwFuseSts.ppConfigFuse & 0xF0000000) >> 5)) {
|
||||
u32 deInterlace = ((dec->ppConfig & PP_DEINTERLACING) >> 25);
|
||||
u32 alphaBlend = ((dec->ppConfig & PP_ALPHA_BLENDING) >> 24);
|
||||
u32 deInterlaceFuse = (((hwFuseSts.ppConfigFuse >> 5) & PP_DEINTERLACING) >> 25);
|
||||
u32 alphaBlendFuse = (((hwFuseSts.ppConfigFuse >> 5) & PP_ALPHA_BLENDING) >> 24);
|
||||
|
||||
if (deInterlace && !deInterlaceFuse) dec->ppConfig &= 0xFD000000;
|
||||
if (alphaBlend && !alphaBlendFuse) dec->ppConfig &= 0xFE000000;
|
||||
}
|
||||
if (!hwFuseSts.sorensonSparkSupportFuse) dec->sorensonSparkSupport = SORENSON_SPARK_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.refBufSupportFuse) dec->refBufSupport = REF_BUF_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.rvSupportFuse) dec->rvSupport = RV_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.avsSupportFuse) dec->avsSupport = AVS_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.mvcSupportFuse) dec->mvcSupport = MVC_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (dec->maxDecPicWidth > hwFuseSts.maxDecPicWidthFuse)
|
||||
dec->maxDecPicWidth = hwFuseSts.maxDecPicWidthFuse;
|
||||
if (dec->maxPpOutPicWidth > hwFuseSts.maxPpOutPicWidthFuse)
|
||||
dec->maxPpOutPicWidth = hwFuseSts.maxPpOutPicWidthFuse;
|
||||
if (!hwFuseSts.h264SupportFuse) dec->h264Support = H264_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.mpeg4SupportFuse) dec->mpeg4Support = MPEG4_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.customMpeg4SupportFuse) dec->customMpeg4Support = MPEG4_CUSTOM_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.jpegSupportFuse) dec->jpegSupport = JPEG_NOT_SUPPORTED;
|
||||
if ((dec->jpegSupport == JPEG_PROGRESSIVE) && !hwFuseSts.jpegProgSupportFuse)
|
||||
dec->jpegSupport = JPEG_BASELINE;
|
||||
if (!hwFuseSts.mpeg2SupportFuse) dec->mpeg2Support = MPEG2_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vc1SupportFuse) dec->vc1Support = VC1_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp6SupportFuse) dec->vp6Support = VP6_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp7SupportFuse) dec->vp7Support = VP7_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.vp8SupportFuse) dec->vp8Support = VP8_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.ppSupportFuse) dec->ppSupport = PP_NOT_SUPPORTED;
|
||||
|
||||
/* check the pp config vs fuse status */
|
||||
if ((dec->ppConfig & 0xFC000000) && ((hwFuseSts.ppConfigFuse & 0xF0000000) >> 5)) {
|
||||
u32 deInterlace = ((dec->ppConfig & PP_DEINTERLACING) >> 25);
|
||||
u32 alphaBlend = ((dec->ppConfig & PP_ALPHA_BLENDING) >> 24);
|
||||
u32 deInterlaceFuse = (((hwFuseSts.ppConfigFuse >> 5) & PP_DEINTERLACING) >> 25);
|
||||
u32 alphaBlendFuse = (((hwFuseSts.ppConfigFuse >> 5) & PP_ALPHA_BLENDING) >> 24);
|
||||
|
||||
if (deInterlace && !deInterlaceFuse) dec->ppConfig &= 0xFD000000;
|
||||
if (alphaBlend && !alphaBlendFuse) dec->ppConfig &= 0xFE000000;
|
||||
}
|
||||
if (!hwFuseSts.sorensonSparkSupportFuse) dec->sorensonSparkSupport = SORENSON_SPARK_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.refBufSupportFuse) dec->refBufSupport = REF_BUF_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.rvSupportFuse) dec->rvSupport = RV_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.avsSupportFuse) dec->avsSupport = AVS_NOT_SUPPORTED;
|
||||
if (!hwFuseSts.mvcSupportFuse) dec->mvcSupport = MVC_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
configReg = pservice->enc_dev.hwregs[63];
|
||||
enc->maxEncodedWidth = configReg & ((1 << 11) - 1);
|
||||
enc->h264Enabled = (configReg >> 27) & 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user