• RK Android7.1 使用POWER按键才能开机


    KrisFei       [RK3399][Android7.1] Uboot启动过程小结

    在board_fbt_preboot中 检测power键的状态 

    u-bootoard ockchipcommon kloaderkey.c

    __maybe_unused static key_config key_rockusb;
    __maybe_unused static key_config key_recovery;
    __maybe_unused static key_config key_fastboot;
    __maybe_unused static key_config key_power;

       开机就循环 检测key_power

    diff --git a/u-boot/board/rockchip/common/rkboot/fastboot.c b/u-boot/board/rockchip/common/rkboot/fastboot.c
    index ce6a0a1..5c07172 100755
    --- a/u-boot/board/rockchip/common/rkboot/fastboot.c
    +++ b/u-boot/board/rockchip/common/rkboot/fastboot.c
    @@ -429,6 +429,12 @@ static void board_fbt_low_power_off(void)
     }
     #endif /* CONFIG_RK_POWER */
     
    +#define POWER_ON_KEY_DECT_BOOT
    +
    +#ifdef POWER_ON_KEY_DECT_BOOT
    +extern void PowerOnKeyDectBoot(void);
    +#endif
    +
     bool board_fbt_exit_uboot_charge(void)
     {
     	int ret;
    @@ -459,6 +465,7 @@ bool board_fbt_exit_uboot_charge(void)
     	return false;
     }
     
    +
     /*
      * Determine if we should enter fastboot mode based on board specific
      * key press or parameter left in memory from previous boot.
    @@ -470,6 +477,7 @@ bool board_fbt_exit_uboot_charge(void)
     void board_fbt_preboot(void)
     {
     	enum fbt_reboot_type frt;
    +	int frt2 = 0;
     	__maybe_unused bool charge_enable = false;
     #ifdef CONFIG_UBOOT_CHARGE
     	int charge_node;			/*device node*/
    @@ -483,6 +491,7 @@ void board_fbt_preboot(void)
     #endif
     
     	frt = board_fbt_get_reboot_type();
    +	frt2 = frt;
     	/* cold boot */
     	if (frt == FASTBOOT_REBOOT_UNKNOWN)
     		charge_enable = true;
    @@ -498,6 +507,15 @@ void board_fbt_preboot(void)
     		board_fbt_set_reboot_type(FASTBOOT_REBOOT_NORMAL);
     	}
     
    +printf("board_fbt_preboot:%d
    ",frt);
    +
    + if(frt2 == FASTBOOT_REBOOT_UNKNOWN)
    + {
    +	#ifdef POWER_ON_KEY_DECT_BOOT
    +	PowerOnKeyDectBoot();
    +	#endif
    + }
    +
     #ifdef CONFIG_RK_POWER
     	board_fbt_low_power_check();
     #endif
    diff --git a/u-boot/board/rockchip/common/rkloader/key.c b/u-boot/board/rockchip/common/rkloader/key.c
    index 3dcb758..0a14c0b 100755
    --- a/u-boot/board/rockchip/common/rkloader/key.c
    +++ b/u-boot/board/rockchip/common/rkloader/key.c
    @@ -163,6 +163,17 @@ __maybe_unused static void FastbootKeyInit(void)
     	key_fastboot.key.adc.ctrl = SARADC_BASE + 8;
     }
     
    +void PowerOnKeyDectBoot(void)
    +{
    + int state=1;
    +
    + while(1)
    + {
    + state = gpio_get_value(key_power.key.ioint.gpio);
    + if(state == 0)
    + break;
    + }
    +}
     
     __maybe_unused static void PowerKeyInit(void)
     {
    

      

  • 相关阅读:
    mysql主从之双主配置
    mysql主从之binlog的工作模式
    mysql主从之主机名导致主从机制失败的问题
    python_文件 处理
    python_字典 学习
    python_元组 学习
    python 基础内置函数表及简单介绍
    python 列表学习
    python函数基础学习
    python迭代器、生成器、列表推倒式
  • 原文地址:https://www.cnblogs.com/crushgirl/p/15188870.html
Copyright © 2020-2023  润新知