avs: reset vdec core when error reset [1/1]

PD#SWPL-1235

Problem:
pc bad value in kernel panic after change source

Solution:
vdec reset core when avs error reset

Verify:
need verify by t962-p321 as jira description.

Change-Id: I490980c43dd4c3de28af01021b3cb0b82d4e151c
Signed-off-by: shihong.zheng <shihong.zheng@amlogic.com>
This commit is contained in:
shihong.zheng
2018-11-07 17:27:04 +08:00
committed by Dongjin Kim
parent d5597dc409
commit e541f1aa96
3 changed files with 36 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/kfifo.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/amlogic/media/utils/amstream.h>
#include <linux/amlogic/media/frame_sync/ptsserv.h>
@@ -1200,6 +1201,8 @@ static void vavs_local_reset(void)
recover_flag = 1;
pr_info("error, local reset\n");
amvdec_stop();
msleep(20);
vdec_reset_core(NULL);
vf_notify_receiver(PROVIDER_NAME, VFRAME_EVENT_PROVIDER_RESET, NULL);
vavs_local_init();
vavs_recover();
@@ -1506,6 +1509,8 @@ static s32 vavs_init(void)
amvdec_enable();
vdec_enable_DMC(NULL);
vavs_local_init();
if (get_cpu_major_id() >= AM_MESON_CPU_MAJOR_ID_GXM)
@@ -1755,7 +1760,9 @@ static int amvdec_avs_remove(struct platform_device *pdev)
user_data_buffer_phys = 0;
}
#endif
amvdec_disable();
vdec_disable_DMC(NULL);
pic_type = 0;
if (mm_blk_handle) {

View File

@@ -2819,6 +2819,32 @@ int vdec_source_changed(int format, int width, int height, int fps)
}
EXPORT_SYMBOL(vdec_source_changed);
void vdec_disable_DMC(struct vdec_s *vdec)
{
/*close first,then wait pedding end,timing suggestion from vlsi*/
unsigned long flags;
spin_lock_irqsave(&vdec_spin_lock, flags);
codec_dmcbus_write(DMC_REQ_CTRL,
codec_dmcbus_read(DMC_REQ_CTRL) & (~(1 << 13)));
spin_unlock_irqrestore(&vdec_spin_lock, flags);
while (!(codec_dmcbus_read(DMC_CHAN_STS)
& (1 << 13)))
;
}
EXPORT_SYMBOL(vdec_disable_DMC);
void vdec_enable_DMC(struct vdec_s *vdec)
{
unsigned long flags;
spin_lock_irqsave(&vdec_spin_lock, flags);
codec_dmcbus_write(DMC_REQ_CTRL,
codec_dmcbus_read(DMC_REQ_CTRL) | (1 << 13));
spin_unlock_irqrestore(&vdec_spin_lock, flags);
}
EXPORT_SYMBOL(vdec_enable_DMC);
void vdec_reset_core(struct vdec_s *vdec)
{
unsigned long flags;

View File

@@ -407,6 +407,9 @@ extern void vdec_core_finish_run(struct vdec_s *vdec, unsigned long mask);
extern void vdec_set_step_mode(void);
#endif
extern void vdec_disable_DMC(struct vdec_s *vdec);
extern void vdec_enable_DMC(struct vdec_s *vdec);
int vdec_read_user_data(struct vdec_s *vdec,
struct userdata_param_t *p_userdata_param);