/*--------------------------------------------------------------------------------*/
enum lcd_panel_type {
PANEL_ST7701S_WVGA = 1,
PANEL_ST7701S_30TH,
};
/*
add for detect GPIO24 lcd_ID0 and GPIO65 lcd_ID1
*/
int panel_detect_pin_id(void)
{
UINT32lcd_id0 = 0;
UINT32lcd_id1 = 0;
EFI_STATUS status = EFI_SUCCESS;
UINT32 idconfig,idconfig1;
EFI_TLMM_PROTOCOL*TLMMProtocol = NULL;
//DEBUG((EFI_D_ERROR, "panel_detect_pin_id is start\n"));
if (EFI_SUCCESS != gBS->LocateProtocol(&gEfiTLMMProtocolGuid, NULL, (void**)&TLMMProtocol))
{
DEBUG((EFI_D_ERROR, "DisplayDxe: Locate TLMM protocol failed!\n"));
}
else
{
idconfig =EFI_GPIO_CFG( LCD_ID0_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA );
status = TLMMProtocol->ConfigGpio((UINT32)idconfig,TLMM_GPIO_ENABLE);
if (status != EFI_SUCCESS)
{
DEBUG((EFI_D_ERROR, "Faile to Configure MSM GPIO 24 ENABLE !!\n"));
}idconfig1 =EFI_GPIO_CFG( LCD_ID1_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA );
status = TLMMProtocol->ConfigGpio((UINT32)idconfig1,TLMM_GPIO_ENABLE);
if (status != EFI_SUCCESS)
{
DEBUG((EFI_D_ERROR, "Faile to Configure MSM GPIO 65 ENABLE !!\n"));
}
/*Read Value*/
gBS->Stall(20000);
//20ms
status = TLMMProtocol->GpioIn(idconfig, &lcd_id0);
gBS->Stall(5000);
// 5 ms .
status = TLMMProtocol->GpioIn(idconfig1, &lcd_id1);
DEBUG((EFI_D_ERROR, "lcd_id0 = %d\t lcd_id1 = %d.\n",lcd_id0,lcd_id1));
}
/*Select TP*/
if ((lcd_id0 == GPIO_LOW_VALUE) && (lcd_id1 == GPIO_HIGH_VALUE)) {
DEBUG((EFI_D_ERROR, "PANEL_ST7701S_WVGA\n"));
return PANEL_ST7701S_WVGA;
}
else if ((lcd_id0 == GPIO_LOW_VALUE) && (lcd_id1 == GPIO_LOW_VALUE)){
DEBUG((EFI_D_ERROR, "PANEL_ST7701S_30TH\n"));
return PANEL_ST7701S_30TH;
}return 0;
}
【Linux|SDM660 UEFI LCD读ID脚兼容】
文章图片
推荐阅读
- Linux|109 个实用 shell 脚本
- linux笔记|linux 常用命令汇总(面向面试)
- Linux|Linux--网络基础
- linux|apt update和apt upgrade命令 - 有什么区别()
- linux|2022年云原生趋势
- Go|Docker后端部署详解(Go+Nginx)
- 开源生态|GPL、MIT、Apache...开发者如何选择开源协议(一文讲清根本区别)
- GitHub|7 款可替代 top 命令的工具