| 
 | 
 
发表于 2020-11-25 14:21:48
 49913 浏览  11 回复
                                 
 
 
MTK平台如何做上电开机功能?
                                
 
需求: 
         一些行业需求,用MTK平台需要上电即立马开机功能! 
解决方案: 
         平台本身开机是通过长按PowerKey 3S才能正常开机,有些平台可以通过配置PMIC的寄存器来实现,却有些平台实现不了,因此用如下硬件方案实现是靠谱的。 
GPIO120_PWK开机默认是之前是低电平,Q601截止,Q602导通,PWRKEY接地,类似于按下PowerKey按键,实现开机,开机之后,屏背光亮后,在显示驱动出控制GPIO120_PWK输出高电平,Q601导通,Q602截止,类似于松开PowerKey,从而实现上电开机。 
         VBUS网络二极管接到GPIO120_PWK是为了在使用USB下载的时候,释放PowerKey按键。 
 
 
 
软件上面处理方式(以6765为例): 
- +++ b/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt6765/disp_lcm.c
 
 - @@ -996,12 +996,24 @@ extern int ddp_dsi_dump(DISP_MODULE_ENUM module, int level);
 
 - extern int DSI_BIST_Pattern_Test(DISP_MODULE_ENUM module, void* cmdq, bool enable, unsigned int color);
 
 - extern int ddp_dsi_start(DISP_MODULE_ENUM module, cmdqRecHandle cmdq);
 
  
