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


#ifndef CONFIG_DEFAULT_H
#define CONFIG_DEFAULT_H

#include "x_pinmux.h"

//----------------------------------------------------------------------------
// Initial dram settings
//----------------------------------------------------------------------------
#define DEFAULT_DRAM_TYPE                   DDR_LP4_x4
#define DEFAULT_DDR_CLOCK                   (3504000000)
//for MTK turnkey PCB only (in bootp.c)
//#define DEFAULT_DRAM_PCB_CHK                (0)

//#ifndef DRAM_PRIORITY_LIST
// Audio/0 > B2R/5 > NR/PSCAN/4 > Scpip/7 > OSD/3 > Mjc_in/13 > Mjc_out/14 > VLD1/9 > Vdec_mc/8 > CPU/6 > Gfx/11 > Demux/PVR/1 > VBI/3D/TVE/2 >VENC/12 > Test/15 > Unused/10
//#define DRAM_PRIORITY_LIST                  ((UINT8*)"0c9421a387fbd56e")
//#endif

#define RELEASE_ENABLE_WATCHDOG (0)
#ifdef ANDROID
    #if defined(CONFIG_64BIT) || defined(CC_64BIT_SUPPORT)
		#if defined(CC_SUPPORT_DRAM_4GB)
			#define TOTAL_MEM_SIZE					(0x100000000) //(4 * 1024 * 1024 * 1024)
		#elif defined(CC_SUPPORT_DRAM_3GB)
			#define TOTAL_MEM_SIZE					(0xC0000000) //(3 * 1024 * 1024 * 1024)
		#elif defined(CC_SUPPORT_DRAM_2GB)
			#define TOTAL_MEM_SIZE					(0x80000000) //(2 * 1024 * 1024 * 1024)
		#else
			#define TOTAL_MEM_SIZE					(0xA0000000) //(2.5 * 1024 * 1024 * 1024)
		#endif
    #else
		#define TOTAL_MEM_SIZE						(0x60000000) //(1536 * 1024 * 1024)
    #endif
#else
    #if defined(CONFIG_64BIT) || defined(CC_64BIT_SUPPORT)
	    #if defined(CC_SUPPORT_DRAM_4GB)
            #define TOTAL_MEM_SIZE                      (0x100000000) // 8888Gb
            //#define DEFAULT_CHANNEL_A_SIZE            (0x60000000)
		#elif defined(CC_SUPPORT_DRAM_3GB)
			#define TOTAL_MEM_SIZE                      (0xC0000000) // 8844Gb
			//#define DEFAULT_CHANNEL_A_SIZE              (3 * 1024 * 1024 * 1024)
		#elif defined(CC_SUPPORT_DRAM_2GB)
			#define TOTAL_MEM_SIZE                      (0x80000000)//(2 * 1024 * 1024 * 1024) // 4444Gb
			//#define DEFAULT_CHANNEL_A_SIZE              (2 * 1024 * 1024 * 1024)
		#else   //CC_SUPPORT_DRAM_2_5GB
			#define TOTAL_MEM_SIZE                      (0xA0000000)//(2.5 * 1024 * 1024 * 1024) // 8444Gb
			//#define DEFAULT_CHANNEL_A_SIZE              (2.5 * 1024 * 1024 * 1024)
		#endif
    #else
        #define TOTAL_MEM_SIZE                      (0x60000000) //(1536 * 1024 * 1024) // 8888Gb
    #endif
#endif

#define EMI_MEM_OFFSET 0x40000000   // 1GB offset


#ifdef CC_FORCE_DRAM1_25G
        //#define TOTAL_CHB_MEM_SIZE                      (512 * 1024 * 1024) /* size of Channel B bank */
#elif defined (CC_FORCE_DRAM1_75G)
        //#define TOTAL_CHB_MEM_SIZE                      (512 * 1024 * 1024) /* size of Channel B bank */
#else
        //#define TOTAL_CHB_MEM_SIZE                      (1024 * 1024 * 1024) /* size of Channel B bank */
#endif


//----------------------------------------------------------------------------
// DFB setup
//----------------------------------------------------------------------------
#if 1
#define CC_CONFIG_OSD_CM_SIZE               (4) // 4:argb 8888 ;2:argb 4444
#define CC_CONFIG_OSD_BUF_MODE              (2) // 2:double  buffer ;1:sngle buffer

#ifndef CC_CONFIG_OSD_PLANE1_MAX_W
#define CC_CONFIG_OSD_PLANE1_MAX_W          (0)
#endif
#ifndef CC_CONFIG_OSD_PLANE1_MAX_H
#define CC_CONFIG_OSD_PLANE1_MAX_H          (0)
#endif
#define CC_CONFIG_OSD_PLANE1_MEM_SIZE       (((CC_CONFIG_OSD_PLANE1_MAX_W*     \
                                        CC_CONFIG_OSD_PLANE1_MAX_H*        \
                                        CC_CONFIG_OSD_CM_SIZE*             \
                                        CC_CONFIG_OSD_BUF_MODE)+0x1000)&(0xFFFFF000))

        // osd 3d buffer size
#if (defined(CC_CONFIG_OSD_SBS_PLANE1)||defined(CC_CONFIG_OSD_TB_PLANE1))
#define CC_CONFIG_OSD_3D_PLANE1_MEM_SIZE    (CC_CONFIG_OSD_PLANE1_MEM_SIZE)
#else
#define CC_CONFIG_OSD_3D_PLANE1_MEM_SIZE    (0)
#endif

        // osd decompress  buffer size
#ifdef CONFIG_OSD_PLANE1_COMPRESSION
#define CC_CONFIG_OSD_DEC_PLANE1_MEM_SIZE   (CC_CONFIG_OSD_PLANE1_MEM_SIZE)
#else
#define CC_CONFIG_OSD_DEC_PLANE1_MEM_SIZE   (0)
#endif

#ifndef CC_CONFIG_OSD_PLANE2_MAX_W
#define CC_CONFIG_OSD_PLANE2_MAX_W          (960)
#endif
#ifndef CC_CONFIG_OSD_PLANE2_MAX_H
#define CC_CONFIG_OSD_PLANE2_MAX_H          (540)
#endif
#define CC_CONFIG_OSD_PLANE2_MEM_SIZE       (((CC_CONFIG_OSD_PLANE2_MAX_W*     \
                                            CC_CONFIG_OSD_PLANE2_MAX_H*        \
                                            CC_CONFIG_OSD_CM_SIZE*             \
                                            CC_CONFIG_OSD_BUF_MODE)+0x1000)&(0xFFFFF000))

#if (defined(CC_CONFIG_OSD_SBS_PLANE2)||defined(CC_CONFIG_OSD_TB_PLANE2))
#define CC_CONFIG_OSD_3D_PLANE2_MEM_SIZE    (CC_CONFIG_OSD_PLANE2_MEM_SIZE)
#else
#define CC_CONFIG_OSD_3D_PLANE2_MEM_SIZE    (0)
#endif

#ifndef CONFIG_OSD_PLANE2_COMPRESSION
        //#define  CONFIG_OSD_PLANE2_COMPRESSION
#endif

        // osd decompress  buffer size
#ifdef CONFIG_OSD_PLANE2_COMPRESSION
#define CC_CONFIG_OSD_DEC_PLANE2_MEM_SIZE   (CC_CONFIG_OSD_PLANE2_MEM_SIZE)
#else
#define CC_CONFIG_OSD_DEC_PLANE2_MEM_SIZE   (0)
#endif

#ifndef CC_CONFIG_OSD_PLANE3_MAX_W
#ifdef CC_C4TV_SUPPORT
#define CC_CONFIG_OSD_PLANE3_MAX_W          (1920)
#else
#define CC_CONFIG_OSD_PLANE3_MAX_W          (1920)
#endif
#endif
#ifndef CC_CONFIG_OSD_PLANE3_MAX_H
#ifdef CC_C4TV_SUPPORT
#define CC_CONFIG_OSD_PLANE3_MAX_H          (1080)
#else
#define CC_CONFIG_OSD_PLANE3_MAX_H          (1080)
#endif
#endif
#define CC_CONFIG_OSD_PLANE3_MEM_SIZE       (((CC_CONFIG_OSD_PLANE3_MAX_W*     \
                                            CC_CONFIG_OSD_PLANE3_MAX_H*        \
                                            CC_CONFIG_OSD_CM_SIZE*             \
                                            CC_CONFIG_OSD_BUF_MODE)+0x1000)&(0xFFFFF000))

#if (defined(CC_CONFIG_OSD_SBS_PLANE3)||defined(CC_CONFIG_OSD_TB_PLANE3))
#define CC_CONFIG_OSD_3D_PLANE3_MEM_SIZE    (CC_CONFIG_OSD_PLANE3_MEM_SIZE)
#else
#define CC_CONFIG_OSD_3D_PLANE3_MEM_SIZE    (0)
#endif

        // osd decompress  buffer size
#ifndef CONFIG_OSD_PLANE3_COMPRESSION
        // #define  CONFIG_OSD_PLANE3_COMPRESSION
#endif

#ifdef CONFIG_OSD_PLANE3_COMPRESSION
#define CC_CONFIG_OSD_DEC_PLANE3_MEM_SIZE   (CC_CONFIG_OSD_PLANE3_MEM_SIZE)
#else
#define CC_CONFIG_OSD_DEC_PLANE3_MEM_SIZE   (0)
#endif

#ifndef CC_CONFIG_OSD_PLANE4_MAX_W
#define CC_CONFIG_OSD_PLANE4_MAX_W          (0)
#endif
#ifndef CC_CONFIG_OSD_PLANE4_MAX_H
#define CC_CONFIG_OSD_PLANE4_MAX_H          (0)
#endif
#define CC_CONFIG_OSD_PLANE4_MEM_SIZE       (((CC_CONFIG_OSD_PLANE4_MAX_W*     \
                                            CC_CONFIG_OSD_PLANE4_MAX_H*        \
                                            CC_CONFIG_OSD_CM_SIZE*             \
                                            CC_CONFIG_OSD_BUF_MODE)+0x1000)&(0xFFFFF000))

#if (defined(CC_CONFIG_OSD_SBS_PLANE4)||defined(CC_CONFIG_OSD_TB_PLANE4))
#define CC_CONFIG_OSD_3D_PLANE4_MEM_SIZE    (CC_CONFIG_OSD_PLANE4_MEM_SIZE)
#else
#define CC_CONFIG_OSD_3D_PLANE4_MEM_SIZE    (0)
#endif

        // osd decompress  buffer size
