/*=============================================================================
File: mdppLib.c
=============================================================================*/
#ifdef __cplusplus extern “C” { #endif
#include <PlatformInfo.h> #include <Library/PcdLib.h> #include <api/pmic/pm/pm_lcdb.h> #include <api/pmic/pm/pm_wled.h> #include <api/pmic/pm/pm_ldo.h> #include <api/pmic/pm/pm_smps.h> #include <api/pmic/pm/pm_boot.h> #include <api/pmic/pm/pm_version.h> #include “MDPTypes.h” #include “MDPPlatformLib.h” #include “MDPSystem.h” #include “DDITlmm.h” #include “pmapp_npa.h” #include “npa.h” #include “boot_extern_platforminfo_interface.h” #include “HALDSILib.h”
/* ----------------------------------------------------------------------- ** Defines ** ----------------------------------------------------------------------- */ #define PCD_PANEL_TYPE_OEM 1
#define DSI_READ_ADDRESS_SIZE 2 #define DSI_READ_READBACK_SIZE 8
#define PLATFORM_PANEL_ID_MAX_COMMANDS 3 // maximum panel ID read commands
// PMIC Device Indices #define PMIC_A 0 // PMIC device (Vreg, LDO, ect) #define PMIC_A 0 // PMIC device (Vreg, LDO, ect) #define PMIC_PMI_DEV_INDEX 1 // PMIC interface device (IBB/LAB, GPIO, WLED)
#define PMIC_IBBLAB_READYTIME 25 // Maximum of milliseconds to wait for IBB/LAB to stabilize (Can be up to 8.8ms +/-16%)
/* SM8250 Main Panel CDP specific defines */ #define CDP_DISP_RESET_GPIO 75 // GPIO number for LCD0_RESET #define CDP_DISP_TE_GPIO 66 // GPIO number for TE #define CDP_DISP_MODE_SEL 46 // GPIO for panel mode select 0 = Dual Port, 1 = Single Port (DSC) #define CDP_DISP_LCD_REG_EN 61 // GPIO for LCD internal boost power #define CDP_DISP_LCD_BKLT_EN 60 // GPIO for backlight enable #define CDP_SEC_DISP_RESET_GPIO 128 // GPIO number for LCD0_RESET on secondary display #define CDP_SEC_DISP_TE_GPIO 67 // GPIO number for TE on secondary display
#define DSI_WRITE_BACKLIGHT_SIZE 3
#define DISP_DIV_ROUND_UP(x, y) (((x) + (y/2)) / (y)) #define PANEL_LIST_LENGTH(LIST) (sizeof(LIST)/sizeof((LIST)[0]))
// Get reset gpio based on display id #define GET_CDP_DISP_RESET_GPIO(displayId) (((displayId) == MDP_DISPLAY_SECONDARY) ? CDP_SEC_DISP_RESET_GPIO : CDP_DISP_RESET_GPIO)
// Get te gpio based on display id #define GET_CDP_DISP_TE_GPIO(displayId) (((displayId) == MDP_DISPLAY_SECONDARY) ? CDP_SEC_DISP_TE_GPIO : CDP_DISP_TE_GPIO) uint8 readback[DSI_READ_READBACK_SIZE];
/* ----------------------------------------------------------------------- ** Types ** ----------------------------------------------------------------------- */
/* Panel command ID list for dynamic panel detection */
typedef struct { uint8 address[DSI_READ_ADDRESS_SIZE]; // DCS command for panel ID uint8 expectedReadback[DSI_READ_READBACK_SIZE]; // expected readback } PlatformPanelIDCommandInfo;
/* Dynamic panel ID detection entry */ typedef struct { uint8 uCmdType; // data type for panel ID DSI read uint32 uTotalRetry; // number of retry if DSI read fails PlatformPanelIDCommandInfo panelIdCommands[PLATFORM_PANEL_ID_MAX_COMMANDS]; // commands for panel ID and expected readback uint32 uLaneRemapOrder; // Lane remap order const int8 *psPanelCfg; // pointer to the panel configuration uint32 uPanelCfgSize; // size of panel configuration data MDPPlatformPanelType eSelectedPanel; // index of the selected panel uint32 uFlags; // flags to set clock config for now, can set other config in future } PlatformDSIDetectParams;
/* Power configuration / typedef struct { MDP_PmicModuleControlType ePMICSecondaryPower[MDP_DISPLAY_MAX]; // Configuration for PMIC based secondary power source } Panel_PowerCtrlParams; / NPA Client info / typedef struct { char cResourceName; char* cClientName; }NPAClientName;
/* Panel backlight DCS command */ typedef struct { uint8 uCmdType; // DCS command type for backlight control uint8 command[DSI_WRITE_BACKLIGHT_SIZE]; // DCS command for backlight control } PlatformPanelBacklightControl;
/* ----------------------------------------------------------------------- ** Local functions ** ----------------------------------------------------------------------- */
/* Platform detection */ static MDP_Status ReadPlatformIDAndChipID(EFI_PLATFORMINFO_PLATFORM_INFO_TYPE *pPlatformInfo, EFIChipInfoIdType *pChipSetId, EFIChipInfoFamilyType *pChiSetFamily); static MDP_Status DynamicDSIPanelDetection(MDPPlatformPanelInfo *pPlatformPanel, uint32 *puPanelID, PlatformDSIDetectParams *pPanelList, uint32 uPanelCnt);
/* 8998 Main Panel CDP Functions */ static MDP_Status Panel_CDP_PowerUp(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams); static MDP_Status Panel_CDP_PowerDown(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams); static MDP_Status Panel_CDP_Reset(MDP_Display_IDType eDisplayId); static MDP_Status Panel_CDP_BacklightLevel(MDP_Display_IDType eDisplayId, BacklightConfigType *pBacklightConfig); static MDP_Status Panel_CDP_PeripheralPower(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams, bool32 bPowerUp); static void Panel_IBBLAB_WaitForReady();
/* Main Panel CDP/MTP Functions */
/* General helper functions */ MDP_Status SetDefaultGPIOState(GpioStateType *pGPIOList);
/=========================================================================== Local Configuration Definitions ===========================================================================/ //wanghui add for lcd /******************************************************************
/ const static int8 Primary_rm692e0_1080p_cmd_xmldata[] = “<?xml version=\"1.0\" encoding=\"utf-8\"?>” “rm692e0 DSI Command Mode Panel (1080x2400 24bpp)” “<Group id=“Active Timing”>” " 1080" " 0" " 0" " 0" " 0" " 0" " 0" " 2400" " 0" " 0" " 0" " 0" " 0" " 0" " False" " False" " False" " 0x0" “” “<Group id=“Display Interface”>” " 9" " 3" “” “<Group id=“DSI Interface”>” " 2" " 0" " 36" " 1" " 4" " 0x3C0000" " False" " False" " True" " 2" " True" " True" " 2400" " 2400" " " " 00\n" " " “” “” " 15 FE 00\n" " 15 C2 08\n" " 15 35 00\n" " 15 51 07 ff\n" " 05 11 00\n" " FF 78\n" " 05 29 00\n" “” “” " 05 28\n" " 05 10\n" “” “0x2E 0x3D” “” " 3" “12” “\n”; /
******************************************************************/
const static int8 Primary_vtdr6130_1080p_cmd_xmldata[] = “<?xml version=\"1.0\" encoding=\"utf-8\"?>” “vtdr6130 DSI Command Mode Panel (1080x2400 24bpp)” “<Group id=“Active Timing”>” " 1080" " 0" " 0" " 0" " 0" " 0" " 0" " 2400" " 0" " 0" " 0" " 0" " 0" " 0" " False" " False" " False" " 0x0" “” “<Group id=“Display Interface”>” " 9" " 3" “” “<Group id=“DSI Interface”>” " 2" " 0" " 36" " 1" " 4" " 19200000" " 0x3C0000" " False" " False" " True" " 2" " True" " True" " 2400" " 2400" “1” " True" " 1" " 1" " 0" " 0x0B" " 540" " 12" " 1" " " " 00\n" " " “” “” " 15 03 01\n" " 15 59 09\n" " 15 35 00\n" " 15 53 20\n" " 15 51 07 ff\n" " 15 6c 00\n" " 15 6d 01\n" " 15 6f 02\n" " 39 70 11 00 00 AC 30 80 09 60 04 38 00 C8 02 1C 02 1C 02 00 01 17 00 20 22 E5 00 07 00 01 00 0B 00 83 18 00 10 F0 07 10 20 00 06 0F 0F 33 0E 1C 2A 38 46 54 62 69 70 77 79 7B 7D 7E 02 02 22 00 2A 40 2A BE 3A FC 3A FA 3A F8 3B 38 3B 78 3B B6 4B B6 4B F4 4B F4 6C 34 84 74 00 00 00 00 00 00\n" " 05 11 00\n" " FF 78\n" " 05 29 00\n" “” “” " 05 28\n" " 05 10\n" “” “0x2E 0x3D” “” " 3" “12” “\n”;
/******************************************************************
******************************************************************/ const static int8 Primary_Sharp_1080p_cmd_xmldata[] = “<?xml version=\"1.0\" encoding=\"utf-8\"?>” “Sharp DSI Command Mode Panel (1080x1920 24bpp)” “<Group id=“Active Timing”>” " 1080" " 0" " 0" " 0" " 0" " 0" " 0" " 1920" " 0" " 0" " 0" " 0" " 0" " 0" " False" " False" " False" " 0x0" “” “<Group id=“Display Interface”>” " 9" " 3" “” “<Group id=“DSI Interface”>” " 2" " 0" " 36" " 1" " 4" " 0x3C0000" " False" " False" " True" " 2" " True" " True" " 1920" " 1920" " " " 00\n" " " “” “” " 15 BB 10\n" " 15 B0 03\n" " 05 11 00\n" " FF 78\n" " 15 51 FF\n" " 15 53 24\n" " 15 FF 23\n" " 15 08 05\n" " 15 46 90\n" " 15 FF 10\n" " 15 FF F0\n" " 15 92 01\n" " 15 FF 10\n" " 15 35 00\n" " 05 29 00\n" " FF 28\n" “” “” " 05 28\n" " 05 10\n" “” “0x2E 0x3D” “” " 3" “\n”;
/******************************************************************
******************************************************************/ const static int8 Secondary_Truly_1080p_cmd_xmldata[] = “<?xml version=\"1.0\" encoding=\"utf-8\"?>” “NT35695b” “Truly FHD Command Mode Panel (1080x1920 24bpp)” “<Group id=“Active Timing”>” " 1080" " 120" " 60" " 12" " 0" " 0" " 0" " 1920" " 12" " 2" " 2" " 0" " 0" " 0" " False" " False" " False" " 0x0" “” “<Group id=“Display Interface”>” " 11" " 3" “” “<Group id=“DSI Interface”>” " 2" " 0" " 36" " 1" " 4" " 0x3C0000" " False" " False" " True" " 2" " True" " True" " 1920" " 1920" " 1" " " " 01\n" " " “” “” " 15 FF 20\n" " 15 FB 01\n" " 15 00 01\n" " 15 01 55\n" " 15 02 45\n" " 15 03 55\n" " 15 05 50\n" " 15 06 A8\n" " 15 07 AD\n" " 15 08 0C\n" " 15 0B AA\n" " 15 0C AA\n" " 15 0E B0\n" " 15 0F B3\n" " 15 11 28\n" " 15 12 10\n" " 15 13 01\n" " 15 14 4A\n" " 15 15 12\n" " 15 16 12\n" " 15 30 01\n" " 15 72 11\n" " 15 58 82\n" " 15 59 00\n" " 15 5A 02\n" " 15 5B 00\n" " 15 5C 82\n" " 15 5D 80\n" " 15 5E 02\n" " 15 5F 00\n" " 15 FF 24\n" " 15 FB 01\n" " 15 00 01\n" " 15 01 0B\n" " 15 02 0C\n" " 15 03 89\n" " 15 04 8A\n" " 15 05 0F\n" " 15 06 10\n" " 15 07 10\n" " 15 08 1C\n" " 15 09 00\n" " 15 0A 00\n" " 15 0B 00\n" " 15 0C 00\n" " 15 0D 13\n" " 15 0E 15\n" " 15 0F 17\n" " 15 10 01\n" " 15 11 0B\n" " 15 12 0C\n" " 15 13 89\n" " 15 14 8A\n" " 15 15 0F\n" " 15 16 10\n" " 15 17 10\n" " 15 18 1C\n" " 15 19 00\n" " 15 1A 00\n" " 15 1B 00\n" " 15 1C 00\n" " 15 1D 13\n" " 15 1E 15\n" " 15 1F 17\n" " 15 20 00\n" " 15 21 01\n" " 15 22 00\n" " 15 23 40\n" " 15 24 40\n" " 15 25 6D\n" " 15 26 40\n" " 15 27 40\n" " 15 29 D8\n" " 15 2A 2A\n" " 15 4B 03\n" " 15 4C 11\n" " 15 4D 10\n" " 15 4E 01\n" " 15 4F 01\n" " 15 50 10\n" " 15 51 00\n" " 15 52 80\n" " 15 53 00\n" " 15 54 07\n" " 15 55 25\n" " 15 56 00\n" " 15 58 07\n" " 15 5B 43\n" " 15 5C 00\n" " 15 5F 73\n" " 15 60 73\n" " 15 63 22\n" " 15 64 00\n" " 15 67 08\n" " 15 68 04\n" " 15 7A 80\n" " 15 7B 91\n" " 15 7C d8\n" " 15 7D 60\n" " 15 93 06\n" " 15 94 06\n" " 15 8A 00\n" " 15 9B 0F\n" " 15 B3 C0\n" " 15 B4 00\n" " 15 B5 00\n" " 15 B6 21\n" " 15 B7 22\n" " 15 B8 07\n" " 15 B9 07\n" " 15 Ba 22\n" " 15 Bd 20\n" " 15 Be 07\n" " 15 Bf 07\n" " 15 C1 6D\n" " 15 C4 24\n" " 15 E3 00\n" " 15 EC 00\n" " 15 FF 10\n" " 15 BB 10\n" " 15 35 00\n" " 05 11 00\n" " FF 78\n" " 05 29 00\n" " FF 78\n" “” “” " 05 28\n" " 05 10\n" “” “0x2E 0x3D” “” " 3" " 0 10 1000 10000 0" “\n”;
/*
- Dummy panel configuration, default fallback mode.
*/ const static int8 dummy_xmldata[] = “<?xml version=\"1.0\" encoding=\"utf-8\"?>” " VirtioDSI" " DSI Model (640x480 24bpp)" " <Group id=“Active Timing”>" " <HorizontalActive units=“Dot Clocks”>640" " <HorizontalFrontPorch units=“Dot Clocks”>13" " <HorizontalBackPorch units=“Dot Clocks”>14" " <HorizontalSyncPulse units=“Dot Clocks”>15" " <HorizontalSyncSkew units=“Dot Clocks”>0" " <HorizontalLeftBorder units=“Dot Clocks”>0" " <HorizontalRightBorder units=“Dot Clocks”>0" " <VerticalActive units=“Dot Clocks”>480" " <VerticalFrontPorch units=“Lines”>11" " <VerticalBackPorch units=“Lines”>12" " <VerticalSyncPulse units=“Lines”>13" " <VerticalSyncSkew units=“Lines”>0" " <VerticalTopBorder units=“Lines”>0" " <VerticalBottomBorder units=“Lines”>0" " False" " False" " False" " 0x0" " " " <Group id=“Display Interface”>" " <InterfaceType units=“QDI_DisplayConnectType”>8" " <InterfaceColorFormat units=“QDI_PixelFormatType”>3" " " " <Group id=“DSI Interface”>" " <DSIChannelId units=“DSI_Channel_IDType”>1" " <DSIVirtualId units=“DSI_Display_VCType”>0" " <DSIColorFormat units=“DSI_ColorFormatType”>36" " <DSITrafficMode units=“DSI_TrafficModeType”>0" " <DSILanes units=“integer”>2" " <DSIHsaHseAfterVsVe units=“Bool”>False" " <DSILowPowerModeInHFP units=“Bool”>False" " <DSILowPowerModeInHBP units=“Bool”>False" " <DSILowPowerModeInHSA units=“Bool”>False" " <DSILowPowerModeInBLLPEOF units=“Bool”>False" " <DSILowPowerModeInBLLP units=“Bool”>False" " 0x3c0000" " " " 0x2" " " " 32 00 00\n" " ";
/*************************************************************************** Dynamic panel detect list: – first entry contains default panel
At SDM845 panel detection base on platform subtype – use Truly 2k panel — dual dsi (without dsc) video and cmd mode — single dsi with DSC video and cmd mode
**************************************************************************/ static PlatformDSIDetectParams uefiPanelList[] = { //wanghui add rm692e0 lcd start // Panel #0 - hehui 2k single dsc Command Mode Panel (1080x2400 24bpp) ID:0x8000 { 0x06, // uCmdType 0x05, // total number of retry on failures { { {0x02}, // address to read ID1 {0xB2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback }, { {0x03}, // address to read ID2 {0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback }, { {0x01}, // address to read ID3 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback } }, 0, // Lane remap order {0, 1, 2, 3} NULL, // psPanelCfg (panel configuration) 0, // uPanelCfgSize MDPPLATFORM_PANEL_692E0_AMOLED_FHD_CMD, // eSelectedPanel 0 // uFlags }, / { 0x06, // uCmdType 0x05, // total number of retry on failures { { {0x04}, // address to read ID1 {0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback }, { {0x01}, // address to read ID2 {0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback }, { {0x02}, // address to read ID3 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // expected readback } }, 0, // Lane remap order {0, 1, 2, 3} NULL, // psPanelCfg (panel configuration) 0, // uPanelCfgSize MDPPLATFORM_PANEL_VTDR6130_AMOLED_FHD_CMD, // eSelectedPanel 0 // uFlags }, */ };
/=========================================================================== Function Definitions ===========================================================================/
/* ---------------------------------------------------------------------- / /* ** FUNCTION: PlatformClientInit() ** ** DESCRIPTION: ** Initialize NPA client ** // -------------------------------------------------------------------- */ static MDP_Status PlatformClientInit(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams) { MDP_Status eStatus = MDP_STATUS_OK;
return eStatus; }
/********************************************************************************************** *
- FUNCTION: DynamicDSIPanelDetection()
- DESCRIPTION:
- Detect DSI panels by doing a DSI read specific to each panels.
- This function could be used as sample for OEM to detect DSI panels,
- it is not a complete implementation of all possible combinations of read
- commands that could be needed for this detection.
- Return success only if a DSI panel was correctly detected and the information
- is updated in pPlatformParams->sPlatformPanel
***********************************************************************************************/ static MDP_Status DynamicDSIPanelDetection(MDPPlatformPanelInfo *pPlatformPanel, uint32 *puPanelID, PlatformDSIDetectParams *pPanelList, uint32 uPanelCnt) { MDP_Status Status = MDP_STATUS_NOT_SUPPORTED; bool32 bDumpPanelId = FALSE; MDP_Display_IDType eDisplayId = MDP_DISPLAY_PRIMARY;
if (MDP_STATUS_OK == DSIDriver_MinimalInit()) // do minimal DSI init { uint8 panelID[PLATFORM_PANEL_ID_MAX_COMMANDS]; uint32 uPanelIndex; bool32 bMatch = FALSE; uint32 uPrevClkConfig = 0; //wanghui add rm692e0 lcd start PlatformPanelBacklightControl panelIcPageChange = { 0x15, {0xFE, 0xC2}, // Using standard MIPI DCS commands to control panel ic page }; //wanghui add rm692e0 lcd end
// go through all possible panels
for (uPanelIndex = 0; uPanelIndex < uPanelCnt; uPanelIndex++)
{
uint32 readSize = sizeof(readback);
int iCommandIndex = 0;
uint32 uClkConfig = (MDPPLATFORM_PANEL_DETECT_FLAG_CLOCK_FORCEHS &
pPanelList[uPanelIndex].uFlags);
//MDP_Log_Message((MDP_LOGLEVEL_ERROR, "DynamicDSIPanelDetection uflag=%x\n",pPanelList[uPanelIndex].uFlags));
//MDP_Log_Message((MDP_LOGLEVEL_ERROR, "DynamicDSIPanelDetection uClkConfig=%x\n",uClkConfig));
// Check if there is any change in the clock config and set it accordingly
if (uPrevClkConfig != uClkConfig)
{
if (MDP_STATUS_OK != DSIDriver_ConfigClockLane(uClkConfig))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Display: DSIDriver_ConfigClockLane failed\n");
}
uPrevClkConfig = uClkConfig;
}
// Reprogram the DSI lane swap based on remap order
if (MDP_STATUS_OK != DSIDriver_RemapLane(pPanelList[uPanelIndex].uLaneRemapOrder))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Display: DSIDriver_RemapLane failed\n");
}
// Allow debug option to scan panel registers (used to help generate a uniquie panel ID for detection)
if (TRUE == bDumpPanelId)
{
DsiPanelDumpRegisters();
// Dump just once
bDumpPanelId = FALSE;
}
// clear the panel ID
MDP_OSAL_MEMZERO(panelID, PLATFORM_PANEL_ID_MAX_COMMANDS);
// for each possible panel ID read
for(iCommandIndex = 0; iCommandIndex<PLATFORM_PANEL_ID_MAX_COMMANDS; iCommandIndex++)
{
uint32 uRetryCount = 0;
// if read command is 0, then stop reading panel ID
if ((0 == pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address[0]) &&
(0 == pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address[1]) )
{
break;
}
// DSI read
bMatch = FALSE;
uRetryCount = 0;
//wanghui add rm692e0 lcd start
if(uPanelIndex==0){
panelIcPageChange.command[1] = 0xC2;
Status = DSIDriver_Write(eDisplayId,
panelIcPageChange.uCmdType,
panelIcPageChange.command,
sizeof(panelIcPageChange.command));
if (MDP_STATUS_OK != Status)
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Panel IC page DCS command send failed\n");
}
}
do
{
MDP_OSAL_MEMZERO(&readback[iCommandIndex], readSize);
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Dynamic-Detected panel.addr=%x,readSize=%d\n",pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address[0],readSize);
readSize = 1;
Status = DSIDriver_Read(eDisplayId,
pPanelList[uPanelIndex].uCmdType,
pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address,
sizeof(pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address),
&readback[iCommandIndex],
&readSize);
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "wh-command addr=%x read size=%d\n",pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address[0],readSize);
for(int i=0;i<readSize;i++)
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "wh addr=%x-command read data[%d]=%x\n",pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].address[0],i,readback[i]);
if (MDP_STATUS_OK != Status)
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "command read failed\n");
}
uRetryCount++;
} while((uRetryCount < pPanelList[uPanelIndex].uTotalRetry) &&
((MDP_STATUS_OK != Status) ||
(0 == readSize)));
if(uPanelIndex==0){
panelIcPageChange.command[1] = 0x00;
Status = DSIDriver_Write(eDisplayId,
panelIcPageChange.uCmdType,
panelIcPageChange.command,
sizeof(panelIcPageChange.command));
if (MDP_STATUS_OK != Status)
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Panel IC page DCS command send failed\n");
}
}
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "uPanelIndex=%d,iCommandIndex=%d\n",uPanelIndex,iCommandIndex);
if ((uRetryCount <= pPanelList[uPanelIndex].uTotalRetry) &&
(0 != readSize))
{
// Read was successful, now check the data is what we expect
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "readback=%x,readSize=%d,%x\n",readback[iCommandIndex],readSize, pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].expectedReadback[0]);
// if (0 == CompareMem(readback, pPanelList[uPanelIndex].panelIdCommands[iCommandIndex].expectedReadback, readSize))
if(readback[0]>=0xB2)
{
panelID[iCommandIndex] = readback[iCommandIndex]; // store the first byte of readback as panel ID
bMatch = TRUE; // mark one panel ID matched
break;
}
}
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "bMatch=%d\n",bMatch);
//wanghui add rm692e0 lcd end
// if any panel ID is not matched, then go to detect next panel in the list
if(FALSE == bMatch)
{
break;
}
}
// if all panel IDs are matched for a specific panel, store settings and stop
if(TRUE == bMatch)
{
// store matched panel configuration xml data
pPlatformPanel->eSelectedPanel = pPanelList[uPanelIndex].eSelectedPanel;
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Detected panel id:%d\n", pPanelList[uPanelIndex].eSelectedPanel);
// return the final combined panel ID
*puPanelID = (panelID[0]<<16) | (panelID[1]<<8) | (panelID[2]);
Status = MDP_STATUS_OK;
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Detected panel id:%08x\n", *puPanelID);
break;
}
else
{
//wanghui add rm692e0 lcd start
if((eDisplayId == MDP_DISPLAY_PRIMARY)&&(Status == MDP_STATUS_OK))
{//evt1-default
pPlatformPanel->eSelectedPanel = MDPPLATFORM_PANEL_692E0_AMOLED_FHD_CMD;
Status = MDP_STATUS_OK;
}
else if((eDisplayId == MDP_DISPLAY_PRIMARY)&&(Status == MDP_STATUS_FAILED))
{//default
pPlatformPanel->eSelectedPanel = MDPPLATFORM_PANEL_SIM_VIDEO_PANEL;
Status = MDP_STATUS_OK;
}
else
{
pPlatformPanel->eSelectedPanel = MDPPLATFORM_PANEL_NONE;
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Dynamic-Detected panel Failed\n");
Status = MDP_STATUS_FAILED;
}
//wanghui add rm692e0 lcd end
}
}
// Close the DSI context opened in DSIDriver_MinimalInit()
DSIDriver_Close(eDisplayId);
} return Status; }
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_CDP_PowerUp() ** ** DESCRIPTION: ** Panel power up sequence for CDP ** / / -------------------------------------------------------------------- */ static MDP_Status Panel_CDP_PowerUp(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams) { MDP_Status eStatus = MDP_STATUS_OK; DALGpioSignalType uGPIOCfg = 0; uint32 uResetGpio = GET_CDP_DISP_RESET_GPIO(eDisplayId); uint32 uTeGpio = GET_CDP_DISP_TE_GPIO(eDisplayId);
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_LOW_VALUE); Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
if (MDP_STATUS_OK != (eStatus = PlatformClientInit(eDisplayId, pPowerParams))) { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “DisplayLib: Failed to initialize handle for Primary display NPA node.\n”); } else { DALGpioSignalType uGPIOCfg = 0;
/* LDO1, LDO2 for DSI PHY/PLL are already turned on by system driver.*/
/*Turn on LDO14 for V_LCD_VDDI_1P8 which is used by panel */
if (PM_ERR_FLAG__SUCCESS != pm_ldo_volt_level(PMIC_A, PM_LDO_14, 1800000, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error configuring LDO to 1.8V\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_volt_level(PMIC_C, PM_LDO_11, 3296000, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error configuring LDO to 3.3V\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_volt_level(PMIC_A, PM_LDO_9, 1200000, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error configuring LDO to 1.8V\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_volt_level(PMIC_A, PM_LDO_5, 880000, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error configuring LDO to 1.8V\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_sw_enable(PMIC_A, PM_LDO_14, PM_ON, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error enabling LDO14\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_sw_enable(PMIC_C, PM_LDO_11, PM_ON, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error enabling LDO11\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_sw_enable(PMIC_A, PM_LDO_9, PM_ON, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error enabling LDO3\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_ldo_sw_enable(PMIC_A, PM_LDO_5, PM_ON, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error enabling LDO5\n");
}
MDP_OSAL_DELAYMS(15); /* delay 10ms for panel to reset (from panel spec) */
/* only support single dsi mode */
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(CDP_DISP_MODE_SEL, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_HIGH_VALUE);
Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
MDP_OSAL_DELAYMS(10); /* delay 10ms for panel to reset (from panel spec) */
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG(uTeGpio, 1, DAL_GPIO_INPUT, DAL_GPIO_NO_PULL, DAL_GPIO_LOW_VALUE);
Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
}
return eStatus; }
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_CDP_PowerDown() ** ** DESCRIPTION: ** Panel power down sequence for CDP ** / / -------------------------------------------------------------------- */ static MDP_Status Panel_CDP_PowerDown(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams) { MDP_Status eStatus = MDP_STATUS_OK; DALGpioSignalType uGPIOCfg = 0; uint32 uResetGpio = GET_CDP_DISP_RESET_GPIO(eDisplayId);
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_LOW_VALUE); eStatus = Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
return eStatus; }
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_CDP_Reset() ** ** DESCRIPTION: ** Panel reset sequence for CDP ** / / -------------------------------------------------------------------- */ MDP_Status Panel_CDP_Reset(MDP_Display_IDType eDisplayId) { MDP_Status eStatus = MDP_STATUS_OK; DALGpioSignalType uGPIOCfg = 0; uint32 uResetGpio = GET_CDP_DISP_RESET_GPIO(eDisplayId);
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_LOW_VALUE); Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
MDP_OSAL_DELAYMS(10);
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_HIGH_VALUE); Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
MDP_OSAL_DELAYMS(10); uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_LOW_VALUE); Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
MDP_OSAL_DELAYMS(10);
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(uResetGpio, 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_16MA, DAL_GPIO_HIGH_VALUE); Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1); MDP_OSAL_DELAYMS(10); return eStatus; }
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_CDP_PeripheralPower() ** ** DESCRIPTION: ** Secondary power sequence for other PMIC modules such as IBB/LAB ** / / -------------------------------------------------------------------- */ static MDP_Status Panel_CDP_PeripheralPower(MDP_Display_IDType eDisplayId, Panel_PowerCtrlParams *pPowerParams, bool32 bPowerUp) { MDP_Status eStatus = MDP_STATUS_OK;
if (MDP_PMIC_MODULE_CONTROLTYPE_IBB_LAB_LCD == pPowerParams->ePMICSecondaryPower[eDisplayId]) { if (TRUE == bPowerUp) { if (PM_ERR_FLAG__SUCCESS != pm_lcdb_set_output_volt(PMIC_C, 5500,-5500, TRUE)) { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “DisplayDxeBoot: Lcdb 5.5V failed\n”); }
if (PM_ERR_FLAG__SUCCESS != pm_lcdb_config_enable_ctrl(PMIC_C, PM_LCDB_ENABLE_CTL_MODULE_EN, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Lcdb Enable failed\n");
}
// Wait for IBB/LAB to become ready
Panel_IBBLAB_WaitForReady();
/************************************************************************
* Enable brightness power source
************************************************************************/
if (PM_ERR_FLAG__SUCCESS != pm_wled_enable_modulator(PMIC_C, PM_MODULATOR_TYPE_A,TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled EnableModulatorA failed\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_set_led_duty_cycle(PMIC_C, PM_MODULATOR_TYPE_A,0x1ff)) /* duty cycle is 12 bits */
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled SetLedDutyCycle failed\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_modulator_src_sel(PMIC_C, PM_MODULATOR_TYPE_A, PM_MODULATOR_SRC_DRV_HIGH))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled ModulatorSrcSelect failed\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_enable_module(PMIC_C, 0, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled EnableWled failed\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_enable_current_sink(PMIC_C, PM_WLED_LED1|PM_WLED_LED2|PM_WLED_LED3))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled EnableCurrentSink failed\n");
}
}
else
{
// ********** Brightness Power-down Sequence **********
// Power down
if (PM_ERR_FLAG__SUCCESS != pm_lcdb_config_enable_ctrl(PMIC_C, PM_LCDB_ENABLE_CTL_MODULE_EN, FALSE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Error to disable LCDB\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_enable_current_sink(PMIC_C, PM_WLED_NONE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled EnableCurrentSink failed\n");
}
if (PM_ERR_FLAG__SUCCESS != pm_wled_enable_module(PMIC_C, 0, FALSE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled EnableWled failed\n");
}
}
} else { /* do nothing for amoled panel */ }
return eStatus;
}
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_CDP_BacklightLevel() ** ** DESCRIPTION: ** / / -------------------------------------------------------------------- */ static MDP_Status Panel_CDP_BacklightLevel(MDP_Display_IDType eDisplayId, BacklightConfigType *pBacklightConfig) { MDP_Status eStatus = MDP_STATUS_OK;
if (MDP_PANEL_BACKLIGHTTYPE_PMIC == pBacklightConfig->eBacklightType) { // Configure the power grid based on the module type switch (pBacklightConfig->uBacklightCntrl.eBacklightCtrl) { case MDP_PMIC_BACKLIGHT_CONTROLTYPE_WLED: {
uint32 uWLEDValue = (0xFFF * pBacklightConfig->uLevel) / 100; // Calculate duty cycle based on 12 bit mode
if (PM_ERR_FLAG__SUCCESS != pm_wled_set_led_duty_cycle(PMIC_C, PM_MODULATOR_TYPE_A, uWLEDValue)) /* PM_WLED_ALL */
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: Wled pm_wled_set_led_duty_cycle failed\n");
}
}
break;
default:
break;
}
} else if (MDP_PANEL_BACKLIGHTTYPE_DSI == pBacklightConfig->eBacklightType) { if (pBacklightConfig->uNumBits > 16) { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “Backlight dcs bit width is not available\n”); eStatus = MDP_STATUS_BAD_PARAM; } else { PlatformPanelBacklightControl panelBacklightControl = { 0x00, {0x51, 0x00, 0x00}, // Using standard MIPI DCS commands to control brightness }; MDP_Log_Message(MDP_LOGLEVEL_ERROR, “Backlight pBacklightConfig->uLevel=%d\n”,DISP_DIV_ROUND_UP(((1 << pBacklightConfig->uNumBits) - 1) * pBacklightConfig->uLevel, 100) & 0xFF); if (pBacklightConfig->uNumBits > 8) { // Calculate brightness panelBacklightControl.uCmdType = 0x39; // Use dcs long write type, e.g. 10bits: first byte is bits 0:7, the second byte is bits 8:9. //wanghui modify for dump display panelBacklightControl.command[1] = 0x07;//DISP_DIV_ROUND_UP(((1 << pBacklightConfig->uNumBits) - 1) * pBacklightConfig->uLevel, 100) & 0xFF; panelBacklightControl.command[2] = 0xff;//DISP_DIV_ROUND_UP(((1 << pBacklightConfig->uNumBits) - 1) * pBacklightConfig->uLevel, 100) >> 0x08; //wanghui modify for dump display } else { // Default to calculate brightness based on 8 bit mode panelBacklightControl.uCmdType = 0x15; // Use dcs short write type as only needs one byte. panelBacklightControl.command[1] = DISP_DIV_ROUND_UP(0xFF * pBacklightConfig->uLevel, 100) & 0xFF; }
//MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Backlight dcs bit width is not available ,cmd[1]=%x,%x\n",panelBacklightControl.command[1],panelBacklightControl.command[2]);
eStatus = DSIDriver_Write(eDisplayId,
panelBacklightControl.uCmdType,
panelBacklightControl.command,
sizeof(panelBacklightControl.command));
if (MDP_STATUS_OK != eStatus)
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Backlight brightness DCS command send failed\n");
}
}
} else { // Nothing to do for other configurations }
return eStatus; }
/* ---------------------------------------------------------------------- / /* ** FUNCTION: Panel_IBBLAB_WaitForReady() ** ** DESCRIPTION: ** Polling loop to wait for IBB/LAB modules to be ready. ** VDISN, VDISP will reach the proper voltage upon ready. **/ static void Panel_IBBLAB_WaitForReady() {
boolean lcdbStatus;
uint32 uCount;
for (uCount = 0; uCount < PMIC_IBBLAB_READYTIME; uCount++) { if (PM_ERR_FLAG__SUCCESS == pm_lcdb_vreg_ok(PMIC_C, &lcdbStatus)) { if (lcdbStatus) { break; } else if (PMIC_IBBLAB_READYTIME == (uCount + 1)) { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “DisplayDxeBoot: LAB/IBB GetStatus(LabVregOk) failed after %dms\n”, PMIC_IBBLAB_READYTIME); }
// Wait 1ms between checks
MDP_OSAL_DELAYMS(1);
}
else
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxeBoot: IBB/LAB GetStatus() Failed\n");
break;
}
} }
MDP_Status MDPPlatformConfigure(MDP_Display_IDType eDisplayId, MDPPlatformConfigType eConfig, MDPPlatformParams *pPlatformParams) { MDP_Status eStatus = MDP_STATUS_OK;
/* Static information, initial once during the first call */ static MDPPlatformInfo sPlatformInfo; static Panel_PowerCtrlParams sPanelPowerCtrl; static uint32 uHardwareVersionMinor = 0; static MDPPlatformPanelInfo sPlatformPanel;
MDP_Log_Message(MDP_LOGLEVEL_ERROR, “MDPPlatformConfigure–wanghui-Config=%d\n”,eConfig);
switch (eConfig) { case MDPPLATFORM_CONFIG_INIT: MDP_OSAL_MEMZERO(&sPlatformInfo, sizeof(MDPPlatformInfo)); MDP_OSAL_MEMZERO(&sPanelPowerCtrl, sizeof(Panel_PowerCtrlParams));
// Read the platform ID once
if (MDP_STATUS_OK == ReadPlatformIDAndChipID(&sPlatformInfo.sEFIPlatformType, &sPlatformInfo.sEFIChipSetId, &sPlatformInfo.sEFIChipSetFamily))
{
UINT32 uPanelOverride = 0;
// Read the display panel ID override
if ((MDP_STATUS_OK == MDP_Display_GetVariable_Integer (PANEL_OVERRIDE_STRINGNAME, &uPanelOverride)) &&
(uPanelOverride > 0))
{
sPlatformInfo.uPanelIdOverride = (uint32) uPanelOverride;
}
// Parse sub-revision specific info to determine the platform type
uHardwareVersionMinor = sPlatformInfo.sEFIPlatformType.version & 0xFF;
}
/* Enable VDDMM so that MMCX Arc can be configured */
if (PM_ERR_FLAG__SUCCESS != pm_smps_volt_level(PMIC_C, PM_SMPS_4, 752*1000, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error set VDDMM level \n");
}
if (PM_ERR_FLAG__SUCCESS != pm_smps_sw_enable(PMIC_C, PM_SMPS_4, PM_ON, TRUE))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "DisplayDxe: Error enable VDDMM\n");
}
// Store the platform specific ID
sPlatformInfo.uPlatformID = pPlatformParams->sPlatformInfo.uPlatformID;
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
// Default to enable primary display
MDP_SUPPORTED_DISPLAY(MDP_DISPLAY_PRIMARY) = TRUE;
if (MDP_BOOT_PLATFORMID_DUAL_PANEL == sPlatformInfo.uPlatformID)
{
// On the dual panel platform reference multiple displays are supported.
MDP_SUPPORTED_DISPLAY(MDP_DISPLAY_SECONDARY) = TRUE;
}
break;
default:
// Enable primary display
MDP_SUPPORTED_DISPLAY(MDP_DISPLAY_PRIMARY) = TRUE;
break;
}
break;
case MDPPLATFORM_CONFIG_SW_RENDERER:
if ((EFI_PLATFORMINFO_TYPE_UNKNOWN == sPlatformInfo.sEFIPlatformType.platform) ||
(EFI_PLATFORMINFO_TYPE_VIRTIO == sPlatformInfo.sEFIPlatformType.platform) ||
(EFI_PLATFORMINFO_TYPE_RUMI == sPlatformInfo.sEFIPlatformType.platform) ||
(TRUE == PcdGetBool(PcdDisplayForceSwRenderer)))
{
// Treat unknown platforms as a SW model only
pPlatformParams->sPlatformInfo.bSWRender = TRUE;
MDP_Log_Message(MDP_LOGLEVEL_WARN, "DisplayDxeBoot: SW renderer only\n");
}
else
{
pPlatformParams->sPlatformInfo.bSWRender = FALSE;
}
break;
case MDPPLATFORM_CONFIG_GETPANELCONFIG: { pPlatformParams->sPlatformPanel.uDefaultVendor = 0; pPlatformParams->sPlatformPanel.uDefaultRevision = 0; pPlatformParams->sPlatformPanel.uPanelId = 0;
// Retrieve panel configuration (could be dependent on the interface)
switch (eDisplayId)
{
case MDP_DISPLAY_PRIMARY:
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
case EFI_PLATFORMINFO_TYPE_MTP:
case EFI_PLATFORMINFO_TYPE_QRD:
if (MDP_BOOT_PLATFORMID_DUAL_PANEL == sPlatformInfo.uPlatformID)
{
//MDP_Log_Message(MDP_LOGLEVEL_ERROR, "MDPPlatformConfigure--MDP_BOOT_PLATFORMID_DUAL_PANEL\n");
// Primary sharp 1080p command mode panel
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8 *)Primary_Sharp_1080p_cmd_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(Primary_Sharp_1080p_cmd_xmldata);
pPlatformParams->sPlatformPanel.eSelectedPanel = MDPPLATFORM_PRI_PANEL_SHARP_1080P_CMD;
}
else
{
uint32 uPanelID = 0;
PlatformDSIDetectParams *pPanelList = &uefiPanelList[0];
uint32 uPanelCnt = PANEL_LIST_LENGTH(uefiPanelList);
DynamicDSIPanelDetection(&sPlatformPanel, &uPanelID, pPanelList, uPanelCnt);
//wanghui add
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "MDPPlatformConfigure--Primary_rm692e0_1080p_cmd_xmldata\n");
// default to boe amoled wqhd ds cmd Mode
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "MDPPlatformConfigure--readback=%d\n",readback[0]);
if(readback[0]>=0xB2){
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8 *)Primary_rm692e0_1080p_cmd_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(Primary_rm692e0_1080p_cmd_xmldata);
pPlatformParams->sPlatformPanel.eSelectedPanel = MDPPLATFORM_PANEL_692E0_AMOLED_FHD_CMD;
}
else
{
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8 *)Primary_vtdr6130_1080p_cmd_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(Primary_vtdr6130_1080p_cmd_xmldata);
pPlatformParams->sPlatformPanel.eSelectedPanel = MDPPLATFORM_PANEL_VTDR6130_AMOLED_FHD_CMD;
}
pPlatformParams->sPlatformPanel.uPanelId = 0x00008056;
sPlatformInfo.uPrimaryPanelId = 0x00008056;
}
break;
default:
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8*)dummy_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(dummy_xmldata);
break;
}
break;
case MDP_DISPLAY_SECONDARY:
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
// Secondary truly 1080p command mode panel
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8 *)Secondary_Truly_1080p_cmd_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(Secondary_Truly_1080p_cmd_xmldata);
pPlatformParams->sPlatformPanel.eSelectedPanel = MDPPLATFORM_SEC_PANEL_TRULY_1080P_CMD;
break;
default:
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8*)dummy_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(dummy_xmldata);
break;
}
break;
case MDP_DISPLAY_EXTERNAL:
pPlatformParams->sPlatformPanel.pPanelXMLConfig = (int8*)dummy_xmldata;
pPlatformParams->sPlatformPanel.uConfigSize = sizeof(dummy_xmldata);
break;
default:
break;
}
}
break;
case MDPPLATFORM_CONFIG_POWERUP: { switch (eDisplayId) { case MDP_DISPLAY_PRIMARY: case MDP_DISPLAY_SECONDARY:
// Config based on the platform
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
case EFI_PLATFORMINFO_TYPE_MTP:
case EFI_PLATFORMINFO_TYPE_QRD:
sPanelPowerCtrl.ePMICSecondaryPower[eDisplayId] = MDP_PMIC_MODULE_CONTROLTYPE_IBB_LAB_OLED; // OLED Power Configuration (IBB/LAB)
/* Check for common power or panel specific power,
* Common Power : pPlatformParams is NULL or uFlags is 0x0,
* Panel Power : uFlags is set to panel specific power flag.
*/
if ((NULL != pPlatformParams) &&
(POWERCONFIG_FLAGS_PANEL_POWER & pPlatformParams->sPowerConfig.uFlags))
{
switch (sPlatformInfo.uPrimaryPanelId)
{
default:
// OEM to populate panel specific power up.
break;
}
}
else
{
/*
* Ramdump mode Primary Power Sequence:
* MDPPLATFORM_CONFIG_POWERDOWN is not be called at both enter and exit ramdump mode
* Therefore panel power down is called first before power up panel to obey panel
* power up sequence
*/
if (MDP_STATUS_OK != (eStatus = Panel_CDP_PowerDown(eDisplayId, &sPanelPowerCtrl)))
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Ramdump: Panel_PowerDown: Primary Power Down Sequence Failed (%d)\n", eStatus);
}
else if (MDP_STATUS_OK != (eStatus = Panel_CDP_PeripheralPower(eDisplayId, &sPanelPowerCtrl, FALSE))) // Secondary Power Sequence
{
MDP_Log_Message(MDP_LOGLEVEL_ERROR, "Ramdump: Panel_PowerDown: Secondary Power Down Sequence Failed (%d)\n", eStatus);
}
MDP_OSAL_DELAYMS(10); /* delay 10ms to allow power grid to settle */
// Primary Power Sequence
if (MDP_STATUS_OK != (eStatus = Panel_CDP_PowerUp(eDisplayId, &sPanelPowerCtrl)))
{
MDP_Log_Message(MDP_LOGLEVEL_WARN, "DisplayLib: Primary Power Up Sequence Failed (%d)\n", eStatus);
}
else if (MDP_STATUS_OK != (eStatus = Panel_CDP_PeripheralPower(eDisplayId, &sPanelPowerCtrl, TRUE))) // Secondary Power Sequence
{
MDP_Log_Message(MDP_LOGLEVEL_WARN, "DisplayLib: Secondary Power Up Sequence Failed (%d)\n", eStatus);
}
}
//wanghui add for dump display
Panel_CDP_Reset(eDisplayId);
//wanghui add for dump display
break;
default:
break;
}
break;
case MDP_DISPLAY_EXTERNAL:
// Config based on the platform
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
case EFI_PLATFORMINFO_TYPE_QRD:
break;
default:
break;
}
break;
default:
break;
}
}
break;
case MDPPLATFORM_CONFIG_POWERDOWN: { MDP_Log_Message(MDP_LOGLEVEL_WARN, “DisplayDxeBoot: Power Down not supported in this mode\n”); } break; case MDPPLATFORM_CONFIG_SETBACKLIGHT: { // Handle backlight level switch (eDisplayId) { case MDP_DISPLAY_PRIMARY: case MDP_DISPLAY_SECONDARY: switch (sPlatformInfo.sEFIPlatformType.platform) { case EFI_PLATFORMINFO_TYPE_CDP: case EFI_PLATFORMINFO_TYPE_MTP: case EFI_PLATFORMINFO_TYPE_QRD: eStatus = Panel_CDP_BacklightLevel(eDisplayId, &pPlatformParams->sBacklightConfig); default: break; } break; case MDP_DISPLAY_EXTERNAL: eStatus = MDP_STATUS_NOT_SUPPORTED; break; default: break; } } break; case MDPPLATFORM_CONFIG_GETPANELID: { } break; case MDPPLATFORM_CONFIG_GETPLATFORMINFO: { // // Return platform information // MDP_OSAL_MEMCPY(&pPlatformParams->sPlatformInfo, &sPlatformInfo, sizeof(MDPPlatformInfo)); } break; case MDPPLATFORM_CONFIG_RESETPANEL: { // Handle power down switch (eDisplayId) { case MDP_DISPLAY_PRIMARY: case MDP_DISPLAY_SECONDARY:
// Config based on the platform
switch (sPlatformInfo.sEFIPlatformType.platform)
{
case EFI_PLATFORMINFO_TYPE_CDP:
case EFI_PLATFORMINFO_TYPE_MTP:
case EFI_PLATFORMINFO_TYPE_QRD:
eStatus = Panel_CDP_Reset(eDisplayId);
default:
break;
}
break;
case MDP_DISPLAY_EXTERNAL:
eStatus = MDP_STATUS_NOT_SUPPORTED;
break;
default:
break;
}
}
break;
case MDPPLATFORM_CONFIG_SETGPIOSTATE: { eStatus = SetDefaultGPIOState(&pPlatformParams->sGPIOState); } break;
default: eStatus = MDP_STATUS_BAD_PARAM; break; }
return eStatus; }
/=========================================================================== Private Function Definitions ===========================================================================/
/* ---------------------------------------------------------------------- / /* ** FUNCTION: ReadPlatformIDAndChipID() ** ** DESCRIPTION: ** / / -------------------------------------------------------------------- */ static MDP_Status ReadPlatformIDAndChipID(EFI_PLATFORMINFO_PLATFORM_INFO_TYPE *pPlatformInfo, EFIChipInfoIdType *pChipSetId, EFIChipInfoFamilyType *pChipSetFamily) { DalPlatformInfoPlatformInfoType dalPlatformInfo; DALResult eDalStatus = DAL_SUCCESS; MDP_Status eStatus = MDP_STATUS_OK;
MDP_OSAL_MEMZERO(&dalPlatformInfo, sizeof(DalPlatformInfoPlatformInfoType));
eDalStatus = boot_DalPlatformInfo_PlatformInfo(&dalPlatformInfo); if (eDalStatus != DAL_SUCCESS) { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “Ramdump:Display:ReadPlatformIDAndChipId: Failed\n”);
eStatus = MDP_STATUS_FAILED;
} else { MDP_Log_Message(MDP_LOGLEVEL_ERROR, “Ramdump:Display:ReadPlatformIDAndChipId: dalPlatformInfo.subtype=%x\n”, dalPlatformInfo.subtype); pPlatformInfo->platform = (EFI_PLATFORMINFO_PLATFORM_TYPE)dalPlatformInfo.platform; pPlatformInfo->version = dalPlatformInfo.version; pPlatformInfo->subtype = dalPlatformInfo.subtype; pPlatformInfo->fusion = dalPlatformInfo.fusion;
eDalStatus = boot_DalPlatformInfo_ChipId(pChipSetId);
eDalStatus = boot_DalPlatformInfo_ChipFamily(pChipSetFamily);
}
return eStatus; }
/**************************************************************************** * ** FUNCTION: SetDefaultGPIOState() / /!
- \brief
- The \b SetDefaultGPIOState function toggles a list of GPIO’s based on the requested configuration
** - \retval MDP_Status
****************************************************************************/ MDP_Status SetDefaultGPIOState(GpioStateType *pGPIOList) { MDP_Status eStatus = MDP_STATUS_OK;
if ((NULL == pGPIOList) || (NULL == pGPIOList->pGPIOList)) { eStatus = MDP_STATUS_BAD_PARAM; } else { // Handle each type of GPIO differently switch (pGPIOList->eGPIOType) { case MDPPLATFORM_GPIOTYPE_TLMM: { uint32 uCount;
// Loop the list to configure all GPIOs.
for (uCount = 0;uCount < pGPIOList->uListSize;uCount++)
{
// Only try to program GPIOs that are within range, TLMM Macro (EFI_GPIO_CFG) supports up to 0x3FF
if (pGPIOList->pGPIOList[uCount] < 0x3FF)
{
DALGpioSignalType uGPIOCfg = 0;
uint32 uValue = (pGPIOList->uState > 0) ? DAL_GPIO_HIGH_VALUE : DAL_GPIO_LOW_VALUE;
uGPIOCfg = (DALGpioSignalType)DAL_GPIO_CFG_OUT(pGPIOList->pGPIOList[uCount], 0, DAL_GPIO_OUTPUT, DAL_GPIO_NO_PULL, DAL_GPIO_2MA, uValue);
Tlmm_ConfigGpioGroup(DAL_TLMM_GPIO_ENABLE, &uGPIOCfg, 1);
}
}
}
break;
default:
// Others (PMIC, PMI) not supported
break;
}
}
return eStatus; }
#ifdef __cplusplus } #endif
|