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


//----------------------------------------------------------------------------
// Include general files
//----------------------------------------------------------------------------
// driver general header file
#include "x_typedef.h"
#include "x_assert.h"
#include "x_serial.h"
#include "x_hal_5381.h"
// driver customized header file
#include "drvcust_if.h"
#include "x_ckgen.h"
#include "eeprom_if.h"
#include "dram_priority.h"

#if defined(CC_MTK_PRELOADER)

#else /* defined(CC_NAND_BOOT) && defined(CC_MTK_PRELOADER) */
//----------------------------------------------------------------------------
// driver customization setting include files
//----------------------------------------------------------------------------

#include "c_model.h"/* CUSTOM_CFG_FILE */

#include "drv_def_file.h"


//----------------------------------------------------------------------------
// include customized files
//----------------------------------------------------------------------------

#ifndef CC_MTK_PRELOADER

#ifdef PDWNC_EXT_IMPL
#include PDWNC_EXT_IMPL
#endif

#ifdef GPIO_INCLUDE_FILE
#include GPIO_INCLUDE_FILE
#endif

#ifdef EDID_INCLUDE_FILE
#include EDID_INCLUDE_FILE
#endif

#ifdef IR_INCLUDE_FILE
#include IR_INCLUDE_FILE
#endif

#ifdef BUTTON_INCLUDE_FILE
#include BUTTON_INCLUDE_FILE
#endif

#ifdef T8032UP_INCLUDE_FILE
#include T8032UP_INCLUDE_FILE
#endif

#ifdef SIF_INCLUDE_FILE
#include SIF_INCLUDE_FILE
#endif

#ifdef TCON_CUST_FILE
#include TCON_CUST_FILE
#endif

#ifdef NAND_INCLUDE_FILE
#include NAND_INCLUDE_FILE
#endif

#ifdef AUD_AMP_EXT_IMPL_FILE
#include AUD_AMP_EXT_IMPL_FILE  //AMP_DRV_CUST
#endif

#ifdef AUD_FLASH_AQ_FILE  //CC_AUD_AQ_IN_DRVCUST
#include  AUD_FLASH_AQ_FILE
#endif

#ifdef BE_CTRL_INCLUDE_FILE
#include BE_CTRL_INCLUDE_FILE
#endif

#ifdef HDMI_INCLUDE_FILE
#include HDMI_INCLUDE_FILE
#endif

#endif /* CC_MTK_PRELOADER */

#if !defined(CC_MTK_PRELOADER) && !defined(__KERNEL__)
#ifdef LOADER_LOGO_H_FILE
#include LOADER_LOGO_H_FILE
#endif /* LOADER_LOGO_H_FILE */
#endif /* CC_MTK_PRELOADER */

#include "drv_default.h"

#ifdef CUSTOM_EEPROM_FILE
#include CUSTOM_EEPROM_FILE
#endif

#ifdef CC_UBOOT
#include "drv_pwm.h"
#endif

#ifndef CC_MTK_PRELOADER
#ifdef CC_PHP_SUPPORT
rOption_code_state rOPCodeState;
UINT8 u1IsUhdDD;
#endif
#endif //#ifndef CC_MTK_PRELOADER

//----------------------------------------------------------------------------
// Public function implementation
//----------------------------------------------------------------------------
#ifdef CC_COMBINE_4K_2K
extern UINT32 DRVCUST_Get_2K_Model(void);
extern UINT32 DRVCUST_Get_BE_Type(void);
extern UINT32 DRVCUST_Get_FRC_Type(void);
extern UINT32 DRVCUST_Get_PQ_Type(void);
extern BOOL DRVCUST_Is_All_in_One_Series(void);
extern BOOL DRVCUST_IsExternalDecoderModel(void);
#endif
extern UINT32 DRVCUST_Get_Illumination_LED_Type(void);
extern UINT32 DRVCUST_Get_FP_Key_Type(void);
extern UINT32 DRVCUST_Get_InterMemc_type(void);
extern UINT8 DRVCUST_Get_TrialLv(void);
extern UINT8 DRVCUST_Get_Series(void);
static const UINT8 AGENTConfig_CHA[24] =
{
//
  CHA_AGENT0_Audio,
  CHA_AGENT1_DEMUX_GCPU_DDI,
  CHA_AGENT2_VBI_3D_TVE_DOLBY,
  CHA_AGENT3_XRP,
  CHA_AGENT4_NONE,
  CHA_AGENT5_AUDIO_DSP,
  CHA_AGENT6_2DGRAPH,
  CHA_AGENT7_Ethernet_RS232,
  CHA_AGENT8_DEMOD,
  CHA_AGENT9_USB2,
  CHA_AGENT10_USB3D,
  CHA_AGENT11_MMU,
  CHA_AGENT12_ARM11,
  CHA_AGENT13_MSDC,
  CHA_AGENT14_GDMA,
  CHA_AGENT15_Test0,
  CHA_AGENT16_NFIDMA,
  CHA_AGENT17_UFOZIP,
  CHA_AGENT18_USB3C
};

UINT32 DRVCUST_Get_MVI_Val_Byte(UINT32 u4Addr)
{
    UINT8 u1Val = 0;
    EEPROM_Read((UINT64)u4Addr, (UPTR)(void*)&u1Val, (UINT32)sizeof(UINT8));
    return (UINT32)u1Val;
}

//----------------------------------------------------------------------------
/** DRVCUST_InitQuery() return initial customization paramter, use for loader or BSP.
 */
//----------------------------------------------------------------------------
INT32 DRVCUST_InitQuery(QUERY_TYPE_T eQryType, UINT32 *pu4Data)
{
#ifndef CC_MTK_PRELOADER
    if (DRVCUST_PanelQuery(eQryType, pu4Data)==0)
    {
        return 0;
    }
#endif /* CC_MTK_PRELOADER */

    ASSERT(pu4Data!=NULL);

    switch(eQryType)
    {
// Boot
    case eFlagBootVerbose:
        *pu4Data = (UINT32)DEFAULT_BOOT_VERBOSE;
        return 0;

    case eNorCpuClock:
        *pu4Data = (UINT32)DEFAULT_NOR_CPU_CLK;
        return 0;

    case eDramType:
        *pu4Data = (UINT32)DEFAULT_DRAM_TYPE;
        return 0;

    case eDramColAddr:
        *pu4Data = (UINT32)DEFAULT_DRAM_COLADDR;
        return 0;

    case eDdrClock:
        *pu4Data = (UINT32)(DRVCUST_DramClk(DEFAULT_DDR_CLOCK));
        return 0;

    case eDdrCL:
        *pu4Data = (UINT32)DEFAULT_DDR_CL;
        return 0;

    case eDdrBusX8:
        *pu4Data = (UINT32)DEFAULT_DDR_BUS_X8;
        return 0;

    case eDmpllSpectrumPermillage:
        *pu4Data = (UINT32)DMPLL_SPECTRUM_PERMILLAGE;
        return 0;

    case eDmpllSpectrumFrequency:
        *pu4Data = (UINT32)DMPLL_SPECTRUM_FREQUENCY;
        return 0;

    case eFlag1GBitSupport:
        *pu4Data = (UINT32)DEFAULT_DRAM_8_BANKS;
        return 0;

    case eFlagReadODT:
        *pu4Data = (UINT32)DEFAULT_DRAM_RODT;
        return 0;

    case eFlagWriteODT:
        *pu4Data = (UINT32)DEFAULT_DRAM_WODT;
        return 0;

    case eFlagDDRQfp:
        *pu4Data = (UINT32)FLAG_DDR_QFP;
        return 0;

	case eFlagDDRDCBalance:
		*pu4Data = (UINT32)FLAG_DDR_DCBALANCE;
        return 0;

	case eFlagDDRScramble:
		*pu4Data = (UINT32)FLAG_DDR_SCRAMBLE;
        return 0;

    case eFlagDDR16BitSwap:
        *pu4Data = (UINT32)FLAG_DDR_16BITSWAP;
        return 0;

    case eSysResetTimer:
        *pu4Data = (UINT32)((SYS_RESET_TIMER == 0x1000000) ? (SYS_RESET_TIMER - 1) : SYS_RESET_TIMER);
        return 0;
	case eHotBootWdtTimer:
	    *pu4Data = (UINT32)HOTBOOT_RESET_TIMER;
        return 0;
	case eSuspendWdtTimer:
	    *pu4Data = (UINT32)SUSPEND_RESET_TIMER;
        return 0;

    case eDramBurstLen:
        *pu4Data = (UINT32)DRAM_BURSTLEN;
        return 0;

    case eDramBurstLen0:
        *pu4Data = (UINT32)AGTIM0;
        return 0;

    case eDramBurstLen1:
        *pu4Data = (UINT32)AGTIM1;
        return 0;

    case eDramGroup1ArbiterTime:
        *pu4Data = (UINT32)DRAM_GROUP1ARBITERTIME;
        return 0;

    case eDramGroup2ArbiterTime:
        *pu4Data = (UINT32)DRAM_GROUP2ARBITERTIME;
        return 0;

    case eDramGroup3ArbiterTime:
        *pu4Data = (UINT32)DRAM_GROUP3ARBITERTIME;
        return 0;

    case eTrustzoneEnable:
#ifdef CC_TRUSTZONE_SUPPORT
        *pu4Data = (UINT32)1;
#else
        *pu4Data = (UINT32)0;
#endif
        return 0;

    case eTzCodeBase:
        *pu4Data = (UINT32)TRUSTZONE_CODE_BASE;
        return 0;
    case eTzFlashPartition:
        *pu4Data = (UINT32)TRUSTZONE_FLASH_PARTITION;
        return 0;


#ifndef CC_MTK_PRELOADER
    case eTunerTypeOfst0:
        *pu4Data = (UINT32) DEFAULT_TUNER_TYPE_OFST0;
        return 0;

    case eTunerTypeOfst1:
        *pu4Data = (UINT32) DEFAULT_TUNER_TYPE_OFST1;
        return 0;

    case eTunerTypeOfst2:
        *pu4Data = (UINT32) DEFAULT_TUNER_TYPE_OFST2;
        return 0;

// Fbm Size needed in loader.
    case eFbmMemSize:
	#if defined(CC_FBM_DYNMJC)
	if(DRVCUST_Get_InterMemc_type())
	{
	*pu4Data = FBM_MEM_CFG_MT5895_3DTV_MJC;
	}
	else
	{
	*pu4Data = FBM_MEM_CFG_MT5895_3DTV_NOMJC;
	}
	#else
     *pu4Data = (UINT32)FBM_MEM_CFG_SIZE;
	#endif
        return 0;
    case eFbmMemR20Start:
#ifdef CC_FBM_DYNMJC
        if(DRVCUST_Get_InterMemc_type()==0)
        {
        *pu4Data = (UINT32)0;
        }
        else
#endif
        {
#ifdef CC_TWO_MEM_REGION_BANK
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE - (TOTAL_MEM_SIZE - 0xC0000000));
#else
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE);
#endif
        }
        return 0;
    case eFbmMemR21Start:
#ifdef CC_FBM_DYNMJC
        if(DRVCUST_Get_InterMemc_type()==0)
        {
        *pu4Data = (UINT32)0;
        }
        else
#endif
        {
#ifdef CC_TWO_MEM_REGION_BANK
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE + FBM_MJC_R20_SIZE - (TOTAL_MEM_SIZE - 0xC0000000));
#else
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE + FBM_MJC_R20_SIZE);
#endif
        }
        return 0;
    case eFbmMem3DLUTStart:
#ifdef CC_FBM_DYNMJC
        if(DRVCUST_Get_InterMemc_type()==0)
        {
        *pu4Data = (UINT32)0;
        }
        else
#endif
        {
#ifdef CC_TWO_MEM_REGION_BANK
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE + FBM_MJC_R20_SIZE + FBM_MJC_R21_SIZE + FBM_LD_SIZE - (TOTAL_MEM_SIZE - 0xC0000000));
#else
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA - FBM_R2_TOTAL_SIZE + FBM_MJC_R20_SIZE + FBM_MJC_R21_SIZE + FBM_LD_SIZE);
#endif
        }
        return 0;

    case eFbmMemUartDMAStart:
#ifdef CC_TWO_MEM_REGION_BANK
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA + TRUSTZONE_MEM_SIZE_BL32 - UART_DMA_SIZE - (TOTAL_MEM_SIZE - 0xC0000000));
#else
        *pu4Data = (UINT32)(DRAM_START + TOTAL_MEM_SIZE - TRUSTZONE_MEM_SIZE_CHA + TRUSTZONE_MEM_SIZE_BL32 - UART_DMA_SIZE);
#endif
        return 0;
    case eFbmMemUartDMASize:
        *pu4Data = (UINT32)(UART_DMA_SIZE);
        return 0;

//Backlight PWM
    case eFlagControlBacklightPWM:
#ifdef CONTROL_BACKLIGHT_PWM
       *pu4Data = (UINT32)CONTROL_BACKLIGHT_PWM;
#else
       *pu4Data = (UINT32)0;
#endif // #ifdef CONTROL_BACKLIGHT_PWM
        return 0;

case eFbmMemChCStart:
        *pu4Data = (UINT32)TOTAL_MEM_SIZE + TOTAL_CHB_MEM_SIZE;
         return 0;

		 // Loader logo
    case eLoaderLogoNumber:
		 *pu4Data = (UINT32)LOADER_LOGO_NUMBER;
		 return 0;

// Usb upgrade
#ifdef CC_MTK_LOADER
    case eAutoUsbUpgradeEnable:
        *pu4Data = (UINT32)AUTO_USB_UPGRADE_ENABLE;
        return 0;

    case eEepromUsbUpgradeEnable:
        *pu4Data = (UINT32)EEPROM_USB_UPGRADE_ENABLE;
        return 0;

    case eUsbUpgradeForceDisable:
#ifndef LOADER_UPGRADE_FORCE_DISABLE_OFFSET
        return -1;
#else
        *pu4Data = (UINT32)LOADER_UPGRADE_FORCE_DISABLE_OFFSET;
        return 0;
#endif

    case eLoaderStandbyEnableIfUpgradeBreak:
        *pu4Data = (UINT32)LOADER_STANDBY_ENABLE_IF_UPGRADE_BREAK;
        return 0;

    case eLoaderUpgradeBreakStateOffset:
#ifndef LOADER_UPGRADE_BREAK_STATE_OFFSET
        return -1;
#else
        *pu4Data = (UINT32)LOADER_UPGRADE_BREAK_STATE_OFFSET;
        return 0;
#endif

    case eLoaderUpgradeDlmVerDataOff:
        *pu4Data = (UINT32)LOADER_UPGRADE_DLM_VER_DATA_OFF;
        return 0;

    case eLoaderUpgradeDlmVerDataLen:
        *pu4Data = (UINT32)LOADER_UPGRADE_DLM_VER_DATA_LEN;
        return 0;

    case eLoaderUpgradeDlmForceVer:
        *pu4Data = (UINT32)LOADER_UPGRADE_DLM_FORCE_VER;
        return 0;

    case eloaderUpgradeOnlyACon:
	    *pu4Data = (UINT32)LOADER_UPGRADE_ONLY_ACON;
	    return 0;
    case eloaderUpgradeAfterLoaderWriteFlagEepromAddress:
#ifndef DRVCUST_EEPROM_AFTER_LOADER_WRITE_FLAG_OFFSET
        *pu4Data = (UINT32)0;
        return -1;
#else
        *pu4Data = (UINT32)DRVCUST_EEPROM_AFTER_LOADER_WRITE_FLAG_OFFSET;
        return 0;
#endif
// Loader Misc
    case eReleaseLoaderEnableWatchDog:
    	*pu4Data = (UINT32)RELEASE_LOADER_ENABLE_WATCHDOG;
    	return 0;

    case eReleaseLoaderWatchdogTimeout:
    	*pu4Data = (UINT32)RELEASE_LOADER_WATCHDOG_TIMEOUT;
    	return 0;

    case eLoaderLogoBackground:
        *pu4Data = (UINT32)LOADER_LOGO_BACKGROUND;
        return 0;

    case eLoaderMsgBackground:
        *pu4Data = (UINT32)LOADER_MSG_BACKGROUND;
        return 0;

    case eLoaderLogoColorMode:
#ifndef LOADER_LOGO_COLOR_MODE
        return -1;
#else
        *pu4Data = (UINT32)LOADER_LOGO_COLOR_MODE;
        return 0;
#endif

    case eLoaderLogoFlashAddr:
        *pu4Data = (UINT32)LOADER_LOGO_FLASHADDR;
        return 0;

    case eLoaderDualBootOffset:
        *pu4Data = (UINT32)LOADER_DUAL_BOOT_OFFSET;
        return 0;
#endif

    case eT8032uPSize:
        *pu4Data = (UINT32)T8032UP_SIZE;
        return 0;

#ifdef CC_ENABLE_REBOOT_REASON
    case eRebootEepromAddress:
        *pu4Data = (UINT32)DRVCUST_EEPROM_ANDROID_OTA_OFFSET;
        return 0;

    case eRebootEepromSize:
        *pu4Data = (UINT32)DRVCUST_EEPROM_ANDROID_OTA_SIZE;
        return 0;
#endif

    case eMMCRecoveryEepromAddress:
#ifndef DRVCUST_EEPROM_EMMC_USB_RECOVERY_OFFSET
        *pu4Data = (UINT32)0;
        return -1;
#else
        *pu4Data = (UINT32)DRVCUST_EEPROM_EMMC_USB_RECOVERY_OFFSET;
        return 0;
#endif

    // NOR flash parameter.
    case eNorFlashTotalSize:
        *pu4Data = (UINT32)NOR_FLASH_TOTAL_SIZE;
        return 0;

    case eNorFlashAppImageSize:
        *pu4Data = (UINT32)NOR_FLASH_APPIMAGE_SIZE;
        return 0;

    case eNorFlashDynamicPartitionSize:
        *pu4Data = (UINT32)NOR_FLASH_DYNAMIC_PART_SIZE;
        return 0;

    case eNorFlashStaticPartitionSize:
        *pu4Data = (UINT32)NOR_FLASH_STATIC_PART_SIZE;
        return 0;

    case eNorFlashLoaderSize:
        *pu4Data = (UINT32)NOR_FLASH_LOADER_SIZE;
        return 0;

    case eNorFlashPartOffset0:
        *pu4Data = (UINT32)0;
        return 0;

    case eNorFlashPartOffset1:
        *pu4Data = (UINT32)NOR_PART_OFFSET_1;
        return 0;

    case eNorFlashPartOffset2:
        *pu4Data = (UINT32)NOR_PART_OFFSET_2;
        return 0;

    case eNorFlashPartOffset3:
        *pu4Data = (UINT32)NOR_PART_OFFSET_3;
        return 0;

    case eNorFlashPartOffset4:
        *pu4Data = (UINT32)NOR_PART_OFFSET_4;
        return 0;

    case eNorFlashPartOffset5:
        *pu4Data = (UINT32)NOR_PART_OFFSET_5;
        return 0;

    case eNorFlashPartOffset6:
        *pu4Data = (UINT32)NOR_PART_OFFSET_6;
        return 0;

    case eNorFlashPartOffset7:
        *pu4Data = (UINT32)NOR_PART_OFFSET_7;
        return 0;

    case eNorFlashPartOffset8:
        *pu4Data = (UINT32)NOR_PART_OFFSET_8;
        return 0;

    case eNorFlashPartOffset9:
        *pu4Data = (UINT32)NOR_PART_OFFSET_9;
        return 0;

    case eNorFlashPartOffset10:
        *pu4Data = (UINT32)NOR_PART_OFFSET_10;
        return 0;

    case eNorFlashPartOffset11:
        *pu4Data = (UINT32)NOR_PART_OFFSET_11;
        return 0;

    case eNorFlashPartOffset12:
        *pu4Data = (UINT32)NOR_PART_OFFSET_12;
        return 0;

    case eNorFlashPartOffset13:
        *pu4Data = (UINT32)NOR_PART_OFFSET_13;
        return 0;

    case eNorFlashPartOffset14:
        *pu4Data = (UINT32)NOR_PART_OFFSET_14;
        return 0;

    case eNorFlashPartOffset15:
        *pu4Data = (UINT32)NOR_PART_OFFSET_15;
        return 0;

    case eNorFlashPartOffset16:
        *pu4Data = (UINT32)NOR_PART_OFFSET_16;
        return 0;

    case eNorFlashPartOffset17:
        *pu4Data = (UINT32)NOR_PART_OFFSET_17;
        return 0;

    case eNorFlashPartOffset18:
        *pu4Data = (UINT32)NOR_PART_OFFSET_18;
        return 0;

    case eNorFlashPartOffset19:
        *pu4Data = (UINT32)NOR_PART_OFFSET_19;
        return 0;

    case eNorFlashPartOffset20:
        *pu4Data = (UINT32)NOR_PART_OFFSET_20;
        return 0;

    case eNorFlashPartOffset21:
        *pu4Data = (UINT32)NOR_PART_OFFSET_21;
        return 0;

    // NOR flash partition size customization
    case eNorFlashPartSize0:
        *pu4Data = (UINT32)NOR_PART_SIZE_0;
        return 0;

    case eNorFlashPartSize1:
        *pu4Data = (UINT32)NOR_PART_SIZE_1;
        return 0;

    case eNorFlashPartSize2:
        *pu4Data = (UINT32)NOR_PART_SIZE_2;
        return 0;

    case eNorFlashPartSize3:
        *pu4Data = (UINT32)NOR_PART_SIZE_3;
        return 0;

    case eNorFlashPartSize4:
        *pu4Data = (UINT32)NOR_PART_SIZE_4;
        return 0;

    case eNorFlashPartSize5:
        *pu4Data = (UINT32)NOR_PART_SIZE_5;
        return 0;

    case eNorFlashPartSize6:
        *pu4Data = (UINT32)NOR_PART_SIZE_6;
        return 0;

    case eNorFlashPartSize7:
        *pu4Data = (UINT32)NOR_PART_SIZE_7;
        return 0;
    case eNorFlashPartSize8:
        *pu4Data = (UINT32)NOR_PART_SIZE_8;
        return 0;

    case eNorFlashPartSize9:
        *pu4Data = (UINT32)NOR_PART_SIZE_9;
        return 0;

    case eNorFlashPartSize10:
        *pu4Data = (UINT32)NOR_PART_SIZE_10;
        return 0;

    case eNorFlashPartSize11:
        *pu4Data = (UINT32)NOR_PART_SIZE_11;
        return 0;

    case eNorFlashPartSize12:
        *pu4Data = (UINT32)NOR_PART_SIZE_12;
        return 0;

    case eNorFlashPartSize13:
        *pu4Data = (UINT32)NOR_PART_SIZE_13;
        return 0;

    case eNorFlashPartSize14:
        *pu4Data = (UINT32)NOR_PART_SIZE_14;
        return 0;

    case eNorFlashPartSize15:
        *pu4Data = (UINT32)NOR_PART_SIZE_15;
        return 0;

    case eNorFlashPartSize16:
        *pu4Data = (UINT32)NOR_PART_SIZE_16;
        return 0;

    case eNorFlashPartSize17:
        *pu4Data = (UINT32)NOR_PART_SIZE_17;
        return 0;

    case eNorFlashPartSize18:
        *pu4Data = (UINT32)NOR_PART_SIZE_18;
        return 0;

    case eNorFlashPartSize19:
        *pu4Data = (UINT32)NOR_PART_SIZE_19;
        return 0;

    case eNorFlashPartSize20:
        *pu4Data = (UINT32)NOR_PART_SIZE_20;
        return 0;

    case eNorFlashPartSize21:
        *pu4Data = (UINT32)NOR_PART_SIZE_21;
        return 0;

    case eVGAEDIDNorPartId:
        *pu4Data = (UINT32)VGAEDID_NOR_FLASH_PART_ID;
        return 0;

    case eVGAEDIDNorOffset:
        *pu4Data = (UINT32)VGAEDID_NOR_FLASH_OFFSET;
        return 0;

    case eHDMIEDIDNorPartId:
        *pu4Data = (UINT32)HDMIEDID_NOR_FLASH_PART_ID;
        return 0;

    case eHDMIEDIDNorOffset:
        *pu4Data = (UINT32)HDMIEDID_NOR_FLASH_OFFSET;
        return 0;