#ifdef CONFIG_OSD_PLANE4_COMPRESSION
#define CC_CONFIG_OSD_DEC_PLANE4_MEM_SIZE   (CC_CONFIG_OSD_PLANE4_MEM_SIZE)
#else
#define CC_CONFIG_OSD_DEC_PLANE4_MEM_SIZE   (0)
#endif

#ifndef CC_CONFIG_OSD_PLANE5_MAX_W
#define CC_CONFIG_OSD_PLANE5_MAX_W          (100)
#endif
#ifndef CC_CONFIG_OSD_PLANE5_MAX_H
#define CC_CONFIG_OSD_PLANE5_MAX_H          (100)
#endif

#define CC_CONFIG_OSD_PLANE5_MEM_SIZE       (((CC_CONFIG_OSD_PLANE5_MAX_W*     \
                                    CC_CONFIG_OSD_PLANE5_MAX_H*        \
                                    CC_CONFIG_OSD_CM_SIZE)+0x1000)&(0xFFFFF000))

        // osd 3d buffer size
#if (defined(CC_CONFIG_OSD_SBS_PLANE5)||defined(CC_CONFIG_OSD_TB_PLANE5))
#define CC_CONFIG_OSD_3D_PLANE5_MEM_SIZE    (CC_CONFIG_OSD_PLANE5_MEM_SIZE)
#else
#define CC_CONFIG_OSD_3D_PLANE5_MEM_SIZE    (0)
#endif

        // osd decompress  buffer size
#ifdef CONFIG_OSD_PLANE5_COMPRESSION
#define CC_CONFIG_OSD_DEC_PLANE5_MEM_SIZE   (CC_CONFIG_OSD_PLANE5_MEM_SIZE)
#else
#define CC_CONFIG_OSD_DEC_PLANE5_MEM_SIZE   (0)
#endif

#define CC_CONFIG_OSD_PLANE_BASIC_MEM_SIZE  (CC_CONFIG_OSD_PLANE1_MEM_SIZE+ \
                                        CC_CONFIG_OSD_PLANE2_MEM_SIZE+  \
                                        CC_CONFIG_OSD_PLANE3_MEM_SIZE+  \
                                        CC_CONFIG_OSD_PLANE4_MEM_SIZE+  \
                                        CC_CONFIG_OSD_PLANE5_MEM_SIZE)

#define CC_CONFIG_OSD_3D_PLANE_MEM_SIZE     (CC_CONFIG_OSD_3D_PLANE1_MEM_SIZE+  \
                                            CC_CONFIG_OSD_3D_PLANE2_MEM_SIZE+   \
                                            CC_CONFIG_OSD_3D_PLANE3_MEM_SIZE+   \
                                            CC_CONFIG_OSD_3D_PLANE4_MEM_SIZE+   \
                                            CC_CONFIG_OSD_3D_PLANE5_MEM_SIZE)

#define CC_CONFIG_OSD_DEC_PLANE_MEM_SIZE    (CC_CONFIG_OSD_DEC_PLANE1_MEM_SIZE+ \
                                            CC_CONFIG_OSD_DEC_PLANE2_MEM_SIZE+  \
                                            CC_CONFIG_OSD_DEC_PLANE3_MEM_SIZE+  \
                                            CC_CONFIG_OSD_DEC_PLANE4_MEM_SIZE+  \
                                            CC_CONFIG_OSD_DEC_PLANE5_MEM_SIZE)

#define CC_CONFIG_GFX_TEMP_MEM_SIZE         (CC_CONFIG_OSD_PLANE3_MAX_W*    \
                                            CC_CONFIG_OSD_PLANE3_MAX_H*     \
                                            CC_CONFIG_OSD_CM_SIZE)

#ifdef CC_LINUX_GPU_SUPPORT_DFB
#define LINUX_GPU_BUFFER_SIZE            (8 * 1024 * 1024)
#else
#define LINUX_GPU_BUFFER_SIZE            (0 * 1024 * 1024)
#endif

#define DFB_SUM_MEM_SIZE                  (CC_CONFIG_OSD_PLANE_BASIC_MEM_SIZE+\
                                            CC_CONFIG_OSD_3D_PLANE_MEM_SIZE+    \
                                            CC_CONFIG_OSD_DEC_PLANE_MEM_SIZE+   \
                                            CC_CONFIG_GFX_TEMP_MEM_SIZE+        \
                                            LINUX_GPU_BUFFER_SIZE)


#endif

#ifdef CC_GFX_MMU
    #if defined(CC_LINUX_GPU_SUPPORT) && defined(CC_LINUX_GPU_SUPPORT_DFB)
      #if defined(CC_FBM_DFB_IN_CHANNELC)
        #define DIRECT_FB_MEM_SIZE                  0
        #define FBM_MTDFB_SIZE 						((DFB_SUM_MEM_SIZE+4*1024 + 32*1024*1024)&(0xFFFFF000))
      #else
        #define DIRECT_FB_MEM_SIZE                  ((DFB_SUM_MEM_SIZE+4*1024 + 32*1024*1024)&(0xFFFFF000))    /*openGL Base on DFB window need use DFB pool memory*/
      #endif
    #else
      #if defined(CC_FBM_DFB_IN_CHANNELC)
        #define DIRECT_FB_MEM_SIZE                  0
        #define FBM_MTDFB_SIZE 						((DFB_SUM_MEM_SIZE + 4*1024)&(0xFFFFF000))
      #else
        #define DIRECT_FB_MEM_SIZE                  ((DFB_SUM_MEM_SIZE + 4*1024)&(0xFFFFF000))
      #endif
    #endif
#else
    #if defined(CC_FBM_DFB_IN_CHANNELC)
    	#define DIRECT_FB_MEM_SIZE                  0
    	#define FBM_MTDFB_SIZE 						(76 * 1024 * 1024)
    #else
    	#define DIRECT_FB_MEM_SIZE                  (76 * 1024 * 1024)
    #endif
#endif

//----------------------------------------------------------------------------
// FB setup
//----------------------------------------------------------------------------
#ifdef ANDROID
    #ifdef OSD_RESOLUTION_1080p
		#if defined(CC_FBM_FB_IN_CHANNELB)
	        #define FB_MEM_SIZE                         (0)
			#define FBM_MTFB_SIZE                       (48 * 1024 * 1024)
		#else
        	#define FB_MEM_SIZE                         (48 * 1024 * 1024)
		#endif
    #else
		#if defined(CC_FBM_FB_IN_CHANNELB)
	        #define FB_MEM_SIZE                         (0)
			#define FBM_MTFB_SIZE                       (24 * 1024 * 1024)
		#else
        	#define FB_MEM_SIZE                         (24 * 1024 * 1024)
		#endif
    #endif
#else
   #if defined(CC_LINUX_GPU_SUPPORT) && !defined(CC_LINUX_GPU_SUPPORT_DFB)
	    #ifdef CC_C4TV_SUPPORT
		    #ifndef CC_SUPPORT_CAST_1080P
				#if defined(CC_FBM_FB_IN_CHANNELB)
			        #define FB_MEM_SIZE                         (0)
					#define FBM_MTFB_SIZE                       (16 * 1024 * 1024)
				#else
				    #define FB_MEM_SIZE                         (16 * 1024 * 1024)
				#endif
		    #else
				#if defined(CC_FBM_FB_IN_CHANNELB)
			        #define FB_MEM_SIZE                         (0)
					#define FBM_MTFB_SIZE                       (24 * 1024 * 1024)
				#else
			    	#define FB_MEM_SIZE                         (24 * 1024 * 1024)
				#endif
		    #endif
	    #else
			#if defined(CC_FBM_FB_IN_CHANNELB)
		        #define FB_MEM_SIZE                         (0)
				#define FBM_MTFB_SIZE                       (20 * 1024 * 1024)
			#else
		    	#define FB_MEM_SIZE                         (20 * 1024 * 1024)
			#endif
	    #endif
	#else
		#if defined(CC_FBM_FB_IN_CHANNELB)
	        #define FB_MEM_SIZE                         (0)
		    #define FBM_MTFB_SIZE                       (40*1024*1024)
		#else
		    #define FB_MEM_SIZE                         (40*1024*1024)
		#endif
	#endif
#endif

//----------------------------------------------------------------------------
// FBM setup
//----------------------------------------------------------------------------
#ifndef FBM_MEM_CFG_SIZE
#ifdef  CC_FBM_CONFIG_WITH_3DTV_4K_SUPPORT
#define FBM_MEM_CFG_SIZE                        	(FBM_MEM_CFG_MT5895_3DTV)
#else
#define FBM_MEM_CFG_SIZE                            (FBM_MEM_CFG_MT5895_3DTV)
#endif
#endif /* FBM_MEM_CFG_SIZE */

//----------------------------------------------------------------------------
// Trustzone setup
//----------------------------------------------------------------------------
#if defined(CC_SVP_SUPPORT) && defined(CC_SUPPORT_4K2K)
    #define VFIFO_MAIN   (35*1024*1024 + 35*1024*1024) // 4k(35M) + 4k(35M)
    #define VFIFO_SUB    0
    #define VFIFO_TOTAL VFIFO_SUB + VFIFO_MAIN
#else
    #define VFIFO_MAIN   (10*1024*1024)
    #define VFIFO_SUB    0
    #define VFIFO_TOTAL  VFIFO_SUB + VFIFO_MAIN
#endif

#if defined(CC_TRUSTZONE_64_SUPPORT)
#define TRUSTZONE_CODE_BASE                 (0x10000)
#define TRUSTZONE_CODE_BASE_BL32            (0x5000)
#define TRUSTZONE_MEM_SIZE                  ((20 * 1024 * 1024) + VFIFO_TOTAL)
#define TRUSTZONE_MEM_SIZE_BL32             (TRUSTZONE_MEM_SIZE-0x30000)

#elif defined(CC_TRUSTZONE_SUPPORT)
#define TRUSTZONE_CODE_BASE                 (0x5000)
#define TRUSTZONE_MEM_SIZE                  (20 * 1024 * 1024) + VFIFO_TOTAL

#else
#define TRUSTZONE_MEM_SIZE                  (0)
#endif

