/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 *
 * $Author: brianpc.huang $
 * $Date: 2015/05/29 $
 * $RCSfile: hw_mjcfd.h $
 * $Revision: #1 $
 *
 *----------------------------------------------------------------------------*/

#ifndef _HW_MJCFD_H_
#define _HW_MJCFD_H_

#include "hw_vdoin.h"

#define IO_MDDI_BASE (IO_VIRT_SRE+ 0x42000)

#define MJCFD_00 (IO_MDDI_BASE + 0x760)
    #define MJCFD_C_FD_BD_AUTO Fld(1,31,AC_MSKB3)//[31:31]
    #define MJCFD_C_FD_STA_RST Fld(1,28,AC_MSKB3)//[28:28]
    #define MJCFD_C_FD_IGNORE_MOV Fld(1,27,AC_MSKB3)//[27:27]
    #define MJCFD_C_FD_IGNORE_VST Fld(1,26,AC_MSKB3)//[26:26]
    #define MJCFD_C_FD_IGNORE_SAW Fld(1,25,AC_MSKB3)//[25:25]
    #define MJCFD_C_FD_IGNORE_NRM Fld(1,24,AC_MSKB3)//[24:24]
    #define MJCFD_C_FD_SAW_BD_LR Fld(4,20,AC_MSKB2)//[23:20]
    #define MJCFD_C_FD_SAW_BD_UD Fld(4,16,AC_MSKB2)//[19:16]
    #define MJCFD_C_FD_3DFS_MODE Fld(1,2,AC_MSKB0)//[2:2]
    #define MJCFD_C_FD_SRC_SEL Fld(1,1,AC_MSKB0)//[1:1]
    #define MJCFD_C_FD_INFO_SEL Fld(1,0,AC_MSKB0)//[0:0]
#define MJCFD_01 (IO_MDDI_BASE + 0x764)
    #define MJCFD_C_FD_QUAN_TH4 Fld(8,24,AC_FULLB3)//[31:24]
    #define MJCFD_C_FD_QUAN_TH3 Fld(8,16,AC_FULLB2)//[23:16]
    #define MJCFD_C_FD_QUAN_TH2 Fld(8,8,AC_FULLB1)//[15:8]
    #define MJCFD_C_FD_QUAN_TH1 Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_02 (IO_MDDI_BASE + 0x768)
    #define MJCFD_C_FD_QUAN_VALUE2 Fld(8,24,AC_FULLB3)//[31:24]
    #define MJCFD_C_FD_QUAN_VALUE1 Fld(8,16,AC_FULLB2)//[23:16]
    #define MJCFD_C_FD_QUAN_TH5 Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_03 (IO_MDDI_BASE + 0x76C)
    #define MJCFD_C_FD_QUAN_VALUE6 Fld(8,24,AC_FULLB3)//[31:24]
    #define MJCFD_C_FD_QUAN_VALUE5 Fld(8,16,AC_FULLB2)//[23:16]
    #define MJCFD_C_FD_QUAN_VALUE4 Fld(8,8,AC_FULLB1)//[15:8]
    #define MJCFD_C_FD_QUAN_VALUE3 Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_04 (IO_MDDI_BASE + 0x770)
    #define MJCFD_C_FD_VST_FRM_THR Fld(8,24,AC_FULLB3)//[31:24]
    #define MJCFD_C_FD_VST_BLK_THR Fld(8,16,AC_FULLB2)//[23:16]
    #define MJCFD_C_FD_VST_PXL_THR Fld(4,12,AC_MSKB1)//[15:12]
    #define MJCFD_C_FD_VST_SFT_1 Fld(2,10,AC_MSKB1)//[11:10]
    #define MJCFD_C_FD_VST_SFT_0 Fld(2,8,AC_MSKB1)//[9:8]
    #define MJCFD_C_FD_NRM_FRM_THR Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_05 (IO_MDDI_BASE + 0x774)
    #define MJCFD_C_FD_SAW_FRM_THR Fld(8,24,AC_FULLB3)//[31:24]
    #define MJCFD_C_FD_SAW_BLK_THR Fld(8,16,AC_FULLB2)//[23:16]
    #define MJCFD_C_FD_SAW_SUM_TH2 Fld(8,8,AC_FULLB1)//[15:8]
    #define MJCFD_C_FD_SAW_SUM_TH1 Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_06 (IO_MDDI_BASE + 0x778)
    #define MJCFD_C_FD_NO_SUB Fld(1,31,AC_MSKB3)//[31:31]
    #define MJCFD_C_FD_DBG_SEL Fld(3,28,AC_MSKB3)//[30:28]
    #define MJCFD_C_FD_SEQ_FRM_THR Fld(4,24,AC_MSKB3)//[27:24]
    #define MJCFD_C_FD_SEQ_BAD_RST Fld(1,23,AC_MSKB2)//[23:23]
    #define MJCFD_C_FD_SEQ_DCR_LEN Fld(3,20,AC_MSKB2)//[22:20]
    #define MJCFD_C_FD_SEQ_LEN Fld(4,16,AC_MSKB2)//[19:16]
    #define MJCFD_C_FD_MOV_FRM_THR Fld(8,8,AC_FULLB1)//[15:8]
    #define MJCFD_C_FD_MOV_PXL_TH2 Fld(4,4,AC_MSKB0)//[7:4]
    #define MJCFD_C_FD_MOV_PXL_TH1 Fld(4,0,AC_MSKB0)//[3:0]