// NAND flash parameter
#if defined(CC_NAND_ENABLE) || defined(CC_EMMC_BOOT)
    case eNANDFlashTotalSize:
        *pu4Data = (UINT32)NAND_FLASH_TOTAL_SIZE;
        return 0;

    case eNANDFlashLoaderSize:
        *pu4Data = (UINT32)NAND_FLASH_LOADER_SIZE;
        return 0;

    case eNANDFlashStaticPartitionSize:
        *pu4Data = (UINT32)NAND_FLASH_STATIC_PART_SIZE;
        return 0;

    case eNANDFlashDynamicPartitionSize:
        *pu4Data = (UINT32)NAND_FLASH_DYNAMIC_PART_SIZE;
        return 0;

    case eNANDFlashStaticPartitionLastID:
        *pu4Data = (UINT32)NAND_FLASH_STATIC_LAST_PART_ID;
        return 0;

    case eNANDFlashDynamicPartitionID:
        *pu4Data = (UINT32)NAND_FLASH_DYNAMIC_PART_ID;
        return 0;

    case eNANDFlashPartIdSysImgA:
        *pu4Data = (UINT32)NAND_PART_ID_SYSIMG_A;
        return 0;

    case eNANDFlashPartIdUpA:
        *pu4Data = (UINT32)NAND_PART_ID_UP_A;
        return 0;

    case eNANDFlashPartIdSysImgB:
        *pu4Data = (UINT32)NAND_PART_ID_SYSIMG_B;
        return 0;

    case eNANDFlashPartIdUpB:
        *pu4Data = (UINT32)NAND_PART_ID_UP_B;
        return 0;

    case eNANDFlashPartIdChannelDataA:
        *pu4Data = (UINT32)NAND_PART_ID_CH_A;
        return 0;

    case eNANDFlashPartIdChannelDataB:
        *pu4Data = (UINT32)NAND_PART_ID_CH_B;
        return 0;

    case eNANDFlashPartIdEepromA:
        *pu4Data = (UINT32)NAND_PART_ID_EEPROM_A;
        return 0;

    case eNANDFlashPartIdEepromB:
        *pu4Data = (UINT32)NAND_PART_ID_EEPROM_B;
        return 0;

    // NAND flash partition offset customization
    case eNANDFlashPartOffset0:
        *pu4Data = (UINT32)0;
        return 0;

    case eNANDFlashPartOffset1:
        *pu4Data = (UINT32)NAND_PART_OFFSET_1;
        return 0;

    case eNANDFlashPartOffset2:
        *pu4Data = (UINT32)NAND_PART_OFFSET_2;
        return 0;

    case eNANDFlashPartOffset3:
        *pu4Data = (UINT32)NAND_PART_OFFSET_3;
        return 0;

    case eNANDFlashPartOffset4:
        *pu4Data = (UINT32)NAND_PART_OFFSET_4;
        return 0;

    case eNANDFlashPartOffset5:
        *pu4Data = (UINT32)NAND_PART_OFFSET_5;
        return 0;

    case eNANDFlashPartOffset6:
        *pu4Data = (UINT32)NAND_PART_OFFSET_6;
        return 0;

    case eNANDFlashPartOffset7:
        *pu4Data = (UINT32)NAND_PART_OFFSET_7;
        return 0;

    case eNANDFlashPartOffset8:
        *pu4Data = (UINT32)NAND_PART_OFFSET_8;
        return 0;

    case eNANDFlashPartOffset9:
        *pu4Data = (UINT32)NAND_PART_OFFSET_9;
        return 0;

    case eNANDFlashPartOffset10:
        *pu4Data = (UINT32)NAND_PART_OFFSET_10;
        return 0;

    case eNANDFlashPartOffset11:
        *pu4Data = (UINT32)NAND_PART_OFFSET_11;
        return 0;

    case eNANDFlashPartOffset12:
        *pu4Data = (UINT32)NAND_PART_OFFSET_12;
        return 0;

    case eNANDFlashPartOffset13:
        *pu4Data = (UINT32)NAND_PART_OFFSET_13;
        return 0;

    case eNANDFlashPartOffset14:
        *pu4Data = (UINT32)NAND_PART_OFFSET_14;
        return 0;

    case eNANDFlashPartOffset15:
        *pu4Data = (UINT32)NAND_PART_OFFSET_15;
        return 0;

    case eNANDFlashPartOffset16:
        *pu4Data = (UINT32)NAND_PART_OFFSET_16;
        return 0;

    case eNANDFlashPartOffset17:
        *pu4Data = (UINT32)NAND_PART_OFFSET_17;
        return 0;

    case eNANDFlashPartOffset18:
        *pu4Data = (UINT32)NAND_PART_OFFSET_18;
        return 0;

    case eNANDFlashPartOffset19:
        *pu4Data = (UINT32)NAND_PART_OFFSET_19;
        return 0;

    case eNANDFlashPartOffset20:
        *pu4Data = (UINT32)NAND_PART_OFFSET_20;
        return 0;

    case eNANDFlashPartOffset21:
        *pu4Data = (UINT32)NAND_PART_OFFSET_21;
        return 0;

    case eNANDFlashPartOffset22:
        *pu4Data = (UINT32)NAND_PART_OFFSET_22;
        return 0;

    case eNANDFlashPartOffset23:
        *pu4Data = (UINT32)NAND_PART_OFFSET_23;
        return 0;

    case eNANDFlashPartOffset24:
        *pu4Data = (UINT32)NAND_PART_OFFSET_24;
        return 0;

    case eNANDFlashPartOffset25:
        *pu4Data = (UINT32)NAND_PART_OFFSET_25;
        return 0;

    case eNANDFlashPartOffset26:
        *pu4Data = (UINT32)NAND_PART_OFFSET_26;
        return 0;

    case eNANDFlashPartOffset27:
        *pu4Data = (UINT32)NAND_PART_OFFSET_27;
        return 0;

    case eNANDFlashPartOffset28:
        *pu4Data = (UINT32)NAND_PART_OFFSET_28;
        return 0;

    case eNANDFlashPartOffset29:
        *pu4Data = (UINT32)NAND_PART_OFFSET_29;
        return 0;

    case eNANDFlashPartOffset30:
        *pu4Data = (UINT32)NAND_PART_OFFSET_30;
        return 0;

    case eNANDFlashPartOffset31:
        *pu4Data = (UINT32)NAND_PART_OFFSET_31;
        return 0;
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartOffset32:
        *pu4Data = (UINT32)NAND_PART_OFFSET_32;
        return 0;

    case eNANDFlashPartOffset33:
        *pu4Data = (UINT32)NAND_PART_OFFSET_33;
        return 0;

    case eNANDFlashPartOffset34:
        *pu4Data = (UINT32)NAND_PART_OFFSET_34;
        return 0;

    case eNANDFlashPartOffset35:
        *pu4Data = (UINT32)NAND_PART_OFFSET_35;
        return 0;

    case eNANDFlashPartOffset36:
        *pu4Data = (UINT32)NAND_PART_OFFSET_36;
        return 0;

    case eNANDFlashPartOffset37:
        *pu4Data = (UINT32)NAND_PART_OFFSET_37;
        return 0;

    case eNANDFlashPartOffset38:
        *pu4Data = (UINT32)NAND_PART_OFFSET_38;
        return 0;

    case eNANDFlashPartOffset39:
        *pu4Data = (UINT32)NAND_PART_OFFSET_39;
        return 0;

    case eNANDFlashPartOffset40:
        *pu4Data = (UINT32)NAND_PART_OFFSET_40;
        return 0;

    case eNANDFlashPartOffset41:
        *pu4Data = (UINT32)NAND_PART_OFFSET_41;
        return 0;

    case eNANDFlashPartOffset42:
        *pu4Data = (UINT32)NAND_PART_OFFSET_42;
        return 0;

    case eNANDFlashPartOffset43:
        *pu4Data = (UINT32)NAND_PART_OFFSET_43;
        return 0;

    case eNANDFlashPartOffset44:
        *pu4Data = (UINT32)NAND_PART_OFFSET_44;
        return 0;

    case eNANDFlashPartOffset45:
        *pu4Data = (UINT32)NAND_PART_OFFSET_45;
        return 0;

    case eNANDFlashPartOffset46:
        *pu4Data = (UINT32)NAND_PART_OFFSET_46;
        return 0;

    case eNANDFlashPartOffset47:
        *pu4Data = (UINT32)NAND_PART_OFFSET_47;
        return 0;

    case eNANDFlashPartOffset48:
        *pu4Data = (UINT32)NAND_PART_OFFSET_48;
        return 0;

    case eNANDFlashPartOffset49:
        *pu4Data = (UINT32)NAND_PART_OFFSET_49;
        return 0;

    case eNANDFlashPartOffset50:
        *pu4Data = (UINT32)NAND_PART_OFFSET_50;
        return 0;

    case eNANDFlashPartOffset51:
        *pu4Data = (UINT32)NAND_PART_OFFSET_51;
        return 0;

    case eNANDFlashPartOffset52:
        *pu4Data = (UINT32)NAND_PART_OFFSET_52;
        return 0;

    case eNANDFlashPartOffset53:
        *pu4Data = (UINT32)NAND_PART_OFFSET_53;
        return 0;

    case eNANDFlashPartOffset54:
        *pu4Data = (UINT32)NAND_PART_OFFSET_54;
        return 0;

    case eNANDFlashPartOffset55:
        *pu4Data = (UINT32)NAND_PART_OFFSET_55;
        return 0;

    case eNANDFlashPartOffset56:
        *pu4Data = (UINT32)NAND_PART_OFFSET_56;
        return 0;

    case eNANDFlashPartOffset57:
        *pu4Data = (UINT32)NAND_PART_OFFSET_57;
        return 0;

    case eNANDFlashPartOffset58:
        *pu4Data = (UINT32)NAND_PART_OFFSET_58;
        return 0;

    case eNANDFlashPartOffset59:
        *pu4Data = (UINT32)NAND_PART_OFFSET_59;
        return 0;

    case eNANDFlashPartOffset60:
        *pu4Data = (UINT32)NAND_PART_OFFSET_60;
        return 0;

    case eNANDFlashPartOffset61:
        *pu4Data = (UINT32)NAND_PART_OFFSET_61;
        return 0;

    case eNANDFlashPartOffset62:
        *pu4Data = (UINT32)NAND_PART_OFFSET_62;
        return 0;

    case eNANDFlashPartOffset63:
        *pu4Data = (UINT32)NAND_PART_OFFSET_63;
        return 0;
#endif
    // NAND flash partition size customization
    case eNANDFlashPartSize0:
        *pu4Data = (UINT32)NAND_PART_SIZE_0;
        return 0;

    case eNANDFlashPartSize1:
        *pu4Data = (UINT32)NAND_PART_SIZE_1;
        return 0;

    case eNANDFlashPartSize2:
        *pu4Data = (UINT32)NAND_PART_SIZE_2;
        return 0;

    case eNANDFlashPartSize3:
        *pu4Data = (UINT32)NAND_PART_SIZE_3;
        return 0;

    case eNANDFlashPartSize4:
        *pu4Data = (UINT32)NAND_PART_SIZE_4;
        return 0;

    case eNANDFlashPartSize5:
        *pu4Data = (UINT32)NAND_PART_SIZE_5;
        return 0;

    case eNANDFlashPartSize6:
        *pu4Data = (UINT32)NAND_PART_SIZE_6;
        return 0;

    case eNANDFlashPartSize7:
        *pu4Data = (UINT32)NAND_PART_SIZE_7;
        return 0;

    case eNANDFlashPartSize8:
        *pu4Data = (UINT32)NAND_PART_SIZE_8;
        return 0;

    case eNANDFlashPartSize9:
        *pu4Data = (UINT32)NAND_PART_SIZE_9;
        return 0;

    case eNANDFlashPartSize10:
        *pu4Data = (UINT32)NAND_PART_SIZE_10;
        return 0;

    case eNANDFlashPartSize11:
        *pu4Data = (UINT32)NAND_PART_SIZE_11;
        return 0;

    case eNANDFlashPartSize12:
        *pu4Data = (UINT32)NAND_PART_SIZE_12;
        return 0;

    case eNANDFlashPartSize13:
        *pu4Data = (UINT32)NAND_PART_SIZE_13;
        return 0;

    case eNANDFlashPartSize14:
        *pu4Data = (UINT32)NAND_PART_SIZE_14;
        return 0;

    case eNANDFlashPartSize15:
        *pu4Data = (UINT32)NAND_PART_SIZE_15;
        return 0;

    case eNANDFlashPartSize16:
        *pu4Data = (UINT32)NAND_PART_SIZE_16;
        return 0;

    case eNANDFlashPartSize17:
        *pu4Data = (UINT32)NAND_PART_SIZE_17;
        return 0;

    case eNANDFlashPartSize18:
        *pu4Data = (UINT32)NAND_PART_SIZE_18;
        return 0;

    case eNANDFlashPartSize19:
        *pu4Data = (UINT32)NAND_PART_SIZE_19;
        return 0;

    case eNANDFlashPartSize20:
        *pu4Data = (UINT32)NAND_PART_SIZE_20;
        return 0;

    case eNANDFlashPartSize21:
        *pu4Data = (UINT32)NAND_PART_SIZE_21;
        return 0;

    case eNANDFlashPartSize22:
        *pu4Data = (UINT32)NAND_PART_SIZE_22;
        return 0;

    case eNANDFlashPartSize23:
        *pu4Data = (UINT32)NAND_PART_SIZE_23;
        return 0;

    case eNANDFlashPartSize24:
        *pu4Data = (UINT32)NAND_PART_SIZE_24;
        return 0;

    case eNANDFlashPartSize25:
        *pu4Data = (UINT32)NAND_PART_SIZE_25;
        return 0;

    case eNANDFlashPartSize26:
        *pu4Data = (UINT32)NAND_PART_SIZE_26;
        return 0;

    case eNANDFlashPartSize27:
        *pu4Data = (UINT32)NAND_PART_SIZE_27;
        return 0;

    case eNANDFlashPartSize28:
        *pu4Data = (UINT32)NAND_PART_SIZE_28;
        return 0;

    case eNANDFlashPartSize29:
        *pu4Data = (UINT32)NAND_PART_SIZE_29;
        return 0;

    case eNANDFlashPartSize30:
        *pu4Data = (UINT32)NAND_PART_SIZE_30;
        return 0;

    case eNANDFlashPartSize31:
        *pu4Data = (UINT32)NAND_PART_SIZE_31;
        return 0;
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartSize32:
        *pu4Data = (UINT32)NAND_PART_SIZE_32;
        return 0;

    case eNANDFlashPartSize33:
        *pu4Data = (UINT32)NAND_PART_SIZE_33;
        return 0;

    case eNANDFlashPartSize34:
        *pu4Data = (UINT32)NAND_PART_SIZE_34;
        return 0;

    case eNANDFlashPartSize35:
        *pu4Data = (UINT32)NAND_PART_SIZE_35;
        return 0;

    case eNANDFlashPartSize36:
        *pu4Data = (UINT32)NAND_PART_SIZE_36;
        return 0;

    case eNANDFlashPartSize37:
        *pu4Data = (UINT32)NAND_PART_SIZE_37;
        return 0;

    case eNANDFlashPartSize38:
        *pu4Data = (UINT32)NAND_PART_SIZE_38;
        return 0;

    case eNANDFlashPartSize39:
        *pu4Data = (UINT32)NAND_PART_SIZE_39;
        return 0;

    case eNANDFlashPartSize40:
        *pu4Data = (UINT32)NAND_PART_SIZE_40;
        return 0;

    case eNANDFlashPartSize41:
        *pu4Data = (UINT32)NAND_PART_SIZE_41;
        return 0;

    case eNANDFlashPartSize42:
        *pu4Data = (UINT32)NAND_PART_SIZE_42;
        return 0;

    case eNANDFlashPartSize43:
        *pu4Data = (UINT32)NAND_PART_SIZE_43;
        return 0;

    case eNANDFlashPartSize44:
        *pu4Data = (UINT32)NAND_PART_SIZE_44;
        return 0;

    case eNANDFlashPartSize45:
        *pu4Data = (UINT32)NAND_PART_SIZE_45;
        return 0;

    case eNANDFlashPartSize46:
        *pu4Data = (UINT32)NAND_PART_SIZE_46;
        return 0;

    case eNANDFlashPartSize47:
        *pu4Data = (UINT32)NAND_PART_SIZE_47;
        return 0;

    case eNANDFlashPartSize48:
        *pu4Data = (UINT32)NAND_PART_SIZE_48;
        return 0;

    case eNANDFlashPartSize49:
        *pu4Data = (UINT32)NAND_PART_SIZE_49;
        return 0;

    case eNANDFlashPartSize50:
        *pu4Data = (UINT32)NAND_PART_SIZE_50;
        return 0;

    case eNANDFlashPartSize51:
        *pu4Data = (UINT32)NAND_PART_SIZE_51;
        return 0;

    case eNANDFlashPartSize52:
        *pu4Data = (UINT32)NAND_PART_SIZE_52;
        return 0;

    case eNANDFlashPartSize53:
        *pu4Data = (UINT32)NAND_PART_SIZE_53;
        return 0;

    case eNANDFlashPartSize54:
        *pu4Data = (UINT32)NAND_PART_SIZE_54;
        return 0;

    case eNANDFlashPartSize55:
        *pu4Data = (UINT32)NAND_PART_SIZE_55;
        return 0;

    case eNANDFlashPartSize56:
        *pu4Data = (UINT32)NAND_PART_SIZE_56;
        return 0;

    case eNANDFlashPartSize57:
        *pu4Data = (UINT32)NAND_PART_SIZE_57;
        return 0;

    case eNANDFlashPartSize58:
        *pu4Data = (UINT32)NAND_PART_SIZE_58;
        return 0;

    case eNANDFlashPartSize59:
        *pu4Data = (UINT32)NAND_PART_SIZE_59;
        return 0;

    case eNANDFlashPartSize60:
        *pu4Data = (UINT32)NAND_PART_SIZE_60;
        return 0;

    case eNANDFlashPartSize61:
        *pu4Data = (UINT32)NAND_PART_SIZE_61;
        return 0;

    case eNANDFlashPartSize62:
        *pu4Data = (UINT32)NAND_PART_SIZE_62;
        return 0;

    case eNANDFlashPartSize63:
        *pu4Data = (UINT32)NAND_PART_SIZE_63;
        return 0;