#if defined(CC_TRUSTZONE_IN_CHB)
#define TRUSTZONE_MEM_SIZE_CHA (0)
#else
#define TRUSTZONE_MEM_SIZE_CHA TRUSTZONE_MEM_SIZE
#endif

//----------------------------------------------------------------------------
// Kernel mem setup
//----------------------------------------------------------------------------

#ifdef CC_SUPPORT_MULTI_DRAM_COMBINATION
    #define DEFAULT_LINUX_KERNEL_MEM_SIZE       ((TOTAL_MEM_SIZE > (FBM_MEM_CFG_SIZE + DIRECT_FB_MEM_SIZE + FB_MEM_SIZE + TRUSTZONE_MEM_SIZE_CHA)) ?\
                                                (TOTAL_MEM_SIZE - FBM_MEM_CFG_SIZE - DIRECT_FB_MEM_SIZE - FB_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA) : (54 * 1024 * 1024))
#else
    #define LINUX_KERNEL_MEM_SIZE               ((TOTAL_MEM_SIZE > (FBM_MEM_CFG_SIZE + DIRECT_FB_MEM_SIZE + FB_MEM_SIZE + TRUSTZONE_MEM_SIZE_CHA)) ?\
                                            (TOTAL_MEM_SIZE - FBM_MEM_CFG_SIZE - DIRECT_FB_MEM_SIZE - FB_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA) : (54 * 1024 * 1024))
#endif

#define DEFAULT_TARGET_COUNTRY              (COUNTRY_EU)

//----------------------------------------------------------------------------
// Default Panel setting
//----------------------------------------------------------------------------
#ifndef DEFAULT_PANEL_SELECT
#define DEFAULT_PANEL_SELECT                (PANEL_DEFAULT)
#endif
#define BACKLIGHT_GPIO                      (OPCTRL(4))
#define BACKLIGHT_ON_VAL                    (0)
#define PANELPOWER_GPIO                     (OPCTRL(9))
#define PANELPOWER_ON_VAL                   (1)

// disable spread spectrum for vga output
#define SPREAD_SPECTRUM_PERMILLAGE          (0)

// pwm backlight adjustment setting
#define PANEL_BACKLIGHT_PWM_PORT            (1)

// 3D Enable & LR GPIO
//#define EXT_3D_ENABLE_PORT                  (GPIO(54))
//#define EXT_3D_LR_PIN                       (PIN_GPIO53)
//#define EXT_3D_LR_PIN_FUNC                  (1)

// VB1 lockn & htpdn [Phoenix]
#define PANEL_VB1_LOCKN_PIN          (PIN_GPIO50)
#define PANEL_VB1_LOCKN_PIN_FUNC     (2)
#define PANEL_VB1_HTPDN_PIN          (PIN_GPIO49)
#define PANEL_VB1_HTPDN_PIN_FUNC     (2)
#define PANEL_VB1_OSD_LOCKN_PIN      (PIN_GPIO54)
#define PANEL_VB1_OSD_LOCKN_PIN_FUNC (2)
#define PANEL_VB1_OSD_HTPDN_PIN      (PIN_GPIO53)
#define PANEL_VB1_OSD_HTPDN_PIN_FUNC (5)

#define PDWNC_POLARITY                      (0)

//----------------------------------------------------------------------------
// Loader logo
//----------------------------------------------------------------------------
#ifdef CC_LOADER_LOGO_SUPPORT
#ifdef CC_DUALLOADER_SUPPORT
#define LOADER_LOGO_NUMBER                  (2)
#define LOADER_LOGO_H_FILE                  "mediatek/MediaTek_600x100x5_recv.h"
#else
#define LOADER_LOGO_NUMBER                  (1)
#define LOADER_LOGO_H_FILE                  "mediatek/MediaTek_600x100x5.h"
#endif
#endif

//----------------------------------------------------------------------------
// Audio Customization
//----------------------------------------------------------------------------
#define AUDIO_INCLUDE_FILE                  "mediatek/Husky_aud.h"
#define AUDIO_Mute_Gpio_Num                 (OPCTRL(11))
#define AUDIO_Amp_Gpio_Num                  (OPCTRL(5))
#define AUDIO_HP_PLUG_IN_GPIO               (OPCTRL(6))
#define AUDIO_MUTE_GPIO_POLARITY            AUD_MUTE_GPIO_LOW_ENALBE
#define AUDIO_AMP_GPIO_POLARITY             AUD_AMP_GPIO_LOW_ENALBE
#ifdef CC_SORTING_SUPPORT
#define AUDIO_HP_PLUG_IN_POLARITY           (AUD_GPIO_HIGH_ENALBE)
#else
#define AUDIO_HP_PLUG_IN_POLARITY           (AUD_GPIO_LOW_ENALBE)
#endif
#define AUDIO_INPUT_MUX_SEL_TABLE           (&_rMustangAudInputMuxTable)
#define AUDIO_APROC_ENABLE                  (TRUE)

//----------------------------------------------------------------------------
// Other GPIO customization
//#define DEFAULT_TUNER_RFAGC_SWITCH_GPIO     (88)//d120203_Haibo:OPWM2 is for RFAGC switch
//----------------------------------------------------------------------------
#define FLAG_EXT_STATUS                     (0)

#if defined (CC_TUNER_DB10) || defined (CC_DUAL_TUNER_SUPPORT)
#define DEFAULT_DEMOD_RESET_GPIO            (GPIO(85)) // ???????????????)	 #define DEFAULT_DEMOD_I2C_BUS_ID				 6
#define DEFAULT_TUNER_I2C_BUS_ID  3
#define DEFAULT_DEMOD_I2C_BUS_ID  3

#else
#define DEFAULT_DEMOD_RESET_GPIO            (GPIO(85)) // ???????????????)	 #define DEFAULT_DEMOD_I2C_BUS_ID				 6
#define DEFAULT_TUNER_I2C_BUS_ID  3
#define DEFAULT_DEMOD_I2C_BUS_ID  3
#endif

//----------------------------------------------------------------------------
// EEPROM customization
//----------------------------------------------------------------------------
#if (defined(REPLACE_EEPROM_WITH_EMMC)||defined(REPLACE_EEPROM_WITH_FLASH))
#define SYSTEM_EEPROM_SIZE                  (307200)
#else
#define SYSTEM_EEPROM_SIZE                  (8*1024)
#endif
#define SYSTEM_EEPROM_WP_GPIO               (OPCTRL(7)) // OPCTRL9.
#define SYSTEM_EEPROM_WP_ENABLE_POLARITY    (1)
#ifdef CC_HOTKEY_WAKEUP_SUPPORT
#define SUPPORT_HOTKEY_WAKEUP               (1)
#endif


//----------------------------------------------------------------------------
// European CI (Common Interface) customization
//----------------------------------------------------------------------------
//#define CI_EXTERNAL_IC_INT_GPIO             (GPIO(84))  // Set:Interrupt Mode, UnSet:Polling Mode
#define CI_5V_OC_GPIO                       (GPIO(46))  // GPIO42
#define CI_5V_POWERON_GPIO                  (GPIO(44))
#define CI_5V_POWERON_POLARITY              (1)
#define CI_5V_OC_POLARITY                   (0)
#define CI_EXTERNAL_IC_DRIVING_CURRENT      (2)         // 2mA
#define CI_SYSTEM_CLOCK                     (72)        // 72 MHz
#define CI_TS_CLOCK                         (108)       // 108 MHz
#define CI_SPI_CLOCK                        (27)        // 72 MHz

//----------------------------------------------------------------------------
// USB Customization
//----------------------------------------------------------------------------
// "USBx_PORT_USING_LOADER & USBx_PORT_USING" related define is only for USB2.0 port
// 1. Loader, USB port using define (1)=used (0)=not used
#define USB0_PORT_USING_LOADER              (1)
#define USB1_PORT_USING_LOADER              (1)
#define USB2_PORT_USING_LOADER              (0)
#define USB3_PORT_USING_LOADER              (0)

// 2. Nuclues/Linux/Android System USB port using define (1)=used (0)=not used
#define USB0_PORT_USING                     (1)
#define USB1_PORT_USING                     (1)
#define USB2_PORT_USING                     (0)
#define USB3_PORT_USING                     (0)

// 3. USB +5V power switch Vbus GPIO control, if vbus not control by GPIO, mark off it.
#define USB0_VBUS_GPIO                      GPIO(42)    // GPIO42.
#define USB0_VBUS_GPIO_POLARITY             (1)
#define USB1_VBUS_GPIO                      GPIO(43)    // GPIO43
#define USB1_VBUS_GPIO_POLARITY             (1)
#define USB2_VBUS_GPIO                      GPIO(48)    // GPIO48
#define USB2_VBUS_GPIO_POLARITY             (1)
#define USB3_VBUS_GPIO                      OPCTRL(10)  // OPCTRL10.
#define USB3_VBUS_GPIO_POLARITY             (1)

// 4. USB power switch overcurrent GPIO control, if have not ic to control by GPIO, mark off it.
#define USB0_OC_GPIO                        ADIN(4)     // ADIN 4.
#define USB0_OC_GPIO_POLARITY                (0)
#define USB1_OC_GPIO                        ADIN(4)     // ADIN 4.
#define USB1_OC_GPIO_POLARITY                (0)
#define USB2_OC_GPIO                        ADIN(5)     // ADIN 5.
#define USB2_OC_GPIO_POLARITY                (0)
#define USB3_OC_GPIO                        ADIN(5)     // ADIN 5.
#define USB3_OC_GPIO_POLARITY                (0)

// 5. Detect USB upgrade time, default is 0, but some device maybe can't detect when upgrade.
// If possible, set it to (300)ms when in customer's module.
#define USB_LOADER_WAIT_TIME                (0)
#define SDCARD_UPGRADE_SUPPORT_FLAG         (1)
//#define USB_DISABLE_SUSPEND_MODE /* Disable USB suspend, share 240 Mhz with H.264.*/

// 6.delay resume support
#define USB0_DELAY_RESUME_USING             (1)
#define USB1_DELAY_RESUME_USING             (1)
#define USB2_DELAY_RESUME_USING             (1)
#define USB3_DELAY_RESUME_USING             (0)

//----------------------------------------------------------------------------
// sdcard gpio define
//----------------------------------------------------------------------------
#define MSDC_DETECT_GPIO                    GPIO(262)
#define MSDC_VOLTAGE_GPIO                   GPIO(176)
//----------------------------------------------------------------------------
// Button Customization
//----------------------------------------------------------------------------
#define FLAG_BUTTON_SUPPORT                 (0)

