/* 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: wenming.wu $
 * $Date: 2015/08/08 $
 * $RCSfile: drv_dvi.h,v $
 * $Revision: #1 $
 *
 *---------------------------------------------------------------------------*/
/**
 * @file dvi2com driver interface
 *
 * @author wenming_wu@mtk.com.tw
 */

#ifndef _DRV_DVI2COM_H_
#define _DRV_DVI2COM_H_

#include "typedef.h"
/**
 * @brief        Set CCIR input horizontal start
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        wStart---- CCIR input horizontal start
*/
extern void vCCIR2SetAvStart(UINT8 u1Type,UINT16 wStart);
/**
 * @brief        Set CCIR input HDE width
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        wWidth---- CCIR input HDE width
*/
extern void vCCIR2SetAvWidth(UINT8 u1Type,UINT16 wWidth);
/**
 * @brief        Set CCIR input vertical start
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        wStart---- CCIR input vertical start
*/
extern void vCCIR2SetVsStart(UINT8 u1Type,UINT16 wStart);
/**
 * @brief        Set CCIR input VDE width
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        wWidth---- CCIR input VDE width
*/
extern void vCCIR2SetVdeWidth(UINT8 u1Type,UINT16 wWidth);
/**
 * @brief        Enable/Disable CCIR 422 to 444 convert
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        fgIs422---- TRUE for enable 422 to 444 convert, FALSE for disable
*/
extern void vCCIR2Set422To444(UINT8 u1Type,BOOL fgIs422);
/**
 * @brief        Get current CCIR input horizontal start
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern UINT16 wCCIR2GetAvStart(UINT8 u1Type);
/**
 * @brief        Get current CCIR input HDE width
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       CCIR input HDE width
*/
extern UINT16 wCCIR2GetAvWidth(UINT8 u1Type);
/**
 * @brief        Get current CCIR input vertical start
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       CCIR input vertical start
*/
extern UINT16 wCCIR2GetVsStart(UINT8 u1Type);
/**
 * @brief        Get current CCIR input VDE width
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       CCIR input VDE width
*/
extern UINT16 wCCIR2GetVdeWidth(UINT8 u1Type);
/**
 * @brief        Get CCIR CEN status
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       1 for toggling, 0 for original CEN
*/
extern UINT8 bCCIR2CENStatus(UINT8 u1Type);
/**
 * @brief        Get CCIR 2:1 down sample status
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       1 for enable, 0 for disable
*/
extern UINT8 bCCIR2ClkStatus(UINT8 u1Type);
/**
 * @brief        Set CCIR CEN
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1CenSel---- 1 for toggling, 0 for original CEN
*/
extern void vCCIR2SetCENSel(UINT8 u1Type,UINT8 u1CenSel);
/**
 * @brief        Set CCIR 2:1 down sample
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1ClkDiv---- 1 for enable, 0 for disable
*/
extern void vCCIR2SetClkDiv(UINT8 u1Type,UINT8 u1ClkDiv);
/**
 * @brief        Check CCIR downsample enabled or disabled
                 If the CEN is set to 1(toggling) or Clk Div is set to 1(enable), then CCIR will do downsample
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @retval       TRUE for downsample enabled, FALSE for disabled
*/
extern BOOL bCCIR2IsDownSample(UINT8 u1Type);
/**
 * @brief        Set CCIR downsample
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1CenSel---- CEN select, 1 for toggling, 0 for original CEN
 * @param        u1ClkDiv---- Enable/Disable Clk div, 1 for enable, 0 for disable
*/
extern void vCCIR2SetDownSample(UINT8 u1Type, UINT8 u1CenSel, UINT8 u1ClkDiv);
/**
 * @brief        Set CCIR 3D V active
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u4Value---- V active value
*/
extern void vCCIR2Set3DVactive(UINT8 u1Type,UINT32 u4Value);
/**
 * @brief        Set CCIR 3D V active SP1 value
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u4Value---- 3D V active SP1 value
*/
extern void vCCIR2Set3DVactiveSP1(UINT8 u1Type,UINT32 u4Value);
/**
 * @brief        Set CCIR 3D V active SP2 value
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u4Value---- 3D V active SP2 value
*/
extern void vCCIR2Set3DVactiveSP2(UINT8 u1Type,UINT32 u4Value);
/**
 * @brief        Init CCIR settings
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2SetDither(UINT8 u1Type, BOOL bEn);
/**
 * @brief	     select ccir path.
 * @param	     u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2SelectCCIR(UINT8 u1Type, UINT8 u1Bypass);

/**
 * @brief        Select OMUX for CCIR
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2SelectOMUX(UINT8 u1Type);
/**
 * @brief        Init CCIR settings
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2DecoderInitial(UINT8 u1Type);
/**
 * @brief        Set OMUX pattern gen
 * @param        bPath---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        bMode---- Pattern gen mode
*/
extern void vOmuxPatternGenOnOff(UINT8 bPath, UINT8 bMode);
/**
 * @brief        Print CCIR status
 * @param        bchannel---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2GetStatus(UINT8 bchannel);
/**
 * @brief        Set CCIR setting for interlaced signal
 * @param        bchannel---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        fgInterlace---- TRUE for interlaced signal, FALSE for progressive signal
*/
extern void vCCIR2SetInterlace(UINT8 bchannel,BOOL fgInterlace);
/**
 * @brief        Set CCIR 3D config
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u13DType---- 3D type
*/
extern void vCCIR2Set3DConfig(UINT8 u1Type,UINT8 u13DType);
/**
 * @brief        Enable/Disable CCIR 422 extern bit
 * @param        fgEnable---- TRUE for enable, FALSE for disable
*/
extern void vCCIR2SetYC422ExtBit(BOOL fgEnable);
/**
 * @brief        Set CCIR counter to non-stop option
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1Value---- 1 for non-stop counter, 0 for original
*/
extern void vCCIR2SetVHSEnd(UINT8 u1Type,UINT8 u1Value);
/**
 * @brief        Select Dolby EDR path
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
*/
extern void vCCIR2SelDolbyEDRPath(UINT8 u1Type);

/**
 * @brief        vCCIR2SetMuteSel
 * @param        u1Type---- Video path number(SsinV_VP_MAIN/SV_VP_PIP)
 * @param        u1Sel---- 1 using hw muet, 0 disable hw mute
*/
extern void vCCIR2SetMuteSel(UINT8 u1Type, UINT8 u1Sel);
/**
 * @brief        vCCIR2SetFldDet
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1Onoff----1 enable film det, 0 disabel film det
*/
extern void vCCIR2SetFldDet(UINT8 u1Type, UINT8 u1Onoff);

/**
 * @brief        vsstart register setting include vfp or not
 * @param        u1Type---- Video path number(SV_VP_MAIN/SV_VP_PIP)
 * @param        u1Sel----1 vsync_width+vbp, 0 vfp+vsync_width+vbp
*/
extern void vCCIR2SetVsStartMode(UINT8 u1Type, UINT8 u1Sel);
#endif