#endif
#ifdef CC_MTD_ENCRYPT_SUPPORT
    // NAND flash partition encypt customization
    case eNANDFlashPartEncypt0:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_0;
        return 0;

    case eNANDFlashPartEncypt1:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_1;
        return 0;

    case eNANDFlashPartEncypt2:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_2;
        return 0;

    case eNANDFlashPartEncypt3:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_3;
        return 0;

    case eNANDFlashPartEncypt4:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_4;
        return 0;

    case eNANDFlashPartEncypt5:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_5;
        return 0;

    case eNANDFlashPartEncypt6:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_6;
        return 0;

    case eNANDFlashPartEncypt7:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_7;
        return 0;

    case eNANDFlashPartEncypt8:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_8;
        return 0;

    case eNANDFlashPartEncypt9:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_9;
        return 0;

    case eNANDFlashPartEncypt10:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_10;
        return 0;

    case eNANDFlashPartEncypt11:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_11;
        return 0;

    case eNANDFlashPartEncypt12:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_12;
        return 0;

    case eNANDFlashPartEncypt13:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_13;
        return 0;

    case eNANDFlashPartEncypt14:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_14;
        return 0;

    case eNANDFlashPartEncypt15:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_15;
        return 0;

    case eNANDFlashPartEncypt16:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_16;
        return 0;

    case eNANDFlashPartEncypt17:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_17;
        return 0;

    case eNANDFlashPartEncypt18:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_18;
        return 0;

    case eNANDFlashPartEncypt19:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_19;
        return 0;

    case eNANDFlashPartEncypt20:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_20;
        return 0;

    case eNANDFlashPartEncypt21:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_21;
        return 0;

    case eNANDFlashPartEncypt22:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_22;
        return 0;

    case eNANDFlashPartEncypt23:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_23;
        return 0;

    case eNANDFlashPartEncypt24:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_24;
        return 0;

    case eNANDFlashPartEncypt25:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_25;
        return 0;

    case eNANDFlashPartEncypt26:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_26;
        return 0;

    case eNANDFlashPartEncypt27:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_27;
        return 0;

    case eNANDFlashPartEncypt28:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_28;
        return 0;

    case eNANDFlashPartEncypt29:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_29;
        return 0;

    case eNANDFlashPartEncypt30:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_30;
        return 0;

    case eNANDFlashPartEncypt31:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_31;
        return 0;
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartEncypt32:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_32;
        return 0;

    case eNANDFlashPartEncypt33:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_33;
        return 0;

    case eNANDFlashPartEncypt34:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_34;
        return 0;

    case eNANDFlashPartEncypt35:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_35;
        return 0;

    case eNANDFlashPartEncypt36:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_36;
        return 0;

    case eNANDFlashPartEncypt37:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_37;
        return 0;

    case eNANDFlashPartEncypt38:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_38;
        return 0;

    case eNANDFlashPartEncypt39:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_39;
        return 0;

    case eNANDFlashPartEncypt40:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_40;
        return 0;

    case eNANDFlashPartEncypt41:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_41;
        return 0;

    case eNANDFlashPartEncypt42:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_42;
        return 0;

    case eNANDFlashPartEncypt43:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_43;
        return 0;

    case eNANDFlashPartEncypt44:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_44;
        return 0;

    case eNANDFlashPartEncypt45:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_45;
        return 0;

    case eNANDFlashPartEncypt46:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_46;
        return 0;

    case eNANDFlashPartEncypt47:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_47;
        return 0;

    case eNANDFlashPartEncypt48:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_48;
        return 0;

    case eNANDFlashPartEncypt49:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_49;
        return 0;

    case eNANDFlashPartEncypt50:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_50;
        return 0;

    case eNANDFlashPartEncypt51:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_51;
        return 0;

    case eNANDFlashPartEncypt52:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_52;
        return 0;

    case eNANDFlashPartEncypt53:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_53;
        return 0;

    case eNANDFlashPartEncypt54:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_54;
        return 0;

    case eNANDFlashPartEncypt55:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_55;
        return 0;

    case eNANDFlashPartEncypt56:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_56;
        return 0;

    case eNANDFlashPartEncypt57:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_57;
        return 0;

    case eNANDFlashPartEncypt58:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_58;
        return 0;

    case eNANDFlashPartEncypt59:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_59;
        return 0;

    case eNANDFlashPartEncypt60:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_60;
        return 0;

    case eNANDFlashPartEncypt61:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_61;
        return 0;

    case eNANDFlashPartEncypt62:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_62;
        return 0;

    case eNANDFlashPartEncypt63:
        *pu4Data = (UINT32)NAND_PART_ENCRYPT_63;
        return 0;
#endif
#endif /* CC_MTD_ENCRYPT_SUPPORT */

#ifdef CC_PARTITION_WP_SUPPORT
        //  flash partition write protect customization
        case eNANDFlashPartWp0:
            *pu4Data = (UINT32)NAND_PART_WP_0;
            return 0;

        case eNANDFlashPartWp1:
            *pu4Data = (UINT32)NAND_PART_WP_1;
            return 0;

        case eNANDFlashPartWp2:
            *pu4Data = (UINT32)NAND_PART_WP_2;
            return 0;

        case eNANDFlashPartWp3:
            *pu4Data = (UINT32)NAND_PART_WP_3;
            return 0;

        case eNANDFlashPartWp4:
            *pu4Data = (UINT32)NAND_PART_WP_4;
            return 0;

        case eNANDFlashPartWp5:
            *pu4Data = (UINT32)NAND_PART_WP_5;
            return 0;

        case eNANDFlashPartWp6:
            *pu4Data = (UINT32)NAND_PART_WP_6;
            return 0;

        case eNANDFlashPartWp7:
            *pu4Data = (UINT32)NAND_PART_WP_7;
            return 0;

        case eNANDFlashPartWp8:
            *pu4Data = (UINT32)NAND_PART_WP_8;
            return 0;

        case eNANDFlashPartWp9:
            *pu4Data = (UINT32)NAND_PART_WP_9;
            return 0;

        case eNANDFlashPartWp10:
            *pu4Data = (UINT32)NAND_PART_WP_10;
            return 0;

        case eNANDFlashPartWp11:
            *pu4Data = (UINT32)NAND_PART_WP_11;
            return 0;

        case eNANDFlashPartWp12:
            *pu4Data = (UINT32)NAND_PART_WP_12;
            return 0;

        case eNANDFlashPartWp13:
            *pu4Data = (UINT32)NAND_PART_WP_13;
            return 0;

        case eNANDFlashPartWp14:
            *pu4Data = (UINT32)NAND_PART_WP_14;
            return 0;

        case eNANDFlashPartWp15:
            *pu4Data = (UINT32)NAND_PART_WP_15;
            return 0;

        case eNANDFlashPartWp16:
            *pu4Data = (UINT32)NAND_PART_WP_16;
            return 0;

        case eNANDFlashPartWp17:
            *pu4Data = (UINT32)NAND_PART_WP_17;
            return 0;

        case eNANDFlashPartWp18:
            *pu4Data = (UINT32)NAND_PART_WP_18;
            return 0;

        case eNANDFlashPartWp19:
            *pu4Data = (UINT32)NAND_PART_WP_19;
            return 0;

        case eNANDFlashPartWp20:
            *pu4Data = (UINT32)NAND_PART_WP_20;
            return 0;

        case eNANDFlashPartWp21:
            *pu4Data = (UINT32)NAND_PART_WP_21;
            return 0;

        case eNANDFlashPartWp22:
            *pu4Data = (UINT32)NAND_PART_WP_22;
            return 0;

        case eNANDFlashPartWp23:
            *pu4Data = (UINT32)NAND_PART_WP_23;
            return 0;

        case eNANDFlashPartWp24:
            *pu4Data = (UINT32)NAND_PART_WP_24;
            return 0;

        case eNANDFlashPartWp25:
            *pu4Data = (UINT32)NAND_PART_WP_25;
            return 0;

        case eNANDFlashPartWp26:
            *pu4Data = (UINT32)NAND_PART_WP_26;
            return 0;

        case eNANDFlashPartWp27:
            *pu4Data = (UINT32)NAND_PART_WP_27;
            return 0;

        case eNANDFlashPartWp28:
            *pu4Data = (UINT32)NAND_PART_WP_28;
            return 0;

        case eNANDFlashPartWp29:
            *pu4Data = (UINT32)NAND_PART_WP_29;
            return 0;

        case eNANDFlashPartWp30:
            *pu4Data = (UINT32)NAND_PART_WP_30;
            return 0;

        case eNANDFlashPartWp31:
            *pu4Data = (UINT32)NAND_PART_WP_31;
            return 0;
#ifdef CC_MTD_SUPPORT_64_PARTITION
        case eNANDFlashPartWp32:
            *pu4Data = (UINT32)NAND_PART_WP_32;
            return 0;

        case eNANDFlashPartWp33:
            *pu4Data = (UINT32)NAND_PART_WP_33;
            return 0;

        case eNANDFlashPartWp34:
            *pu4Data = (UINT32)NAND_PART_WP_34;
            return 0;

        case eNANDFlashPartWp35:
            *pu4Data = (UINT32)NAND_PART_WP_35;
            return 0;

        case eNANDFlashPartWp36:
            *pu4Data = (UINT32)NAND_PART_WP_36;
            return 0;

        case eNANDFlashPartWp37:
            *pu4Data = (UINT32)NAND_PART_WP_37;
            return 0;

        case eNANDFlashPartWp38:
            *pu4Data = (UINT32)NAND_PART_WP_38;
            return 0;

        case eNANDFlashPartWp39:
            *pu4Data = (UINT32)NAND_PART_WP_39;
            return 0;

        case eNANDFlashPartWp40:
            *pu4Data = (UINT32)NAND_PART_WP_40;
            return 0;

        case eNANDFlashPartWp41:
            *pu4Data = (UINT32)NAND_PART_WP_41;
            return 0;

        case eNANDFlashPartWp42:
            *pu4Data = (UINT32)NAND_PART_WP_42;
            return 0;

        case eNANDFlashPartWp43:
            *pu4Data = (UINT32)NAND_PART_WP_43;
            return 0;

        case eNANDFlashPartWp44:
            *pu4Data = (UINT32)NAND_PART_WP_44;
            return 0;

        case eNANDFlashPartWp45:
            *pu4Data = (UINT32)NAND_PART_WP_45;
            return 0;

        case eNANDFlashPartWp46:
            *pu4Data = (UINT32)NAND_PART_WP_46;
            return 0;

        case eNANDFlashPartWp47:
            *pu4Data = (UINT32)NAND_PART_WP_47;
            return 0;

        case eNANDFlashPartWp48:
            *pu4Data = (UINT32)NAND_PART_WP_48;
            return 0;

        case eNANDFlashPartWp49:
            *pu4Data = (UINT32)NAND_PART_WP_49;
            return 0;

        case eNANDFlashPartWp50:
            *pu4Data = (UINT32)NAND_PART_WP_50;
            return 0;

        case eNANDFlashPartWp51:
            *pu4Data = (UINT32)NAND_PART_WP_51;
            return 0;

        case eNANDFlashPartWp52:
            *pu4Data = (UINT32)NAND_PART_WP_52;
            return 0;

        case eNANDFlashPartWp53:
            *pu4Data = (UINT32)NAND_PART_WP_53;
            return 0;

        case eNANDFlashPartWp54:
            *pu4Data = (UINT32)NAND_PART_WP_54;
            return 0;

        case eNANDFlashPartWp55:
            *pu4Data = (UINT32)NAND_PART_WP_55;
            return 0;

        case eNANDFlashPartWp56:
            *pu4Data = (UINT32)NAND_PART_WP_56;
            return 0;

        case eNANDFlashPartWp57:
            *pu4Data = (UINT32)NAND_PART_WP_57;
            return 0;

        case eNANDFlashPartWp58:
            *pu4Data = (UINT32)NAND_PART_WP_58;
            return 0;

        case eNANDFlashPartWp59:
            *pu4Data = (UINT32)NAND_PART_WP_59;
            return 0;

        case eNANDFlashPartWp60:
            *pu4Data = (UINT32)NAND_PART_WP_60;
            return 0;

        case eNANDFlashPartWp61:
            *pu4Data = (UINT32)NAND_PART_WP_61;
            return 0;

        case eNANDFlashPartWp62:
            *pu4Data = (UINT32)NAND_PART_WP_62;
            return 0;

        case eNANDFlashPartWp63:
            *pu4Data = (UINT32)NAND_PART_WP_63;
            return 0;
#endif
#endif /* CC_PARTITION_WP_SUPPORT */
    case eNANDFlashPartEnd:
        *pu4Data = (UINT32)NAND_PART_END;
        return 0;

    case eVGAEDIDNANDPartId:
        *pu4Data = (UINT32)VGAEDID_NAND_FLASH_PART_ID;
        return 0 ;

    case eVGAEDIDNANDOffset:
        *pu4Data = (UINT32)VGAEDID_NAND_FLASH_OFFSET;
        return 0 ;

    case eHDMIEDIDNANDPartId:
        *pu4Data = (UINT32)HDMIEDID_NAND_FLASH_PART_ID;
        return 0 ;

    case eHDMIEDIDNANDOffset:
        *pu4Data = (UINT32)HDMIEDID_NAND_FLASH_OFFSET;
        return 0 ;
#endif // CC_NAND_ENABLE

    // System EEPROM
    case eSystemEepromBus:
        *pu4Data = (UINT32) SYSTEM_EEPROM_BUS;
        return 0;

    case eSystemEepromAddress:
        *pu4Data = (UINT32) SYSTEM_EEPROM_ADDRESS;
        return 0;

    case eSystemEepromSize:
        *pu4Data = (UINT32)SYSTEM_EEPROM_SIZE;
        return 0;

    case eSystemEepromClkDiv:
        *pu4Data = (UINT32)SYSTEM_EEPROM_CLKDIV;
        return 0;

    case eSystemEepromPageSize:
        *pu4Data = (UINT32)SYSTEM_EEPROM_PAGESIZE;
        return 0;

#ifdef CC_EEP2EMMC_DUAL_BANK_SUPPORT
    case eSystemEepHeaderSize:
#ifdef SYSTEM_EEPROM_HEADER_SIZE
        *pu4Data = (UINT32) SYSTEM_EEPROM_HEADER_SIZE;
#else
        *pu4Data = (UINT32) (300*1024);
#endif
        return 0;

    case eSystemEepInitHeaderSize:
#ifdef SYSTEM_EEPROM_INIT_HEADER_SIZE
        *pu4Data = (UINT32) SYSTEM_EEPROM_INIT_HEADER_SIZE;
#else
        *pu4Data = (UINT32) 4096;
#endif
        return 0;
#endif

    case eHdmiEdidPARx0:
#ifdef HDMI_RX0_PA
        *pu4Data = (UINT32)HDMI_RX0_PA;
#else
        *pu4Data = (UINT32)0;
#endif
        return 0;

    case eHdmiEdidPARx1:
#ifdef HDMI_RX1_PA
        *pu4Data = (UINT32)HDMI_RX1_PA;
#else
        *pu4Data = (UINT32)0;
#endif
        return 0;

    case eHdmiEdidPARx2:
#ifdef HDMI_RX2_PA
        *pu4Data = (UINT32)HDMI_RX2_PA;
#else
        *pu4Data = (UINT32)0;
#endif
        return 0;

    case eHdmiEdidPARx3:
#ifdef HDMI_RX3_PA
        *pu4Data = (UINT32)HDMI_RX3_PA;
#else
        *pu4Data = (UINT32)0;
#endif
        return 0;

#ifdef SYSTEM_EEPROM_WP_GPIO
    case eSysEepromWPGpio:
        *pu4Data = (UINT32)SYSTEM_EEPROM_WP_GPIO;
        return 0;
#endif

#ifdef SYSTEM_EEPROM_WP_ENABLE_POLARITY
    case eSysEepromWPEnablePolarity:
        *pu4Data = (UINT32)SYSTEM_EEPROM_WP_ENABLE_POLARITY;
        return 0;
#endif

    case eSysEepromResetTime:
        *pu4Data = (UINT32)SYSTEM_EEPROM_WAIT_TIME;
        return 0;

    case eSysEepromEnableRetry:
        *pu4Data = (UINT32)SYSTEM_EEPROM_ENABLE_RETRY;
        return 0;

    // HDCP EEPROM
    case eHdcpEepromBus:
        *pu4Data = (UINT32) HDCP_EEPROM_BUS;
        return 0;

    case eHdcpEepromAddress:
        *pu4Data = (UINT32) HDCP_EEPROM_ADDRESS;
        return 0;

    case eHdcpEepromSize:
        *pu4Data = (UINT32)HDCP_EEPROM_SIZE;
        return 0;

    case eHdcpEepromClkDiv:
        *pu4Data = (UINT32)HDCP_EEPROM_CLKDIV;
        return 0;

    case eHdcpEepromOffset:
        *pu4Data = (UINT32) HDCP_EEPROM_OFFSET;
        return 0;

#ifdef HDCP_EEPROM_WP_GPIO
    case eHdcpEepromWPGpio:
        *pu4Data = (UINT32)HDCP_EEPROM_WP_GPIO;
        return 0;
#endif

#ifdef HDCP_EEPROM_WP_ENABLE_POLARITY
    case eHdcpEepromWPEnablePolarity:
        *pu4Data = (UINT32)HDCP_EEPROM_WP_ENABLE_POLARITY;
        return 0;
#endif

#ifdef DRVCUST_EEPROM_VGA_EDID_OFFSET
    case eEepromVgaEdidOffset:
        *pu4Data = (UINT32)DRVCUST_EEPROM_VGA_EDID_OFFSET;
        return 0;
#endif

#ifdef DRVCUST_VGA_EDID_SIZE
    case eEdidVgaSize:
        *pu4Data = (UINT32)DRVCUST_VGA_EDID_SIZE;
        return 0;
#endif

    case eEdidVgaStorageSize:
    #ifdef CC_NAND_ENABLE
        *pu4Data = (UINT32)HDMIEDID_NAND_FLASH_PART_SIZE;
    #elif defined(DRVCUST_VGA_EDID_STORAGE_SIZE)
        *pu4Data = (UINT32)DRVCUST_VGA_EDID_STORAGE_SIZE;
    #else
        return -1 ;
#endif
        return 0;
#ifdef DRVCUST_EEPROM_HDMI_EDID_OFFSET
    case eEepromHdmiEdidOffset:
        *pu4Data = (UINT32)DRVCUST_EEPROM_HDMI_EDID_OFFSET;
        return 0;
#endif

#ifdef DRVCUST_HDMI_EDID_SIZE
    case eEdidHdmiSize:
        *pu4Data = (UINT32)DRVCUST_HDMI_EDID_SIZE;
        return 0;
#endif

    case eEdidHdmiStorageSize:
    #ifdef CC_NAND_ENABLE
        *pu4Data = (UINT32)HDMIEDID_NAND_FLASH_PART_SIZE;
    #elif defined(DRVCUST_HDMI_EDID_STORAGE_SIZE)
        *pu4Data = (UINT32)DRVCUST_HDMI_EDID_STORAGE_SIZE;
    #else
        return -1;
#endif
        return 0;

#ifdef MHL_EDID_FLASH_PART_ID
    case eEdidMhlFlashId:
        *pu4Data = (UINT32)MHL_EDID_FLASH_PART_ID;
        return 0;
#endif

#ifdef MHL_EDID_OFFSET
    case eEdidMhlOffset:
        *pu4Data = (UINT32)MHL_EDID_OFFSET;
        return 0;
#endif

#ifdef MHL_EDID_STORAGE_SIZE
    case eEdidMhlStorageSize:
        *pu4Data = (UINT32)MHL_EDID_STORAGE_SIZE;
        return 0;
#endif

#ifdef HDMI2_EDID_STANDARD_PART_ID
    case eEdidHdmi2StandardFlashId:
        *pu4Data = (UINT32)HDMI2_EDID_STANDARD_PART_ID;
        return 0;
#endif

#ifdef HDMI2_EDID_STANDARD_OFFSET
    case eEdidHdmi2StandardOffset:
        *pu4Data = (UINT32)HDMI2_EDID_STANDARD_OFFSET;
        return 0;
#endif

#ifdef HDMI2_EDID_STANDARD_STORAGE_SIZE
    case eEdidHdmi2StandardStorageSize:
        *pu4Data = (UINT32)HDMI2_EDID_STANDARD_STORAGE_SIZE;
        return 0;
#endif

#ifdef HDMI2_EDID_ENHANCE_PART_ID
    case eEdidHdmi2EnhanceFlashId:
        *pu4Data = (UINT32)HDMI2_EDID_ENHANCE_PART_ID;
        return 0;
#endif

#ifdef HDMI2_EDID_ENHANCE_OFFSET
    case eEdidHdmi2EnhanceOffset:
        *pu4Data = (UINT32)HDMI2_EDID_ENHANCE_OFFSET;
        return 0;
#endif

#ifdef HDMI2_EDID_ENHANCE_STORAGE_SIZE
    case eEdidHdmi2EnhanceStorageSize:
        *pu4Data = (UINT32)HDMI2_EDID_ENHANCE_STORAGE_SIZE;
        return 0;
#endif

#ifdef HDMI_HDCP22_PART_ID
    case eHdmiHdcp22FlashId:
        *pu4Data = (UINT32)HDMI_HDCP22_PART_ID;
        return 0;
#endif

#ifdef HDMI_HDCP22_OFFSET
    case eHdmiHdcp22Offset:
        *pu4Data = (UINT32)HDMI_HDCP22_OFFSET;
        return 0;
#endif

#ifdef HDMI_HDCP22_STORAGE_SIZE
    case eHdmiHdcp22StorageSize:
        *pu4Data = (UINT32)HDMI_HDCP22_STORAGE_SIZE;
        return 0;
#endif

#ifdef EEPROM_VGA_EDID_INDEX_OFFSET
    case eEdidVgaIndexOffset:
        *pu4Data = (UINT32)EEPROM_VGA_EDID_INDEX_OFFSET;
        return 0;
#endif

#ifdef EEPROM_HDMI_EDID_FORMAT_OFFSET
    case eEdidHdmiFormatOffset:
        *pu4Data = (UINT32)EEPROM_HDMI_EDID_FORMAT_OFFSET;
        return 0;
#endif

#ifdef EEPROM_HDMI_EDID_LDDP_OFFSET
    case eEdidHdmiLddpOffset:
        *pu4Data = (UINT32)EEPROM_HDMI_EDID_LDDP_OFFSET;
        return 0;
#endif

    // System EEPROM Layout Configuration
#ifdef DRVCUST_EEPROM_HDMI_HDCP_OFFSET
    case eEepromHdmiHdcpOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_HDMI_HDCP_OFFSET;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_HDMI_HDCP_SIZE
    case eEepromHdmiHdcpSize:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_HDMI_HDCP_SIZE;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_DTV_DRIVER_OFFSET
    case eEepromDtvDriverOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_DTV_DRIVER_OFFSET;
          return 0;
