vdec: the dec core was reset when the vdec poweron before.

PD#165053:
1. regs about the ao dos needs to be reset when reboot.
2. the hhi regs with vdec clk should be clear when the
	clock reference count minus to zero. the issue also
	needs to be amended clk tree by qiufang.

Change-Id: Idce668af7e4d8fc7e400d5907705aaf87e59043c
Signed-off-by: Nanxin Qin <nanxin.qin@amlogic.com>
This commit is contained in:
Nanxin Qin
2018-05-03 18:09:36 +08:00
committed by Dongjin Kim
parent 5960c2b63a
commit 7e5bd674b6
3 changed files with 52 additions and 0 deletions

View File

@@ -2253,6 +2253,52 @@ static bool test_hevc(u32 decomp_addr, u32 us_delay)
return (READ_VREG(HEVCD_IPP_DBG_DATA) & 3) == 1;
}
void vdec_power_reset(void)
{
/* enable vdec1 isolation */
WRITE_AOREG(AO_RTI_GEN_PWR_ISO0,
READ_AOREG(AO_RTI_GEN_PWR_ISO0) | 0xc0);
/* power off vdec1 memories */
WRITE_VREG(DOS_MEM_PD_VDEC, 0xffffffffUL);
/* vdec1 power off */
WRITE_AOREG(AO_RTI_GEN_PWR_SLEEP0,
READ_AOREG(AO_RTI_GEN_PWR_SLEEP0) | 0xc);
if (has_vdec2()) {
/* enable vdec2 isolation */
WRITE_AOREG(AO_RTI_GEN_PWR_ISO0,
READ_AOREG(AO_RTI_GEN_PWR_ISO0) | 0x300);
/* power off vdec2 memories */
WRITE_VREG(DOS_MEM_PD_VDEC2, 0xffffffffUL);
/* vdec2 power off */
WRITE_AOREG(AO_RTI_GEN_PWR_SLEEP0,
READ_AOREG(AO_RTI_GEN_PWR_SLEEP0) | 0x30);
}
if (has_hdec()) {
/* enable hcodec isolation */
WRITE_AOREG(AO_RTI_GEN_PWR_ISO0,
READ_AOREG(AO_RTI_GEN_PWR_ISO0) | 0x30);
/* power off hcodec memories */
WRITE_VREG(DOS_MEM_PD_HCODEC, 0xffffffffUL);
/* hcodec power off */
WRITE_AOREG(AO_RTI_GEN_PWR_SLEEP0,
READ_AOREG(AO_RTI_GEN_PWR_SLEEP0) | 3);
}
if (has_hevc_vdec()) {
/* enable hevc isolation */
WRITE_AOREG(AO_RTI_GEN_PWR_ISO0,
READ_AOREG(AO_RTI_GEN_PWR_ISO0) | 0xc00);
/* power off hevc memories */
WRITE_VREG(DOS_MEM_PD_HEVC, 0xffffffffUL);
/* hevc power off */
WRITE_AOREG(AO_RTI_GEN_PWR_SLEEP0,
READ_AOREG(AO_RTI_GEN_PWR_SLEEP0) | 0xc0);
}
}
EXPORT_SYMBOL(vdec_power_reset);
void vdec_poweron(enum vdec_type_e core)
{
void *decomp_addr = NULL;

View File

@@ -70,6 +70,7 @@ extern void vdec2_power_mode(int level);
extern void vdec_poweron(enum vdec_type_e core);
extern void vdec_poweroff(enum vdec_type_e core);
extern bool vdec_on(enum vdec_type_e core);
extern void vdec_power_reset(void);
/*irq num as same as .dts*/

View File

@@ -3793,6 +3793,11 @@ static int amstream_probe(struct platform_device *pdev)
/*prealloc fetch buf to avoid no continue buffer later...*/
stbuf_fetch_init();
REG_PATH_CONFIGS("media.amports", amports_configs);
/* poweroff the decode core because dos can not be reset when reboot */
if (get_cpu_type() == MESON_CPU_MAJOR_ID_G12A)
vdec_power_reset();
return 0;
/*