/* 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.
 *
 *****************************************************************************/


/*************************************************************************
 *
 * Filename:
 * ---------
 *   $Workfile: timer.h $
 *
 * Project:
 * --------
 *   MT8205
 *
 * Description:
 * ------------
 * Timer function header
 *
 * Author:
 * -------
 *
 *
 * Last changed:
 * -------------
 * $Author: weibo.li $
 *
 * $Modtime: 04/05/28 4:40p $
 *
 * $Revision: #7 $
*************************************************************************/
/* 20091227
David: due to lots of customer development projects still on 0801, pls note the following 6 define
1. #define CUS_SH_HOTEL_MODE 0//For P_COMP platform, this define must be 0!!!!!!!!!!!!!!
2. #define RC56_IR_DRIVER 1 //For P_COMP platform, this define must be 1!!!!!!!!!!!!!!
4. //#define MT5387_CEC  1 //4 & 5 exculsive
5. #define MT5365_CEC  1
*/
#ifndef _CUSTOM_DEF_H_
#define _CUSTOM_DEF_H_

#define CC_MT5891

//#define CC_MT8223
//fix LED pwm freqency / refine TV key wake up //add consolelock cmd 
//89 : add cmd support //90 : add 4K MHL pulldown mode support //91 : add quickly bring up white led after ir platform resume
//67:fix opwrsb control in 8032   
// 69&70: Set PWM out to 1/2500s or not output PWM
// 71: Only light LED in IR/BT/FrontPanelKey status   // 72: change nothing, add a cmd for debug
// 73: disable IR process when ARM working
//74:add the shutdown ECO mode
//75 add the suspend shut down mode
//76 add more wake up key
#define FW_VERSION 76
#define RC56_IR_DRIVER 0
#define CUST_P_DC_ON_SEQUENCE 0 // 1
#define CUST_P_SX_SUPPORT 0
#define UART_PD_RX_EN 0// 1
#define UP_ARM_TEST 0
#define IR_DEBOUNCE 0// 1
#define PDWNC_INT_POLLING 0
#define IR_MULTIKEY_WAKEUP 0

#define BUILD_IN_DEBUG_MSG 0
#define ETHERNET_TASK 1

#define S_HOTEL_MODE_COMMAND 1// 1// 1
#define CY8C20110_SUPPORT 0 // 1
#define STANDBY_AC_DETECTION 0
//#define HOTEL_MODE_DBG 0// 1
//#define SX_RS232_DBG 1
#define DEFAULT_DEBUG_LEVEL 0
#define HOTKEY_WAKEUP_SUPPORT 0

/***************************
*RW_REG_INTERFACE : by teraterm 
*UART_DBG : by Mtktool
***************************/
#define RW_REG_INTERFACE 0// 1 //for sif read and write test under standby(open it can r/w xdata under standby)
#define UART_DBG 0
#define SONY_IR_DBG 0

#define SUPPORT_ERROR_LED_CTRL  1
//david: always enable #define FW_UPGRATE_PWR_CTRL 0// 1
#define SUPORT_COLD_REBOOT 0// 1
#define SUPORT_DIGIT_KEY_WAKEUP 1 // 1

#define T8032_OCCUPIED_UART0_AT_NORMAL_POWER 0
#define CUS_S_MULTI_KEY_ECO 0 // 1

//david: always enable #define FW_UPGRATE_PWR_CTRL 0// 1
#define SIMPLE_LED_TOGGLE 0// 1
#define SIR_TASK 1 // 1
#define QUERY_IR_POWER_KEY_STATE_SUPPORT 1
#define DISABLE_WAKEUP_SOMETIME 0
#define POWERBOARD_GPIO_CTRL 1
#if DISABLE_WAKEUP_SOMETIME
	#define DISABLE_WAKEUP_CNT 35 // 200*20ms=4 seconds
#endif

#define CUS_SH_HOTEL_MODE 0//For P_COMP platform, this define must be 0!!!!!!!!!!!!!!
#define CUST_B_NEC_IR_DRIVER 0	//Add by Cust_B 20091215

#define SIF_DRV_SUPPORT 0// 1

#define T8032_PWM_SUPPORT 1
#define CUST_AUTO_IRRC_WAKEUP 0
#if CUST_AUTO_IRRC_WAKEUP
#define USE_LONG_TIME_TIMER
#endif