#endif

#ifdef WFD_HDCP22_PART_ID
    case eWfdHdcp22FlashId:
        *pu4Data = (UINT32)WFD_HDCP22_PART_ID;
        return 0;
#endif

#ifdef WFD_HDCP22_OFFSET
    case eWfdHdcp22Offset:
        *pu4Data = (UINT32)WFD_HDCP22_OFFSET;
        return 0;
#endif


#ifdef DRVCUST_EEPROM_DTV_DRIVER_SIZE
    case eEepromDtvDriverSize:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_DTV_DRIVER_SIZE ;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_NPTV_DRIVER_OFFSET
    case eEepromNptvDriverOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_NPTV_DRIVER_OFFSET ;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_NPTV_DRIVER_SIZE
    case eEepromNptvDriverSize:
         *pu4Data = (UINT32)DRVCUST_EEPROM_NPTV_DRIVER_SIZE ;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_DRIVER_SIZE
    case eEepromDriverSize:
         *pu4Data = (UINT32)DRVCUST_EEPROM_DRIVER_SIZE ;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_MW_OFFSET
    case eEepromMwOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_MW_OFFSET ;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_MW_SIZE
    case eEepromMwSize:
         *pu4Data = (UINT32)DRVCUST_EEPROM_MW_SIZE ;
          return 0;
#endif

#if 1
#ifdef DRVCUST_EEPROM_HDCP2X_OFFSET
	case eEepromHDCP2xOffset:
		*pu4Data = (UINT32)DRVCUST_EEPROM_HDCP2X_OFFSET;
		return 0;
#endif

#ifdef DRVCUST_EEPROM_HDCP2X_SIZE
	case eEepromHDCP2xSize:
		*pu4Data = (UINT32)DRVCUST_EEPROM_HDCP2X_SIZE;
		return 0;
#endif
#endif
    case eHdmiHpdRTCToggle:
         *pu4Data = (UINT32)EEPROM_HDMI_HPD_RTC_TOGGLE_OFFSET;
         return 0;

     case eHdmiEARCEnable:
          *pu4Data = (UINT32)EEPROM_HDMI_EARC_ENABLE_OFFSET;
          return 0;

#ifdef DRVCUST_EEPROM_ERROR_CODE_OFFSET
    case eEepromErrorCodeOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_ERROR_CODE_OFFSET;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_ERROR_CODE_SIZE
    case eEepromErrorCodeSize:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_ERROR_CODE_SIZE;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_STATE_CODE_OFFSET
    case eEepromStateCodeOffset:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_STATE_CODE_OFFSET;
          return 0;
#endif

#ifdef DRVCUST_EEPROM_STATE_CODE_SIZE
    case eEepromStateCodeSize:
         *pu4Data =  (UINT32)DRVCUST_EEPROM_STATE_CODE_SIZE;
          return 0;
#endif

    case eEepromCECMenuLanguageOffset:
         *pu4Data = (UINT32)EEPROM_CEC_MENU_LANGUAGE_OFFSET;
         return 0;

    case eEepromCECEnableOffset:
         *pu4Data = (UINT32)EEPROM_CEC_ENABLE_OFFSET;//bit 0 for cec enable & disable
         return 0;
    case eEepromNHLRCPOffset:
         *pu4Data = (UINT32)EEPROM_MHL_RCP_RECEIVE_OFFSET;//bit 1 for mhl rcp received
          return 0;
    case eEepromCECOneTouchPlayEnableOffset:
        *pu4Data = (UINT32)EEPROM_CEC_ONE_TOUCH_PLAY_ENABLE_OFFSET;
        return 0;

    case eEepromDataMemOffset:
        *pu4Data = (UINT32)DRVCUST_EEPROM_DATA_MEM_OFFSET;
        return 0;

    case eEepromGammaAddr:
#ifdef EEPROM_DRIVER_EXT_GAMMA_ADDR
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_GAMMA_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromGammaCheckAddr:
#ifdef EEPROM_DRIVER_EXT_GAMMA_CHECK_ADDR
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_GAMMA_CHECK_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromGammaCheckAddr1:
#ifdef EEPROM_DRIVER_EXT_GAMMA_CHECK_ADDR_1
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_GAMMA_CHECK_ADDR_1;
        return 0;
#else
        return -1;
#endif

    case eEepromGammaSize:
#ifdef EEPROM_DRIVER_EXT_GAMMA_SIZE
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_GAMMA_SIZE;
        return 0;
#else
        return -1;
#endif

    case eEepromWatchdogFlagAddr:
#ifdef EEPROM_DRIVER_EXT_WATCHDOG_FLAG_ADDR
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_WATCHDOG_FLAG_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromDIAGFlagAddr:
#ifdef EEPROM_DRIVER_EXT_DIAG_FLAG_ADDR
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_DIAG_FLAG_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromStoreDemoAddr:
#ifdef EEPROM_STORE_DEMO_ADDR
        *pu4Data = (UINT32)EEPROM_STORE_DEMO_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromVLogoAddr:
#ifdef EEPROM_VLOGO_FLAG_ADDR
        *pu4Data = (UINT32)EEPROM_VLOGO_FLAG_ADDR;
        return 0;
#else
        return -1;
#endif

    case eEepromFactoryModeAddr:
#ifdef EEPROM_DRIVER_EXT_BURNING_MODE_ADDR
        *pu4Data = (UINT32)EEPROM_DRIVER_EXT_BURNING_MODE_ADDR;
        return 0;
#else
        return -1;
#endif

    // USB Loader polling time in ms.
    // If not define, it will use default: MUSB_LOADER_MAX_WAIT_TIME in musb_if.c.
#ifdef USB_LOADER_WAIT_TIME
    case eUSBLoaderWaitTime:
        *pu4Data = (UINT32)USB_LOADER_WAIT_TIME;
        return 0;
#endif

#ifdef USB0_PORT_USING_LOADER
    case eUSB0LoaderConfig:
    *pu4Data = (UINT32)USB0_PORT_USING_LOADER;
    return 0;
#endif

#ifdef USB1_PORT_USING_LOADER
    case eUSB1LoaderConfig:
    *pu4Data = (UINT32)USB1_PORT_USING_LOADER;
    return 0;
#endif

#ifdef USB2_PORT_USING_LOADER
    case eUSB2LoaderConfig:
    *pu4Data = (UINT32)USB2_PORT_USING_LOADER;
    return 0;
#endif

#ifdef USB3_PORT_USING_LOADER
    case eUSB3LoaderConfig:
    *pu4Data = (UINT32)USB3_PORT_USING_LOADER;
        return 0;
#endif

#ifdef USB0_PORT_USING
    case eUSB0Config:
    *pu4Data = (UINT32)USB0_PORT_USING;
    return 0;
#endif

#ifdef USB1_PORT_USING
    case eUSB1Config:
    *pu4Data = (UINT32)USB1_PORT_USING;
    return 0;
#endif

#ifdef USB2_PORT_USING
    case eUSB2Config:
    *pu4Data = (UINT32)USB2_PORT_USING;
    return 0;
#endif

#ifdef USB3_PORT_USING
    case eUSB3Config:
    *pu4Data = (UINT32)USB3_PORT_USING;
    return 0;
#endif

     // USB delay resume control
#ifdef USB0_DELAY_RESUME_USING
     case eUSB0DelayResume:
     *pu4Data = (UINT32)USB0_DELAY_RESUME_USING;
     return 0;
#endif

#ifdef USB1_DELAY_RESUME_USING
      case eUSB1DelayResume:
      *pu4Data = (UINT32)USB1_DELAY_RESUME_USING;
      return 0;
#endif

#ifdef USB2_DELAY_RESUME_USING
      case eUSB2DelayResume:
      *pu4Data = (UINT32)USB2_DELAY_RESUME_USING;
      return 0;
#endif

#ifdef USB3_DELAY_RESUME_USING
      case eUSB3DelayResume:
      *pu4Data = (UINT32)USB3_DELAY_RESUME_USING;
      return 0;
#endif

    // USB0 vbus control.
#ifdef USB0_VBUS_GPIO
    case eUSBVbus0Gpio:
        *pu4Data = (UINT32)USB0_VBUS_GPIO;
        return 0;
#endif

#ifdef USB0_VBUS_GPIO_POLARITY
    case eUSBVbus0EnablePolarity:
        *pu4Data = (UINT32)USB0_VBUS_GPIO_POLARITY;
        return 0;
#endif

    // USB1 vbus control.
#ifdef USB1_VBUS_GPIO
    case eUSBVbus1Gpio:
        *pu4Data = (UINT32)USB1_VBUS_GPIO;
        return 0;
#endif

#ifdef USB1_VBUS_GPIO_POLARITY
    case eUSBVbus1EnablePolarity:
        *pu4Data = (UINT32)USB1_VBUS_GPIO_POLARITY;
        return 0;
#endif

    // USB2 vbus control.
#ifdef USB2_VBUS_GPIO
    case eUSBVbus2Gpio:
        *pu4Data = (UINT32)USB2_VBUS_GPIO;
        return 0;
#endif
#ifdef USB2_VBUS_GPIO_POLARITY
    case eUSBVbus2EnablePolarity:
        *pu4Data = (UINT32)USB2_VBUS_GPIO_POLARITY;
        return 0;
#endif

    // USB3 vbus control.
#ifdef USB3_VBUS_GPIO
    case eUSBVbus3Gpio:
        *pu4Data = (UINT32)USB3_VBUS_GPIO;
        return 0;
#endif
#ifdef USB3_VBUS_GPIO_POLARITY
    case eUSBVbus3EnablePolarity:
        *pu4Data = (UINT32)USB3_VBUS_GPIO_POLARITY;
        return 0;
#endif

    // USB0 over current flag enable.
#ifdef USB0_OC_GPIO
    case eUSB0OCGpio:
        *pu4Data = (UINT32)USB0_OC_GPIO;
        return 0;
#endif

#ifdef USB0_OC_GPIO_POLARITY
    case eUSB0OCEnablePolarity:
        *pu4Data = (UINT32)USB0_OC_GPIO_POLARITY;
        return 0;
#endif

    // USB1 over current flag enable.
#ifdef USB1_OC_GPIO
    case eUSB1OCGpio:
        *pu4Data = (UINT32)USB1_OC_GPIO;
        return 0;
#endif

#ifdef USB1_OC_GPIO_POLARITY
    case eUSB1OCEnablePolarity:
        *pu4Data = (UINT32)USB1_OC_GPIO_POLARITY;
        return 0;
#endif

    // USB2 over current flag enable.
#ifdef USB2_OC_GPIO
    case eUSB2OCGpio:
        *pu4Data = (UINT32)USB2_OC_GPIO;
        return 0;
#endif

#ifdef USB2_OC_GPIO_POLARITY
    case eUSB2OCEnablePolarity:
        *pu4Data = (UINT32)USB2_OC_GPIO_POLARITY;
        return 0;
#endif

    // USB3 over current flag enable.
#ifdef USB3_OC_GPIO
    case eUSB3OCGpio:
        *pu4Data = (UINT32)USB3_OC_GPIO;
        return 0;
#endif

#ifdef USB3_OC_GPIO_POLARITY
    case eUSB3OCEnablePolarity:
        *pu4Data = (UINT32)USB3_OC_GPIO_POLARITY;
        return 0;
#endif

    // USB HSTERMC impedance control.
#ifdef USB_HSTERMC
    case eUSBHSTERMC:
        *pu4Data = (UINT32)USB_HSTERMC;
        return 0;
#endif

    // USB vbus turn on delay (ms).
#ifdef USB_VBUS_TURN_ON_DELAY
    case eUSBVbusTurnOnDelay:
        *pu4Data = (UINT32)USB_VBUS_TURN_ON_DELAY;
        return 0;
#endif

    // USB Full speed only enable
#ifdef USB_FULL_SPEED_ONLY_ENABLE
    case eUSBFullSpeedOnlyEnable:
        *pu4Data = (UINT32)TRUE;
        return 0;
#endif

    // USB disable suspend mode.
#ifdef USB_DISABLE_SUSPEND_MODE
    case eUSBDisableSuspendMode:
        *pu4Data = (UINT32)TRUE;
        return 0;
#endif
#ifdef CC_UBOOT_ADD_USB_LOG_MODE
    case eFlagIsUsbLogMode:
    #ifdef _IS_USB_LOG_MODE
        *pu4Data = (UINT32)_IS_USB_LOG_MODE;
        return 0;
    #else
        return -1;
    #endif
#endif

// MSDC DETECT GPIO control.
#ifdef MSDC_DETECT_GPIO
    case eMSDC0DetectGpio:
        *pu4Data = MSDC_DETECT_GPIO;
        return 0;
#endif

// MSDC WRITE PROTECT GPIO control.
#ifdef MSDC_WP_GPIO
    case eMSDC0WriteProtectGpio:
        *pu4Data = MSDC_WP_GPIO;
        return 0;
#endif

// MSDC POWER GPIO control.
#ifdef MSDC_POWER_GPIO
    case eMSDC0PoweronoffDetectGpio:
        *pu4Data = MSDC_POWER_GPIO;
        return 0;
#endif

// MSDC VOLTAGE SWITCH GPIO control.
#ifdef MSDC_VOLTAGE_GPIO
    case eMSDC0VoltageSwitchGpio:
        *pu4Data = MSDC_VOLTAGE_GPIO;
        return 0;
#endif

// MSDC BACKUP1 GPIO control.
#ifdef MSDC_BACKUP1_GPIO
    case eMSDCbackup1Gpio:
        *pu4Data = MSDC_BACKUP1_GPIO;
        return 0;
#endif

// MSDC BACKUP2 GPIO control.
#ifdef MSDC_BACKUP2_GPIO
    case eMSDCbackup2Gpio:
        *pu4Data = MSDC_BACKUP2_GPIO;
        return 0;
#endif
// Irrx settings
    case eIrrxType:
#ifndef DEFAULT_IRRX_TYPE
        #error no define DEFAULT_IRRX_TYPE
#else /* DEFAULT_IRRX_TYPE */
        *pu4Data = (UINT32)DEFAULT_IRRX_TYPE;
#endif /* DEFAULT_IRRX_TYPE */
        return 0;

    case eIrrxNecMapArraySize:
#ifndef IRRX_NEC_MAPARRAY_SIZE
        #error no define IRRX_NEC_MAPARRAY_SIZE
#else /* IRRX_NEC_MAPARRAY_SIZE */
        *pu4Data = (UINT32)IRRX_NEC_MAPARRAY_SIZE;
#endif /* IRRX_NEC_MAPARRAY_SIZE */
        return 0;

    case eIrrxRc5MapArraySize:
#ifndef IRRX_RC5_KEYMAP_SIZE
#error no define IRRX_RC5_KEYMAP_SIZE
#else /* IRRX_RC5_KEYMAP_SIZE */
        *pu4Data = (UINT32)IRRX_RC5_KEYMAP_SIZE;
#endif /* IRRX_RC5_KEYMAP_SIZE */
        return 0;

    case eIrrxHotkeyArraySize:
#ifdef IRRX_HOTKEY_SIZE
        *pu4Data = (UINT32)IRRX_HOTKEY_SIZE;
        return 0;
#else
        return -1;
#endif

#ifdef FLAG_IR_POWERON_WAKEUP
       case eIrrxFlagPowerOnWakeup:
        *pu4Data = (UINT32)FLAG_IR_POWERON_WAKEUP;
        return 0;
#endif

    case eIrrxKeyUpTimeout:
        *pu4Data = (UINT32)DEFAULT_IRRX_KEY_UP_TIMEOUT;
        return 0;

    case eIrrxRepeatValidTime:
        *pu4Data = (UINT32)DEFAULT_IRRX_REPEAT_VALID_TIME;
        return 0;

    case eIrrxNecPulse1:
        *pu4Data = (UINT32)IRRX_NEC_PULSE1;
        return 0;

    case eIrrxNecPulse2:
        *pu4Data = (UINT32)IRRX_NEC_PULSE2;
        return 0;

    case eIrrxNecPulse3:
        *pu4Data = (UINT32)IRRX_NEC_PULSE3;
        return 0;

    case eIrrxUsrConfig:
        *pu4Data = (UINT32)IRRX_USR_CONFIG;
        return 0;

    case eIrrxUsrSaperiod:
        *pu4Data = (UINT32)IRRX_USR_SAPERIOD;
        return 0;

    case eIrrxUsrThreshold:
        *pu4Data = (UINT32)IRRX_USR_THRESHOLD;
        return 0;

    case eUsrIRClkSel:
#ifdef IRRX_CLK_SEL
        *pu4Data = (UINT32)IRRX_CLK_SEL;
        return 0;
#else
        return -1;
#endif

    case eIrrxRepeatPulseUp:
        *pu4Data = (UINT32)IRRX_REPEAT_PULSE_UP;
        return 0;

    case eIrrxRepeatPulseDown:
        *pu4Data = (UINT32)IRRX_REPEAT_PULSE_DOWN;
        return 0;

    case eIrrxFlagBlinking:
        *pu4Data = (UINT32)IRRX_FLAG_IRRX_BLINKING;
        return 0;

    case eIrrxFlagPrgUpDownWakeup:
        *pu4Data = (UINT32)FLAG_IR_PRGUPDOWN_WAKEUP;
        return 0;

    case eIrrxFlagAllWakeup:
        *pu4Data = (UINT32)FLAG_IR_ALL_WAKEUP;
        return 0;

    case eIrrxFlagUserDefineWakeup:
        *pu4Data = (UINT32)FLAG_IR_USER_DEFINE_WAKEUP;
        return 0;

    case eIrrxLedBlinkGpio:
#ifdef IRRX_LED_BLINK_GPIO
        *pu4Data = (UINT32)IRRX_LED_BLINK_GPIO;
        return 0;
#else
        return -1;
#endif

    case eIrrxLedBlinkOnVal:
#ifdef IRRX_LED_BLINK_ON_VAL
        *pu4Data = (UINT32)IRRX_LED_BLINK_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case eIrrxLedBlinkDuration:
#ifdef IRRX_LED_BLINK_DURATION
        *pu4Data = (UINT32)IRRX_LED_BLINK_DURATION;
        return 0;
#else
        return -1;
#endif

    case eFlagIrrxSoundSupport:
#ifdef FLAG_IRRX_SOUND_SUPPORT
        *pu4Data = (UINT32)FLAG_IRRX_SOUND_SUPPORT;
        return 0;
#else
        return -1;
#endif
    case eFlagIrrxSoundSupportAlwaysEnable:
        *pu4Data = (UINT32)FLAG_IRRX_SOUND_SUPPORT_ALWAYSE_ENABLE;
        return 0;

    case eIrrcCheckRepeatByRaw:
        *pu4Data = (UINT32)IRRC_CHECK_REPEAT_BY_RAW;
        return 0;
// Keypad
    case eFlagButtonSupport:
        *pu4Data = (UINT32)FLAG_BUTTON_SUPPORT;
        return 0;

    case eKeyPadWakeupBit:
        *pu4Data = (UINT32)KEYPAD_WAKEUP_BIT;
        return 0;

    case eKeyPadPollingTime:
        *pu4Data = (UINT32)KEYPAD_POLLING_TIME;
        return 0;

    case eKeyPadCheckTime:
        *pu4Data = (UINT32)KEYPAD_CHECK_TIME;
        return 0;

#ifdef AUDIO_STA335_RESET_GPIO
//STA335
    case eAudioSTA335ResetGpio:
        *pu4Data = (UINT32)AUDIO_STA335_RESET_GPIO;
        return 0;
#endif /* AUDIO_STA335_RESET_GPIO */

#ifdef AUDIO_STA335_RESET_GPIO_POLARITY
    case eAudioSTA335ResetGpioPolarity:
        *pu4Data = (UINT32)AUDIO_STA335_RESET_GPIO_POLARITY;
        return 0;
#endif /* AUDIO_STA335_RESET_GPIO_POLARITY */

    case eAudioMuteGpioNum:
#ifdef CC_COMBINE_4K_2K
	   if((DRVCUST_Get_2K_Model()&0x03)==0x00)
	   *pu4Data = (UINT32)AUDIO_Mute_Gpio_Num_2K;
	    else
	   *pu4Data = (UINT32)AUDIO_Mute_Gpio_Num_4K;
#else
        *pu4Data = (UINT32)AUDIO_Mute_Gpio_Num;
#endif
        return 0;

    case eAudioAmpEnableGpioNum:
#ifdef CC_COMBINE_4K_2K
        if((DRVCUST_Get_2K_Model()&0x03)==0x00)
            *pu4Data = (UINT32)AUDIO_Amp_Gpio_Num_2K;
        else
            *pu4Data = (UINT32)AUDIO_Amp_Gpio_Num_4K;
#else
        *pu4Data = (UINT32)AUDIO_Amp_Gpio_Num;
#endif
        return 0;
#ifdef CC_MTK_CM4_SUPPORT
    case eVadDmicPowerOn:
        *pu4Data = (UINT32)VAD_DMIC_PWR_ON_GPIO;
        return 0;
    case eVadDmicPDM0Data0:
        *pu4Data = (UINT32)VAD_DMIC_PDM0_DATA0_PIN;
        return 0;
    case eVadDmicPDM1Data0:
        *pu4Data = (UINT32)VAD_DMIC_PDM1_DATA0_PIN;
        return 0;
    case eVadDmicPDMCLK:
        *pu4Data = (UINT32)VAD_DMIC_PDM_CLK;
        return 0;
    case eVadI2sBck:
        *pu4Data = (UINT32)VAD_I2S_BCK_PIN;
        return 0;
    case eVadI2sLrck:
        *pu4Data = (UINT32)VAD_I2S_LRCK_PIN;
        return 0;
    case eVadI2sSdata:
        *pu4Data = (UINT32)VAD_I2S_SDATA_PIN;
        return 0;
