From 411c4de652b2a767ca7ea3cd9ec0384a02eb7869 Mon Sep 17 00:00:00 2001 From: "wenfeng.guo" Date: Wed, 15 Aug 2018 16:29:35 +0800 Subject: [PATCH] di: remove unused txl register of dump di reg/mif PD#171757: di: remove unused txl register of dump di reg/mif 1.add new debugfs: cat /sys/kernel/debug/di/dumpreg cat /sys/kernel/debug/di/dumpmif 2.move di_state to deinterlace_dbg Change-Id: Ic183abd793b170519ccc20e9a546efdfd531c469 Signed-off-by: wenfeng.guo --- .../amlogic/media/deinterlace/deinterlace.c | 409 ++--------- .../amlogic/media/deinterlace/deinterlace.h | 36 + .../media/deinterlace/deinterlace_dbg.c | 672 +++++++++++++++--- .../media/deinterlace/deinterlace_dbg.h | 3 +- 4 files changed, 704 insertions(+), 416 deletions(-) diff --git a/drivers/amlogic/media/deinterlace/deinterlace.c b/drivers/amlogic/media/deinterlace/deinterlace.c index eae074114c2d..d3ce77cc20e9 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.c +++ b/drivers/amlogic/media/deinterlace/deinterlace.c @@ -80,7 +80,6 @@ #define DEVICE_NAME "deinterlace" #define CLASS_NAME "deinterlace" -#define VFM_NAME "deinterlace" static struct di_pre_stru_s di_pre_stru; @@ -265,7 +264,6 @@ static int post_urgent = 1; static int pre_process_time; static int di_receiver_event_fun(int type, void *data, void *arg); static void di_uninit_buf(unsigned int disable_mirror); -static unsigned char is_bypass(vframe_t *vf_in); static void log_buffer_state(unsigned char *tag); /* static void put_get_disp_buf(void); */ @@ -445,12 +443,83 @@ static ssize_t store_config(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); - - static int run_flag = DI_RUN_FLAG_RUN; static int pre_run_flag = DI_RUN_FLAG_RUN; static int dump_state_flag; +/*2018-08-17 add debugfs*/ +/*add debugfs: get dump_state parameter*/ +struct di_pre_stru_s *get_di_pre_stru(void) +{ + return &di_pre_stru; +} + +struct di_post_stru_s *get_di_post_stru(void) +{ + return &di_post_stru; +} + +struct di_dev_s *get_di_de_devp(void) +{ + return de_devp; +} + +const char *get_di_version_s(void) +{ + return version_s; +} + +int get_di_di_blocking(void) +{ + return di_blocking; +} + +int get_di_video_peek_cnt(void) +{ + return video_peek_cnt; +} + +unsigned long get_di_reg_unreg_timeout_cnt(void) +{ + return reg_unreg_timeout_cnt; +} + +uint get_di_init_flag(void) +{ + return init_flag; +} + +unsigned char get_di_recovery_flag(void) +{ + return recovery_flag; +} + +unsigned int get_di_recovery_log_reason(void) +{ + return recovery_log_reason; +} + +unsigned int get_di_recovery_log_queue_idx(void) +{ + return recovery_log_queue_idx; +} + +struct di_buf_s *get_di_recovery_log_di_buf(void) +{ + return recovery_log_di_buf; +} + +struct vframe_s **get_di_vframe_in(void) +{ + return &vframe_in[0]; +} + +int get_di_dump_state_flag(void) +{ + return dump_state_flag; +} +/*--------------------------*/ + static ssize_t store_dbg(struct device *dev, struct device_attribute *attr, @@ -475,6 +544,7 @@ store_dbg(struct device *dev, dump_pool(get_queue_by_idx(idx)); } else if (strncmp(buf, "state", 4) == 0) { dump_state(); + pr_info("add new debugfs: cat /sys/kernel/debug/di/state\n"); } else if (strncmp(buf, "prog_proc_config", 16) == 0) { if (buf[16] == '1') prog_proc_config = 1; @@ -503,7 +573,7 @@ store_dbg(struct device *dev, if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) dump_di_reg_g12(); else - dump_di_reg(); + pr_info("add new debugfs: cat /sys/kernel/debug/di/dumpreg\n"); } else if (strncmp(buf, "dumpmif", 7) == 0) { dump_mif_size_state(&di_pre_stru, &di_post_stru); } else if (strncmp(buf, "recycle_buf", 11) == 0) { @@ -765,16 +835,6 @@ static unsigned int default_height = 1080; * 6) post_free_list_head * 8) (struct di_buf_s*)(vframe->private_data) */ -#define QUEUE_LOCAL_FREE 0 -#define QUEUE_IN_FREE 1 -#define QUEUE_PRE_READY 2 -#define QUEUE_POST_FREE 3 -#define QUEUE_POST_READY 4 -#define QUEUE_RECYCLE 5 -#define QUEUE_DISPLAY 6 -#define QUEUE_TMP 7 -#define QUEUE_POST_DOING 8 -#define QUEUE_NUM 9 #define queue_t struct queue_s static queue_t queue[QUEUE_NUM]; @@ -787,10 +847,6 @@ static struct queue_s *get_queue_by_idx(int idx) return NULL; } - -#define queue_for_each_entry(di_buf, ptm, queue_idx, list) \ - for (itmp = 0; ((di_buf = get_di_buf(queue_idx, &itmp)) != NULL); ) - static void queue_init(int local_buffer_num) { int i, j; @@ -826,7 +882,7 @@ static void queue_init(int local_buffer_num) } } -static struct di_buf_s *get_di_buf(int queue_idx, int *start_pos) +struct di_buf_s *get_di_buf(int queue_idx, int *start_pos) { queue_t *q = &(queue[queue_idx]); int idx = 0; @@ -1182,99 +1238,6 @@ static bool is_in_queue(struct di_buf_s *di_buf, int queue_idx) return ret; } -/*2018-07-18 add debugfs*/ -/*same as dump_di_pre_stru*/ -static int dump_di_pre_stru_seq(struct seq_file *seq, void *v) -{ - seq_puts(seq, "di_pre_stru:\n"); - - seq_printf(seq, "%-25s = 0x%p\n", "di_mem_buf_dup_p", - di_pre_stru.di_mem_buf_dup_p); - seq_printf(seq, "%-25s = 0x%p\n", "di_chan2_buf_dup_p", - di_pre_stru.di_chan2_buf_dup_p); - seq_printf(seq, "%-25s = %d\n", "in_seq", - di_pre_stru.in_seq); - seq_printf(seq, "%-25s = %d\n", "recycle_seq", - di_pre_stru.recycle_seq); - seq_printf(seq, "%-25s = %d\n", "pre_ready_seq", - di_pre_stru.pre_ready_seq); - seq_printf(seq, "%-25s = %d\n", "pre_de_busy", - di_pre_stru.pre_de_busy); - seq_printf(seq, "%-25s = %d\n", "pre_de_busy_timer_count", - di_pre_stru.pre_de_busy_timer_count); - seq_printf(seq, "%-25s = %d\n", "pre_de_process_done", - di_pre_stru.pre_de_process_done); - seq_printf(seq, "%-25s = %d\n", "pre_de_process_flag", - di_pre_stru.pre_de_process_flag); - seq_printf(seq, "%-25s =%d\n", "pre_de_irq_timeout_count", - di_pre_stru.pre_de_irq_timeout_count); - seq_printf(seq, "%-25s = %d\n", "unreg_req_flag", - di_pre_stru.unreg_req_flag); - seq_printf(seq, "%-25s = %d\n", "unreg_req_flag_irq", - di_pre_stru.unreg_req_flag_irq); - seq_printf(seq, "%-25s = %d\n", "reg_req_flag", - di_pre_stru.reg_req_flag); - seq_printf(seq, "%-25s = %d\n", "reg_req_flag_irq", - di_pre_stru.reg_req_flag_irq); - seq_printf(seq, "%-25s = %d\n", "cur_width", - di_pre_stru.cur_width); - seq_printf(seq, "%-25s = %d\n", "cur_height", - di_pre_stru.cur_height); - seq_printf(seq, "%-25s = 0x%x\n", "cur_inp_type", - di_pre_stru.cur_inp_type); - seq_printf(seq, "%-25s = %d\n", "cur_source_type", - di_pre_stru.cur_source_type); - seq_printf(seq, "%-25s = %d\n", "cur_prog_flag", - di_pre_stru.cur_prog_flag); - seq_printf(seq, "%-25s = %d\n", "source_change_flag", - di_pre_stru.source_change_flag); - seq_printf(seq, "%-25s = %s\n", "bypass_flag", - di_pre_stru.bypass_flag?"true":"false"); - seq_printf(seq, "%-25s = %d\n", "prog_proc_type", - di_pre_stru.prog_proc_type); - seq_printf(seq, "%-25s = %d\n", "madi_enable", - di_pre_stru.madi_enable); - seq_printf(seq, "%-25s = %d\n", "mcdi_enable", - di_pre_stru.mcdi_enable); -#ifdef DET3D - seq_printf(seq, "%-25s = %d\n", "vframe_interleave_flag", - di_pre_stru.vframe_interleave_flag); -#endif - seq_printf(seq, "%-25s = %d\n", "left_right", - di_pre_stru.left_right); - seq_printf(seq, "%-25s = %s\n", "force_interlace", - di_pre_stru.force_interlace ? "true" : "false"); - seq_printf(seq, "%-25s = %d\n", "vdin2nr", - di_pre_stru.vdin2nr); - seq_printf(seq, "%-25s = %s\n", "bypass_pre", - di_pre_stru.bypass_pre ? "true" : "false"); - seq_printf(seq, "%-25s = %s\n", "invert_flag", - di_pre_stru.invert_flag ? "true" : "false"); - - return 0; -} - -/*2018-07-18 add debugfs*/ -/*same as dump_di_post_stru*/ -static int dump_di_post_stru_seq(struct seq_file *seq, void *v) -{ - seq_puts(seq, "di_post_stru:\n"); - seq_printf(seq, "run_early_proc_fun_flag = %d\n", - di_post_stru.run_early_proc_fun_flag); - seq_printf(seq, "cur_disp_index = %d\n", - di_post_stru.cur_disp_index); - seq_printf(seq, "post_de_busy = %d\n", - di_post_stru.post_de_busy); - seq_printf(seq, "de_post_process_done = %d\n", - di_post_stru.de_post_process_done); - seq_printf(seq, "cur_post_buf = 0x%p\n", - di_post_stru.cur_post_buf); - seq_printf(seq, "post_peek_underflow = %u\n", - di_post_stru.post_peek_underflow); - - return 0; -} - static ssize_t store_dump_mem(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -1505,7 +1468,8 @@ static unsigned char is_source_change(vframe_t *vframe) * } */ static int trick_mode; -static unsigned char is_bypass(vframe_t *vf_in) + +unsigned char is_bypass(vframe_t *vf_in) { unsigned int vtype = 0; int ret = 0; @@ -2363,48 +2327,6 @@ static void log_buffer_state(unsigned char *tag) } } -/*2018-07-18 add debugfs*/ -static void print_di_buf_seq(struct di_buf_s *di_buf, int format, - struct seq_file *seq) -{ - if (!di_buf) - return; - if (format == 1) { - seq_printf(seq, - "\t+index %d, 0x%p, type %d, vframetype 0x%x\n", - di_buf->index, - di_buf, - di_buf->type, - di_buf->vframe->type); - seq_printf(seq, "\t+trans_fmt %u,bitdepath %d pages %p\n", - di_buf->vframe->trans_fmt, - di_buf->vframe->bitdepth, - di_buf->pages); - if (di_buf->di_wr_linked_buf) { - seq_printf(seq, "\tlinked +index %d, 0x%p, type %d\n", - di_buf->di_wr_linked_buf->index, - di_buf->di_wr_linked_buf, - di_buf->di_wr_linked_buf->type); - } - } else if (format == 2) { - seq_printf(seq, "index %d, 0x%p(vframe 0x%p), type %d pages %p\n", - di_buf->index, di_buf, - di_buf->vframe, di_buf->type, di_buf->pages); - seq_printf(seq, "vframetype 0x%x, trans_fmt %u,duration %d pts %d,bitdepth %d\n", - di_buf->vframe->type, - di_buf->vframe->trans_fmt, - di_buf->vframe->duration, - di_buf->vframe->pts, - di_buf->vframe->bitdepth); - if (di_buf->di_wr_linked_buf) { - seq_printf(seq, "linked index %d, 0x%p, type %d\n", - di_buf->di_wr_linked_buf->index, - di_buf->di_wr_linked_buf, - di_buf->di_wr_linked_buf->type); - } - } -} - static void dump_state(void) { struct di_buf_s *p = NULL, *keep_buf; @@ -2515,121 +2437,6 @@ static void dump_state(void) dump_state_flag = 0; } -/*2018-07-18 add debugfs*/ -/*same as dump_state*/ -static int seq_file_di_state_show(struct seq_file *seq, void *v) -{ - int itmp, i; - struct di_buf_s *p = NULL, *keep_buf;;/* , *ptmp; */ - - dump_state_flag = 1; - seq_printf(seq, "version %s, init_flag %d, is_bypass %d\n", - version_s, init_flag, is_bypass(NULL)); - seq_printf(seq, "recovery_flag = %d, recovery_log_reason=%d, di_blocking=%d", - recovery_flag, recovery_log_reason, di_blocking); -seq_printf(seq, "recovery_log_queue_idx=%d, recovery_log_di_buf=0x%p\n", - recovery_log_queue_idx, recovery_log_di_buf); - seq_printf(seq, "buffer_size=%d, mem_flag=%d, cma_flag=%d\n", - de_devp->buffer_size, atomic_read(&de_devp->mem_flag), - de_devp->flag_cma); - keep_buf = di_post_stru.keep_buf; - seq_printf(seq, "used_post_buf_index %d(0x%p),", - IS_ERR_OR_NULL(keep_buf) ? - -1 : keep_buf->index, keep_buf); - if (!IS_ERR_OR_NULL(keep_buf)) { - seq_puts(seq, "used_local_buf_index:\n"); - for (i = 0; i < USED_LOCAL_BUF_MAX; i++) { - p = keep_buf->di_buf_dup_p[i]; - seq_printf(seq, "%d(0x%p) ", - IS_ERR_OR_NULL(p) ? -1 : p->index, p); - } - } - seq_printf(seq, "\nin_free_list (max %d):\n", MAX_IN_BUF_NUM); - queue_for_each_entry(p, ptmp, QUEUE_IN_FREE, list) { - seq_printf(seq, "index %2d, 0x%p, type %d\n", - p->index, p, p->type); - } - seq_printf(seq, "local_free_list (max %d):\n", de_devp->buf_num_avail); - queue_for_each_entry(p, ptmp, QUEUE_LOCAL_FREE, list) { - seq_printf(seq, "index %2d, 0x%p, type %d\n", - p->index, p, p->type); - } - - seq_puts(seq, "post_doing_list:\n"); - queue_for_each_entry(p, ptmp, QUEUE_POST_DOING, list) { - print_di_buf_seq(p, 2, seq); - } - seq_puts(seq, "pre_ready_list:\n"); - queue_for_each_entry(p, ptmp, QUEUE_PRE_READY, list) { - print_di_buf_seq(p, 2, seq); - } - seq_printf(seq, "post_free_list (max %d):\n", - di_post_stru.di_post_num); - queue_for_each_entry(p, ptmp, QUEUE_POST_FREE, list) { - seq_printf(seq, "index %2d, 0x%p, type %d, vframetype 0x%x\n", - p->index, p, p->type, p->vframe->type); - } - seq_puts(seq, "post_ready_list:\n"); - queue_for_each_entry(p, ptmp, QUEUE_POST_READY, list) { - print_di_buf_seq(p, 2, seq); - print_di_buf_seq(p->di_buf[0], 1, seq); - print_di_buf_seq(p->di_buf[1], 1, seq); - } - seq_puts(seq, "display_list:\n"); - queue_for_each_entry(p, ptmp, QUEUE_DISPLAY, list) { - print_di_buf_seq(p, 2, seq); - print_di_buf_seq(p->di_buf[0], 1, seq); - print_di_buf_seq(p->di_buf[1], 1, seq); - } - seq_puts(seq, "recycle_list:\n"); - queue_for_each_entry(p, ptmp, QUEUE_RECYCLE, list) { - seq_printf(seq, - "index %d, 0x%p, type %d, vframetype 0x%x pre_ref_count %d post_ref_count %d\n", - p->index, p, p->type, - p->vframe->type, - p->pre_ref_count, - p->post_ref_count); - if (p->di_wr_linked_buf) { - seq_printf(seq, - "linked index %2d, 0x%p, type %d pre_ref_count %d post_ref_count %d\n", - p->di_wr_linked_buf->index, - p->di_wr_linked_buf, - p->di_wr_linked_buf->type, - p->di_wr_linked_buf->pre_ref_count, - p->di_wr_linked_buf->post_ref_count); - } - } - if (di_pre_stru.di_inp_buf) { - seq_printf(seq, "di_inp_buf:index %d, 0x%p, type %d\n", - di_pre_stru.di_inp_buf->index, - di_pre_stru.di_inp_buf, - di_pre_stru.di_inp_buf->type); - } else { - seq_puts(seq, "di_inp_buf: NULL\n"); - } - if (di_pre_stru.di_wr_buf) { - seq_printf(seq, "di_wr_buf:index %d, 0x%p, type %d\n", - di_pre_stru.di_wr_buf->index, - di_pre_stru.di_wr_buf, - di_pre_stru.di_wr_buf->type); - } else { - seq_puts(seq, "di_wr_buf: NULL\n"); - } - dump_di_pre_stru_seq(seq, v);/*dump_di_pre_stru();*/ - dump_di_post_stru_seq(seq, v);/*dump_di_post_stru();*/ - seq_puts(seq, "vframe_in[]:"); - - for (i = 0; i < MAX_IN_BUF_NUM; i++) - seq_printf(seq, "0x%p\n", vframe_in[i]); - - seq_puts(seq, "\n"); - seq_printf(seq, "vf_peek()=>0x%p, video_peek_cnt = %d\n", - vf_peek(VFM_NAME), video_peek_cnt); - seq_printf(seq, "reg_unreg_timerout = %lu\n", reg_unreg_timeout_cnt); - dump_state_flag = 0; - return 0; -} - static unsigned char check_di_buf(struct di_buf_s *di_buf, int reason) { int error = 0; @@ -7536,66 +7343,6 @@ static void di_get_vpu_clkb(struct device *dev, struct di_dev_s *pdev) #endif } -/*2018-07-18 add debugfs*/ -#define DEFINE_SHOW_DI(__name) \ -static int __name ## _open(struct inode *inode, struct file *file) \ -{ \ - return single_open(file, __name ## _show, inode->i_private); \ -} \ - \ -static const struct file_operations __name ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __name ## _open, \ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release, \ -} - -DEFINE_SHOW_DI(seq_file_di_state); - -struct di_debugfs_files_t { - const char *name; - const umode_t mode; - const struct file_operations *fops; -}; - -static struct di_debugfs_files_t di_debugfs_files[] = { - {"state", S_IFREG | 0644, &seq_file_di_state_fops}, - -}; - - -static void di_debugfs_init(void) -{ - int i; - struct dentry *ent; - - if (de_devp->dbg_root) - return; - - de_devp->dbg_root = debugfs_create_dir("di", NULL); - if (!de_devp->dbg_root) { - pr_err("can't create debugfs dir di\n"); - return; - } - - for (i = 0; i < ARRAY_SIZE(di_debugfs_files); i++) { - ent = debugfs_create_file(di_debugfs_files[i].name, - di_debugfs_files[i].mode, - de_devp->dbg_root, NULL, - di_debugfs_files[i].fops); - if (!ent) - pr_err("debugfs create failed\n"); - } - -} -static void di_debugfs_exit(void) -{ - if (de_devp && de_devp->dbg_root) - debugfs_remove(de_devp->dbg_root); -} -/*-----------------------*/ - static int di_probe(struct platform_device *pdev) { int ret = 0; diff --git a/drivers/amlogic/media/deinterlace/deinterlace.h b/drivers/amlogic/media/deinterlace/deinterlace.h index 950bed3d1524..ed2442e4ea36 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace.h +++ b/drivers/amlogic/media/deinterlace/deinterlace.h @@ -170,6 +170,18 @@ struct di_buf_s { #define DI_LOG_VFRAME 0x80 +#define QUEUE_LOCAL_FREE 0 +#define QUEUE_IN_FREE 1 +#define QUEUE_PRE_READY 2 +#define QUEUE_POST_FREE 3 +#define QUEUE_POST_READY 4 +#define QUEUE_RECYCLE 5 +#define QUEUE_DISPLAY 6 +#define QUEUE_TMP 7 +#define QUEUE_POST_DOING 8 +#define QUEUE_NUM 9 + +#define VFM_NAME "deinterlace" #ifdef CONFIG_AMLOGIC_MEDIA_VSYNC_RDMA extern void enable_rdma(int enable_flag); @@ -390,6 +402,30 @@ struct di_buf_pool_s { unsigned int size; }; +unsigned char is_bypass(vframe_t *vf_in); + +/*---get di state parameter---*/ +struct di_dev_s *get_di_de_devp(void); +struct di_pre_stru_s *get_di_pre_stru(void); +struct di_post_stru_s *get_di_post_stru(void); +const char *get_di_version_s(void); +int get_di_dump_state_flag(void); +uint get_di_init_flag(void); +unsigned char get_di_recovery_flag(void); +unsigned int get_di_recovery_log_reason(void); +int get_di_di_blocking(void); +unsigned int get_di_recovery_log_queue_idx(void); +struct di_buf_s *get_di_recovery_log_di_buf(void); +int get_di_video_peek_cnt(void); +unsigned long get_di_reg_unreg_timeout_cnt(void); +struct vframe_s **get_di_vframe_in(void); +/*---------------------*/ + +struct di_buf_s *get_di_buf(int queue_idx, int *start_pos); + +#define queue_for_each_entry(di_buf, ptm, queue_idx, list) \ + for (itmp = 0; ((di_buf = get_di_buf(queue_idx, &itmp)) != NULL); ) + #define di_dev_t struct di_dev_s #define di_pr_info(fmt, args ...) pr_info("DI: " fmt, ## args) diff --git a/drivers/amlogic/media/deinterlace/deinterlace_dbg.c b/drivers/amlogic/media/deinterlace/deinterlace_dbg.c index 319a9d606e42..2803e6b1d864 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace_dbg.c +++ b/drivers/amlogic/media/deinterlace/deinterlace_dbg.c @@ -36,6 +36,14 @@ #include "deinterlace_dbg.h" #include "di_pps.h" #include "nr_downscale.h" +#include + + +/*2018-07-18 add debugfs*/ +#include +#include +/*2018-07-18 -----------*/ + void parse_cmd_params(char *buf_orig, char **parm) { @@ -55,138 +63,151 @@ void parse_cmd_params(char *buf_orig, char **parm) parm[n++] = token; } } +const unsigned int size_reg_addr1[] = { + 0x1702, 0x1703, 0x2d01, + 0x2d01, 0x2d8f, 0x2d08, + 0x2d09, 0x2f00, 0x2f01, + 0x17d0, 0x17d1, 0x17d2, + 0x17d3, 0x17dd, 0x17de, + 0x17df, 0x17e0, 0x17f7, + 0x17f8, 0x17f9, 0x17fa, + 0x17c0, 0x17c1, 0x17a0, + 0x17a1, 0x17c3, 0x17c4, + 0x17cb, 0x17cc, 0x17a3, + 0x17a4, 0x17a5, 0x17a6, + 0x2f92, 0x2f93, 0x2f95, + 0x2f96, 0x2f98, 0x2f99, + 0x2f9b, 0x2f9c, 0x2f65, + 0x2f66, 0x2f67, 0x2f68, + 0x1a53, 0x1a54, 0x1a55, + 0x1a56, 0x17ea, 0x17eb, + 0x17ec, 0x17ed, 0x2012, + 0x2013, 0x2014, 0x2015, + 0xffff +}; -void dump_di_reg(void) +/*g12 new added*/ +const unsigned int size_reg_addr2[] = { + 0x37d2, 0x37d3, 0x37d7, + 0x37d8, 0x37dc, 0x37dd, + 0x37e1, 0x37e2, 0x37e6, + 0x37e7, 0x37e9, 0x37ea, + 0x37ed, 0x37ee, 0x37f1, + 0x37f2, 0x37f4, 0x37f5, + 0x37f6, 0x37f8, 0x3751, + 0x3752, 0x376e, 0x376f, + 0x37f9, 0x37fa, 0x37fc, + 0x3740, 0x3757, 0x3762, + 0xffff +}; + +/*2018-08-17 add debugfs*/ +static int seq_file_dump_di_reg_show(struct seq_file *seq, void *v) { unsigned int i = 0, base_addr = 0; - unsigned int size_reg_addr[] = { - 0x1702, 0x1703, 0x2d01, - 0x2d01, 0x2d8f, 0x2d08, - 0x2d09, 0x2f00, 0x2f01, - 0x17d0, 0x17d1, 0x17d2, - 0x17d3, 0x17dd, 0x17de, - 0x17df, 0x17e0, 0x17f7, - 0x17f8, 0x17f9, 0x17fa, - 0x17c0, 0x17c1, 0x17a0, - 0x17a1, 0x17c3, 0x17c4, - 0x17cb, 0x17cc, 0x17a3, - 0x17a4, 0x17a5, 0x17a6, - 0x2f92, 0x2f93, 0x2f95, - 0x2f96, 0x2f98, 0x2f99, - 0x2f9b, 0x2f9c, 0x2f65, - 0x2f66, 0x2f67, 0x2f68, - 0x1a53, 0x1a54, 0x1a55, - 0x1a56, 0x17ea, 0x17eb, - 0x17ec, 0x17ed, 0x2012, - 0x2013, 0x2014, 0x2015, - 0x37d2, 0x37d3, 0x37d7, - 0x37d8, 0x37dc, 0x37dd, - 0x37e1, 0x37e2, 0x37e6, - 0x37e7, 0x37e9, 0x37ea, - 0x37ed, 0x37ee, 0x37f1, - 0x37f2, 0x37f4, 0x37f5, - 0x37f6, 0x37f8, 0x3751, - 0x3752, 0x376e, 0x376f, - 0x37f9, 0x37fa, 0x37fc, - 0x3740, 0x3757, 0x3762, - 0xffff - }; + if (is_meson_txlx_cpu() || is_meson_txhd_cpu()) base_addr = 0xff900000; else base_addr = 0xd0100000; - pr_info("----dump di reg----\n"); - pr_info("----dump size reg---"); - for (i = 0; size_reg_addr[i] != 0xffff; i++) - pr_info("[0x%x][0x%x]=0x%x\n", - base_addr + ((size_reg_addr[i]) << 2), - size_reg_addr[i], RDMA_RD(size_reg_addr[i])); + seq_puts(seq, "----dump di reg----\n"); + seq_puts(seq, "----dump size reg---\n"); + /*txl crash when dump 0x37d2~0x3762 of size_reg_addr*/ + for (i = 0; size_reg_addr1[i] != 0xffff; i++) + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", + base_addr + ((size_reg_addr1[i]) << 2), + size_reg_addr1[i], RDMA_RD(size_reg_addr1[i])); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + for (i = 0; size_reg_addr2[i] != 0xffff; i++) + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", + base_addr + ((size_reg_addr2[i]) << 2), + size_reg_addr2[i], RDMA_RD(size_reg_addr2[i])); + } for (i = 0; i < 255; i++) { if (i == 0x45) - pr_info("----nr reg----"); + seq_puts(seq, "----nr reg----"); if (i == 0x80) - pr_info("----3d reg----"); + seq_puts(seq, "----3d reg----"); if (i == 0x9e) - pr_info("---nr reg done---"); + seq_puts(seq, "---nr reg done---"); if (i == 0x9c) - pr_info("---3d reg done---"); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_puts(seq, "---3d reg done---"); + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x1700 + i) << 2), 0x1700 + i, RDMA_RD(0x1700 + i)); } for (i = 0; i < 4; i++) { - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x20ab + i) << 2), 0x20ab + i, RDMA_RD(0x20ab + i)); } - pr_info("----dump mcdi reg----\n"); + seq_puts(seq, "----dump mcdi reg----\n"); for (i = 0; i < 201; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2f00 + i) << 2), 0x2f00 + i, RDMA_RD(0x2f00 + i)); - pr_info("----dump pulldown reg----\n"); + seq_puts(seq, "----dump pulldown reg----\n"); for (i = 0; i < 26; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2fd0 + i) << 2), 0x2fd0 + i, RDMA_RD(0x2fd0 + i)); - pr_info("----dump bit mode reg----\n"); + seq_puts(seq, "----dump bit mode reg----\n"); for (i = 0; i < 4; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x20a7 + i) << 2), 0x20a7 + i, RDMA_RD(0x20a7 + i)); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (0x2022 << 2), 0x2022, RDMA_RD(0x2022)); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (0x17c1 << 2), 0x17c1, RDMA_RD(0x17c1)); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (0x17c2 << 2), 0x17c2, RDMA_RD(0x17c2)); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (0x1aa7 << 2), 0x1aa7, RDMA_RD(0x1aa7)); - pr_info("----dump dnr reg----\n"); + seq_puts(seq, "----dump dnr reg----\n"); for (i = 0; i < 29; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2d00 + i) << 2), 0x2d00 + i, RDMA_RD(0x2d00 + i)); - pr_info("----dump if0 reg----\n"); + seq_puts(seq, "----dump if0 reg----\n"); for (i = 0; i < 26; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x1a60 + i) << 2), 0x1a50 + i, RDMA_RD(0x1a50 + i)); - pr_info("----dump gate reg----\n"); - pr_info("[0x%x][0x1718]=0x%x\n", + seq_puts(seq, "----dump gate reg----\n"); + seq_printf(seq, "[0x%x][0x1718]=0x%x\n", base_addr + ((0x1718) << 2), RDMA_RD(0x1718)); for (i = 0; i < 5; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2006 + i) << 2), 0x2006 + i, RDMA_RD(0x2006 + i)); - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2dff) << 2), 0x2dff, RDMA_RD(0x2dff)); - pr_info("----dump if2 reg----\n"); + seq_puts(seq, "----dump if2 reg----\n"); for (i = 0; i < 29; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + ((0x2010 + i) << 2), 0x2010 + i, RDMA_RD(0x2010 + i)); - pr_info("----dump nr4 reg----\n"); + if (!is_meson_txl_cpu()) { + seq_puts(seq, "----dump nr4 reg----\n"); for (i = 0x2da4; i < 0x2df6; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (i << 2), i, RDMA_RD(i)); for (i = 0x3700; i < 0x373f; i++) - pr_info("[0x%x][0x%x]=0x%x\n", + seq_printf(seq, "[0x%x][0x%x]=0x%x\n", base_addr + (i << 2), i, RDMA_RD(i)); - for (i = 0; i < 57; i++) - pr_info("[0x%x][0x%x]=0x%x\n", - base_addr + ((size_reg_addr[i]) << 2), - size_reg_addr[i], RDMA_RD(size_reg_addr[i])); - pr_info("----dump reg done----\n"); + } + seq_puts(seq, "----dump reg done----\n"); + return 0; } void dump_di_reg_g12(void) @@ -365,6 +386,23 @@ static void dump_mif_state(struct DI_MIF_s *mif) mif->canvas0_addr2); } +/*2018-08-17 add debugfs*/ +/*same as dump_mif_state*/ +static void dump_mif_state_seq(struct DI_MIF_s *mif, + struct seq_file *seq) +{ + seq_printf(seq, "luma <%u, %u> <%u %u>.\n", + mif->luma_x_start0, mif->luma_x_end0, + mif->luma_y_start0, mif->luma_y_end0); + seq_printf(seq, "chroma <%u, %u> <%u %u>.\n", + mif->chroma_x_start0, mif->chroma_x_end0, + mif->chroma_y_start0, mif->chroma_y_end0); + seq_printf(seq, "canvas id <%u %u %u>.\n", + mif->canvas0_addr0, + mif->canvas0_addr1, + mif->canvas0_addr2); +} + static void dump_simple_mif_state(struct DI_SIM_MIF_s *simp_mif) { pr_info("<%u %u> <%u %u>.\n", @@ -374,6 +412,18 @@ static void dump_simple_mif_state(struct DI_SIM_MIF_s *simp_mif) simp_mif->canvas_num); } +/*2018-08-17 add debugfs*/ +/*same as dump_simple_mif_state*/ +static void dump_simple_mif_state_seq(struct DI_SIM_MIF_s *simp_mif, + struct seq_file *seq) +{ + seq_printf(seq, "<%u %u> <%u %u>.\n", + simp_mif->start_x, simp_mif->end_x, + simp_mif->start_y, simp_mif->end_y); + seq_printf(seq, "canvas num <%u>.\n", + simp_mif->canvas_num); +} + static void dump_mc_mif_state(struct DI_MC_MIF_s *mc_mif) { pr_info("startx %u,<%u %u>, size <%u %u>.\n", @@ -382,6 +432,17 @@ static void dump_mc_mif_state(struct DI_MC_MIF_s *mc_mif) mc_mif->size_y); } +/*2018-08-17 add debugfs*/ +/*same as dump_mc_mif_state*/ +static void dump_mc_mif_state_seq(struct DI_MC_MIF_s *mc_mif, + struct seq_file *seq) +{ + seq_printf(seq, "startx %u,<%u %u>, size <%u %u>.\n", + mc_mif->start_x, mc_mif->start_y, + mc_mif->end_y, mc_mif->size_x, + mc_mif->size_y); +} + void dump_di_pre_stru(struct di_pre_stru_s *di_pre_stru_p) { pr_info("di_pre_stru:\n"); @@ -449,6 +510,80 @@ void dump_di_pre_stru(struct di_pre_stru_s *di_pre_stru_p) di_pre_stru_p->invert_flag ? "true" : "false"); } +/*2018-08-17 add debugfs*/ +/*same as dump_di_pre_stru*/ +static int dump_di_pre_stru_seq(struct seq_file *seq, void *v) + +{ + struct di_pre_stru_s *di_pre_stru_p = get_di_pre_stru(); + + seq_puts(seq, "di_pre_stru:\n"); + seq_printf(seq, "%-25s = 0x%p\n", "di_mem_buf_dup_p", + &di_pre_stru_p->di_mem_buf_dup_p); + seq_printf(seq, "%-25s = 0x%p\n", "di_chan2_buf_dup_p", + &di_pre_stru_p->di_chan2_buf_dup_p); + seq_printf(seq, "%-25s = %d\n", "in_seq", + di_pre_stru_p->in_seq); + seq_printf(seq, "%-25s = %d\n", "recycle_seq", + di_pre_stru_p->recycle_seq); + seq_printf(seq, "%-25s = %d\n", "pre_ready_seq", + di_pre_stru_p->pre_ready_seq); + seq_printf(seq, "%-25s = %d\n", "pre_de_busy", + di_pre_stru_p->pre_de_busy); + seq_printf(seq, "%-25s = %d\n", "pre_de_busy_timer_count", + di_pre_stru_p->pre_de_busy_timer_count); + seq_printf(seq, "%-25s = %d\n", "pre_de_process_done", + di_pre_stru_p->pre_de_process_done); + seq_printf(seq, "%-25s = %d\n", "pre_de_process_flag", + di_pre_stru_p->pre_de_process_flag); + seq_printf(seq, "%-25s =%d\n", "pre_de_irq_timeout_count", + di_pre_stru_p->pre_de_irq_timeout_count); + seq_printf(seq, "%-25s = %d\n", "unreg_req_flag", + di_pre_stru_p->unreg_req_flag); + seq_printf(seq, "%-25s = %d\n", "unreg_req_flag_irq", + di_pre_stru_p->unreg_req_flag_irq); + seq_printf(seq, "%-25s = %d\n", "reg_req_flag", + di_pre_stru_p->reg_req_flag); + seq_printf(seq, "%-25s = %d\n", "reg_req_flag_irq", + di_pre_stru_p->reg_req_flag_irq); + seq_printf(seq, "%-25s = %d\n", "cur_width", + di_pre_stru_p->cur_width); + seq_printf(seq, "%-25s = %d\n", "cur_height", + di_pre_stru_p->cur_height); + seq_printf(seq, "%-25s = 0x%x\n", "cur_inp_type", + di_pre_stru_p->cur_inp_type); + seq_printf(seq, "%-25s = %d\n", "cur_source_type", + di_pre_stru_p->cur_source_type); + seq_printf(seq, "%-25s = %d\n", "cur_prog_flag", + di_pre_stru_p->cur_prog_flag); + seq_printf(seq, "%-25s = %d\n", "source_change_flag", + di_pre_stru_p->source_change_flag); + seq_printf(seq, "%-25s = %s\n", "bypass_flag", + &di_pre_stru_p->bypass_flag?"true":"false"); + seq_printf(seq, "%-25s = %d\n", "prog_proc_type", + di_pre_stru_p->prog_proc_type); + seq_printf(seq, "%-25s = %d\n", "madi_enable", + di_pre_stru_p->madi_enable); + seq_printf(seq, "%-25s = %d\n", "mcdi_enable", + di_pre_stru_p->mcdi_enable); +#ifdef DET3D + seq_printf(seq, "%-25s = %d\n", "vframe_interleave_flag", + &di_pre_stru_p->vframe_interleave_flag); +#endif + seq_printf(seq, "%-25s = %d\n", "left_right", + di_pre_stru_p->left_right); + seq_printf(seq, "%-25s = %s\n", "force_interlace", + &di_pre_stru_p->force_interlace ? "true" : "false"); + seq_printf(seq, "%-25s = %d\n", "vdin2nr", + di_pre_stru_p->vdin2nr); + seq_printf(seq, "%-25s = %s\n", "bypass_pre", + &di_pre_stru_p->bypass_pre ? "true" : "false"); + seq_printf(seq, "%-25s = %s\n", "invert_flag", + &di_pre_stru_p->invert_flag ? "true" : "false"); + + return 0; +} + void dump_di_post_stru(struct di_post_stru_s *di_post_stru_p) { pr_info("\ndi_post_stru:\n"); @@ -466,6 +601,29 @@ void dump_di_post_stru(struct di_post_stru_s *di_post_stru_p) di_post_stru_p->post_peek_underflow); } +/*2018-08-17 add debugfs*/ +/*same as dump_di_post_stru*/ +static int dump_di_post_stru_seq(struct seq_file *seq, void *v) +{ + struct di_post_stru_s *di_post_stru_p = get_di_post_stru(); + + seq_puts(seq, "di_post_stru:\n"); + seq_printf(seq, "run_early_proc_fun_flag = %d\n", + di_post_stru_p->run_early_proc_fun_flag); + seq_printf(seq, "cur_disp_index = %d\n", + di_post_stru_p->cur_disp_index); + seq_printf(seq, "post_de_busy = %d\n", + di_post_stru_p->post_de_busy); + seq_printf(seq, "de_post_process_done = %d\n", + di_post_stru_p->de_post_process_done); + seq_printf(seq, "cur_post_buf = 0x%p\n", + &di_post_stru_p->cur_post_buf); + seq_printf(seq, "post_peek_underflow = %u\n", + di_post_stru_p->post_peek_underflow); + + return 0; +} + void dump_mif_size_state(struct di_pre_stru_s *pre_stru_p, struct di_post_stru_s *post_stru_p) { @@ -473,16 +631,22 @@ void dump_mif_size_state(struct di_pre_stru_s *pre_stru_p, pr_info("DI_PRE_CTRL=0x%x\n", Rd(DI_PRE_CTRL)); pr_info("DI_PRE_SIZE=0x%x\n", Rd(DI_PRE_SIZE)); pr_info("DNR_HVSIZE=0x%x\n", Rd(DNR_HVSIZE)); - pr_info("CONTWR_CAN_SIZE=0x%x\n", Rd(0x37ec)); - pr_info("MTNWR_CAN_SIZE=0x%x\n", Rd(0x37f0)); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + pr_info("CONTWR_CAN_SIZE=0x%x\n", Rd(0x37ec)); + pr_info("MTNWR_CAN_SIZE=0x%x\n", Rd(0x37f0)); + } pr_info("DNR_STAT_X_START_END=0x%x\n", Rd(0x2d08)); pr_info("DNR_STAT_Y_START_END=0x%x\n", Rd(0x2d09)); pr_info("MCDI_HV_SIZEIN=0x%x\n", Rd(0x2f00)); pr_info("MCDI_HV_BLKSIZEIN=0x%x\n", Rd(0x2f01)); - pr_info("MCVECWR_CAN_SIZE=0x%x\n", Rd(0x37f4)); - pr_info("MCINFWR_CAN_SIZE=0x%x\n", Rd(0x37f8)); - pr_info("NRDSWR_CAN_SIZE=0x%x\n", Rd(0x37fc)); - pr_info("NR_DS_BUF_SIZE=0x%x\n", Rd(0x3740)); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + pr_info("MCVECWR_CAN_SIZE=0x%x\n", Rd(0x37f4)); + pr_info("MCINFWR_CAN_SIZE=0x%x\n", Rd(0x37f8)); + pr_info("NRDSWR_CAN_SIZE=0x%x\n", Rd(0x37fc)); + pr_info("NR_DS_BUF_SIZE=0x%x\n", Rd(0x3740)); + } + + pr_info("=====inp mif:\n"); #if 0 Wr(DI_DBG_CTRL, 0x1b); @@ -537,12 +701,108 @@ void dump_mif_size_state(struct di_pre_stru_s *pre_stru_p, dump_simple_mif_state(&post_stru_p->di_mtnprd_mif); pr_info("=====mcvecrd mif:\n"); dump_mc_mif_state(&post_stru_p->di_mcvecrd_mif); - pr_info("======pps size status======\n"); - pr_info("DI_SC_LINE_IN_LENGTH=0x%x\n", Rd(0x3751)); - pr_info("DI_SC_PIC_IN_HEIGHT=0x%x\n", Rd(0x3752)); - pr_info("DI_HDR_IN_HSIZE=0x%x\n", Rd(0x376e)); - pr_info("DI_HDR_IN_VSIZE=0x%x\n", Rd(0x376f)); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + pr_info("======pps size status======\n"); + pr_info("DI_SC_LINE_IN_LENGTH=0x%x\n", Rd(0x3751)); + pr_info("DI_SC_PIC_IN_HEIGHT=0x%x\n", Rd(0x3752)); + pr_info("DI_HDR_IN_HSIZE=0x%x\n", Rd(0x376e)); + pr_info("DI_HDR_IN_VSIZE=0x%x\n", Rd(0x376f)); + } } + +/*2018-08-17 add debugfs*/ +/*same as dump_mif_size_state*/ +static int seq_file_dump_mif_size_state_show(struct seq_file *seq, void *v) +{ + struct di_pre_stru_s *di_pre_stru_p = get_di_pre_stru(); + struct di_post_stru_s *di_post_stru_p = get_di_post_stru(); + + seq_puts(seq, "======pre mif status======\n"); + seq_printf(seq, "DI_PRE_CTRL=0x%x\n", Rd(DI_PRE_CTRL)); + seq_printf(seq, "DI_PRE_SIZE=0x%x\n", Rd(DI_PRE_SIZE)); + seq_printf(seq, "DNR_HVSIZE=0x%x\n", Rd(DNR_HVSIZE)); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + seq_printf(seq, "CONTWR_CAN_SIZE=0x%x\n", Rd(0x37ec)); + seq_printf(seq, "MTNWR_CAN_SIZE=0x%x\n", Rd(0x37f0)); + } + seq_printf(seq, "DNR_STAT_X_START_END=0x%x\n", Rd(0x2d08)); + seq_printf(seq, "DNR_STAT_Y_START_END=0x%x\n", Rd(0x2d09)); + seq_printf(seq, "MCDI_HV_SIZEIN=0x%x\n", Rd(0x2f00)); + seq_printf(seq, "MCDI_HV_BLKSIZEIN=0x%x\n", Rd(0x2f01)); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + seq_printf(seq, "MCVECWR_CAN_SIZE=0x%x\n", Rd(0x37f4)); + seq_printf(seq, "MCINFWR_CAN_SIZE=0x%x\n", Rd(0x37f8)); + seq_printf(seq, "NRDSWR_CAN_SIZE=0x%x\n", Rd(0x37fc)); + seq_printf(seq, "NR_DS_BUF_SIZE=0x%x\n", Rd(0x3740)); + } + + seq_puts(seq, "=====inp mif:\n"); +#if 0 + Wr(DI_DBG_CTRL, 0x1b); + Wr(DI_DBG_CTRL1, 0x640064); + Wr_reg_bits(DI_PRE_GL_CTRL, 0, 31, 1); + Wr_reg_bits(DI_PRE_CTRL, 0, 11, 1); + Wr_reg_bits(DI_PRE_CTRL, 1, 31, 1); + Wr_reg_bits(DI_PRE_GL_CTRL, 1, 31, 1); + pr_info("DI_DBG_SRDY_INF=0x%x\n", Rd(DI_DBG_SRDY_INF)); + pr_info("DI_DBG_RRDY_INF=0x%x\n", Rd(DI_DBG_RRDY_INF)); +#endif + seq_printf(seq, "DI_INP_GEN_REG=0x%x\n", Rd(DI_INP_GEN_REG)); + dump_mif_state_seq(&di_pre_stru_p->di_inp_mif, seq);/*dump_mif_state*/ + seq_puts(seq, "=====mem mif:\n"); + seq_printf(seq, "DI_MEM_GEN_REG=0x%x\n", Rd(DI_MEM_GEN_REG)); + dump_mif_state_seq(&di_pre_stru_p->di_mem_mif, seq); + seq_puts(seq, "=====chan2 mif:\n"); + seq_printf(seq, "DI_CHAN2_GEN_REG=0x%x\n", Rd(DI_CHAN2_GEN_REG)); + dump_mif_state_seq(&di_pre_stru_p->di_chan2_mif, seq); + seq_puts(seq, "=====nrwr mif:\n"); + seq_printf(seq, "DI_NRWR_CTRL=0x%x\n", Rd(DI_NRWR_CTRL)); + /*dump_simple_mif_state*/ + dump_simple_mif_state_seq(&di_pre_stru_p->di_nrwr_mif, seq); + seq_puts(seq, "=====mtnwr mif:\n"); + dump_simple_mif_state_seq(&di_pre_stru_p->di_mtnwr_mif, seq); + seq_puts(seq, "=====contp2rd mif:\n"); + dump_simple_mif_state_seq(&di_pre_stru_p->di_contp2rd_mif, seq); + seq_puts(seq, "=====contprd mif:\n"); + dump_simple_mif_state_seq(&di_pre_stru_p->di_contprd_mif, seq); + seq_puts(seq, "=====contwr mif:\n"); + dump_simple_mif_state_seq(&di_pre_stru_p->di_contwr_mif, seq); + seq_puts(seq, "=====mcinford mif:\n"); + /*dump_mc_mif_state*/ + dump_mc_mif_state_seq(&di_pre_stru_p->di_mcinford_mif, + seq); + seq_puts(seq, "=====mcinfowr mif:\n"); + dump_mc_mif_state_seq(&di_pre_stru_p->di_mcinfowr_mif, seq); + seq_puts(seq, "=====mcvecwr mif:\n"); + dump_mc_mif_state_seq(&di_pre_stru_p->di_mcvecwr_mif, seq); + seq_puts(seq, "======post mif status======\n"); + seq_printf(seq, "DI_POST_SIZE=0x%x\n", Rd(DI_POST_SIZE)); + seq_printf(seq, "DECOMB_FRM_SIZE=0x%x\n", Rd(0x2d8f)); + seq_puts(seq, "=====if0 mif:\n"); + seq_printf(seq, "DI_IF0_GEN_REG=0x%x\n", Rd(0x2030)); + dump_mif_state_seq(&di_post_stru_p->di_buf0_mif, seq); + seq_puts(seq, "=====if1 mif:\n"); + seq_printf(seq, "DI_IF1_GEN_REG=0x%x\n", Rd(0x17e8)); + dump_mif_state_seq(&di_post_stru_p->di_buf1_mif, seq); + seq_puts(seq, "=====if2 mif:\n"); + seq_printf(seq, "DI_IF2_GEN_REG=0x%x\n", Rd(0x2010)); + dump_mif_state_seq(&di_post_stru_p->di_buf2_mif, seq); + seq_puts(seq, "=====diwr mif:\n"); + dump_simple_mif_state_seq(&di_post_stru_p->di_diwr_mif, seq); + seq_puts(seq, "=====mtnprd mif:\n"); + dump_simple_mif_state_seq(&di_post_stru_p->di_mtnprd_mif, seq); + seq_puts(seq, "=====mcvecrd mif:\n"); + dump_mc_mif_state_seq(&di_post_stru_p->di_mcvecrd_mif, seq); + if (cpu_after_eq(MESON_CPU_MAJOR_ID_G12A)) { + seq_puts(seq, "======pps size status======\n"); + seq_printf(seq, "DI_SC_LINE_IN_LENGTH=0x%x\n", Rd(0x3751)); + seq_printf(seq, "DI_SC_PIC_IN_HEIGHT=0x%x\n", Rd(0x3752)); + seq_printf(seq, "DI_HDR_IN_HSIZE=0x%x\n", Rd(0x376e)); + seq_printf(seq, "DI_HDR_IN_VSIZE=0x%x\n", Rd(0x376f)); + } + return 0; +} + void dump_di_buf(struct di_buf_s *di_buf) { pr_info("di_buf %p vframe %p:\n", di_buf, di_buf->vframe); @@ -648,6 +908,51 @@ void print_di_buf(struct di_buf_s *di_buf, int format) } } } + +/*2018-08-17 add debugfs*/ +/*same as print_di_buf*/ +static void print_di_buf_seq(struct di_buf_s *di_buf, int format, + struct seq_file *seq) +{ + if (!di_buf) + return; + if (format == 1) { + seq_printf(seq, + "\t+index %d, 0x%p, type %d, vframetype 0x%x\n", + di_buf->index, + di_buf, + di_buf->type, + di_buf->vframe->type); + seq_printf(seq, "\t+trans_fmt %u,bitdepath %d pages %p\n", + di_buf->vframe->trans_fmt, + di_buf->vframe->bitdepth, + di_buf->pages); + if (di_buf->di_wr_linked_buf) { + seq_printf(seq, "\tlinked +index %d, 0x%p, type %d\n", + di_buf->di_wr_linked_buf->index, + di_buf->di_wr_linked_buf, + di_buf->di_wr_linked_buf->type); + } + } else if (format == 2) { + seq_printf(seq, "index %d, 0x%p(vframe 0x%p), type %d pages %p\n", + di_buf->index, di_buf, + di_buf->vframe, di_buf->type, di_buf->pages); + seq_printf(seq, "vframetype 0x%x, trans_fmt %u,duration %d pts %d,bitdepth %d\n", + di_buf->vframe->type, + di_buf->vframe->trans_fmt, + di_buf->vframe->duration, + di_buf->vframe->pts, + di_buf->vframe->bitdepth); + if (di_buf->di_wr_linked_buf) { + seq_printf(seq, "linked index %d, 0x%p, type %d\n", + di_buf->di_wr_linked_buf->index, + di_buf->di_wr_linked_buf, + di_buf->di_wr_linked_buf->type); + } + } +} + + void dump_pre_mif_state(void) { unsigned int i = 0; @@ -740,3 +1045,202 @@ void dump_buf_addr(struct di_buf_s *di_buf, unsigned int num) di_buf_p->mcvec_adr, di_buf_p->mcinfo_adr); } } + +/*2018-08-17 add debugfs*/ +/*same as dump_state*/ +static int seq_file_di_state_show(struct seq_file *seq, void *v) +{ + int itmp, i; + struct di_buf_s *p = NULL, *keep_buf;/* ptmp; */ + struct di_pre_stru_s *di_pre_stru_p = get_di_pre_stru(); + struct di_post_stru_s *di_post_stru_p = get_di_post_stru(); + struct di_dev_s *de_devp = get_di_de_devp(); + + const char *version_s = get_di_version_s(); + int dump_state_flag = get_di_dump_state_flag(); + uint init_flag = get_di_init_flag(); + unsigned char recovery_flag = get_di_recovery_flag(); + unsigned int recovery_log_reason = get_di_recovery_log_reason(); + int di_blocking = get_di_di_blocking(); + unsigned int recovery_log_queue_idx = get_di_recovery_log_queue_idx(); + struct di_buf_s *recovery_log_di_buf = get_di_recovery_log_di_buf(); + int video_peek_cnt = get_di_video_peek_cnt(); + unsigned long reg_unreg_timeout_cnt = get_di_reg_unreg_timeout_cnt(); + struct vframe_s **vframe_in = get_di_vframe_in(); + + dump_state_flag = 1; + seq_printf(seq, "version %s, init_flag %d, is_bypass %d\n", + version_s, init_flag, is_bypass(NULL)); + seq_printf(seq, "recovery_flag = %d, recovery_log_reason=%d, di_blocking=%d", + recovery_flag, recovery_log_reason, di_blocking); +seq_printf(seq, "recovery_log_queue_idx=%d, recovery_log_di_buf=0x%p\n", + recovery_log_queue_idx, recovery_log_di_buf); + seq_printf(seq, "buffer_size=%d, mem_flag=%d, cma_flag=%d\n", + de_devp->buffer_size, atomic_read(&de_devp->mem_flag), + de_devp->flag_cma); + keep_buf = di_post_stru_p->keep_buf; + seq_printf(seq, "used_post_buf_index %d(0x%p),", + IS_ERR_OR_NULL(keep_buf) ? + -1 : keep_buf->index, keep_buf); + if (!IS_ERR_OR_NULL(keep_buf)) { + seq_puts(seq, "used_local_buf_index:\n"); + for (i = 0; i < USED_LOCAL_BUF_MAX; i++) { + p = keep_buf->di_buf_dup_p[i]; + seq_printf(seq, "%d(0x%p) ", + IS_ERR_OR_NULL(p) ? -1 : p->index, p); + } + } + seq_printf(seq, "\nin_free_list (max %d):\n", MAX_IN_BUF_NUM); + queue_for_each_entry(p, ptmp, QUEUE_IN_FREE, list) { + seq_printf(seq, "index %2d, 0x%p, type %d\n", + p->index, p, p->type); + } + seq_printf(seq, "local_free_list (max %d):\n", de_devp->buf_num_avail); + queue_for_each_entry(p, ptmp, QUEUE_LOCAL_FREE, list) { + seq_printf(seq, "index %2d, 0x%p, type %d\n", + p->index, p, p->type); + } + + seq_puts(seq, "post_doing_list:\n"); + queue_for_each_entry(p, ptmp, QUEUE_POST_DOING, list) { + print_di_buf_seq(p, 2, seq); + } + seq_puts(seq, "pre_ready_list:\n"); + queue_for_each_entry(p, ptmp, QUEUE_PRE_READY, list) { + print_di_buf_seq(p, 2, seq); + } + seq_printf(seq, "post_free_list (max %d):\n", + di_post_stru_p->di_post_num); + queue_for_each_entry(p, ptmp, QUEUE_POST_FREE, list) { + seq_printf(seq, "index %2d, 0x%p, type %d, vframetype 0x%x\n", + p->index, p, p->type, p->vframe->type); + } + seq_puts(seq, "post_ready_list:\n"); + queue_for_each_entry(p, ptmp, QUEUE_POST_READY, list) { + print_di_buf_seq(p, 2, seq); + print_di_buf_seq(p->di_buf[0], 1, seq); + print_di_buf_seq(p->di_buf[1], 1, seq); + } + seq_puts(seq, "display_list:\n"); + queue_for_each_entry(p, ptmp, QUEUE_DISPLAY, list) { + print_di_buf_seq(p, 2, seq); + print_di_buf_seq(p->di_buf[0], 1, seq); + print_di_buf_seq(p->di_buf[1], 1, seq); + } + seq_puts(seq, "recycle_list:\n"); + queue_for_each_entry(p, ptmp, QUEUE_RECYCLE, list) { + seq_printf(seq, + "index %d, 0x%p, type %d, vframetype 0x%x pre_ref_count %d post_ref_count %d\n", + p->index, p, p->type, + p->vframe->type, + p->pre_ref_count, + p->post_ref_count); + if (p->di_wr_linked_buf) { + seq_printf(seq, + "linked index %2d, 0x%p, type %d pre_ref_count %d post_ref_count %d\n", + p->di_wr_linked_buf->index, + p->di_wr_linked_buf, + p->di_wr_linked_buf->type, + p->di_wr_linked_buf->pre_ref_count, + p->di_wr_linked_buf->post_ref_count); + } + } + if (di_pre_stru_p->di_inp_buf) { + seq_printf(seq, "di_inp_buf:index %d, 0x%p, type %d\n", + di_pre_stru_p->di_inp_buf->index, + &di_pre_stru_p->di_inp_buf, + di_pre_stru_p->di_inp_buf->type); + } else { + seq_puts(seq, "di_inp_buf: NULL\n"); + } + if (di_pre_stru_p->di_wr_buf) { + seq_printf(seq, "di_wr_buf:index %d, 0x%p, type %d\n", + di_pre_stru_p->di_wr_buf->index, + &di_pre_stru_p->di_wr_buf, + di_pre_stru_p->di_wr_buf->type); + } else { + seq_puts(seq, "di_wr_buf: NULL\n"); + } + dump_di_pre_stru_seq(seq, v);/*dump_di_pre_stru();*/ + dump_di_post_stru_seq(seq, v);/*dump_di_post_stru();*/ + seq_puts(seq, "vframe_in[]:"); + + for (i = 0; i < MAX_IN_BUF_NUM; i++) { + seq_printf(seq, "0x%p\n", *vframe_in); + vframe_in++; + } + + seq_puts(seq, "\n"); + seq_printf(seq, "vf_peek()=>0x%p, video_peek_cnt = %d\n", + vf_peek(VFM_NAME), video_peek_cnt); + seq_printf(seq, "reg_unreg_timerout = %lu\n", reg_unreg_timeout_cnt); + dump_state_flag = 0; + return 0; +} + +/*2018-08-17 add debugfs*/ +#define DEFINE_SHOW_DI(__name) \ +static int __name ## _open(struct inode *inode, struct file *file) \ +{ \ + return single_open(file, __name ## _show, inode->i_private); \ +} \ + \ +static const struct file_operations __name ## _fops = { \ + .owner = THIS_MODULE, \ + .open = __name ## _open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +} + +DEFINE_SHOW_DI(seq_file_di_state); +DEFINE_SHOW_DI(seq_file_dump_di_reg); +DEFINE_SHOW_DI(seq_file_dump_mif_size_state); + +struct di_debugfs_files_t { + const char *name; + const umode_t mode; + const struct file_operations *fops; +}; + +static struct di_debugfs_files_t di_debugfs_files[] = { + {"state", S_IFREG | 0644, &seq_file_di_state_fops}, + {"dumpreg", S_IFREG | 0644, &seq_file_dump_di_reg_fops}, + {"dumpmif", S_IFREG | 0644, &seq_file_dump_mif_size_state_fops}, + +}; + +void di_debugfs_init(void) +{ + int i; + struct dentry *ent; + struct di_dev_s *de_devp = get_di_de_devp(); + + if (de_devp->dbg_root) + return; + + de_devp->dbg_root = debugfs_create_dir("di", NULL); + if (!de_devp->dbg_root) { + pr_err("can't create debugfs dir di\n"); + return; + } + + for (i = 0; i < ARRAY_SIZE(di_debugfs_files); i++) { + ent = debugfs_create_file(di_debugfs_files[i].name, + di_debugfs_files[i].mode, + de_devp->dbg_root, NULL, + di_debugfs_files[i].fops); + if (!ent) + pr_err("debugfs create failed\n"); + } + +} +void di_debugfs_exit(void) +{ + struct di_dev_s *de_devp = get_di_de_devp(); + + if (de_devp && de_devp->dbg_root) + debugfs_remove_recursive(de_devp->dbg_root); +} +/*-----------------------*/ + diff --git a/drivers/amlogic/media/deinterlace/deinterlace_dbg.h b/drivers/amlogic/media/deinterlace/deinterlace_dbg.h index c45da23c29bc..ab4cbd98f4b1 100644 --- a/drivers/amlogic/media/deinterlace/deinterlace_dbg.h +++ b/drivers/amlogic/media/deinterlace/deinterlace_dbg.h @@ -24,7 +24,6 @@ void dump_di_post_stru(struct di_post_stru_s *di_post_stru_p); void dump_di_buf(struct di_buf_s *di_buf); void dump_pool(struct queue_s *q); void dump_vframe(vframe_t *vf); -void dump_di_reg(void); void dump_di_reg_g12(void); void print_di_buf(struct di_buf_s *di_buf, int format); void dump_pre_mif_state(void); @@ -34,4 +33,6 @@ void dump_mif_size_state(struct di_pre_stru_s *pre, struct di_post_stru_s *post); void debug_device_files_add(struct device *dev); void debug_device_files_del(struct device *dev); +extern void di_debugfs_init(void); +extern void di_debugfs_exit(void); #endif