- +#define NM_PWRKEY_BOOTUP_SUPPORT
 
 - +#if defined(NM_PWRKEY_BOOTUP_SUPPORT)
 
 - +#define GPIO_POWERKEY_PIN (GPIO7 | 0x80000000)
 
 - +#endif
 
 - +
 
 - +
 
 - int disp_lcm_init(disp_lcm_handle *plcm)
 
 - {
 
 - DISPFUNC();
 
 - LCM_DRIVER *lcm_drv = NULL;
 
 - bool isLCMConnected = false;
 
  
- +#if defined(NM_PWRKEY_BOOTUP_SUPPORT)
 
 - + mt_set_gpio_mode(GPIO_POWERKEY_PIN, GPIO_MODE_00);
 
 - + mt_set_gpio_dir(GPIO_POWERKEY_PIN, GPIO_DIR_OUT);
 
 - + mt_set_gpio_out(GPIO_POWERKEY_PIN, GPIO_OUT_ONE);
 
 - +#endif
 
 - +
 
 - if (_is_lcm_inited(plcm)) {
 
 - lcm_drv = plcm->drv;
 
  复制代码 软件上面处理方式(以6737为例):- +++ b/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt6735/disp_lcm.c
 
 - @@ -1079,13 +1079,21 @@ FAIL:
 
 -         return NULL;
 
 -  }
 
 -  
 
 - -
 
 - +//#define NM_PWRKEY_BOOTUP_SUPPORT
 
 - +#if defined(NM_PWRKEY_BOOTUP_SUPPORT)
 
 - +#define GPIO_POWERKEY_PIN (GPIO127 | 0x80000000)
 
 - +#endif 
 
 -  int disp_lcm_init(disp_lcm_handle *plcm)
 
 -  {
 
 -         DISPFUNC();
 
 -         LCM_DRIVER *lcm_drv = NULL;
 
 -         bool isLCMConnected = false;
 
 -  
 
 - +               #if defined(NM_PWRKEY_BOOTUP_SUPPORT)
 
 - +        mt_set_gpio_mode(GPIO_POWERKEY_PIN, GPIO_MODE_00);
 
 - +        mt_set_gpio_dir(GPIO_POWERKEY_PIN, GPIO_DIR_OUT);
 
 - +        mt_set_gpio_out(GPIO_POWERKEY_PIN, GPIO_OUT_ONE);
 
 - +       #endif
 
  复制代码 
 
 
 |   
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册  
 
x
 
 
 
 
 |  
| 
 手机微信同号:13682654092 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 
发表于 2020-11-26 13:47:37
                                 
 
 
 本帖最后由 jawadi 于 2020-11-26 13:58 编辑  
 
谢谢。 但是,如何在MT2503D软件中做到这一点并将PWRKEY连接到GND? |   
 
 
 
 |  
| 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 楼主|
发表于 2020-11-26 17:28:18
                                 
 
 
 
没有使用这种方式,用pwk直接拉到地会有风险,用硬件去模拟按下和抬起的实现是最可靠的。 |   
 
 
 
 |  
| 
 手机微信同号:13682654092 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 
发表于 2020-12-9 16:56:53
                                 
 
 
| 
I solved the problem in SW |   
 
 
 
 |  
| 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 楼主|
发表于 2020-12-12 10:38:05
                                 
 
 
 |  
| 
 手机微信同号:13682654092 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 
发表于 2020-12-14 14:48:18
                                 
 
 
 本帖最后由 jawadi 于 2020-12-14 15:14 编辑  
 
I overwrote the function that checks the status of PWRKEY in file DclH_kbd.c. I control the behavior of the function based on the times it has been called and keep record using a static variable. Needless to say, I commented out the part that returns the real key press value. 
 
kal_bool PowerKey_Press(void) 
{ 
        static kal_uint32 pwk_cnt = 0; 
 
////////////////////////////////////////////////// 
//          The rest of the function 
////////////////////////////////////////////////// 
        if(pwk_cnt < 3){ 
                pwk_cnt++; 
                return KAL_TRUE; 
        } 
        else{ 
                return KAL_FALSE; 
        }         
 
} 
 |   
 
 
 
 |  
| 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 楼主|
发表于 2020-12-14 15:40:21
                                 
 
 
 |  
| 
 手机微信同号:13682654092 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 楼主|
发表于 2020-12-17 11:56:59
                                 
 
 
+++ b/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt6765/disp_lcm.c 
@@ -996,12 +996,24 @@ extern int ddp_dsi_dump(DISP_MODULE_ENUM module, int level); 
extern int DSI_BIST_Pattern_Test(DISP_MODULE_ENUM module, void* cmdq, bool enable, unsigned int color); 
extern int ddp_dsi_start(DISP_MODULE_ENUM module, cmdqRecHandle cmdq); 
 
+#define NM_PWRKEY_BOOTUP_SUPPORT 
+#if defined(NM_PWRKEY_BOOTUP_SUPPORT) 
+#define GPIO_POWERKEY_PIN (GPIO7 | 0x80000000) 
+#endif 
+ 
+ 
int disp_lcm_init(disp_lcm_handle *plcm) 
{ 
DISPFUNC(); 
LCM_DRIVER *lcm_drv = NULL; 
bool isLCMConnected = false; 
 
+#if defined(NM_PWRKEY_BOOTUP_SUPPORT) 
+ mt_set_gpio_mode(GPIO_POWERKEY_PIN, GPIO_MODE_00); 
+ mt_set_gpio_dir(GPIO_POWERKEY_PIN, GPIO_DIR_OUT); 
+ mt_set_gpio_out(GPIO_POWERKEY_PIN, GPIO_OUT_ONE); 
+#endif 
+ 
if (_is_lcm_inited(plcm)) { 
lcm_drv = plcm->drv; |   
 
 
 
 |  
| 
 手机微信同号:13682654092 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
| 
 | 
 
 
发表于 2022-8-4 09:31:44
                                 
 
 
tangh 发表于 2020-12-17 11:56 
+++ b/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt6765/disp_lcm.c 
@@ -996,12 +996, ...  
请问,6765 Android9.0是不是可以直接用软件的方法实现插充电器上电开机呢? |   
 
 
 
 |  
| 
 | 
 
 
 | 
 | 
 
| 
 | 
 | 
 
 
 
	
登录或注册 
 |