#endif
// Other Gpio
    case eExternalStatus:
        *pu4Data = (UINT32)FLAG_EXT_STATUS;
        return 0;

#ifdef STANDBY_SET_GPIO
    case eStandbySetGpio:
        *pu4Data = (UINT32)STANDBY_SET_GPIO;
        return 0;
#endif /* STANDBY_SET_GPIO */

#ifdef POWER_STATUS_GPIO
    case ePowerStatusGpio:
        *pu4Data = (UINT32)POWER_STATUS_GPIO;
        return 0;
#endif /* POWER_STATUS_GPIO */

    case eStdbyUsePowerBtnCount:
        *pu4Data = (UINT32)STDBY_USE_PWR_BTN_CNT;
        return 0;

    case eStdbyUsePrevPowerState:
        *pu4Data = (UINT32)STDBY_USE_PREV_PWR_STATE;
        return 0;

    case eStdbyUseVGAStatus:
        *pu4Data = (UINT32)STDBY_USE_VGA_STATUS;
        return 0;

    case ePowerCtrlDelayMs:
        *pu4Data = (UINT32)POWER_CTRL_DELAY_MS;
        return 0;

    case ePowerCtrlGpio:
#ifdef POWER_CTRL_GPIO
        *pu4Data = (UINT32)POWER_CTRL_GPIO;
        return 0;
#else
        return -1;
#endif

    case ePowerCtrlOnVal:
#ifdef POWER_CTRL_ON_VAL
        *pu4Data = (UINT32)POWER_CTRL_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case eDvdCtrlGpio:
#ifdef DVD_CTRL_GPIO
        *pu4Data = (UINT32)DVD_CTRL_GPIO;
        return 0;
#else
        return -1;
#endif

    case eDvdCtrlOnVal:
#ifdef DVD_CTRL_ON_VAL
        *pu4Data = (UINT32)DVD_CTRL_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case eSpecialWakeupGpio:
#ifdef SPECIAL_WAKEUP_GPIO
        *pu4Data = (UINT32)SPECIAL_WAKEUP_GPIO;
        return 0;
#else
        return -1;
#endif

    case eSpecialWakeupOnVal:
#ifdef SPECIAL_WAKEUP_ON_VAL
        *pu4Data = (UINT32)SPECIAL_WAKEUP_ON_VAL;
        return 0;
#else
        return -1;
#endif
		case eSuspendDramPowGpio:
#ifdef SUSPEND_GPIO_NUMBER
			*pu4Data = (UINT32)SUSPEND_GPIO_NUMBER;
			return 0;
#else
			return -1;
#endif
		case eSuspendDramPowPol:
#ifdef SUSPEND_GPIO_POL
			*pu4Data = (UINT32)SUSPEND_GPIO_POL;
			return 0;
#else
			return -1;
#endif
	case eResetWLanGpio:
#ifdef RESET_ON_WLAN_GPIO
			*pu4Data = (UINT32)RESET_ON_WLAN_GPIO;
			return 0;
#else
			return -1;
#endif
	case eWakeupOnWLanGpio:
#ifdef WAKEUP_ON_WLAN_GPIO
        *pu4Data = (UINT32)WAKEUP_ON_WLAN_GPIO;
        return 0;
#else
        return -1;
#endif
    case eWakeupOnWLanPol:
#ifdef WAKEUP_ON_WLAN_POL
        *pu4Data = (UINT32)WAKEUP_ON_WLAN_POL;
        return 0;
#else
        return -1;
#endif
	case eWakeupOnEWBSGpio:
#ifdef WAKEUP_ON_PH_EWBS_GPIO
		*pu4Data = (UINT32)WAKEUP_ON_PH_EWBS_GPIO;
		return 0;
#else
		return -1;
#endif
	case eWakeupOnEWBSPol:
#ifdef WAKEUP_ON_PH_EWBS_POL
		*pu4Data = (UINT32)WAKEUP_ON_PH_EWBS_POL;
		return 0;
#else
		return -1;
#endif

	case eBTWakeupGpio:
#ifdef WAKEUP_ON_BT_GPIO
        *pu4Data = (UINT32)WAKEUP_ON_BT_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBTWakeupOnVal:
#ifdef WAKEUP_ON_BT_POL
        *pu4Data = (UINT32)WAKEUP_ON_BT_POL;
        return 0;
#else
        return -1;
#endif

// Led
    case eFlagBootBlinkingLedSupport:
#ifdef FLAG_BOOT_BLINKING_LED_SUPPORT
        *pu4Data = (UINT32)FLAG_BOOT_BLINKING_LED_SUPPORT;
        return 0;
#else
        return -1;
#endif

    case eBootBlinkingLed:
#ifdef BOOT_BLINKING_LED
        *pu4Data = (UINT32)BOOT_BLINKING_LED;
        return 0;
#else
        return -1;
#endif

    case eBootBlinkingLedOnVal:
#ifdef BOOT_BLINKING_LED_ON_VAL
    *pu4Data = (UINT32)BOOT_BLINKING_LED_ON_VAL;
    return 0;
#else
    return -1;
#endif

    case eBootBlinkingLedPeriod:
#ifdef BOOT_BLINKING_LED_PERIOD
    *pu4Data = (UINT32)BOOT_BLINKING_LED_PERIOD;
    return 0;
#else
    return -1;
#endif

    case eT8032CtrlErrLed:
#ifdef T8032_CTRL_ERR_LED
        *pu4Data = (UINT32)T8032_CTRL_ERR_LED;
        return 0;
#else
        return -1;
#endif

    case eT8032CtrlErrLedOnVal:
#ifdef T8032_CTRL_ERR_LED_ON_VAL
        *pu4Data = (UINT32)T8032_CTRL_ERR_LED_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case ePowerLedGpio:
#ifdef POWER_LED_GPIO
        *pu4Data = (UINT32)POWER_LED_GPIO;
        return 0;
#else
        return -1;
#endif

    case ePowerLedOnVal:
#ifdef POWER_LED_ON_VAL
        *pu4Data = (UINT32)POWER_LED_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case eBackupLedGpio:
#ifdef BACKUP_LED_GPIO
        *pu4Data = (UINT32)BACKUP_LED_GPIO;
        return 0;
#else
        return -1;
#endif

    case eBackupLedOnVal:
#ifdef BACKUP_LED_ON_VAL
        *pu4Data = (UINT32)BACKUP_LED_ON_VAL;
        return 0;
#else
        return -1;
#endif

    case eSupportDarkLed:
        *pu4Data = (UINT32)FLAG_SUPPORT_DARK_LED;
        return 0;

    case ePowerLedDarkVal:
#ifdef POWER_LED_DARK_VAL
        *pu4Data = (UINT32)POWER_LED_DARK_VAL;
        return 0;
#else
        return -1;
#endif

    case eBackupLedDarkVal:
#ifdef BACKUP_LED_DARK_VAL
        *pu4Data = (UINT32)BACKUP_LED_DARK_VAL;
        return 0;
#else
        return -1;
#endif

    case eFlagSupportPowerLedOff:
        *pu4Data = (UINT32)FLAG_SUPPORT_POWER_LED_OFF;
        return 0;

#ifdef COMPANION_CHIP_GPIO_NUM
    case eCompanionChipGpio:
        *pu4Data = (UINT32)COMPANION_CHIP_GPIO_NUM;
        return 0;
#endif

#ifdef COMPANION_CHIP_GPIO_POLARITY
    case eCompanionChipGpioPolarity:
        *pu4Data = (UINT32)COMPANION_CHIP_GPIO_POLARITY;
        return 0;
#endif

    case ePdwncPolarity:
        *pu4Data = (UINT32)PDWNC_POLARITY;
        return 0;
	case ePdwncResumeHandleKey:
        *pu4Data = (UINT32)PDWNC_RESUMEHANDLE_KEY;
        return 0;
#ifdef SW_POWER_DETECT_VOLTAGE
    case eSWPowerDetectVoltage:
        *pu4Data = (UINT32)SW_POWER_DETECT_VOLTAGE;
        return 0;
#endif

#ifdef DRV_PWM_H /* make sure that the pwm header, drv_pwm.h, is included */
    case ePWM0Port:
        *pu4Data = (UINT32)PWM0_PORT;
        return 0;

    case ePWM1Port:
        *pu4Data = (UINT32)PWM1_PORT;
        return 0;

    case ePWM2Port:
        *pu4Data = (UINT32)PWM2_PORT;
        return 0;
#endif

    // MT8292 GPIO support
    case eFlagMt8292GpioSupport:
        *pu4Data = (UINT32)FLAG_MT8292_GPIO_SUPPORT;
        return 0;

    case eMt8292ResetGpio:
        *pu4Data = (UINT32)MT8292_RESET_GPIO;
        return 0;

    case eMt8292MuteGpio:
        *pu4Data = (UINT32)MT8292_MUTE_GPIO;
        return 0;

    case eMt8280ResetGpio:
        *pu4Data = (UINT32)MT8280_RESET_GPIO;
        return 0;

    case eMt8280ResetGpioPolarity:
        *pu4Data = (UINT32)MT8280_RESET_GPIO_POLARITY;
        return 0;

    case eMT8280CmdAckGpio:
        *pu4Data = (UINT32)MT8280_CMD_ACK_GPIO;
        return 0;

    case eMT8280CmdAckGpioPolarity:
        *pu4Data = (UINT32)MT8280_CMD_ACK_GPIO_POLARITY;
        return 0;

    case eMT8280SendPanel:
        *pu4Data = (UINT32)MT8280_SEND_PANEL;
        return 0;

    case eDemodResetGpio:
#ifdef DEFAULT_DEMOD_RESET_GPIO
        *pu4Data = (UINT32) DEFAULT_DEMOD_RESET_GPIO;
        return 0;
#else /* DEFAULT_DEMOD_RESET_GPIO */
        return -1;
#endif /* DEFAULT_DEMOD_RESET_GPIO */

    case eDemodResetGpio2:
#ifdef DEFAULT_DEMOD_RESET_GPIO_2
        *pu4Data = (UINT32) DEFAULT_DEMOD_RESET_GPIO_2;
        return 0;
#else /* DEFAULT_DEMOD_RESET_GPIO_2 */
        return -1;
#endif /* DEFAULT_DEMOD_RESET_GPIO_2 */

#endif /* CC_MTK_PRELOADER */

	case eDemodEwsPwrOnGpio:
#ifdef DEFAULT_DEMOD_EWS_PWR_ON_GPIO
		*pu4Data = (UINT32) DEFAULT_DEMOD_EWS_PWR_ON_GPIO;
		return 0;
#else
		return -1;
#endif


    // VGA wakeup setting by external controller
    case eVGAMaxHSyncFreqForExtCtrl:
        *pu4Data = (UINT32)VGA_EXT_MAX_HSYNC_FREQ;
        return 0;

    case eVGAMinHSyncFreqForExtCtrl:
        *pu4Data = (UINT32)VGA_EXT_MIN_HSYNC_FREQ;
        return 0;

    case eVGAMaxVSyncFreqForExtCtrl:
        *pu4Data = (UINT32)VGA_EXT_MAX_VSYNC_FREQ;
        return 0;

    case eVGAMinVSyncFreqForExtCtrl:
        *pu4Data = (UINT32)VGA_EXT_MIN_VSYNC_FREQ;
        return 0;

    // SIF
    case eSifEnableSclStretch:
        *pu4Data = (UINT32)SIF_ENABLE_SCL_STRETCH;
        return 0;

    case eSifDisableOpenDrain:
        *pu4Data = (UINT32)SIF_DISABLE_OPEN_DRAIN;
        return 0;

    case eSifEnablePdwncMaster:
        *pu4Data = (UINT32)SIF_ENABLE_PDWNC_MASTER;
        return 0;

    case eSifEnablePdwncMaster1:
        *pu4Data = (UINT32)SIF_ENABLE_PDWNC_MASTER1;
        return 0;

#ifdef DRV_CUST_FIXED_SIF_CLK_DIV
    case eSifcfgFixClkDiv:
        *pu4Data = (UINT32)DRV_CUST_FIXED_SIF_CLK_DIV;
        return 0;
#endif

        case eAudioFlashAQPartition:
            *pu4Data = (UINT32)FLASH_AQ_BASE_PARTITION_AB;
            return 0;

    case eAudioAdspBinPartition:
        *pu4Data = (UINT32)FLASH_ADSP_BIN_PARTITION;
        return 0;
		//DOLBY
#ifdef CC_SUPPORT_DOLBY_VISION
	case eFlagDolbyCfgPartition:
#ifdef FLASH_DOLBY_VISION_PARTITION
		*pu4Data = (UINT32)FLASH_DOLBY_VISION_PARTITION;
#else
		*pu4Data = (UINT32)0;
#endif
		return 0;
#endif  //CC_SUPPORT_DOLBY_VISION

        // FlashPQ
        case eFlagFlashPqEnable:
#ifdef SUPPORT_FLASH_PQ
            *pu4Data = (UINT32)SUPPORT_FLASH_PQ;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef SUPPORT_FLASH_PQ
            return 0;
        case eFlashPqUseNandFalsh:
#ifdef FLASH_PQ_USE_NAND_FLASH
            *pu4Data = (UINT32)FLASH_PQ_USE_NAND_FLASH;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_USE_NAND_FLASH
            return 0;
        case eFlashPqBasePartition:
#ifdef FLASH_PQ_BASE_PARTITION
            *pu4Data = (UINT32)FLASH_PQ_BASE_PARTITION_AB;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_PARTITION
            return 0;
        case eFlashPqBaseAddress:
#ifdef FLASH_PQ_BASE_ADDRESS
            *pu4Data = (UINT32)FLASH_PQ_BASE_ADDRESS&0xFFFFFF;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_ADDRESS
            return 0;
        case eFlashPqOffset:
#ifdef FLASH_PQ_BASE_OFFSET
            *pu4Data = (UINT32)FLASH_PQ_BASE_OFFSET;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_OFFSET
            return 0;
        case eFlashPqBlockSize:
#ifdef FLASH_PQ_BLOCK_SIZE
            *pu4Data = (UINT32)FLASH_PQ_BLOCK_SIZE;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BLOCK_SIZE
            return 0;

    // FlashPQ	2ndpart-------------------------------------
#ifdef SUPPORT_2ND_FLASHPQ
        case eFlashPq2ndpartBasePartition:
#ifdef FLASH_PQ_SECOND_PARTITION
			*pu4Data = (UINT32)FLASH_PQ_SECOND_PARTITION;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_PARTITION
			return 0;

		case eFlashPq2ndpartBaseAddress:
#ifdef FLASH_PQ_2ND_PART_BASE_ADDRESS
			*pu4Data = (UINT32)FLASH_PQ_2ND_PART_BASE_ADDRESS&0xFFFFFF;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_ADDRESS
			return 0;

		case eFlashPq2ndpartOffset:
#ifdef FLASH_PQ_2ND_PART_BASE_OFFSET
			*pu4Data = (UINT32)FLASH_PQ_2ND_PART_BASE_OFFSET;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BASE_OFFSET
			return 0;

		case eFlashPq2ndpartBlockSize:
#ifdef FLASH_PQ_2ND_PART_BLOCK_SIZE
			*pu4Data = (UINT32)FLASH_PQ_2ND_PART_BLOCK_SIZE;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_BLOCK_SIZE
			return 0;

		case eFlagFlashPq2ndpartEnableGamma:
#ifdef FLASH_PQ_2ND_PART_ENABLE_GAMMA
			*pu4Data = (UINT32)FLASH_PQ_2ND_PART_ENABLE_GAMMA;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_2ND_PART_ENABLE_GAMMA
			return 0;

		case eFlagFlashPq2ndpartEnableSCE:
#ifdef FLASH_PQ_2ND_PART_ENABLE_SCE
			*pu4Data = (UINT32)FLASH_PQ_2ND_PART_ENABLE_SCE;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_2ND_PART_ENABLE_SCE
			return 0;

		case eFlagFlashPq2ndpartEnableQty:
#ifdef SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY
			*pu4Data = (UINT32)SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef SUPPORT_FLASH_PQ_ENABLE_QTY
			return 0;

		case eFlagFlashPq2ndpartEnableQtyMaxMin:
#ifdef SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY_MAX_MIN
			*pu4Data = (UINT32)SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY_MAX_MIN;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef SUPPORT_FLASH_PQ_ENABLE_QTY_MAX_MIN
			return 0;

		case eFlagFlashPq2ndpartEnableQtySmartPic:
#ifdef SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY_SMART_PIC
			*pu4Data = (UINT32)SUPPORT_FLASH_PQ_2ND_PART_ENABLE_QTY_SMART_PIC;
#else
			*pu4Data = (UINT32)0;
#endif // #ifdef SUPPORT_FLASH_PQ_ENABLE_QTY_SMART_PIC
			return 0;
#endif //-----#ifdef SUPPORT_2ND_FLASHPQ    -------------------------

    case  eFlagSupportOD:
#ifdef SUPPORT_OD
            *pu4Data = (UINT32)SUPPORT_OD;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef SUPPORT_OD
            return 0;

        case eFlagFlashPanelEnable:
#ifdef FLASH_PQ_FLASH_PANEL
            *pu4Data = (UINT32)FLASH_PQ_FLASH_PANEL;
#else
            *pu4Data = (UINT32)0;
#endif // #ifdef FLASH_PQ_FLASH_PANEL
            return 0;

    case eCountryDefaultSetting:
        #ifdef DEFAULT_TARGET_COUNTRY
        *pu4Data = (UINT32)DEFAULT_TARGET_COUNTRY;
        return 0;
        #else
        return -1;
        #endif

#ifdef PCIE_RESET_GPIO
    case ePcieResetGpio:
        *pu4Data = (UINT32)PCIE_RESET_GPIO;
        return 0;
#endif
	case eHDMIHPD0GPIONUM:
	 #ifdef HDMIHPD0_GPIONUM
		   *pu4Data = (UINT32)HDMIHPD0_GPIONUM;
			return 0;
	 #else
			return -1;
	 #endif

	 case eHDMIHPD1GPIONUM:
	 #ifdef HDMIHPD1_GPIONUM
			   *pu4Data = (UINT32)HDMIHPD1_GPIONUM;
				return 0;
	 #else
				return -1;
	 #endif
	 case eHDMIHPD2GPIONUM:
	 #ifdef HDMIHPD2_GPIONUM
			   *pu4Data = (UINT32)HDMIHPD2_GPIONUM;
				return 0;
	 #else
				return -1;
	 #endif
	 case eHDMIHPD3GPIONUM:
     #ifdef HDMIHPD3_GPIONUM
				 *pu4Data = (UINT32)HDMIHPD3_GPIONUM;
				 return 0;
     #else
				 return -1;
     #endif
 	 case eEthernetWakeupSupport:
				 *pu4Data = (UINT32)DEFAULT_ETHERNET_WAKEUP_SOPPORT;
				 return 0;

#ifndef CC_MTK_PRELOADER
#ifdef CC_PAA_GET_COUNTRY_SUPPORT
     case ePaaCountrySetFunc:
#ifdef APP_COUNTRY_SET_FUCTION
         *pu4Data = (UINT32)APP_COUNTRY_SET_FUCTION;
         return 0;
#else
         return -1;
#endif
     case ePaaCountryGetFunc:
#ifdef APP_COUNTRY_GET_FUCTION
         *pu4Data = (UINT32)APP_COUNTRY_GET_FUCTION;
         return 0;
#else
         return -1;
#endif
#endif

#ifdef CC_MAPLE_BE_LOADER_BOOT_FLOW
	 case eBELBootPowerOnGpio:
#ifdef BEL_BOOT_POWER_ON_GPIO
				 *pu4Data = (UINT32)BEL_BOOT_POWER_ON_GPIO;
				 return 0;
#else
				 return -1;
#endif

	 case eBELBootPowerOnPolarity:
#ifdef BEL_BOOT_POWER_ON_POLARITY
				 *pu4Data = (UINT32)BEL_BOOT_POWER_ON_POLARITY;
				 return 0;
#else
				 return -1;
#endif
	 case eBELBootUpNotifyGpio:
#ifdef BEL_BOOT_UP_NOTIFY_GPIO
				 *pu4Data = (UINT32)BEL_BOOT_UP_NOTIFY_GPIO;
				 return 0;
#else
				 return -1;
#endif
	 case eBELBootUpNotifyGpioPolarity:
#ifdef BEL_BOOT_UP_NOTIFY_POLARITY
				 *pu4Data = (UINT32)BEL_BOOT_UP_NOTIFY_POLARITY;
				 return 0;
#else
				 return -1;
#endif
	 case eBELBootVx1ReqGpio:
#ifdef BEL_BOOT_VX1_REQ_GPIO
				 *pu4Data = (UINT32)BEL_BOOT_VX1_REQ_GPIO;
				 return 0;
#else
				 return -1;
#endif

	 case eBELBootVx1ReqGpioPolarity:
#ifdef BEL_BOOT_VX1_REQ_POLARITY
				 *pu4Data = (UINT32)BEL_BOOT_VX1_REQ_POLARITY;
				 return 0;
#else
				 return -1;
#endif
	 case eBELBootPnlPwrNotifyGpio:
#ifdef BEL_BOOT_PNL_PWR_NOTIFY_GPIO
				 *pu4Data = (UINT32)BEL_BOOT_PNL_PWR_NOTIFY_GPIO;
				 return 0;
#else
				 return -1;
#endif

	 case eBELBootPnlPwrNotifyGpioPolarity:
#ifdef BEL_BOOT_PNL_PWR_NOTIFY_POLARITY
				 *pu4Data = (UINT32)BEL_BOOT_PNL_PWR_NOTIFY_POLARITY;
				 return 0;
#else
				 return -1;
#endif

    case eBELBootXPqResetGpio:
