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 3f0afa5eb87ee21a0817f7700c95d4aeeac8c499..8720a12838bdaf8b6515ed2e957971fad8b12267 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 09033da2697a20c68bec9c4ea4bab06a05f549e3..935bec94d576403c2ead92f0ad1e7f45506fcdc4 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 64301c39eda1a35f81f4a74eb2fc48a594685173..5faa50bef0527dea99f7a5362cb830a16e3109dd 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