#define MJCFD_07 (IO_MDDI_BASE + 0x77C)
    #define MJCFD_C_FD_VST_BLK_SEL Fld(2,24,AC_MSKB3)//[25:24]
    #define MJCFD_C_FD_SAW_BLK_SEL Fld(2,20,AC_MSKB2)//[21:20]
    #define MJCFD_C_FD_MOV_FRM_SEL Fld(2,16,AC_MSKB2)//[17:16]
    #define MJCFD_C_FD_MOV_MAX_THR Fld(16,0,AC_FULLW10)//[15:0]
#define MJCFD_08 (IO_MDDI_BASE + 0x780)
    #define MJCFD_FD_ADD_DET Fld(1,31,AC_MSKB3)//[31:31]
    #define MJCFD_FD_CASE Fld(14,17,AC_MSKW32)//[30:17]
    #define MJCFD_FD_BAD_DET Fld(1,16,AC_MSKB2)//[16:16]
    #define MJCFD_FD_TRIG Fld(1,4,AC_MSKB0)//[4:4]
    #define MJCFD_FD_INFO Fld(3,0,AC_MSKB0)//[2:0]
#define MJCFD_09 (IO_MDDI_BASE + 0x784)
    #define MJCFD_FD_VST_SEQ Fld(16,16,AC_FULLW32)//[31:16]
    #define MJCFD_FD_SAW_SEQ Fld(16,0,AC_FULLW10)//[15:0]
#define MJCFD_0A (IO_MDDI_BASE + 0x788)
    #define MJCFD_FD_MOV_SEQ Fld(16,16,AC_FULLW32)//[31:16]
    #define MJCFD_FD_DIF_SEQ Fld(16,0,AC_FULLW10)//[15:0]
#define MJCFD_0B (IO_MDDI_BASE + 0x78C)
    #define MJCFD_STA_FD_DBG Fld(32,0,AC_FULLDW)//[31:0]
    #define MJCFD_FD_DET_FRM_INFO Fld(16,16,AC_FULLW32)//[31:16]
    #define MJCFD_FD_DET_BLK_INFO Fld(16,0,AC_FULLW10)//[15:0]
    #define MJCFD_FD_DET_MOV_INFO Fld(21,0,AC_MSKDW)//[21:0]
#define MJCFD_0D (IO_MDDI_BASE + 0x794)
    #define MJCFD_C_FD_RT_SKIP Fld(4,20,AC_MSKB2)//[23:20]
    #define MJCFD_C_FD_LF_SKIP Fld(4,16,AC_MSKB2)//[19:16]
    #define MJCFD_C_FD_DN_SKIP Fld(4,12,AC_MSKB1)//[15:12]
    #define MJCFD_C_FD_UP_SKIP Fld(4,8,AC_MSKB1)//[11:8]
    #define MJCFD_C_FD_Y_THRES Fld(8,0,AC_FULLB0)//[7:0]
#define MJCFD_ATPG (IO_MDDI_BASE + 0x798)
    #define MJCFD_FD_RESERVED Fld(30,2,AC_MSKDW)//[31:2]
    #define MJCFD_ATPG_CT Fld(1,1,AC_MSKB0)//[1:1]
    #define MJCFD_ATPG_OB Fld(1,0,AC_MSKB0)//[0:0]
#define MJCFD_BD_0 (IO_MDDI_BASE + 0x79C)
    #define MJCFD_C_FD_BD_DN Fld(12,16,AC_MSKW32)//[27:16]
    #define MJCFD_C_FD_BD_UP Fld(12,0,AC_MSKW10)//[11:0]
#define MJCFD_BD_1 (IO_MDDI_BASE + 0x7A0)
    #define MJCFD_C_FD_BD_RT Fld(12,16,AC_MSKW32)//[27:16]
    #define MJCFD_C_FD_BD_LF Fld(12,0,AC_MSKW10)//[11:0]
#define MJCFD_SEQ (IO_MDDI_BASE + 0x7A4)
    #define MJCFD_FD_DET_SEQ_R Fld(16,16,AC_FULLW32)//[31:16]
    #define MJCFD_FD_DET_SEQ_L Fld(16,0,AC_FULLW10)//[15:0]
#define MJCFD_HST (IO_MDDI_BASE + 0x7A8)
    #define MJCFD_STA_HST_FRM_SUM Fld(22,0,AC_MSKDW)//[21:0]
#define MJCFD_VST (IO_MDDI_BASE + 0x7AC)
    #define MJCFD_STA_VST_FRM_SUM Fld(22,0,AC_MSKDW)//[21:0]
#define MJCFD_MOV (IO_MDDI_BASE + 0x7B0)
    #define MJCFD_STA_MOV_FRM_SUM Fld(22,0,AC_MSKDW)//[21:0]


#endif // #ifndef _HW_MJCFD_H_