#ifdef BEL_BOOT_X_PQ_RST_GPIO
        *pu4Data = (UINT32)BEL_BOOT_X_PQ_RST_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBELBootXPqResetGpioPolarity:
#ifdef BEL_BOOT_X_PQ_RST_POLARITY
        *pu4Data = (UINT32)BEL_BOOT_X_PQ_RST_POLARITY;
        return 0;
#else
        return -1;
#endif

    case eBELFrameCfgTbl:
#ifdef BE_FRAME_CONFIG_TABLE
#ifdef BE_SUPPORT_3_FRAME_BOOT
                 *pu4Data = (UINT32)BE_FRAME_CONFIG_TABLE_New;
#else
                 *pu4Data = (UINT32)BE_FRAME_CONFIG_TABLE;
#endif
                 return 0;
#else
                 return -1;
#endif
    case eBELFrameCfgTblSize:
#ifdef BE_FRAME_CONFIG_SIZE
#ifdef BE_SUPPORT_3_FRAME_BOOT
                 *pu4Data = (UINT32)BE_FRAME_CONFIG_SIZE_New;
#else
                 *pu4Data = (UINT32)BE_FRAME_CONFIG_SIZE;
#endif
                 return 0;
#else
                 return -1;
#endif
    case eBELPartitionId:
#ifdef FLASH_BE_BASE_PARTITION
                 *pu4Data = (UINT32)FLASH_BE_BASE_PARTITION;
                 return 0;
#else
                 *pu4Data = (UINT32)26;
                 return 0;
#endif
    case eBELMinfPartitionId:
#ifdef FLASH_BE_MINF_BASE_PARTITION
             *pu4Data = (UINT32)FLASH_BE_MINF_BASE_PARTITION;
             return 0;
#else
             *pu4Data = (UINT32)38;
             return 0;
#endif

#ifdef CC_MAPLE_CUST_DRV
	case eSPQDPartition:
#ifdef FLASH_SPQD_PARTITION
				*pu4Data = (UINT32)FLASH_SPQD_PARTITION;
				return 0;
#else
                 *pu4Data = (UINT32)53;
                 return 0;
#endif

	case eSPQCPartition:
#ifdef FLASH_SPQC_PARTITION
				*pu4Data = (UINT32)FLASH_SPQC_PARTITION;
				return 0;
#else
                 *pu4Data = (UINT32)54;
                 return 0;
#endif
#endif

#ifdef CC_COMBINE_4K_2K
            case eGet2KModelSupport:
                *pu4Data = DRVCUST_Get_2K_Model();
                return 0;
            case eGet4KModelBEType:
                *pu4Data = DRVCUST_Get_BE_Type();
                return 0;
            case eGetFRCType:
                *pu4Data = DRVCUST_Get_FRC_Type();
                return 0;
            case eGetPQType:
                *pu4Data = DRVCUST_Get_PQ_Type();
                return 0;
            case eGetAllInOneSeries:
                *pu4Data = DRVCUST_Is_All_in_One_Series();
                return 0;
            case eGetExtDecModel:
                *pu4Data = (UINT32)DRVCUST_IsExternalDecoderModel();
                return 0;
#endif
#endif
        case eGetIlluminationLEDType:
            *pu4Data = DRVCUST_Get_Illumination_LED_Type();
            return 0;
        case eGetFPKeyType:
            *pu4Data = DRVCUST_Get_FP_Key_Type();
            return 0;

        case eGetInterMemcType:
            *pu4Data = DRVCUST_Get_InterMemc_type();
            return 0;

#endif
        case eIrHotKeyWakeupSupport:
            *pu4Data = (UINT32)SUPPORT_HOTKEY_WAKEUP;
            return 0;
        case eIrHotKeyNumEepOffset:
            *pu4Data = (UINT32)HOTKEY_WAKEUP_NUM_EEP_OFFSET;
            return 0;

#ifdef CC_CUSTOM_PMIC_I2C_SUPPORT
		case eGetVCPUdevaddr:
#ifdef PMIC_VCPU_DEVICE_ADDR
			*pu4Data = (UINT32)PMIC_VCPU_DEVICE_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUdataddr:
#ifdef PMIC_VCPU_DATA_ADDR
			*pu4Data = (UINT32)PMIC_VCPU_DATA_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUmodaddr:
#ifdef PMIC_VCPU_MODE_ADDR
			*pu4Data = (UINT32)PMIC_VCPU_MODE_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUmodmask:
#ifdef PMIC_VCPU_MODE_MASK
			*pu4Data = (UINT32)PMIC_VCPU_MODE_MASK;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUmodepwm_en:
#ifdef PMIC_VCPU_MODE_PWM_EN
			*pu4Data = (UINT32)PMIC_VCPU_MODE_PWM_EN;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUvmin:
#ifdef PMIC_VCPU_VMIN
			*pu4Data = (UINT32)PMIC_VCPU_VMIN;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUvmax:
#ifdef PMIC_VCPU_VMAX
			*pu4Data = (UINT32)PMIC_VCPU_VMAX;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUvstep:
#ifdef PMIC_VCPU_VSTEP
			*pu4Data = (UINT32)PMIC_VCPU_VSTEP;
			return 0;
#else
			return -1;
#endif

		case eGetVCPUchannelid:
#ifdef PMIC_VCPU_CHANNEL_ID
			*pu4Data = (UINT32)PMIC_VCPU_CHANNEL_ID;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUdevaddr:
#ifdef PMIC_VGPU_DEVICE_ADDR
			*pu4Data = (UINT32)PMIC_VGPU_DEVICE_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUdataddr:
#ifdef PMIC_VGPU_DATA_ADDR
			*pu4Data = (UINT32)PMIC_VGPU_DATA_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUmodaddr:
#ifdef PMIC_VGPU_MODE_ADDR
			*pu4Data = (UINT32)PMIC_VGPU_MODE_ADDR;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUmodmask:
#ifdef PMIC_VGPU_MODE_MASK
			*pu4Data = (UINT32)PMIC_VGPU_MODE_MASK;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUmodepwm_en:
#ifdef PMIC_VGPU_MODE_PWM_EN
			*pu4Data = (UINT32)PMIC_VGPU_MODE_PWM_EN;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUvmin:
#ifdef PMIC_VGPU_VMIN
			*pu4Data = (UINT32)PMIC_VGPU_VMIN;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUvmax:
#ifdef PMIC_VGPU_VMAX
			*pu4Data = (UINT32)PMIC_VGPU_VMAX;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUvstep:
#ifdef PMIC_VGPU_VSTEP
			*pu4Data = (UINT32)PMIC_VGPU_VSTEP;
			return 0;
#else
			return -1;
#endif

		case eGetVGPUchannelid:
#ifdef PMIC_VGPU_CHANNEL_ID
			*pu4Data = (UINT32)PMIC_VGPU_CHANNEL_ID;
			return 0;
#else
			return -1;
#endif

#endif//CC_CUSTOM_PMIC_I2C_SUPPORT
		case eDramResetGpio:
#ifdef DRAM_RESET_BY_EXT_GPIO
		*pu4Data = (UINT32)DRAM_RESET_BY_EXT_GPIO;
		return 0;
#else
		return -1;
#endif

//#ifdef CC_QHB_UPGRADE_SUPPORT
#if 0
#ifdef  CC_MTK_LOADER
	    case eIrrxLoaderIrqInit:
            #ifdef LOADER_IRRX_IRQ_INIT_FUNC	
			*pu4Data = (UINT32)LOADER_IRRX_IRQ_INIT_FUNC;
			return 0;
            #else
			return -1;
            #endif
#endif
#endif
	case eGetTrialLv:
		*pu4Data = DRVCUST_Get_TrialLv();
		return 0;
	case eGetSeries:
		*pu4Data = DRVCUST_Get_Series();
		return 0;
    default:
        break;
    }

    return -1;
}

UINT32 DRVCUST_InitGet(QUERY_TYPE_T eQryType)
{
    UINT32 u4Ret;

    VERIFY(DRVCUST_InitQuery(eQryType, &u4Ret) == 0);
    return u4Ret;
}

INT32 DRVCUST_InitQueryUptr(QUERY_UPTR_T eQryType, UPTR *pu4Data)
{
    static CHAR *szDate = __DATE__;
    static CHAR *szTime = __TIME__;
#ifndef CC_UBOOT
    static CHAR *szBrdCstIf = BRDCST_IF;
    static CHAR *szDrvCustom = DRV_CUSTOM;
#else /* CC_UBOOT */
    static CHAR *szBrdCstIf = "uBoot";
    static CHAR *szDrvCustom = "uBoot";
#endif /* CC_UBOOT */

    ASSERT(pu4Data!=NULL);

    switch(eQryType)
    {
// Common part.
    case eBuildDate:
        LINT_SUPPRESS_NEXT_EXPRESSION(50);
        *pu4Data = (UPTR)szDate;
        return 0;

    case eBuildTime:
        LINT_SUPPRESS_NEXT_EXPRESSION(50);
        *pu4Data = (UPTR)szTime;
        return 0;

    case eBrdCstIf:
        LINT_SUPPRESS_NEXT_EXPRESSION(50);
        *pu4Data = (UPTR)szBrdCstIf;
        return 0;

    case eDrvCust:
        LINT_SUPPRESS_NEXT_EXPRESSION(50);
        *pu4Data = (UPTR)szDrvCustom;
        return 0;

    case eDramAgentPriority:
        *pu4Data = (UPTR)DRAM_PRIORITY_LIST;
        return 0;

#ifdef CC_DRAM_PRIORITY_LIST_BY_CH
    case eDramAgentPriorityCHB:
        *pu4Data = (UPTR)DRAM_PRIORITY_LIST_CHB;
        return 0;

    case eDramAgentPriorityCHC:
        *pu4Data = (UPTR)DRAM_PRIORITY_LIST_CHC;
        return 0;
#endif

// Usb upgrade
    case eUsbUpgradeFileName:
        *pu4Data = (UPTR)USB_UPGRADE_FILE_NAME;
        return 0;

    case eUsbUpgradeFileNamePrefix:
        *pu4Data = (UPTR)USB_UPGRADE_FILE_NAME_PREFIX;
        return 0;

    case eUsbUpgradeFileNameSuffix:
        *pu4Data = (UPTR)USB_UPGRADE_FILE_NAME_SUFFIX;
        return 0;
#ifdef CC_MTK_AUTO_TEST
    case eUsbUpgradeGoldenFileName:
    	*pu4Data = (UPTR)USB_UPGRADE_GOLDEN_FILE_NAME;
    	return 0;

    case eUsbUpgradeGolednFileNameSuffix:
    	*pu4Data = (UPTR)USB_UPGRADE_GOLDEN_FILE_NAME_SUFFIX;
    	return 0;

	case eUsbEepromAutoTestOffset:
		*pu4Data = (UPTR)DRVCUST_EEPROM_AUTOTEST_UPGRADED_PKG_OFFSET;
		return 0;
#endif
#ifdef	CC_C4TV_AUTO_PROCESS
case eUsbUpgradeFileNamePrefixOta:
	*pu4Data = (UINT32)USB_UPGRADE_FILE_NAME_PREFIXOTA;
	return 0;

case eUsbUpgradeFileNameSuffixOta:
	*pu4Data = (UINT32)USB_UPGRADE_FILE_NAME_SUFFIXOTA;
	return 0;
#endif
#ifdef CC_LDR_ATOMIC_MODE_SUPPORT
    case eLdrAtomicUpgFileName:
	    *pu4Data = (UPTR)LDR_ATOMIC_UPG_FILE_NAME;
	    return 0;
    case eLdrAtomicUpgFileNamePrefix:
	    *pu4Data = (UPTR)LDR_ATOMIC_UPG_FILE_NAME_PREFIX;
	    return 0;
	case eLdrAtomicUpgFileNameSuffix:
	    *pu4Data = (UPTR)LDR_ATOMIC_UPG_FILE_NAME_SUFFIX;
	    return 0;
#endif

    case eLoaderUpgradeBreakFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_BREAK_HANDLE_FUNC;
        return 0;

    case eLoaderUpgradeVerCmpFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_VER_CMP_FUNC;
        return 0;

    case eLoaderUpgradeDlmCbFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_DLM_CB_FUNC;
        return 0;

    case eLoaderUpgradeDlmGetTagVerCbFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_DLM_GET_TAG_VER_CB_FUNC;
        return 0;

    case eLoaderUpgradeDlmSetTagVerCbFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_DLM_SET_TAG_VER_CB_FUNC;
        return 0;

    case eLoaderUpgradeDlmCmpTagVerCbFunc:
        *pu4Data = (UPTR)LOADER_UPGRADE_DLM_CMP_TAG_VER_CB_FUNC;
        return 0;

// Loader Misc
    case eLoaderEnvInitFunc:
        *pu4Data = (UPTR)LOADER_ENV_INIT_FUNC;
        return 0;
    case eLoaderCustFDRRstFunc:
        *pu4Data = (UPTR)LOADER_CUST_FDR_RST_FUNC;
        return 0;

    case eLoaderCECConfigQueryFunc:
        *pu4Data = (UPTR)LOADER_CEC_CONFIG_QUERY_FUNC;
        return 0;

    case eLoaderUpgradeCheckFunc:
		*pu4Data = (UPTR)LOADER_USB_UPGRADE_CHECK_FUNC;
		return 0;
    case eLoaderCheckStandByFunc:
        *pu4Data = (UPTR)LOADER_Standby_CHECK_FUNC;
        return 0;

// Loader logo
    case eLoaderLogoDataIdx0:
#ifndef LOADER_LOGO_DATAIDX0
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX0;
        return 0;
#endif

    case eLoaderLogoDataIdx1:
#ifndef LOADER_LOGO_DATAIDX1
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX1;
        return 0;
#endif

    case eLoaderLogoDataIdx2:
#ifndef LOADER_LOGO_DATAIDX2
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX2;
        return 0;
#endif

    case eLoaderLogoDataIdx3:
#ifndef LOADER_LOGO_DATAIDX3
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX3;
        return 0;
#endif

    case eLoaderLogoDataIdx4:
#ifndef LOADER_LOGO_DATAIDX4
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX4;
        return 0;
#endif

    case eLoaderLogoDataIdx5:
#ifndef LOADER_LOGO_DATAIDX5
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX5;
        return 0;
#endif

    case eLoaderLogoDataIdx6:
#ifndef LOADER_LOGO_DATAIDX6
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX6;
        return 0;
#endif

    case eLoaderLogoDataIdx7:
#ifndef LOADER_LOGO_DATAIDX7
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX7;
        return 0;
#endif

    case eLoaderLogoDataIdx8:
#ifndef LOADER_LOGO_DATAIDX8
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX8;
        return 0;
#endif

    case eLoaderLogoDataIdx9:
#ifndef LOADER_LOGO_DATAIDX9
        *pu4Data = (UPTR)0;
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_DATAIDX9;
        return 0;
#endif

    case eLoaderLogoWidthArray:
#ifndef LOADER_LOGO_WIDTH_ARRAY
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_WIDTH_ARRAY;
        return 0;
#endif

    case eLoaderLogoHightArray:
#ifndef LOADER_LOGO_HIGHT_ARRAY
        return -1;
#else
        *pu4Data = (UPTR)LOADER_LOGO_HIGHT_ARRAY;
        return 0;
#endif

    case eLoaderPanelLogoCheckFunc:
        *pu4Data = (UPTR)LOADER_LOGO_CHECK_FUNC;
        return 0;

    case eLoaderImgDecompressionFunc:
        *pu4Data = (UPTR)LOADER_IMG_DECOMPRESS_FUNC;
        return 0;

    case eGpiotimerInitFunc:
        *pu4Data = (UPTR)GPIO_TIMER_INIT_FUNC;
        break;

// Keypad
    case eSingleGpioKeyList:
        *pu4Data = (UPTR)SINGLE_GPIO_KEY_LIST;
        return 0;

    case eSingleServoKeyList:
        *pu4Data = (UPTR)SINGLE_SERVO_KEY_LIST;
        return 0;

    case eGreedGpioKeyList:
        *pu4Data = (UPTR)GREED_GPIO_KEY_LIST;
        return 0;

    case eMultiKeyList:
        *pu4Data = (UPTR)MULTI_KEY_LIST;
        return 0;

    case eCombKeyList:
        *pu4Data = (UPTR)COMB_KEY_LIST;
        return 0;

#ifndef CC_MTK_PRELOADER
    case eT8032uPOffset:
        *pu4Data = (UPTR)T8032UP_OFFSET;
        return 0;
#endif
// Irrx settings
#ifdef IRRX_NEC_KEYMAP_ARRAY
    case eIrrxNecKeyMap:
        *pu4Data = (UPTR)IRRX_NEC_KEYMAP_ARRAY;
        return 0;
#endif /* IRRX_NEC_KEYMAP_ARRAY */

#ifdef IRRX_RC5_KEYMAP_ARRAY
    case eIrrxRc5KeyMap:
        *pu4Data = (UPTR)IRRX_RC5_KEYMAP_ARRAY;
        return 0;
#endif /* IRRX_RC5_KEYMAP_ARRAY */

    case eIrrxHotkeyArray:
#ifdef IRRX_HOTKEY_ARRAY
        *pu4Data = (UPTR)IRRX_HOTKEY_ARRAY;
        return 0;
#else
        return -1;
#endif
    case eIrrcIsUsrLongPress:
        *pu4Data = (UPTR)IRRC_IS_USR_LONG_PRESS_FUNC;
        return 0;

    case eIrrxRc5KeyMapFunc:
        *pu4Data = (UPTR)IRRX_RC5_KEYMAP_FUNC;
        return 0;

    case eIrrxRc6KeyMapFunc:
        *pu4Data = (UPTR)IRRX_RC6_KEYMAP_FUNC;
        return 0;

    case eIrrxXferUsrToCrystalFunc:
        *pu4Data = (UPTR)IRRX_XFER_USR_TO_CRYSTAL_FUNC;
        return 0;

    case eIrrxSetUsrWakeupKeyFunc:
        *pu4Data = (UPTR)IRRX_SET_USR_WAKEUP_KEY_FUNC;
        return 0;

    case eIrrxSetUsrNotifyFunc:
        *pu4Data = (UPTR)IRRX_SET_USR_NOTIFY_FUNC;
        return 0;

#ifdef SET_SIGNAL_USR_NOTIFY_FUNC
     case eSetSignalUsrNotifyFunc:
         *pu4Data = (UPTR)SET_SIGNAL_USR_NOTIFY_FUNC;
        return 0;
#endif

    // GPIO hook function
#ifdef GPIO_POWER_ON_FUNC
    case eGpioPowerOnFunc:
        *pu4Data = (UPTR)GPIO_POWER_ON_FUNC;
        return 0;
#endif /* GPIO_POWER_ON_FUNC */

#ifdef GPIO_POWER_OFF_FUNC
    case eGpioPowerOffFunc:
        *pu4Data = (UPTR)GPIO_POWER_OFF_FUNC;
        return 0;
#endif /* GPIO_POWER_OFF_FUNC */

#ifdef GPIO_LED_CTRL_FUNC
    case eGpioLedCtrlFunc:
        *pu4Data = (UPTR)GPIO_LED_CTRL_FUNC;
        return 0;
#endif /* GPIO_LED_CTRL_FUNC */

#ifdef GPIO_POWER_OFF_SELFDIAG_SHUTDOWN_FUNC
	case eGpioPowerOffSelfDiagShutDownfunc:
		 *pu4Data = (UPTR)GPIO_POWER_OFF_SELFDIAG_SHUTDOWN_FUNC;
		 return 0;
#endif /* GPIO_POWER_OFF_SELFDIAG_SHUTDOWN_FUNC */

    case eSifCfgPinSetFunc:
#ifdef SIF_CFG_PIN_SET_FUNC
        *pu4Data = (UPTR)SIF_CFG_PIN_SET_FUNC;
        return 0;
#else
        return -1;
#endif

    case eSifCfgGetConfigFunc:
#ifdef SIF_CFG_GET_CONFIG_FUNC
        *pu4Data = (UPTR)SIF_CFG_GET_CONFIG_FUNC;
        return 0;
#else
        return -1;
#endif

    case eCustomerPowerOnSequence:
#ifdef CUSTOMER_POWER_ON_SEQUENCE
        *pu4Data = (UPTR)CUSTOMER_POWER_ON_SEQUENCE;
        return 0;
#else
        return -1 ;
#endif

    case eCustomerPowerOffSequence:
#ifdef CUSTOMER_POWER_OFF_SEQUENCE
        *pu4Data = (UPTR)CUSTOMER_POWER_OFF_SEQUENCE;
        return 0;
#else
        return -1 ;
#endif

    case ePowerStateQueryFunc:
#ifdef POWER_STATE_QUERY_FUNC
        *pu4Data = (UPTR)POWER_STATE_QUERY_FUNC;
        return 0;
#else
        return -1;
#endif
    case eCheckFrcInitStatus:
#ifdef CHECK_FRC_INIT_STATUS
        *pu4Data = (UPTR)CHECK_FRC_INIT_STATUS;
        return 0;
#else
        return -1 ;
#endif

    case eReadFRCVersionFromPanel:
#ifdef READ_FRC_VERSION_FROM_PANEL
        *pu4Data = (UPTR)READ_FRC_VERSION_FROM_PANEL;
        return 0;
#else
        return -1 ;
#endif

    case eFRCUnmute:
#ifdef FRC_UNMUTE
        *pu4Data = (UPTR)FRC_UNMUTE;
        return 0;
#else
        return -1 ;
#endif

    case eEnterFRCRegisterMode:
#ifdef ENTER_FRC_REGISTER_MODE
        *pu4Data = (UPTR)ENTER_FRC_REGISTER_MODE;
        return 0;
#else
        return -1 ;
#endif

    case eExitFRCRegisterMode:
#ifdef EXIT_FRC_REGISTER_MODE
        *pu4Data = (UPTR)EXIT_FRC_REGISTER_MODE;
        return 0;
#else
        return -1 ;
#endif

    case eEnableFRCVx1Out:
#ifdef ENABLE_FRC_VX1_OUT
        *pu4Data = (UPTR)ENABLE_FRC_VX1_OUT;
        return 0;
#else
        return -1 ;
#endif

case eDisableFRCVx1Out:
#ifdef DISABLE_FRC_VX1_OUT
        *pu4Data = (UPTR)DISABLE_FRC_VX1_OUT;
        return 0;
#else
        return -1 ;
#endif


#if defined(CC_NAND_ENABLE) || defined(CC_EMMC_BOOT)
#ifndef CC_MTK_PRELOADER
    // NAND flash partition name customization
    case eNANDFlashPartName0:
        *pu4Data = (UPTR)NAND_PART_NAME_0;
        return 0;

    case eNANDFlashPartName1:
        *pu4Data = (UPTR)NAND_PART_NAME_1;
        return 0;

    case eNANDFlashPartName2:
        *pu4Data = (UPTR)NAND_PART_NAME_2;
        return 0;

    case eNANDFlashPartName3:
        *pu4Data = (UPTR)NAND_PART_NAME_3;
        return 0;

    case eNANDFlashPartName4:
        *pu4Data = (UPTR)NAND_PART_NAME_4;
        return 0;

    case eNANDFlashPartName5:
        *pu4Data = (UPTR)NAND_PART_NAME_5;
        return 0;

    case eNANDFlashPartName6:
        *pu4Data = (UPTR)NAND_PART_NAME_6;
        return 0;

    case eNANDFlashPartName7:
        *pu4Data = (UPTR)NAND_PART_NAME_7;
        return 0;

    case eNANDFlashPartName8:
        *pu4Data = (UPTR)NAND_PART_NAME_8;
        return 0;

    case eNANDFlashPartName9:
        *pu4Data = (UPTR)NAND_PART_NAME_9;
        return 0;

    case eNANDFlashPartName10:
        *pu4Data = (UPTR)NAND_PART_NAME_10;
        return 0;

    case eNANDFlashPartName11:
        *pu4Data = (UPTR)NAND_PART_NAME_11;
        return 0;

    case eNANDFlashPartName12:
        *pu4Data = (UPTR)NAND_PART_NAME_12;
        return 0;

    case eNANDFlashPartName13:
        *pu4Data = (UPTR)NAND_PART_NAME_13;
        return 0;

    case eNANDFlashPartName14:
        *pu4Data = (UPTR)NAND_PART_NAME_14;
        return 0;

    case eNANDFlashPartName15:
        *pu4Data = (UPTR)NAND_PART_NAME_15;
        return 0;

    case eNANDFlashPartName16:
        *pu4Data = (UPTR)NAND_PART_NAME_16;
        return 0;

    case eNANDFlashPartName17:
        *pu4Data = (UPTR)NAND_PART_NAME_17;
        return 0;

    case eNANDFlashPartName18:
        *pu4Data = (UPTR)NAND_PART_NAME_18;
        return 0;

    case eNANDFlashPartName19:
        *pu4Data = (UPTR)NAND_PART_NAME_19;
        return 0;

    case eNANDFlashPartName20:
        *pu4Data = (UPTR)NAND_PART_NAME_20;
        return 0;

    case eNANDFlashPartName21:
        *pu4Data = (UPTR)NAND_PART_NAME_21;
        return 0;

    case eNANDFlashPartName22:
        *pu4Data = (UPTR)NAND_PART_NAME_22;
        return 0;

    case eNANDFlashPartName23:
        *pu4Data = (UPTR)NAND_PART_NAME_23;
        return 0;

    case eNANDFlashPartName24:
        *pu4Data = (UPTR)NAND_PART_NAME_24;
        return 0;

    case eNANDFlashPartName25:
        *pu4Data = (UPTR)NAND_PART_NAME_25;
        return 0;

    case eNANDFlashPartName26:
        *pu4Data = (UPTR)NAND_PART_NAME_26;
        return 0;

    case eNANDFlashPartName27:
        *pu4Data = (UPTR)NAND_PART_NAME_27;
        return 0;

    case eNANDFlashPartName28:
        *pu4Data = (UPTR)NAND_PART_NAME_28;
        return 0;

    case eNANDFlashPartName29:
        *pu4Data = (UPTR)NAND_PART_NAME_29;
        return 0;

    case eNANDFlashPartName30:
        *pu4Data = (UPTR)NAND_PART_NAME_30;
        return 0;

    case eNANDFlashPartName31:
        *pu4Data = (UPTR)NAND_PART_NAME_31;
        return 0;
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartName32:
        *pu4Data = (UPTR)NAND_PART_NAME_32;
        return 0;

    case eNANDFlashPartName33:
        *pu4Data = (UPTR)NAND_PART_NAME_33;
        return 0;

    case eNANDFlashPartName34:
        *pu4Data = (UPTR)NAND_PART_NAME_34;
        return 0;

    case eNANDFlashPartName35:
        *pu4Data = (UPTR)NAND_PART_NAME_35;
        return 0;

    case eNANDFlashPartName36:
        *pu4Data = (UPTR)NAND_PART_NAME_36;
        return 0;

    case eNANDFlashPartName37:
        *pu4Data = (UPTR)NAND_PART_NAME_37;
        return 0;

    case eNANDFlashPartName38:
        *pu4Data = (UPTR)NAND_PART_NAME_38;
        return 0;

    case eNANDFlashPartName39:
        *pu4Data = (UPTR)NAND_PART_NAME_39;
        return 0;

    case eNANDFlashPartName40:
        *pu4Data = (UPTR)NAND_PART_NAME_40;
        return 0;

    case eNANDFlashPartName41:
        *pu4Data = (UPTR)NAND_PART_NAME_41;
        return 0;

    case eNANDFlashPartName42:
        *pu4Data = (UPTR)NAND_PART_NAME_42;
        return 0;

    case eNANDFlashPartName43:
        *pu4Data = (UPTR)NAND_PART_NAME_43;
        return 0;

    case eNANDFlashPartName44:
        *pu4Data = (UPTR)NAND_PART_NAME_44;
        return 0;

    case eNANDFlashPartName45:
        *pu4Data = (UPTR)NAND_PART_NAME_45;
        return 0;

    case eNANDFlashPartName46:
        *pu4Data = (UPTR)NAND_PART_NAME_46;
        return 0;

    case eNANDFlashPartName47:
        *pu4Data = (UPTR)NAND_PART_NAME_47;
        return 0;

    case eNANDFlashPartName48:
        *pu4Data = (UPTR)NAND_PART_NAME_48;
        return 0;

    case eNANDFlashPartName49:
        *pu4Data = (UPTR)NAND_PART_NAME_49;
        return 0;

    case eNANDFlashPartName50:
        *pu4Data = (UPTR)NAND_PART_NAME_50;
        return 0;

    case eNANDFlashPartName51:
        *pu4Data = (UPTR)NAND_PART_NAME_51;
        return 0;

    case eNANDFlashPartName52:
        *pu4Data = (UPTR)NAND_PART_NAME_52;
        return 0;

    case eNANDFlashPartName53:
        *pu4Data = (UPTR)NAND_PART_NAME_53;
        return 0;

    case eNANDFlashPartName54:
        *pu4Data = (UPTR)NAND_PART_NAME_54;
        return 0;

    case eNANDFlashPartName55:
        *pu4Data = (UPTR)NAND_PART_NAME_55;
        return 0;

    case eNANDFlashPartName56:
        *pu4Data = (UPTR)NAND_PART_NAME_56;
        return 0;

    case eNANDFlashPartName57:
        *pu4Data = (UPTR)NAND_PART_NAME_57;
        return 0;

    case eNANDFlashPartName58:
        *pu4Data = (UPTR)NAND_PART_NAME_58;
        return 0;

    case eNANDFlashPartName59:
        *pu4Data = (UPTR)NAND_PART_NAME_59;
        return 0;

    case eNANDFlashPartName60:
        *pu4Data = (UPTR)NAND_PART_NAME_60;
        return 0;

    case eNANDFlashPartName61:
        *pu4Data = (UPTR)NAND_PART_NAME_61;
        return 0;

    case eNANDFlashPartName62:
        *pu4Data = (UPTR)NAND_PART_NAME_62;
        return 0;

    case eNANDFlashPartName63:
        *pu4Data = (UPTR)NAND_PART_NAME_63;
        return 0;
#endif
#endif /* CC_MTK_PRELOADER */
#endif /* defined(CC_NAND_ENABLE) || defined(CC_EMMC_BOOT) */
#if (defined(CC_HK_CUST) || defined(CC_CP_CUST))&&defined(CC_S_PLATFORM)
    case eUsbUpgradeViaDramBufAddr:
        *pu4Data = (UPTR)USB_UPGRADE_VIA_DRAM_BUFFER_ADDR;
        return 0;
    case eUsbUpgradeViaDramBufSize:
        *pu4Data = (UPTR)USB_UPGRADE_VIA_DRAM_BUFFER_SIZE;
        return 0;
#endif
#ifdef DRV_TURN_ON_PANEL_FUNC
    case eDrvTurnOnPanel:
        *pu4Data = (UPTR)DRV_TURN_ON_PANEL_FUNC;
        return 0;
#endif
#ifdef DRV_TURN_OFF_PANEL_FUNC
    case eDrvTurnOffPanel:
        *pu4Data = (UPTR)DRV_TURN_OFF_PANEL_FUNC;
        return 0;
#endif
#ifdef DRV_TURN_ON_BACKLT_FUNC
    case eDrvTurnOnBacklt:
        *pu4Data = (UPTR)DRV_TURN_ON_BACKLT_FUNC;
        return 0;
#endif
#ifdef DRV_TURN_OFF_BACKLT_FUNC
    case eDrvTurnOffBacklt:
        *pu4Data = (UPTR)DRV_TURN_OFF_BACKLT_FUNC;
        return 0;
#endif
#ifdef PANLE_IS_ON_FUNC
    case ePanelIsOnFunc:
        *pu4Data = (UPTR)PANLE_IS_ON_FUNC;
        return 0;
#endif
#ifdef PANLE_SET_BACKLIGHT_MUTE_ON_FUNC
    case ePanelSetBackLightMuteOnFunc:
        *pu4Data = (UPTR)PANLE_SET_BACKLIGHT_MUTE_ON_FUNC;
        return 0;
#endif

#ifdef PANLE_SET_BACKLIGHT_MUTE_OFF_FUNC
    case ePanelSetBackLightMuteOffFunc:
        *pu4Data = (UPTR)PANLE_SET_BACKLIGHT_MUTE_OFF_FUNC;
        return 0;
#endif
#ifdef PANLE_SET_PANEL_POWER_1_ON_FUNC
    case ePanelSetPanelPower1OnFunc:
        *pu4Data = (UPTR)PANLE_SET_PANEL_POWER_1_ON_FUNC;
        return 0;
#endif
#ifdef PANLE_SET_PANEL_POWER_1_OFF_FUNC
    case ePanelSetPanelPower1OffFunc:
        *pu4Data = (UPTR)PANLE_SET_PANEL_POWER_1_OFF_FUNC;
        return 0;
#endif
#ifdef PANLE_SET_PANEL_POWER_2_ON_FUNC
    case ePanelSetPanelPower2OnFunc:
        *pu4Data = (UPTR)PANLE_SET_PANEL_POWER_2_ON_FUNC;
        return 0;
#endif
#ifdef PANLE_SET_PANEL_POWER_2_OFF_FUNC
    case ePanelSetPanelPower2OffFunc:
        *pu4Data = (UPTR)PANLE_SET_PANEL_POWER_2_OFF_FUNC;
        return 0;
#endif
#ifdef GPIO_POWER_SET_EXT_DEC_MODEL_FUNC
    case eGpioPowerSetExtDecModelfunc:
        *pu4Data = (UPTR)GPIO_POWER_SET_EXT_DEC_MODEL_FUNC;
        return 0;
#endif /* GPIO_POWER_SET_EXT_DEC_MODEL_FUNC */
    default:
        break;
    }

    return -1;
}