#ifndef T8032UP_INCLUDE_FILE
#define T8032UP_INCLUDE_FILE                "mediatek/mtk_t8032fw.h"
#define T8032UP_OFFSET                      au1T8032FW
#define T8032UP_SIZE                        T8032FW_SIZE
#endif

//----------------------------------------------------------------------------
// MTK IR only setting
//----------------------------------------------------------------------------
#define IR_INCLUDE_FILE                     "mediatek/mtk_ir.h"

#ifndef NPTV_SOURCE_TABLE
#define NPTV_SOURCE_TABLE                   "mediatek/source_table.c"
#endif

//----------------------------------------------------------------------------
// default HDMI GPIO control
//----------------------------------------------------------------------------
#ifndef HDMI_GPIO_CONF
#define HDMI_GPIO_CONF                      "mediatek/hdmi_conf.c"
#endif

/*
 * default VGA table
*/
#ifndef VGA_INCLUDE_FILE
#define VGA_INCLUDE_FILE                    "mediatek/mtk_vga.h"
#endif

//----------------------------------------------------------------------------
// Tcon Customization
//----------------------------------------------------------------------------
// support LVDS and MLVDS both
#define PANEL_DISPLAY_TYPE_ALLOWED_MASK     ((1<<PANEL_DISPLAY_TYPE_LVDS) | (1 << PANEL_DISPLAY_TYPE_MLVDS)| (1 << PANEL_DISPLAY_TYPE_EPI) | (1 << PANEL_DISPLAY_TYPE_VB1))

#ifndef TCON_CUST_FILE
#define TCON_CUST_FILE                      "mediatek/Husky_tcon_cust.c"
#endif
#define SUPPORT_LOCK_FROM_SRVAD

//----------------------------------------------------------------------------
// SCART out configuration
//----------------------------------------------------------------------------
#ifndef TVE_INCLUDE_FILE
#define TVE_INCLUDE_FILE                    "mediatek/mtk_tve.c"
#endif

//----------------------------------------------------------------------------
// DMX configuration
//----------------------------------------------------------------------------
#ifndef DMX_INCLUDE_FILE
#define DMX_INCLUDE_FILE                    "mediatek/mtk_dmx.h"
#endif

//----------------------------------------------------------------------------
// Loader configuration
//----------------------------------------------------------------------------
#if defined (CC_USE_2TB_EMMC)
    #define MAX_UPGRADE_IMAGE_FILE_SIZE         ((UINT64)8*1024*1024*1024) /* 8G */
#elif defined (CC_USE_256MB_NAND)
#define MAX_UPGRADE_IMAGE_FILE_SIZE         (256*1024*1024)     /* 256 MB */
#else
#define MAX_UPGRADE_IMAGE_FILE_SIZE         (512*1024*1024)     /* 512 MB */
#endif

#if defined(LINUX_TURNKEY_SOLUTION) || defined(__KERNEL__)
//----------------------------------------------------------------------------
// Flash Partition configuration
//----------------------------------------------------------------------------
#if defined (CC_USE_2TB_EMMC)
    #define NAND_FLASH_TOTAL_SIZE       ((UINT64)8*1024*1024*1024) /* 8G */
#elif defined (CC_USE_256MB_NAND)
        #define NAND_FLASH_TOTAL_SIZE       (256*1024*1024)
#else
	#ifdef CC_C4TV_SUPPORT
	#define NAND_FLASH_TOTAL_SIZE               ((UINT64)1*1024*1024*1024) /* 1G */
	#else
    #define NAND_FLASH_TOTAL_SIZE               (512*1024*1024)     /* 512 MB */
	#endif
#endif

#ifdef CC_C4TV_SUPPORT
    #define PART_RESERV_SIZE                (256*1024)
    #define PART_SDM_BAD_SECTOR_SIZE        (5*1024*1024)

    #ifdef CC_FAST_INIT
        #define FAST_INIT_SUSP_SIZE         (60*1024*1024)
    #else
        #define FAST_INIT_SUSP_SIZE         (PART_RESERV_SIZE)
    #endif

    #define PART_LOADER_SIZE                (2*1024*1024)
    #define PART_UBOOT_ENV_SIZE             (1*1024*1024)
#ifdef LARGER_KERNEL
    #define PART_KERNEL_SIZE                (6*1024*1024)
#else
    #define PART_KERNEL_SIZE                (5*1024*1024)
