deinterlace: txl: add patch for hdmi progressive input
authorJihong Sui <jihong.sui@amlogic.com>
Fri, 27 Jul 2018 03:00:14 +0000 (11:00 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 3 Aug 2018 06:02:29 +0000 (23:02 -0700)
PD#170301: deinterlace: txl: add patch for hdmi progressive input

Change-Id: I12a534d8aa545cfc2c8d5cfb0b9ab763da58d015
Signed-off-by: Jihong Sui <jihong.sui@amlogic.com>
drivers/amlogic/media/deinterlace/deinterlace.c
drivers/amlogic/media/deinterlace/deinterlace_hw.c
drivers/amlogic/media/deinterlace/deinterlace_hw.h

index 3f0afa5..8720a12 100644 (file)
@@ -3011,6 +3011,8 @@ static void pre_de_process(void)
        }
 
        di_pre_stru.field_count_for_cont++;
+       di_txl_patch_prog(di_pre_stru.cur_prog_flag,
+               di_pre_stru.field_count_for_cont, mcpre_en);
 
 #ifdef SUPPORT_MPEG_TO_VDIN
        if (mpeg2vdin_flag) {
index 09033da..935bec9 100644 (file)
@@ -3156,6 +3156,57 @@ void di_load_regs(struct di_pq_parm_s *di_pq_ptr)
                                value, Rd(addr) != value?"fail":"success");
        }
 }
+/*note:*/
+/*     function: patch for txl for progressive source  */
+/*             480p/576p/720p from hdmi will timeout   */
+/*     prog_flg: in:   1:progressive;                  */
+/*     cnt:    in:     di_pre_stru.field_count_for_cont*/
+/*     mc_en:  in:     mcpre_en*/
+void di_txl_patch_prog(int prog_flg, unsigned int cnt, bool mc_en)
+{
+       unsigned int di_mtn_1_ctrl1 = 0; /*ary add tmp*/
+
+       if (!prog_flg || !is_meson_txl_cpu())
+               return;
+
+       /*printk("prog patch\n");*/
+       if (cnt >= 3) {
+               di_mtn_1_ctrl1 |= 1 << 29;/* enable txt */
+
+               if (mc_en) {
+                       RDMA_WR(DI_MTN_CTRL1,
+                                       (0xffffcfff & RDMA_RD(DI_MTN_CTRL1)));
+
+                       /* enable me(mc di) */
+                       if (cnt == 4) {
+                               di_mtn_1_ctrl1 &= (~(1 << 30));
+                               /* enable contp2rd and contprd */
+                               RDMA_WR(MCDI_MOTINEN, 1 << 1 | 1);
+
+                       }
+                       if (cnt == 5)
+                               RDMA_WR(MCDI_CTRL_MODE, 0x1bfff7ff);
+
+
+               }
+
+       } else {
+               if (mc_en) {
+                       /* txtdet_en mode */
+                       RDMA_WR_BITS(MCDI_CTRL_MODE, 0, 1, 1);
+                       RDMA_WR_BITS(MCDI_CTRL_MODE, 1, 9, 1);
+                       RDMA_WR_BITS(MCDI_CTRL_MODE, 1, 16, 1);
+                       RDMA_WR_BITS(MCDI_CTRL_MODE, 0, 28, 1);
+                       RDMA_WR(MCDI_MOTINEN, 0);
+                       RDMA_WR(DI_MTN_CTRL1,
+                               (0xffffcfff & RDMA_RD(DI_MTN_CTRL1)));
+                       /* disable me(mc di) */
+               }
+               RDMA_WR(DNR_CTRL, 0);
+       }
+       RDMA_WR(DI_MTN_1_CTRL1, di_mtn_1_ctrl1);
+
+}
 #ifdef DEBUG_SUPPORT
 module_param_named(pre_mif_gate, pre_mif_gate, bool, 0644);
 module_param_named(pre_urgent, pre_urgent, ushort, 0644);
index 64301c3..5faa50b 100644 (file)
@@ -174,4 +174,5 @@ void pre_frame_reset(void);
 void di_interrupt_ctrl(unsigned char ma_en,
        unsigned char det3d_en, unsigned char nrds_en,
        unsigned char post_wr, unsigned char mc_en);
+void di_txl_patch_prog(int prog_flg, unsigned int cnt, bool mc_en);
 #endif