UPTR DRVCUST_InitGetUptr(QUERY_UPTR_T eQryType)
{
    UPTR u4Ret;

    VERIFY(DRVCUST_InitQueryUptr(eQryType, &u4Ret) == 0);
    return u4Ret;
}

//----------------------------------------------------------------------------
/** DRVCUST_InitQuery64() return initial customization paramter, use for loader or BSP.
 */
//----------------------------------------------------------------------------
INT32 DRVCUST_InitQuery64(QUERY_TYPE_T eQryType, UINT64 *pu8Data)
{
    ASSERT(pu8Data!=NULL);

    switch(eQryType)
    {
// NAND flash parameter
#if defined(CC_NAND_ENABLE) || defined(CC_EMMC_BOOT)
    case eNANDFlashTotalSize:
        *pu8Data = (UINT64)NAND_FLASH_TOTAL_SIZE;
        return 0;

    case eNANDFlashStaticPartitionSize:
        *pu8Data = (UINT64)NAND_FLASH_STATIC_PART_SIZE;
        return 0;

    case eNANDFlashDynamicPartitionSize:
        *pu8Data = (UINT64)NAND_FLASH_DYNAMIC_PART_SIZE;
        return 0;

    case eNANDFlashStaticPartitionLastID:
        *pu8Data = (UINT64)NAND_FLASH_STATIC_LAST_PART_ID;
        return 0;

    case eNANDFlashDynamicPartitionID:
        *pu8Data = (UINT64)NAND_FLASH_DYNAMIC_PART_ID;
        return 0;

    case eNANDFlashPartIdEepromA:
        *pu8Data = (UINT64)NAND_PART_ID_EEPROM_A;
        return 0;

    case eNANDFlashPartIdEepromB:
        *pu8Data = (UINT64)NAND_PART_ID_EEPROM_B;
        return 0;

    // NAND flash partition offset customization
    case eNANDFlashPartOffset0:
        *pu8Data = (UINT64)0;
        return 0;

    case eNANDFlashPartOffset1:
        *pu8Data = (UINT64)NAND_PART_OFFSET_1;
        return 0;

    case eNANDFlashPartOffset2:
        *pu8Data = (UINT64)NAND_PART_OFFSET_2;
        return 0;

    case eNANDFlashPartOffset3:
        *pu8Data = (UINT64)NAND_PART_OFFSET_3;
        return 0;

    case eNANDFlashPartOffset4:
        *pu8Data = (UINT64)NAND_PART_OFFSET_4;
        return 0;

    case eNANDFlashPartOffset5:
        *pu8Data = (UINT64)NAND_PART_OFFSET_5;
        return 0;

    case eNANDFlashPartOffset6:
        *pu8Data = (UINT64)NAND_PART_OFFSET_6;
        return 0;

    case eNANDFlashPartOffset7:
        *pu8Data = (UINT64)NAND_PART_OFFSET_7;
        return 0;

    case eNANDFlashPartOffset8:
        *pu8Data = (UINT64)NAND_PART_OFFSET_8;
        return 0;

    case eNANDFlashPartOffset9:
        *pu8Data = (UINT64)NAND_PART_OFFSET_9;
        return 0;

    case eNANDFlashPartOffset10:
        *pu8Data = (UINT64)NAND_PART_OFFSET_10;
        return 0;

    case eNANDFlashPartOffset11:
        *pu8Data = (UINT64)NAND_PART_OFFSET_11;
        return 0;

    case eNANDFlashPartOffset12:
        *pu8Data = (UINT64)NAND_PART_OFFSET_12;
        return 0;

    case eNANDFlashPartOffset13:
        *pu8Data = (UINT64)NAND_PART_OFFSET_13;
        return 0;

    case eNANDFlashPartOffset14:
        *pu8Data = (UINT64)NAND_PART_OFFSET_14;
        return 0;

    case eNANDFlashPartOffset15:
        *pu8Data = (UINT64)NAND_PART_OFFSET_15;
        return 0;

    case eNANDFlashPartOffset16:
        *pu8Data = (UINT64)NAND_PART_OFFSET_16;
        return 0;

    case eNANDFlashPartOffset17:
        *pu8Data = (UINT64)NAND_PART_OFFSET_17;
        return 0;

    case eNANDFlashPartOffset18:
        *pu8Data = (UINT64)NAND_PART_OFFSET_18;
        return 0;

    case eNANDFlashPartOffset19:
        *pu8Data = (UINT64)NAND_PART_OFFSET_19;
        return 0;

    case eNANDFlashPartOffset20:
        *pu8Data = (UINT64)NAND_PART_OFFSET_20;
        return 0;

    case eNANDFlashPartOffset21:
        *pu8Data = (UINT64)NAND_PART_OFFSET_21;
        return 0;

    case eNANDFlashPartOffset22:
        *pu8Data = (UINT64)NAND_PART_OFFSET_22;
        return 0;

    case eNANDFlashPartOffset23:
        *pu8Data = (UINT64)NAND_PART_OFFSET_23;
        return 0;

    case eNANDFlashPartOffset24:
        *pu8Data = (UINT64)NAND_PART_OFFSET_24;
        return 0;

    case eNANDFlashPartOffset25:
        *pu8Data = (UINT64)NAND_PART_OFFSET_25;
        return 0;

    case eNANDFlashPartOffset26:
        *pu8Data = (UINT64)NAND_PART_OFFSET_26;
        return 0;

    case eNANDFlashPartOffset27:
        *pu8Data = (UINT64)NAND_PART_OFFSET_27;
        return 0;

    case eNANDFlashPartOffset28:
        *pu8Data = (UINT64)NAND_PART_OFFSET_28;
        return 0;

    case eNANDFlashPartOffset29:
        *pu8Data = (UINT64)NAND_PART_OFFSET_29;
        return 0;

    case eNANDFlashPartOffset30:
        *pu8Data = (UINT64)NAND_PART_OFFSET_30;
        return 0;

    case eNANDFlashPartOffset31:
        *pu8Data = (UINT64)NAND_PART_OFFSET_31;
        return 0;
#ifndef CC_MTK_PRELOADER
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartOffset32:
        *pu8Data = (UINT64)NAND_PART_OFFSET_32;
        return 0;

    case eNANDFlashPartOffset33:
        *pu8Data = (UINT64)NAND_PART_OFFSET_33;
        return 0;

    case eNANDFlashPartOffset34:
        *pu8Data = (UINT64)NAND_PART_OFFSET_34;
        return 0;

    case eNANDFlashPartOffset35:
        *pu8Data = (UINT64)NAND_PART_OFFSET_35;
        return 0;

    case eNANDFlashPartOffset36:
        *pu8Data = (UINT64)NAND_PART_OFFSET_36;
        return 0;

    case eNANDFlashPartOffset37:
        *pu8Data = (UINT64)NAND_PART_OFFSET_37;
        return 0;

    case eNANDFlashPartOffset38:
        *pu8Data = (UINT64)NAND_PART_OFFSET_38;
        return 0;

    case eNANDFlashPartOffset39:
        *pu8Data = (UINT64)NAND_PART_OFFSET_39;
        return 0;

    case eNANDFlashPartOffset40:
        *pu8Data = (UINT64)NAND_PART_OFFSET_40;
        return 0;

    case eNANDFlashPartOffset41:
        *pu8Data = (UINT64)NAND_PART_OFFSET_41;
        return 0;

    case eNANDFlashPartOffset42:
        *pu8Data = (UINT64)NAND_PART_OFFSET_42;
        return 0;

    case eNANDFlashPartOffset43:
        *pu8Data = (UINT64)NAND_PART_OFFSET_43;
        return 0;

    case eNANDFlashPartOffset44:
        *pu8Data = (UINT64)NAND_PART_OFFSET_44;
        return 0;

    case eNANDFlashPartOffset45:
        *pu8Data = (UINT64)NAND_PART_OFFSET_45;
        return 0;

    case eNANDFlashPartOffset46:
        *pu8Data = (UINT64)NAND_PART_OFFSET_46;
        return 0;

    case eNANDFlashPartOffset47:
        *pu8Data = (UINT64)NAND_PART_OFFSET_47;
        return 0;

    case eNANDFlashPartOffset48:
        *pu8Data = (UINT64)NAND_PART_OFFSET_48;
        return 0;

    case eNANDFlashPartOffset49:
        *pu8Data = (UINT64)NAND_PART_OFFSET_49;
        return 0;

    case eNANDFlashPartOffset50:
        *pu8Data = (UINT64)NAND_PART_OFFSET_50;
        return 0;

    case eNANDFlashPartOffset51:
        *pu8Data = (UINT64)NAND_PART_OFFSET_51;
        return 0;

    case eNANDFlashPartOffset52:
        *pu8Data = (UINT64)NAND_PART_OFFSET_52;
        return 0;

    case eNANDFlashPartOffset53:
        *pu8Data = (UINT64)NAND_PART_OFFSET_53;
        return 0;

    case eNANDFlashPartOffset54:
        *pu8Data = (UINT64)NAND_PART_OFFSET_54;
        return 0;

    case eNANDFlashPartOffset55:
        *pu8Data = (UINT64)NAND_PART_OFFSET_55;
        return 0;

    case eNANDFlashPartOffset56:
        *pu8Data = (UINT64)NAND_PART_OFFSET_56;
        return 0;

    case eNANDFlashPartOffset57:
        *pu8Data = (UINT64)NAND_PART_OFFSET_57;
        return 0;

    case eNANDFlashPartOffset58:
        *pu8Data = (UINT64)NAND_PART_OFFSET_58;
        return 0;

    case eNANDFlashPartOffset59:
        *pu8Data = (UINT64)NAND_PART_OFFSET_59;
        return 0;

    case eNANDFlashPartOffset60:
        *pu8Data = (UINT64)NAND_PART_OFFSET_60;
        return 0;

    case eNANDFlashPartOffset61:
        *pu8Data = (UINT64)NAND_PART_OFFSET_61;
        return 0;

    case eNANDFlashPartOffset62:
        *pu8Data = (UINT64)NAND_PART_OFFSET_62;
        return 0;

    case eNANDFlashPartOffset63:
        *pu8Data = (UINT64)NAND_PART_OFFSET_63;
        return 0;
#endif
#endif

#ifndef CC_MTK_PRELOADER
    case eSDCARDUpgradeOffset:
#ifdef SDCARD_UPGRADE_PART_OFFSET
	    *pu8Data = (UINT64) SDCARD_UPGRADE_PART_OFFSET;
#else
		*pu8Data = (UINT64) NAND_PART_OFFSET_24;
#endif
        return 0;

	case eSDCARDUpgradeSupport:
#ifdef SDCARD_UPGRADE_SUPPORT_FLAG
	    *pu8Data = (UINT64) SDCARD_UPGRADE_SUPPORT_FLAG;
#else
		*pu8Data = (UINT64) 0;
#endif
        return 0;
#endif
    // NAND flash partition size customization
    case eNANDFlashPartSize0:
        *pu8Data = (UINT64)NAND_PART_SIZE_0;
        return 0;

    case eNANDFlashPartSize1:
        *pu8Data = (UINT64)NAND_PART_SIZE_1;
        return 0;

    case eNANDFlashPartSize2:
        *pu8Data = (UINT64)NAND_PART_SIZE_2;
        return 0;

    case eNANDFlashPartSize3:
        *pu8Data = (UINT64)NAND_PART_SIZE_3;
        return 0;

    case eNANDFlashPartSize4:
        *pu8Data = (UINT64)NAND_PART_SIZE_4;
        return 0;

    case eNANDFlashPartSize5:
        *pu8Data = (UINT64)NAND_PART_SIZE_5;
        return 0;

    case eNANDFlashPartSize6:
        *pu8Data = (UINT64)NAND_PART_SIZE_6;
        return 0;

    case eNANDFlashPartSize7:
        *pu8Data = (UINT64)NAND_PART_SIZE_7;
        return 0;

    case eNANDFlashPartSize8:
        *pu8Data = (UINT64)NAND_PART_SIZE_8;
        return 0;

    case eNANDFlashPartSize9:
        *pu8Data = (UINT64)NAND_PART_SIZE_9;
        return 0;

    case eNANDFlashPartSize10:
        *pu8Data = (UINT64)NAND_PART_SIZE_10;
        return 0;

    case eNANDFlashPartSize11:
        *pu8Data = (UINT64)NAND_PART_SIZE_11;
        return 0;

    case eNANDFlashPartSize12:
        *pu8Data = (UINT64)NAND_PART_SIZE_12;
        return 0;

    case eNANDFlashPartSize13:
        *pu8Data = (UINT64)NAND_PART_SIZE_13;
        return 0;

    case eNANDFlashPartSize14:
        *pu8Data = (UINT64)NAND_PART_SIZE_14;
        return 0;

    case eNANDFlashPartSize15:
        *pu8Data = (UINT64)NAND_PART_SIZE_15;
        return 0;

    case eNANDFlashPartSize16:
        *pu8Data = (UINT64)NAND_PART_SIZE_16;
        return 0;

    case eNANDFlashPartSize17:
        *pu8Data = (UINT64)NAND_PART_SIZE_17;
        return 0;

    case eNANDFlashPartSize18:
        *pu8Data = (UINT64)NAND_PART_SIZE_18;
        return 0;

    case eNANDFlashPartSize19:
        *pu8Data = (UINT64)NAND_PART_SIZE_19;
        return 0;

    case eNANDFlashPartSize20:
        *pu8Data = (UINT64)NAND_PART_SIZE_20;
        return 0;

    case eNANDFlashPartSize21:
        *pu8Data = (UINT64)NAND_PART_SIZE_21;
        return 0;

    case eNANDFlashPartSize22:
        *pu8Data = (UINT64)NAND_PART_SIZE_22;
        return 0;

    case eNANDFlashPartSize23:
        *pu8Data = (UINT64)NAND_PART_SIZE_23;
        return 0;

    case eNANDFlashPartSize24:
        *pu8Data = (UINT64)NAND_PART_SIZE_24;
        return 0;

    case eNANDFlashPartSize25:
        *pu8Data = (UINT64)NAND_PART_SIZE_25;
        return 0;

    case eNANDFlashPartSize26:
        *pu8Data = (UINT64)NAND_PART_SIZE_26;
        return 0;

    case eNANDFlashPartSize27:
        *pu8Data = (UINT64)NAND_PART_SIZE_27;
        return 0;

    case eNANDFlashPartSize28:
        *pu8Data = (UINT64)NAND_PART_SIZE_28;
        return 0;

    case eNANDFlashPartSize29:
        *pu8Data = (UINT64)NAND_PART_SIZE_29;
        return 0;

    case eNANDFlashPartSize30:
        *pu8Data = (UINT64)NAND_PART_SIZE_30;
        return 0;

    case eNANDFlashPartSize31:
        *pu8Data = (UINT64)NAND_PART_SIZE_31;
        return 0;
#ifndef CC_MTK_PRELOADER
#ifdef CC_MTD_SUPPORT_64_PARTITION
    case eNANDFlashPartSize32:
        *pu8Data = (UINT64)NAND_PART_SIZE_32;
        return 0;

    case eNANDFlashPartSize33:
        *pu8Data = (UINT64)NAND_PART_SIZE_33;
        return 0;

    case eNANDFlashPartSize34:
        *pu8Data = (UINT64)NAND_PART_SIZE_34;
        return 0;

    case eNANDFlashPartSize35:
        *pu8Data = (UINT64)NAND_PART_SIZE_35;
        return 0;

    case eNANDFlashPartSize36:
        *pu8Data = (UINT64)NAND_PART_SIZE_36;
        return 0;

    case eNANDFlashPartSize37:
        *pu8Data = (UINT64)NAND_PART_SIZE_37;
        return 0;

    case eNANDFlashPartSize38:
        *pu8Data = (UINT64)NAND_PART_SIZE_38;
        return 0;

    case eNANDFlashPartSize39:
        *pu8Data = (UINT64)NAND_PART_SIZE_39;
        return 0;

    case eNANDFlashPartSize40:
        *pu8Data = (UINT64)NAND_PART_SIZE_40;
        return 0;

    case eNANDFlashPartSize41:
        *pu8Data = (UINT64)NAND_PART_SIZE_41;
        return 0;

    case eNANDFlashPartSize42:
        *pu8Data = (UINT64)NAND_PART_SIZE_42;
        return 0;

    case eNANDFlashPartSize43:
        *pu8Data = (UINT64)NAND_PART_SIZE_43;
        return 0;

    case eNANDFlashPartSize44:
        *pu8Data = (UINT64)NAND_PART_SIZE_44;
        return 0;

    case eNANDFlashPartSize45:
        *pu8Data = (UINT64)NAND_PART_SIZE_45;
        return 0;

    case eNANDFlashPartSize46:
        *pu8Data = (UINT64)NAND_PART_SIZE_46;
        return 0;

    case eNANDFlashPartSize47:
        *pu8Data = (UINT64)NAND_PART_SIZE_47;
        return 0;

    case eNANDFlashPartSize48:
        *pu8Data = (UINT64)NAND_PART_SIZE_48;
        return 0;

    case eNANDFlashPartSize49:
        *pu8Data = (UINT64)NAND_PART_SIZE_49;
        return 0;

    case eNANDFlashPartSize50:
        *pu8Data = (UINT64)NAND_PART_SIZE_50;
        return 0;

    case eNANDFlashPartSize51:
        *pu8Data = (UINT64)NAND_PART_SIZE_51;
        return 0;

    case eNANDFlashPartSize52:
        *pu8Data = (UINT64)NAND_PART_SIZE_52;
        return 0;

    case eNANDFlashPartSize53:
        *pu8Data = (UINT64)NAND_PART_SIZE_53;
        return 0;

    case eNANDFlashPartSize54:
        *pu8Data = (UINT64)NAND_PART_SIZE_54;
        return 0;

    case eNANDFlashPartSize55:
        *pu8Data = (UINT64)NAND_PART_SIZE_55;
        return 0;

    case eNANDFlashPartSize56:
        *pu8Data = (UINT64)NAND_PART_SIZE_56;
        return 0;

    case eNANDFlashPartSize57:
        *pu8Data = (UINT64)NAND_PART_SIZE_57;
        return 0;

    case eNANDFlashPartSize58:
        *pu8Data = (UINT64)NAND_PART_SIZE_58;
        return 0;

    case eNANDFlashPartSize59:
        *pu8Data = (UINT64)NAND_PART_SIZE_59;
        return 0;

    case eNANDFlashPartSize60:
        *pu8Data = (UINT64)NAND_PART_SIZE_60;
        return 0;

    case eNANDFlashPartSize61:
        *pu8Data = (UINT64)NAND_PART_SIZE_61;
        return 0;

    case eNANDFlashPartSize62:
        *pu8Data = (UINT64)NAND_PART_SIZE_62;
        return 0;

    case eNANDFlashPartSize63:
        *pu8Data = (UINT64)NAND_PART_SIZE_63;
        return 0;
#endif
#endif
    case eSystemEepromSize:
        *pu8Data = (UINT64)SYSTEM_EEPROM_SIZE;
        return 0;
#ifndef CC_MTK_PRELOADER
#ifdef CC_EEP2EMMC_DUAL_BANK_SUPPORT
    case eSystemEepHeaderSize:
#ifdef SYSTEM_EEPROM_HEADER_SIZE
        *pu8Data = (UINT64) SYSTEM_EEPROM_HEADER_SIZE;
#else
        *pu8Data = (UINT64) (300*1024);
#endif
        return 0;

    case eSystemEepInitHeaderSize:
#ifdef SYSTEM_EEPROM_INIT_HEADER_SIZE
        *pu8Data = (UINT64) SYSTEM_EEPROM_INIT_HEADER_SIZE;
#else
        *pu8Data = (UINT64) 4096;
#endif
        return 0;
#endif

#ifdef CC_MAPLE_BE_LOADER_BOOT_FLOW
    case eBELBootPowerOnGpio:
#ifdef BEL_BOOT_POWER_ON_GPIO
        *pu8Data = (UINT64)BEL_BOOT_POWER_ON_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBELBootPowerOnPolarity:
#ifdef BEL_BOOT_POWER_ON_POLARITY
        *pu8Data = (UINT64)BEL_BOOT_POWER_ON_POLARITY;
        return 0;
#else
        return -1;
#endif
    case eBELBootUpNotifyGpio:
#ifdef BEL_BOOT_UP_NOTIFY_GPIO
        *pu8Data = (UINT64)BEL_BOOT_UP_NOTIFY_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBELBootUpNotifyGpioPolarity:
#ifdef BEL_BOOT_UP_NOTIFY_POLARITY
        *pu8Data = (UINT64)BEL_BOOT_UP_NOTIFY_POLARITY;
        return 0;
#else
        return -1;
#endif
    case eBELBootVx1ReqGpio:
#ifdef BEL_BOOT_VX1_REQ_GPIO
        *pu8Data = (UINT64)BEL_BOOT_VX1_REQ_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBELBootVx1ReqGpioPolarity:
#ifdef BEL_BOOT_VX1_REQ_POLARITY
        *pu8Data = (UINT64)BEL_BOOT_VX1_REQ_POLARITY;
        return 0;
#else
        return -1;
#endif
    case eBELBootPnlPwrNotifyGpio:
#ifdef BEL_BOOT_PNL_PWR_NOTIFY_GPIO
        *pu8Data = (UINT64)BEL_BOOT_PNL_PWR_NOTIFY_GPIO;
        return 0;
#else
        return -1;
#endif
    case eBELBootPnlPwrNotifyGpioPolarity:
#ifdef BEL_BOOT_PNL_PWR_NOTIFY_POLARITY
        *pu8Data = (UINT64)BEL_BOOT_PNL_PWR_NOTIFY_POLARITY;
        return 0;
#else
        return -1;
#endif
    case eBELPartitionId:
#ifdef FLASH_BE_BASE_PARTITION
        *pu8Data = (UINT64)FLASH_BE_BASE_PARTITION;
        return 0;
#else
        *pu8Data = (UINT64)26;
        return 0;
#endif
    case eBELMinfPartitionId:
#ifdef FLASH_BE_MINF_BASE_PARTITION
        *pu8Data = (UINT64)FLASH_BE_MINF_BASE_PARTITION;
        return 0;
#else
        *pu8Data = (UINT64)38;
        return 0;
#endif
#endif
#endif//ifndef CC_MTK_PRELOADER

#endif // CC_NAND_ENABLE
#ifdef CC_MAPLE_BE_LOADER_BOOT_FLOW

    case eBELFrameCfgTbl:
#ifdef BE_FRAME_CONFIG_TABLE
#ifdef BE_SUPPORT_3_FRAME_BOOT
        *pu8Data = (UINT64)BE_FRAME_CONFIG_TABLE_New;
#else
        *pu8Data = (UINT64)BE_FRAME_CONFIG_TABLE;
#endif
        return 0;
#else
        return -1;
#endif
    case eBELFrameCfgTblSize:
#ifdef BE_FRAME_CONFIG_SIZE
#ifdef BE_SUPPORT_3_FRAME_BOOT
        *pu8Data = (UINT64)BE_FRAME_CONFIG_SIZE_New;
#else
        *pu8Data = (UINT64)BE_FRAME_CONFIG_SIZE;
#endif

        return 0;
#else
        return -1;
#endif
#endif
	   //DOLBY
#ifdef CC_SUPPORT_DOLBY_VISION
	case eFlagDolbyCfgPartition:
#ifdef FLASH_DOLBY_VISION_PARTITION
		*pu8Data = (UINT64)FLASH_DOLBY_VISION_PARTITION;
#else
		*pu8Data = (UINT64)0;
#endif
		return 0;
#endif//CC_SUPPORT_DOLBY_VISION

#ifdef CC_MAPLE_CUST_DRV
	case eSPQDPartition:
#ifdef FLASH_SPQD_PARTITION
		*pu8Data = (UINT32)FLASH_SPQD_PARTITION;
		return 0;
#else
		*pu8Data = (UINT32)53;
		return 0;
#endif
	case eSPQCPartition:
#ifdef FLASH_SPQC_PARTITION
		*pu8Data = (UINT32)FLASH_SPQC_PARTITION;
		return 0;
#else
		*pu8Data = (UINT32)54;
		return 0;
#endif
#endif

    default:
        break;
    }

    return -1;
}