#endif

    #ifdef CC_DISABLE_BASIC_PART
        #define PART_ROOTFS_SIZE            ((UINT32)100*1024*1024)
        #define PART_BASIC_SIZE             (PART_RESERV_SIZE)
    #else
        #ifndef CC_MSDC_ENABLE
            #define PART_ROOTFS_SIZE        (15*1024*1024)
        #else
            #define PART_ROOTFS_SIZE        (20*1024*1024)
        #endif
            #define PART_BASIC_SIZE         (80*1024*1024)
    #endif

    #define PART_SYSTEM_SIZE                (128*1024*1024)
    #define PART_CHROME_SIZE                (128*1024*1024)
	#define PART_DATA_SIZE                  (150*1024*1024) /* 150MB */
	#define PART_UPGRADE_SIZE				(235*1024*1024) /* 235MB */
    #define PART_PERM_SIZE                  (8*1024*1024)
    #define PART_CHANNEL_SIZE               (256*1024)
    #define PART_PQ_SIZE                    (256*1024)
    #define PART_AQ_SIZE                    (256*1024)

    #ifdef CI_PLUS_SUPPORT
        #define PART_CI_SIZE                (256*1024)
    #else
        #define PART_CI_SIZE                (PART_RESERV_SIZE)
    #endif

    #ifdef DEFAULT_DB_SUPPORT
        #define PART_DEFAULT_DB_SIZE        (256*1024)
    #else
        #define PART_DEFAULT_DB_SIZE        (PART_RESERV_SIZE)
    #endif

    #ifdef CAPTURE_LOGO_SUPPORT
        #define PART_CAPTURE_LOGO_SIZE      (1*1024*1024)
    #else
        #define PART_CAPTURE_LOGO_SIZE      (PART_RESERV_SIZE)
    #endif

    #define PART_ACFG_DESC_SIZE             (1*1024*1024) /* Acfg description size 1M */
    #define PART_SCHED_PVR_SIZE             (256*1024) /* Schedule PVR size 256K */

    #ifdef ADSP_BIN_SUPPORT
         #ifdef CC_AUD_DOLBY_SUPPORT_MS12
		     #define PART_ADSP_SIZE              (4*1024*1024) /* audio dsp size - add for MS12 libraries */
		 #else
		     #define PART_ADSP_SIZE              (3*1024*1024) /* audio dsp size */
		 #endif // CC_AUD_DOLBY_SUPPORT_MS12
    #else
        #define PART_ADSP_SIZE              (PART_RESERV_SIZE)
    #endif

    #ifdef CC_HDMI_2_0_HDCP_BIN
        #define PART_HDCP_BIN_SIZE          (256*1024) /* HDMI 2.0 hdcp partition size 256K*/
		#define PART_EDID_BIN_SIZE          (256*1024) /* HDMI 2.0 edid partition size 256K*/
    #else
        #define PART_HDCP_BIN_SIZE         (PART_RESERV_SIZE)
		#define PART_EDID_BIN_SIZE         (PART_RESERV_SIZE)
    #endif

    #define BDM_NON_3RD_SIZE  \
                            (PART_LOADER_SIZE + PART_UBOOT_ENV_SIZE + \
                             PART_RESERV_SIZE + PART_RESERV_SIZE + \
                             PART_KERNEL_SIZE + PART_KERNEL_SIZE + \
                             PART_ROOTFS_SIZE + PART_ROOTFS_SIZE + \
                             PART_BASIC_SIZE + \
                             PART_PERM_SIZE + \
                             PART_RESERV_SIZE + \
                             PART_SYSTEM_SIZE + PART_CHROME_SIZE + \
                             PART_CHROME_SIZE + \
                             PART_DATA_SIZE + PART_UPGRADE_SIZE)

    #define SDM_TOTAL_SIZE \
                           (PART_CHANNEL_SIZE + PART_CHANNEL_SIZE + \
                            PART_PQ_SIZE + PART_AQ_SIZE + \
                            PART_CI_SIZE + \
                            PART_DEFAULT_DB_SIZE + \
                            PART_CAPTURE_LOGO_SIZE + \
                            PART_ACFG_DESC_SIZE + \
                            PART_SCHED_PVR_SIZE + \
                            PART_ADSP_SIZE + \
                            PART_HDCP_BIN_SIZE + \
                            PART_EDID_BIN_SIZE + \
                            PART_SDM_BAD_SECTOR_SIZE)

    #ifdef CC_3RD_RO
        #ifndef CC_MSDC_ENABLE
            #define PART_3RD_RO_SIZE        (0x8700000)                 /* 135MB */
        #else
            #define PART_3RD_RO_SIZE        (15*1024*1024)              /* 15MB */
        #endif
    #else
        #define PART_3RD_RO_SIZE            (PART_RESERV_SIZE)
    #endif

    #ifndef CC_MSDC_ENABLE
        #define PART_3RD_RW_SIZE            (NAND_FLASH_TOTAL_SIZE - BDM_NON_3RD_SIZE - SDM_TOTAL_SIZE - PART_3RD_RO_SIZE)
    #else
	    #define PART_3RD_RW_SIZE            (10*1024*1024)      /* 10MB */
	#endif

	#if 0
    #define NAND_PART_SIZE_0                (PART_LOADER_SIZE)              /* loader image              */
    #define NAND_PART_SIZE_1                (PART_UBOOT_ENV_SIZE)           /* nand_1 - uboot env        */
    #define NAND_PART_SIZE_2                (PART_SYSTEM_SIZE)              /* nand_2 - system         */
    #define NAND_PART_SIZE_3                (PART_CHROME_SIZE)              /* nand_3 - chrome         */
    #define NAND_PART_SIZE_4                (PART_KERNEL_SIZE)              /* nand_4 - kernel A         */
    #define NAND_PART_SIZE_5                (PART_KERNEL_SIZE)              /* nand_5 - kernel B         */
    #define NAND_PART_SIZE_6                (PART_ROOTFS_SIZE)              /* nand_6 - rootfs A         */
    #define NAND_PART_SIZE_7                (PART_ROOTFS_SIZE)              /* nand_7 - rootfs B         */
    #define NAND_PART_SIZE_8                (PART_BASIC_SIZE)               /* nand_8 - basic            */
    #define NAND_PART_SIZE_9                (PART_PERM_SIZE)                /* nand_9 - perm             */
    #define NAND_PART_SIZE_10               (PART_3RD_RO_SIZE)              /* nand_10 - 3rd ro          */
    #define NAND_PART_SIZE_11               (PART_3RD_RW_SIZE)              /* nand_11 - 3rd_rw          */
    #define NAND_PART_SIZE_12               (PART_DATA_SIZE)                /* nand_12 - data            */
    #define NAND_PART_SIZE_13               (PART_CHANNEL_SIZE)             /* nand_13 - channel list A  */
    #define NAND_PART_SIZE_14               (PART_CHANNEL_SIZE)             /* nand_14 - channel list B  */
    #define NAND_PART_SIZE_15               (PART_PQ_SIZE)                  /* nand_15 - Flash PQ        */
    #define NAND_PART_SIZE_16               (PART_AQ_SIZE)                  /* nand_16 - Flash AQ        */
    #define NAND_PART_SIZE_17               (PART_CAPTURE_LOGO_SIZE)        /* nand_17 - Capture Logo     */
    #define NAND_PART_SIZE_18               (PART_ACFG_DESC_SIZE)           /* nand_18 - Acfg description */
    #define NAND_PART_SIZE_19               (PART_SCHED_PVR_SIZE)           /* nand_19 - Schedule PVR     */
    #define NAND_PART_SIZE_20               (PART_ADSP_SIZE)                /* nand_20 - audio dsp        */
    #define NAND_PART_SIZE_21               (PART_CI_SIZE)                  /* nand_21 - ci              */
    #define NAND_PART_SIZE_22               (PART_DEFAULT_DB_SIZE)          /* nand_22 - DVBS default db */
    #define NAND_PART_SIZE_23               (PART_HDCP_BIN_SIZE)            /* nand_23 - HDMI 2.0 hdcp  */
	#define NAND_PART_SIZE_24               (PART_EDID_BIN_SIZE)            /* nand_24 - HDMI 2.0 edid  */
	#endif

	#define NAND_PART_SIZE_0                (PART_LOADER_SIZE)              /* loader image, 2M             */
    #define NAND_PART_SIZE_1                (PART_UBOOT_ENV_SIZE)           /* nand_1 - uboot env, 2M        */
	#define NAND_PART_SIZE_2                (PART_RESERV_SIZE)           	/* nand_2 - reserved, 256K        */
	#define NAND_PART_SIZE_3                (PART_RESERV_SIZE)           	/* nand_3 - reserved, 256K        */
	#define NAND_PART_SIZE_4                (PART_KERNEL_SIZE)           	/* nand_4 - Kernel A, 4M        */
	#define NAND_PART_SIZE_5                (PART_KERNEL_SIZE)           	/* nand_5 - Kernel B, 4M        */
	#define NAND_PART_SIZE_6                (PART_ROOTFS_SIZE)           	/* nand_6 - RootfsA, 100M        */
	#define NAND_PART_SIZE_7                (PART_ROOTFS_SIZE)           	/* nand_7 - RootfsB, 100M        */
	#define NAND_PART_SIZE_8                (PART_BASIC_SIZE)               /* nand_8 - basic, 256K            */
	#define NAND_PART_SIZE_9                (PART_PERM_SIZE)                /* nand_9 - perm, 8M             */
	#define NAND_PART_SIZE_10               (PART_3RD_RO_SIZE)              /* nand_10 - 3rd ro, 15M          */
	#define NAND_PART_SIZE_11               (PART_3RD_RW_SIZE)              /* nand_11 - 3rd_rw, 10M          */
	#define NAND_PART_SIZE_12               (PART_RESERV_SIZE)           	/* nand_12 - reserved        */
	#define NAND_PART_SIZE_13               (PART_SYSTEM_SIZE)              /* nand_13 - system, 128M         */
	#define NAND_PART_SIZE_14               (PART_CHROME_SIZE)              /* nand_14 - chromeA, 128M         */
	#define NAND_PART_SIZE_15               (PART_CHROME_SIZE)              /* nand_15 - chromeB, 128M         */
	#define NAND_PART_SIZE_16               (PART_DATA_SIZE)                /* nand_16 - data, 150M            */
	#define NAND_PART_SIZE_17               (PART_UPGRADE_SIZE)             /* nand_17 - upgrade, 235M            */
	#define NAND_PART_SIZE_18               (PART_CHANNEL_SIZE)             /* nand_18 - channel list A, 256K  */
    #define NAND_PART_SIZE_19               (PART_CHANNEL_SIZE)             /* nand_19 - channel list B, 256K */
    #define NAND_PART_SIZE_20               (PART_PQ_SIZE)                  /* nand_20 - Flash PQ, 256K        */
    #define NAND_PART_SIZE_21               (PART_AQ_SIZE)                  /* nand_21 - Flash AQ, 256K        */
    #define NAND_PART_SIZE_22               (PART_CAPTURE_LOGO_SIZE)        /* nand_22 - Capture Logo, 1M     */
    #define NAND_PART_SIZE_23               (PART_ACFG_DESC_SIZE)           /* nand_23 - Acfg description,  256K */
    #define NAND_PART_SIZE_24               (PART_SCHED_PVR_SIZE)           /* nand_24 - Schedule PVR, 256K     */
    #define NAND_PART_SIZE_25               (PART_ADSP_SIZE)                /* nand_25 - audio dsp, 3M        */
    #define NAND_PART_SIZE_26               (PART_CI_SIZE)                  /* nand_26 - ci, 256K              */
    #define NAND_PART_SIZE_27               (PART_DEFAULT_DB_SIZE)          /* nand_27 - DVBS default db, 256K */
    #define NAND_PART_SIZE_28               (PART_HDCP_BIN_SIZE)            /* nand_23 - HDMI 2.0 hdcp, 256K  */
	#define NAND_PART_SIZE_29               (PART_EDID_BIN_SIZE)            /* nand_24 - HDMI 2.0 edid, 256K  */

    #define NAND_FLASH_STATIC_LAST_PART_ID  (17)

    #define NAND_FLASH_STATIC_PART_SIZE \
            ((NAND_PART_SIZE_0) + \
            (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
            (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
            (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
            (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12) + \
            (NAND_PART_SIZE_13) + (NAND_PART_SIZE_14) + (NAND_PART_SIZE_15) + \
            (NAND_PART_SIZE_16) + (NAND_PART_SIZE_17))

    #define NAND_PART_NAME_13           "system"
	#define NAND_PART_NAME_14           "chromeA"
	#define NAND_PART_NAME_15           "chromeB"
	#define NAND_PART_NAME_16           "data"
	#define NAND_PART_NAME_17           "upgrade"
	#define NAND_PART_NAME_18           "channelA"
	#define NAND_PART_NAME_19           "channelB"
	#define NAND_PART_NAME_20           "pq"
	#define NAND_PART_NAME_21           "aq"
	#define NAND_PART_NAME_22           "logo"
	#define NAND_PART_NAME_23           "Acfg_desc"
	#define NAND_PART_NAME_24           "sched_pvr"

	#ifdef ADSP_BIN_SUPPORT
        #define FLASH_ADSP_BIN_PARTITION    (25)
        #define NAND_PART_NAME_25           "adsp"
    #endif

	#define NAND_PART_NAME_26           "ci"

    #if defined(DEFAULT_DB_SUPPORT)
        #define NAND_PART_NAME_27           "dvbsDB"
    #endif

    #ifdef CC_HDMI_2_0_HDCP_BIN
        #define NAND_PART_NAME_28           "hdcp"
        #define FLASH_HDCP_BIN_PARTITION    (28)
        #define NAND_PART_NAME_29           "edid"
        #define FLASH_EDID_BIN_PARTITION    (29)
        #define HDCP_NAND_FLASH_PART_ID         (28)
        #define HDMI_HDCP22_PART_ID             (28)
        #define MHL_EDID_FLASH_PART_ID          (29)
        #define HDMI2_EDID_STANDARD_PART_ID     (29)
        #define HDMI2_EDID_ENHANCE_PART_ID      (29)
    #endif
#elif defined (ANDROID)
    #define PART_RESERV_SIZE                ((UINT32)1*1024*1024)
    #define PART_SDM_BAD_SECTOR_SIZE        ((UINT32)5*1024*1024)

    #ifdef CC_FAST_INIT
        #define FAST_INIT_SUSP_SIZE         ((UINT32)60*1024*1024)
    #else
        #define FAST_INIT_SUSP_SIZE         (PART_RESERV_SIZE)
    #endif

    #define PART_LOADER_SIZE                ((UINT32)2*1024*1024)
    #ifdef CC_DUALLOADER_SUPPORT
        #define PART_LOADERB_SIZE           (PART_LOADER_SIZE)
    #else
        #define PART_LOADERB_SIZE           (PART_RESERV_SIZE)
    #endif
    #define PART_UBOOT_ENV_SIZE             ((UINT32)2*1024*1024)

    #ifdef CC_DISABLE_BASIC_PART
        #define PART_ROOTFS_SIZE            ((UINT32)85*1024*1024)
        #define PART_BASIC_SIZE             (PART_RESERV_SIZE)
    #else
        #define PART_ROOTFS_SIZE            ((UINT32)20*1024*1024)
        #define PART_BASIC_SIZE             ((UINT32)75*1024*1024)
    #endif

    #define PART_PERM_SIZE                  ((UINT32)7*1024*1024)
    #define PART_CHANNEL_SIZE               ((UINT32)1*1024*1024)
    #define PART_PQ_SIZE                    ((UINT32)1*1024*1024)
    #define PART_AQ_SIZE                    ((UINT32)1*1024*1024)

    #define PART_MISC_SIZE                  ((UINT32)1*1024*1024)
    #define PART_RECV_SIZE                  ((UINT32)20*1024*1024)
    #define PART_BOOT_SIZE                  ((UINT32)20*1024*1024)
    #define PART_SYSTEM_SIZE                ((UINT32)1450*1024*1024)
    #define PART_USER_DATA_SIZE             ((UINT64)10*1024*1024*1024)
    #define PART_CACHE_SIZE                 ((UINT32)110*1024*1024)
    #define PART_CAPTURE_LOGO_SIZE          ((UINT32)4*1024*1024)       /*   4 MB */
    #define PART_LOADER_LOGO_SIZE           ((UINT32)4*1024*1024)       /*   4 MB */
    #define PART_TRUSTZONE_SIZE             ((UINT32)4*1024*1024)       /*   4 MB */
    #ifdef ADSP_BIN_SUPPORT
	    #ifdef CC_AUD_DOLBY_SUPPORT_MS12
	    #define PART_ADSP_SIZE              (4*1024*1024) /* audio dsp size - add for MS12 libraries */
	    #else
	        #define PART_ADSP_SIZE              ((UINT32)3*1024*1024)       /* audio dsp size */
	    #endif // CC_AUD_DOLBY_SUPPORT_MS12
    #else
        #define PART_ADSP_SIZE              (PART_RESERV_SIZE)
    #endif

    #ifdef REPLACE_EEPROM_WITH_EMMC
    #define PART_EEPROM_SIZE	((UINT64)(1*1024*1024))
    #else
    #define PART_EEPROM_SIZE	((UINT64)(0*1024*1024))
    #endif

    #define PART_UPGRADE_SIZE               ((UINT32)(600*1024*1024))     /* 600 MB */

    #ifdef CI_PLUS_SUPPORT
		#ifdef CC_EMMC_ERASE_SIZE_ALIGNMENT_1M
	        #define PART_CI_SIZE                ((UINT32)1*1024*1024)
		#else
			#define PART_CI_SIZE                ((UINT32)256*1024)
		#endif
    #else
        #define PART_CI_SIZE                (PART_RESERV_SIZE)
    #endif

    #ifdef DEFAULT_DB_SUPPORT
		#ifdef CC_EMMC_ERASE_SIZE_ALIGNMENT_1M
        	#define PART_DEFAULT_DB_SIZE        ((UINT32)1*1024*1024)
		#else
			#define PART_DEFAULT_DB_SIZE        ((UINT32)256*1024)
		#endif
    #else
        #define PART_DEFAULT_DB_SIZE        (PART_RESERV_SIZE)
    #endif
	#ifdef CC_HDMI_2_0_HDCP_BIN
		#ifdef CC_EMMC_ERASE_SIZE_ALIGNMENT_1M
		    #define PART_FLASH_HDCP_BIN_SIZE        ((UINT32)1*1024*1024)         /* HDMI 2.0 hdcp partition size 1M */
			#define PART_FLASH_EDID_BIN_SIZE        ((UINT32)1*1024*1024)         /* HDMI 2.0 edid partition size 1M */
		#else
			#define PART_FLASH_HDCP_BIN_SIZE		((UINT32)256*1024)		   /* HDMI 2.0 hdcp partition size 256K */
			#define PART_FLASH_EDID_BIN_SIZE		((UINT32)256*1024)		   /* HDMI 2.0 edid partition size 256K */
		#endif
	#else
	#define PART_FLASH_HDCP_BIN_SIZE        (PART_RESERV_SIZE)
	#define PART_FLASH_EDID_BIN_SIZE        (PART_RESERV_SIZE)
	#endif
	#define PART_SCHED_PVR_SIZE             (256*1024) /* Schedule PVR size 256K */
	#ifdef CC_SUPPORT_DOLBY_VISION
	#define PART_DOLBY_PQ_SIZE                   ((UINT64)1024*1024)
	#else
	#define PART_DOLBY_PQ_SIZE                   (PART_RESERV_SIZE)
	#endif
    #define BDM_NON_3RD_SIZE  \
                            (PART_LOADER_SIZE + PART_LOADERB_SIZE + PART_UBOOT_ENV_SIZE + \
                             PART_MISC_SIZE + PART_RECV_SIZE + \
                             PART_BOOT_SIZE + PART_SYSTEM_SIZE + \
                             PART_USER_DATA_SIZE + PART_CACHE_SIZE + PART_RESERV_SIZE + \
                             PART_ROOTFS_SIZE + PART_BASIC_SIZE + \
                             PART_PERM_SIZE + \
                             FAST_INIT_SUSP_SIZE + PART_EEPROM_SIZE)

    #define SDM_TOTAL_SIZE \
                           (PART_CHANNEL_SIZE + PART_CHANNEL_SIZE + \
                            PART_PQ_SIZE + PART_AQ_SIZE + \
                            PART_CAPTURE_LOGO_SIZE + PART_LOADER_LOGO_SIZE + \
                            PART_TRUSTZONE_SIZE + PART_ADSP_SIZE + PART_CI_SIZE + \
                            PART_DEFAULT_DB_SIZE + PART_UPGRADE_SIZE + \
                            PART_FLASH_HDCP_BIN_SIZE + PART_FLASH_EDID_BIN_SIZE + \
                            PART_SDM_BAD_SECTOR_SIZE + PART_SCHED_PVR_SIZE + PART_DOLBY_PQ_SIZE)

    #ifdef CC_3RD_RO
        #define PART_3RD_RO_SIZE            ((UINT32)215*1024*1024)                 /* 215MB */
    #else
        #define PART_3RD_RO_SIZE            (PART_RESERV_SIZE)
    #endif

    #define PART_3RD_RW_SIZE                ((UINT32)256*1024*1024)                 /* 256MB */

    #define NAND_PART_SIZE_0                (PART_LOADER_SIZE)
    #define NAND_PART_SIZE_1                (PART_LOADERB_SIZE)
    #define NAND_PART_SIZE_2                (PART_UBOOT_ENV_SIZE)
    #define NAND_PART_SIZE_3                (PART_MISC_SIZE)
    #define NAND_PART_SIZE_4                (PART_RECV_SIZE)
    #define NAND_PART_SIZE_5                (PART_BOOT_SIZE)
    #define NAND_PART_SIZE_6                (PART_SYSTEM_SIZE)
    #define NAND_PART_SIZE_7                (PART_USER_DATA_SIZE)
    #define NAND_PART_SIZE_8                (PART_CACHE_SIZE)
    #define NAND_PART_SIZE_9                (PART_RESERV_SIZE)
    #define NAND_PART_SIZE_10               (PART_ROOTFS_SIZE)
    #define NAND_PART_SIZE_11               (PART_BASIC_SIZE)

    #define NAND_PART_SIZE_12               (PART_PERM_SIZE)
    #define NAND_PART_SIZE_13               (PART_3RD_RO_SIZE)
    #define NAND_PART_SIZE_14               (PART_3RD_RW_SIZE)
    #define NAND_PART_SIZE_15               (FAST_INIT_SUSP_SIZE)

    #define NAND_PART_SIZE_16               (PART_CHANNEL_SIZE)
    #define NAND_PART_SIZE_17               (PART_CHANNEL_SIZE)
    #define NAND_PART_SIZE_18               (PART_PQ_SIZE)
    #define NAND_PART_SIZE_19               (PART_AQ_SIZE)
    #define NAND_PART_SIZE_20               (PART_CAPTURE_LOGO_SIZE)
    #define NAND_PART_SIZE_21               (PART_LOADER_LOGO_SIZE)
    #define NAND_PART_SIZE_22               (PART_TRUSTZONE_SIZE)
    #define NAND_PART_SIZE_23               (PART_ADSP_SIZE)                /* nand_22 - audio dsp        */
    #define NAND_PART_SIZE_24               (PART_CI_SIZE)
    #define NAND_PART_SIZE_25               (PART_DEFAULT_DB_SIZE)
    #define NAND_PART_SIZE_26               (PART_UPGRADE_SIZE)
	#ifdef CC_SUPPORT_DOLBY_VISION
    #define NAND_PART_SIZE_27				(PART_DOLBY_PQ_SIZE)			/* nand_28 - Dolby PQ  */
    #else
    #define NAND_PART_SIZE_27				(PART_RESERV_SIZE)
    #endif
    #define NAND_PART_SIZE_28               (PART_FLASH_HDCP_BIN_SIZE)
    #define NAND_PART_SIZE_29               (PART_FLASH_EDID_BIN_SIZE)
    #define NAND_FLASH_STATIC_LAST_PART_ID  (15)
#ifdef REPLACE_EEPROM_WITH_EMMC
    #define NAND_PART_SIZE_30               (PART_EEPROM_SIZE)
    #define NAND_PART_ID_EEPROM_A           (30)
#endif
    #define NAND_PART_SIZE_31               (PART_SCHED_PVR_SIZE)           /* nand_21 - Schedule PVR     */
    #define NAND_FLASH_STATIC_PART_SIZE \
            ((NAND_PART_SIZE_0) + \
            (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
            (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
            (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
            (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12) + \
            (NAND_PART_SIZE_13) + (NAND_PART_SIZE_14) + (NAND_PART_SIZE_15))
    #define UBOOT_ENV_OFFSET                (PART_LOADER_SIZE + PART_LOADERB_SIZE)

    #define SDCARD_UPGRADE_PART_OFFSET \
        ((NAND_PART_SIZE_0) + \
        (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
        (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
        (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
        (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12) + \
        (NAND_PART_SIZE_13) + (NAND_PART_SIZE_14) + (NAND_PART_SIZE_15) + \
        (NAND_PART_SIZE_16) + (NAND_PART_SIZE_17) + (NAND_PART_SIZE_18) + \
        (NAND_PART_SIZE_19) + (NAND_PART_SIZE_20) + (NAND_PART_SIZE_21) + \
        (NAND_PART_SIZE_22) + (NAND_PART_SIZE_23) + (NAND_PART_SIZE_24) + \
        (NAND_PART_SIZE_25))

    #define NAND_PART_NAME_0                "uboot"
    #define NAND_PART_ENCRYPT_0             (0)
    #define NAND_PART_NAME_1                "ubootB"
    #define NAND_PART_ENCRYPT_1             (0)
    #define NAND_PART_NAME_2                "uboot_env"
    #define NAND_PART_ENCRYPT_2             (1)
    #define NAND_PART_NAME_3                "misc"
    #define NAND_PART_ENCRYPT_3             (1)
    #define NAND_PART_NAME_4                "recovery"
    #define NAND_PART_ENCRYPT_4             (0)
    #define NAND_PART_NAME_5                "boot"
    #define NAND_PART_ENCRYPT_5             (0)
    #define NAND_PART_NAME_6                "system"
    #define NAND_PART_ENCRYPT_6             (0)
    #define NAND_PART_NAME_7                "userdata"
    #define NAND_PART_ENCRYPT_7             (0)
    #define NAND_PART_NAME_8                "cache"
    #define NAND_PART_ENCRYPT_8             (0)
    #define NAND_PART_NAME_9                "dmverity"
    #define NAND_PART_ENCRYPT_9             (0)
    #define NAND_PART_NAME_10               "linux_rootfs"
    #define NAND_PART_ENCRYPT_10            (0)
    #define NAND_PART_NAME_11               "basic"
    #define NAND_PART_ENCRYPT_11            (0)
    #define NAND_PART_NAME_12               "perm"
    #define NAND_PART_ENCRYPT_12            (1)
    #define NAND_PART_NAME_13               "3rd_ro"
    #define NAND_PART_ENCRYPT_13            (1)
    #define NAND_PART_NAME_14               "3rd_rw"
    #define NAND_PART_ENCRYPT_14            (1)
    #define NAND_PART_NAME_15               "reserved"
    #define NAND_PART_ENCRYPT_15            (0)
    #define NAND_PART_NAME_16               "channelA"
    #define NAND_PART_ENCRYPT_16            (0)
    #define NAND_PART_NAME_17               "channelB"
    #define NAND_PART_ENCRYPT_17            (0)
    #define NAND_PART_NAME_18               "pq"
    #define NAND_PART_ENCRYPT_18            (0)
    #define NAND_PART_NAME_19               "aq"
    #define NAND_PART_ENCRYPT_19            (0)
    #define NAND_PART_NAME_20               "logo"
    #define NAND_PART_ENCRYPT_20            (0)
    #define NAND_PART_NAME_21               "bootlogo"
    #define NAND_PART_ENCRYPT_21            (0)
    #ifdef CC_TZBIN_INDIVIDUAL_PARTITION
        #define NAND_PART_NAME_22           "tzbp"
        #define TRUSTZONE_FLASH_PARTITION   (22)
        #define NAND_PART_ENCRYPT_22        (1)
    #endif /* endif CC_TZBIN_INDIVIDUAL_PARTITION */
    #ifdef ADSP_BIN_SUPPORT
        #define NAND_PART_NAME_23           "adsp"
        #define FLASH_ADSP_BIN_PARTITION    (23)
    #endif
    #ifdef CI_PLUS_SUPPORT
        #define NAND_PART_NAME_24           "ciplus"
    #endif
    #ifdef DEFAULT_DB_SUPPORT
        #define NAND_PART_NAME_25           "dvbsDB"
    #endif
    #define NAND_PART_NAME_26               "upgrade"
	#ifdef CC_SUPPORT_DOLBY_VISION
	#define NAND_PART_NAME_27				"dolby"
	#define FLASH_DOLBY_VISION_PARTITION	(27)
    #endif
    #ifdef CC_HDMI_2_0_HDCP_BIN
        #define NAND_PART_NAME_28           "hdcp"
        #define HDCP_NAND_FLASH_PART_ID     (28)
        #define HDMI_HDCP22_PART_ID         (28)
        #define NAND_PART_NAME_29           "edid"
        #define MHL_EDID_FLASH_PART_ID      (29)
        #define HDMI2_EDID_STANDARD_PART_ID (29)
        #define HDMI2_EDID_ENHANCE_PART_ID  (29)
    #endif

    #ifdef REPLACE_EEPROM_WITH_EMMC
        #define NAND_PART_NAME_30           "eeprom_A"
        #define NAND_PART_ENCRYPT_30        (0)
    #endif
    #define NAND_PART_NAME_31               "SCHEDPVR"
#else
    #define PART_RESERV_SIZE                (256*1024)
    #define PART_SDM_BAD_SECTOR_SIZE        (5*1024*1024)

    #ifdef CC_FAST_INIT
        #define FAST_INIT_SUSP_SIZE         (60*1024*1024)
    #else
        #define FAST_INIT_SUSP_SIZE         (PART_RESERV_SIZE)
    #endif

    #define PART_LOADER_SIZE                (2*1024*1024)
    #ifdef CC_DUALLOADER_SUPPORT
        #define PART_LOADERB_SIZE           (PART_LOADER_SIZE)
    #else
        #define PART_LOADERB_SIZE           (PART_RESERV_SIZE)
    #endif
    #define PART_UBOOT_ENV_SIZE             (2*1024*1024)
#ifdef LARGER_KERNEL
    #define PART_KERNEL_SIZE                (6*1024*1024)
#else
    #define PART_KERNEL_SIZE                (5*1024*1024)
#endif
    #ifdef CC_DISABLE_BASIC_PART
        #if defined(CONFIG_64BIT) || defined(CC_64BIT_SUPPORT)
			#ifdef CC_ROOTFS_RW
                #define PART_ROOTFS_SIZE        ((UINT32)300*1024*1024)
			#else		
				#define PART_ROOTFS_SIZE        ((UINT32)75*1024*1024)
			#endif
		#else
		    #ifdef CC_ROOTFS_RW
                #define PART_ROOTFS_SIZE        ((UINT32)200*1024*1024)
			#else
			    #define PART_ROOTFS_SIZE        ((UINT32)50*1024*1024)
			#endif
        #endif
        #define PART_BASIC_SIZE             (PART_RESERV_SIZE)
    #else
        #ifndef CC_MSDC_ENABLE
            #define PART_ROOTFS_SIZE        (15*1024*1024)
        #else
            #define PART_ROOTFS_SIZE        (75*1024*1024)
        #endif
            #define PART_BASIC_SIZE         (80*1024*1024)
    #endif

    #define PART_PERM_SIZE                  (8*1024*1024)
    #define PART_CHANNEL_SIZE               (256*1024)
    #define PART_PQ_SIZE                    (256*1024)
    #define PART_AQ_SIZE                    (256*1024)

    #ifdef CI_PLUS_SUPPORT
        #define PART_CI_SIZE                (256*1024)
    #else
        #define PART_CI_SIZE                (PART_RESERV_SIZE)
    #endif

    #ifdef DEFAULT_DB_SUPPORT
        #define PART_DEFAULT_DB_SIZE        (256*1024)
    #else
        #define PART_DEFAULT_DB_SIZE        (PART_RESERV_SIZE)
    #endif

    #ifdef CAPTURE_LOGO_SUPPORT
        #define PART_CAPTURE_LOGO_SIZE      (1*1024*1024)
    #else
        #define PART_CAPTURE_LOGO_SIZE      (PART_RESERV_SIZE)
    #endif

    #define PART_ACFG_DESC_SIZE             (1*1024*1024) /* Acfg description size 1M */
    #define PART_SCHED_PVR_SIZE             (256*1024) /* Schedule PVR size 256K */

    #ifdef ADSP_BIN_SUPPORT
         #ifdef CC_AUD_DOLBY_SUPPORT_MS12
		     #define PART_ADSP_SIZE              (4*1024*1024) /* audio dsp size - add for MS12 libraries */
		 #else
		     #define PART_ADSP_SIZE              (3*1024*1024) /* audio dsp size */
		 #endif // CC_AUD_DOLBY_SUPPORT_MS12
    #else
        #define PART_ADSP_SIZE              (PART_RESERV_SIZE)
    #endif

    #ifdef CC_HDMI_2_0_HDCP_BIN
        #define PART_HDCP_BIN_SIZE          (256*1024) /* HDMI 2.0 hdcp partition size 256K*/
		#define PART_EDID_BIN_SIZE          (256*1024) /* HDMI 2.0 edid partition size 256K*/
    #else
        #define PART_HDCP_BIN_SIZE         (PART_RESERV_SIZE)
		#define PART_EDID_BIN_SIZE         (PART_RESERV_SIZE)
    #endif

    #ifdef CC_SUPPORT_DOLBY_VISION
        #define PART_DOLBY_PQ_SIZE                   ((UINT64)1024*1024)
    #else
        #define PART_DOLBY_PQ_SIZE					 (PART_RESERV_SIZE)
    #endif


    #define BDM_NON_3RD_SIZE  \
                            (PART_LOADER_SIZE + PART_LOADERB_SIZE + PART_UBOOT_ENV_SIZE + \
                             PART_RESERV_SIZE + \
                             PART_KERNEL_SIZE + PART_KERNEL_SIZE + \
                             PART_ROOTFS_SIZE + PART_ROOTFS_SIZE + \
                             PART_BASIC_SIZE + \
                             PART_PERM_SIZE + \
                             FAST_INIT_SUSP_SIZE)

    #define SDM_TOTAL_SIZE \
                           (PART_CHANNEL_SIZE + PART_CHANNEL_SIZE + \
                            PART_PQ_SIZE + PART_AQ_SIZE + \
                            PART_CI_SIZE + \
                            PART_DEFAULT_DB_SIZE + \
                            PART_CAPTURE_LOGO_SIZE + \
                            PART_ACFG_DESC_SIZE + \
                            PART_SCHED_PVR_SIZE + \
                            PART_ADSP_SIZE + \
                            PART_HDCP_BIN_SIZE + \
                            PART_EDID_BIN_SIZE + \
                            PART_DOLBY_PQ_SIZE + \
                            PART_SDM_BAD_SECTOR_SIZE)

    #ifdef CC_3RD_RO
        #ifndef CC_MSDC_ENABLE
            #define PART_3RD_RO_SIZE        (0x8700000)                 /* 135MB */
        #else
            #define PART_3RD_RO_SIZE        (200*1024*1024)                 /* 200MB */
        #endif
    #else
        #define PART_3RD_RO_SIZE            (PART_RESERV_SIZE)
    #endif

    #ifndef CC_MSDC_ENABLE
        #define PART_3RD_RW_SIZE            (NAND_FLASH_TOTAL_SIZE - BDM_NON_3RD_SIZE - SDM_TOTAL_SIZE - PART_3RD_RO_SIZE)
    #else
        #define PART_3RD_RW_SIZE            (300*1024*1024)      /* 300MB */
    #endif

    #ifdef CC_MTK_CM4_SUPPORT
      #define PART_CM4_SIZE            (UINT64)(5 * 1024 * 1024)
      #define NAND_PART_NAME_26        "cm4"
    #else
      #define PART_CM4_SIZE (UINT64)(5 * 1024 * 1024)
    #endif

    #define NAND_PART_SIZE_0                (PART_LOADER_SIZE)              /* loader image              */
    #define NAND_PART_SIZE_1                (PART_LOADERB_SIZE)             /* loader image              */
    #define NAND_PART_SIZE_2                (PART_UBOOT_ENV_SIZE)           /* nand_2 - uboot env        */
    #define NAND_PART_SIZE_3                (PART_RESERV_SIZE)              /* nand_3 - radt             */
    #define NAND_PART_SIZE_4                (PART_KERNEL_SIZE)              /* nand_4 - kernel A         */
    #define NAND_PART_SIZE_5                (PART_KERNEL_SIZE)              /* nand_5 - kernel B         */
    #define NAND_PART_SIZE_6                (PART_ROOTFS_SIZE)              /* nand_6 - rootfs A         */
    #define NAND_PART_SIZE_7                (PART_ROOTFS_SIZE)              /* nand_7 - rootfs B         */
    #define NAND_PART_SIZE_8                (PART_BASIC_SIZE)               /* nand_8 - basic            */
    #define NAND_PART_SIZE_9                (PART_PERM_SIZE)                /* nand_9 - perm             */
    #define NAND_PART_SIZE_10               (PART_3RD_RO_SIZE)              /* nand_10 - 3rd ro          */
    #define NAND_PART_SIZE_11               (PART_3RD_RW_SIZE)              /* nand_11 - 3rd_rw          */
    #define NAND_PART_SIZE_12               (FAST_INIT_SUSP_SIZE)           /* nand_12 - reserved        */

    #define NAND_PART_SIZE_13               (PART_CHANNEL_SIZE)             /* nand_13 - channel list A  */
    #define NAND_PART_SIZE_14               (PART_CHANNEL_SIZE)             /* nand_14 - channel list B  */
    #define NAND_PART_SIZE_15               (PART_PQ_SIZE)                  /* nand_15 - Flash PQ        */
    #define NAND_PART_SIZE_16               (PART_AQ_SIZE)                  /* nand_16 - Flash AQ        */
    #define NAND_PART_SIZE_17               (PART_CAPTURE_LOGO_SIZE)        /* nand_17 - Capture Logo    */
    #define NAND_PART_SIZE_18               (PART_ACFG_DESC_SIZE)           /* nand_18 - Acfg description*/
    #define NAND_PART_SIZE_19               (PART_SCHED_PVR_SIZE)           /* nand_19 - Schedule PVR    */
    #define NAND_PART_SIZE_20               (PART_ADSP_SIZE)                /* nand_20 - audio dsp       */
    #define NAND_PART_SIZE_21               (PART_CI_SIZE)                  /* nand_21 - ci              */
    #define NAND_PART_SIZE_22               (PART_DEFAULT_DB_SIZE)          /* nand_22 - DVBS default db */
    #define NAND_PART_SIZE_23               (PART_HDCP_BIN_SIZE)            /* nand_23 - HDMI 2.0 hdcp   */
    #define NAND_PART_SIZE_24               (PART_EDID_BIN_SIZE)            /* nand_24 - HDMI 2.0 edid   */
    #define NAND_PART_SIZE_25               (PART_DOLBY_PQ_SIZE)            /* nand_27 - Dolby PQ  */
    #define NAND_PART_SIZE_26               (PART_CM4_SIZE)                 /* nand_26 - cm4.img */

    #ifdef CC_SUPPORT_DOLBY_VISION
        #define NAND_PART_NAME_25				"dolby"
        #define FLASH_DOLBY_VISION_PARTITION	(25)
    #endif


    #define NAND_FLASH_STATIC_LAST_PART_ID  (12)

    #define NAND_FLASH_STATIC_PART_SIZE \
            ((NAND_PART_SIZE_0) + \
            (NAND_PART_SIZE_1) + (NAND_PART_SIZE_2) + (NAND_PART_SIZE_3) + \
            (NAND_PART_SIZE_4) + (NAND_PART_SIZE_5) + (NAND_PART_SIZE_6) + \
            (NAND_PART_SIZE_7) + (NAND_PART_SIZE_8) + (NAND_PART_SIZE_9) + \
            (NAND_PART_SIZE_10) + (NAND_PART_SIZE_11) + (NAND_PART_SIZE_12))
    #define UBOOT_ENV_OFFSET                (PART_LOADER_SIZE + PART_LOADERB_SIZE)

    #ifdef ADSP_BIN_SUPPORT
        #define NAND_PART_NAME_20           "adsp"
        #define FLASH_ADSP_BIN_PARTITION    (20)
    #endif

    #ifdef DEFAULT_DB_SUPPORT
        #define NAND_PART_NAME_22           "dvbsDB"
    #endif

    #ifdef CC_HDMI_2_0_HDCP_BIN
        #define NAND_PART_NAME_23           "hdcp"
        #define HDCP_NAND_FLASH_PART_ID     (23)
        #define HDMI_HDCP22_PART_ID         (23)
        #define NAND_PART_NAME_24           "edid"
        #define MHL_EDID_FLASH_PART_ID      (24)
        #define HDMI2_EDID_STANDARD_PART_ID (24)
        #define HDMI2_EDID_ENHANCE_PART_ID  (24)
    #endif

#endif /* CC_C4TV_SUPPORT */

#ifdef CC_HDMI_2_0_HDCP_BIN
    #define DRVCUST_EEPROM_HDMI_HDCP_OFFSET         (0)
    #define HDMI_HDCP22_OFFSET                      (320)
    #define MHL_EDID_OFFSET                         (0)
    #define HDMI2_EDID_STANDARD_OFFSET              (256)
    #define HDMI2_EDID_ENHANCE_OFFSET               (512)
#endif

#endif //defined(LINUX_TURNKEY_SOLUTION) || defined(__KERNEL__)

#if defined(LINUX_TURNKEY_SOLUTION) || defined(__KERNEL__)
#ifdef CC_FBM_MAPPING_ONE_BY_ONE
#ifndef FBM_BOOT_MMAP_INCLUDE_FILE
#define FBM_BOOT_MMAP_INCLUDE_FILE           "mediatek/mtk_fbm_mmap.h"
#endif
#endif
#endif


/*
 * default quality table
*/
#ifndef QTYTBL_INCLUDE_FILE
//#define QTYTBL_INCLUDE_FILE               "mediatek/QTY_DEFAULT/mtk_QtyTbl.h"
#endif


#ifdef SUPPORT_FLASH_PQ
    #ifdef ANDROID
        #define FLASH_PQ_BASE_PARTITION         (18)
    #elif defined (LINUX_TURNKEY_SOLUTION)
        #ifdef CC_C4TV_SUPPORT
        #define FLASH_PQ_BASE_PARTITION         (20)
        #else
        #define FLASH_PQ_BASE_PARTITION         (15)
        #endif
    #endif
#endif

#ifdef SUPPORT_FLASH_AQ
    #ifdef ANDROID
        #define FLASH_AQ_BASE_PARTITION         (19)
    #elif defined (LINUX_TURNKEY_SOLUTION)
        #ifdef CC_C4TV_SUPPORT
        #define FLASH_AQ_BASE_PARTITION         (21)
        #else
        #define FLASH_AQ_BASE_PARTITION         (16)
        #endif
    #endif
#endif

/*
 * default color parameter
*/
#ifndef COLOR_PARAM_INCLUDE_FILE
//#define COLOR_PARAM_INCLUDE_FILE          "mediatek/PANEL_DEFAULT/color_param.h"
#endif

/*
 * dynamic backlight parameter
*/

/*
 * OD setting
*/

#define SUPPORT_OD                          (0)

//for PMIC
#ifdef CC_CUSTOM_PMIC_I2C_SUPPORT
#ifndef SIF_ENABLE_PDWNC_MASTER1
#define SIF_ENABLE_PDWNC_MASTER1      (1)
#endif
#define PMIC_VCPU_DEVICE_ADDR    (0xc8)
#define PMIC_VCPU_DATA_ADDR      (0x05)
#define PMIC_VCPU_MODE_ADDR      (0x06)
#define PMIC_VCPU_MODE_MASK      (0x10)
#define PMIC_VCPU_MODE_PWM_EN    (1)
#define PMIC_VCPU_VMIN           (700) //unit: mV
#define PMIC_VCPU_VMAX           (1500)//unit: mV
#define PMIC_VCPU_VSTEP          (1000)//unit: 10uV
#define PMIC_VCPU_CHANNEL_ID     (4)
#define PMIC_VGPU_DEVICE_ADDR    (0xc8)
#define PMIC_VGPU_DATA_ADDR      (0x04)
#define PMIC_VGPU_MODE_ADDR      (0x06)
#define PMIC_VGPU_MODE_MASK      (0x10)
#define PMIC_VGPU_MODE_PWM_EN    (1)
#define PMIC_VGPU_VMIN           (700) //unit: mV
#define PMIC_VGPU_VMAX           (1500)//unit: mV
#define PMIC_VGPU_VSTEP          (1000)//unit: 10uV
#define PMIC_VGPU_CHANNEL_ID     (4)
#endif

// for CPU temperature settings
#define THERMAL_REBOOT_TEMP     113000  // 113 degree-C
#define THERMAL_TRIGGER_HOT     107000  // 107 degree-C
#define THERMAL_TRIGGER_HOT2NOR  90000  //  90 degree-C
#define THERMAL_TRIGGER_COLD2NOR 85000  //  85 degree-C
#define THERMAL_TRIGGER_COLD     70000  //  70 degree-C

#define THERMAL_CPUFREQ_HOT          (1200000)
#define THERMAL_CPUFREQ_NOR          (1596000)
#define THERMAL_CPUFREQ_COLD         (1800000)

/*
 *  ENABLE WOW for WiFi
*/
#ifdef CC_WIFI_WOWLAN_SUPPORT
#define WAKEUP_ON_WLAN_GPIO     (222)
#define RESET_ON_WLAN_GPIO     (220)
    #ifdef CC_WIFI_WOWLAN_LOW_ACTIVE
        #define WAKEUP_ON_WLAN_POL         (0)
    #else
        #define WAKEUP_ON_WLAN_POL         (1)
    #endif
#endif

/*
 *  ENABLE WoBT for BT
*/
#ifdef CC_BT_WAKEUP_SUPPORT
#define WAKEUP_ON_BT_GPIO (221)
#define WAKEUP_ON_BT_POL (0)
#endif


#else /* CONFIG_DEFAULT_H */
#error "Cannot include multi-config files"
#endif /* CONFIG_DEFAULT_H */