//#define POWERBOARD_GPIO_CTRL 0
#define RS232_CUSTOMER_TASK_SUPPORT 0//1
#if SIF_DRV_SUPPORT
    #define SIF_BUFFER_SIZE 0x50     
    #undef EEPROM_DRV_SUPPORT 
    #define EEPROM_DRV_SUPPORT 1
#else
#define EEPROM_DRV_SUPPORT 0
#endif

//#define VGA_WAKEUP_MANUAL_WAY

#ifndef VGA_WAKEUP_MANUAL_WAY
#ifdef CC_MT8290
#define VGA_WAKEUP_HW_WAY
#else
#ifdef CC_MT5881
#define VGA_WAKEUP_MANUAL_WAY
#endif
#endif
#endif

#define CONSOLELOCK_MODE

#if EEPROM_DRV_SUPPORT 
    #undef SIF_PDWNC_TEST
    #define SIF_PDWNC_TEST    1//for sif read and write test
    #define EEPROM_DEV_ADDR 0xA0
    #define EEPROM_SUB_ADDR_SIZE 2//24c02 only need one sub address (so call byte address), 24C128 needs 2 bytes for sub address...
    #define EEPROM_WP_GPIO_MASK (0x1 << 3) //opctrl3 for write protection pin
    #define EEPROM_WP_GPIO_POLARITY 1//HI : WP , LO: WRITE 
    #define EEPROM_CLK_DIV   0x100 //eeprom ==> 100Khz, 27M/0x100 =  100khz      
#else
#define SIF_PDWNC_TEST    0
#endif  

//#define SIF_ISR 0
#define UART_TASK 1	//Should always set it to 1, it is use for T8032 debug
#if UART_TASK
    #define MAX_UART_BUF_LEN 32
#endif    

#define IR_TASK 1// 1  //For P_COMP platform, this define must be 1!!!!!!!!!!!!!!
#define GPIO_INTERRUPT_ENABLE  0
#define T8032_GPIO_TEST 0	//just for test GPIO function

#if SIF_DRV_SUPPORT 
#define SIF_SCL_STRECH 0
#define SIF_ODRAIN 0
#endif

#define SIRC_IR 1
#define NEC_IR 2
#define RC56_IR 3
#define SHARP_IR 4

#define IR_PROTOCOL RC56_IR

#if (IR_PROTOCOL == SIRC_IR)
typedef UINT8 IR_DATA_TYPE;
#else
typedef UINT32 IR_DATA_TYPE;
#endif

/******* CEC *******************/
//#define MT5387_CEC  1
#define MT5365_CEC  1

#define CEC_FEATURE_1  	0
#define CEC_FEATURE_2  	1 // this is for sony spec in standby.
#define CEC_FEATURE_3 	0
#define CEC_FEATURE_4   0

/******* CEC Feature 1 *************/
#if CEC_FEATURE_1
#define ENABLE_CEC 1
#define DISABLE_CEC_WITHOUT_ACK 1  
#define STORE_ALL_MSG_AFTER_WAKEUP 0
#endif
/******* CEC Feature 2 *************/
#if CEC_FEATURE_2
#define ENABLE_CEC 1
#define DISABLE_CEC_WITHOUT_ACK 1  
#define STORE_ALL_MSG_AFTER_WAKEUP 0
#define PDWN_ANDROID_WW_CEC_SUPPORT 
#endif
/******* CEC Feature 3 *************/
#if CEC_FEATURE_3
#define ENABLE_CEC 1
#define DISABLE_CEC_WITHOUT_ACK 1  
#define STORE_ALL_MSG_AFTER_WAKEUP 0
//#define CEC_FEATURE_3_1 
#endif
/******* CEC_FEATURE_4 *************/
#if CEC_FEATURE_4
#define ENABLE_CEC 0
#define DISABLE_CEC_WITHOUT_ACK 0  
#define STORE_ALL_MSG_AFTER_WAKEUP 0
#endif

/******Cust_B Debug define**************/
#define Cust_B_Debug_UART 0// 1

#define ENABLE_CBUS 0
//#define CC_SONY_VBUS_CTRL
#define ENABLE_TIF_MHL_VBUS_CTRL 0

#define GPIO_OPWRSB (247)
#define GPIO_STBY_MHL (220)

#define GPIO_WIFIBT_RST (243)
#define GPIO_ETHER_EN (219)
#define GPIO_DDR_EN (217)
#endif 