UINT64 DRVCUST_InitGet64(QUERY_TYPE_T eQryType)
{
    UINT64 u8Ret = 0;

    VERIFY(DRVCUST_InitQuery64(eQryType, &u8Ret) == 0);
    return u8Ret;
}

#ifndef CC_MTK_PRELOADER
void DRVCUST_BootupCheck()
{
// #if MT8280_RESET_GPIO
//     GPIO_SetOut(MT8280_RESET_GPIO, 1);
// #endif /* MT8280_RESET_GPIO */

#ifdef CUSTOM_BootupCheck
    CUSTOM_BootupCheck();
#endif /* CUSTOM_BootupCheck */
}

#ifndef CUSTOM_BootupMode
#define CUSTOM_BootupMode       (0)
#endif /* CUSTOM_BootupMode */

INT32 DRVCUST_GetBootupMode()
{
    return CUSTOM_BootupMode;
}

#if defined(CC_DYNAMIC_FBMSRM_CONF)
INT32 FBMDynIs4KMode()
{
   if(BIM_READ32(0xe0)!=0)
    return 1;
   else
   	return 0;
}
#endif

INT32 DRVCUST_IsLogoDisableInEeprom()
{
#ifndef CUSTOM_IsLogoDisableInEeprom
    return 0;
#else /* CUSTMO_IsLogoDisableInEeprom */
    return CUSTOM_IsLogoDisableInEeprom();
#endif /* CUSTMO_IsLogoDisableInEeprom */
}
#endif /* CC_MTK_PRELOADER */

#ifndef CC_MTK_LOADER
void DRVCUST_UserLISR(INT32 i4Vector)
{
#ifdef CUSTOM_USER_LISR
    CUSTOM_USER_LISR(i4Vector);
#endif /* CUSTOM_USER_LISR */
}
#endif /* CC_MTK_LOADER */

#ifdef CC_PHP_SUPPORT
#ifndef CC_MTK_PRELOADER
UINT16 DRVCUST_NVMOptionCodeCheck(UINT32 u4OpAddr,UINT16 u2Mask)
{
	UINT16 u2OpData = 0;
    UINT8 u1OpData0 = 0;
	UINT8 u1OpData1 = 0;
    EEPROM_Read((UINT64)u4OpAddr, (UPTR)(void *)(&u1OpData0), 1);
	EEPROM_Read((UINT64)(u4OpAddr+1), (UPTR)(void *)(&u1OpData1), 1);
	u2OpData = (u1OpData1 << 8) + u1OpData0;
    u2OpData = (u2OpData & u2Mask);
#ifdef OP_DEBUG
	Printf("[DRVCUST_NVMOptionCodeCheck] :u4OpAddr:0x%2x,u2OpData:0x%2x\n",u4OpAddr,u2OpData);
#endif
    return u2OpData;
}
void DRVCUST_VideoSysInit(void)
{
	rOPCodeState.rOP1_3D 				=DRVCUST_NVMOptionCodeCheck(OP1,0x0380)>>7;  	/*OP1 7~9*/
	rOPCodeState.rOP5_PRODUCT_TYPE 		=DRVCUST_NVMOptionCodeCheck(OP5,0x03800)>>11;  /*OP5 11~13*/
	rOPCodeState.rOP7_CHANNEL_DECODER   =DRVCUST_NVMOptionCodeCheck(OP7,0xf000)>>12;  	/*OP7 12~15*/
	rOPCodeState.rOP2_UHD				=DRVCUST_NVMOptionCodeCheck(OP2,0x20)>>5;		/*OP2 5~5*/
	rOPCodeState.rOP5_FRC 				=DRVCUST_NVMOptionCodeCheck(OP5,0x300)>>8;		/*OP5 8~9*/
	rOPCodeState.rOP7_TCONTYPE 			=DRVCUST_NVMOptionCodeCheck(OP7,0x380)>>7;		/*OP7 7~9*/
	rOPCodeState.rOP6_PANELFREQUENCY 	=DRVCUST_NVMOptionCodeCheck(OP6,0x1000)>>12;	/*OP6 12~12*/
	rOPCodeState.rOP6_DNM				=DRVCUST_NVMOptionCodeCheck(OP6,0x300)>>8;		/*OP6 8~9*/
	rOPCodeState.rOP2_ISF 				=DRVCUST_NVMOptionCodeCheck(OP2,1);				/*OP2 0~0*/
	rOPCodeState.rOP2_BACKENDPQ 		=DRVCUST_NVMOptionCodeCheck(OP2,0x40)>>6;		/*OP2 6~6*/
	//rOPCodeState.rOP5_SOCTYPE 			=DRVCUST_NVMOptionCodeCheck(OP5,0xC0)>>6;		/*OP5 6~7*/ removed in v1.2 option code
	LOG(0,"[opcode::3D=%d,ProductType=%d,UHD=%d,FRC=%d,TconTYPE=%d,Frequency=%d,DNM=%d,IsMjcSup=%d, opcode end&&&&&&] \n",\
			rOPCodeState.rOP1_3D,rOPCodeState.rOP5_PRODUCT_TYPE,rOPCodeState.rOP2_UHD,\
			 rOPCodeState.rOP5_FRC,rOPCodeState.rOP7_TCONTYPE,\
			 rOPCodeState.rOP6_PANELFREQUENCY,rOPCodeState.rOP6_DNM,DRVCUST_GetMJCSupport);
}

#endif
#endif

#endif /* defined(CC_NAND_BOOT) && defined(CC_MTK_PRELOADER) */



//----------------------------------------------------------------------------
/** DRVCUST_DramClk()
 *  In Preloader,  use #define DRVCUST_InitGet(x) to get clock
 *  In others,      use UINT32 DRVCUST_InitGet() to get clock
 */
//----------------------------------------------------------------------------
//#define DRAM_CFG_BY_GPIO
UINT32 DRVCUST_DramClk(UINT32 clk)
{
    UINT32 u4DramClk = clk;

#if (DEFAULT_DRAM_CFG_BY_GPIO)

    // GPIO 49, 69, 70, 72
    // set to input mode
    HAL_WRITE32(IO_VIRT + 0xD724,HAL_READ32(IO_VIRT + 0xD724) & 0xFFFDFFFF);
    HAL_WRITE32(IO_VIRT + 0xD728,HAL_READ32(IO_VIRT + 0xD728) & 0xFFFFFE9F);
    // Read GPIO 49, 69, 70, 72
    u4DramClk = (((HAL_READ32(IO_VIRT + 0xD748) & 0x00000100)>>5)
                  | ((HAL_READ32(IO_VIRT + 0xD748) & 0x00000040)>>6)
                  | ((HAL_READ32(IO_VIRT + 0xD748) & 0x00000020)>>4)
                  | ((HAL_READ32(IO_VIRT + 0xD744) & 0x00020000)>>15));
    //u4DramClk = 255;

    switch ((UINT8)(u4DramClk))
    {
        case 255:
            u4DramClk = 1608000000;
            break;
        case 1:
        case 5:
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
        case 13:
        case 14:
        case 15:
            u4DramClk = 1536000000;
            break;
        default:
            u4DramClk = 1320000000;
            break;
    }

#endif //DEFAULT_DRAM_CFG_BY_GPIO

    return u4DramClk;
}

UINT16 DRVCUST_GetFrcFrmDly(void)
{
    return 0;//sony set this delay in sony ko
}


UINT16 DRVCUST_GetPnlBlDly(void)
{
	 return 0;//sony set this delay in sony ko
}


