本文适用于RK3588+RK806(电源管理芯片)的方案,power(电源)键是直接控制RK806来控制RK3588的上下电,可以实现短按开机、长按强制断电关机的功能,可以通过控制RK806的寄存器来设置长按的时间长短。RK806的power键长按时间可以配置为如下几个值:--- a/arch/arm64/boot/dts/rockchip/rk3588-rk806-single.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-rk806-single.dtsi @@ -44,6 +44,10 @@ */ pmic-reset-func = <1>; + /* PWRON_LP_OFF_TIME: PWRON long press time: + * 00: 6000ms, 01: 8000ms, 10: 10000ms, 11: 12000ms */ + pwron-lp-off-time = <12000>; + vcc1-supply = <&vcc5v0_sys>; vcc2-supply = <&vcc5v0_sys>; vcc3-supply = <&vcc5v0_sys>; diff --git a/drivers/mfd/rk806-core.c b/drivers/mfd/rk806-core.c index 5421ac95578f..2fbc2e967fef 100644 --- a/drivers/mfd/rk806-core.c +++ b/drivers/mfd/rk806-core.c @@ -620,6 +620,7 @@ static int rk806_parse_dt(struct rk806 *rk806) struct device *dev = rk806->dev; int rst_fun; int ret; + int value; pdata = rk806->pdata; @@ -678,6 +679,25 @@ static int rk806_parse_dt(struct rk806 *rk806) if (device_property_read_bool(dev, "pwron-on-time-500ms")) rk806_field_write(rk806, PWRON_ON_TIME, 0x00); + if (device_property_read_bool(dev, "pwron-lp-to-reset")) + rk806_field_write(rk806, PWRON_LP_ACT, 0x01); + + ret = device_property_read_u32(dev, + "pwron-lp-off-time", + &value); + if (ret < 0) { + dev_info(dev, "pwron-lp-off-time missing!\n"); + } else { + if (value <= 6000) + rk806_field_write(rk806, PWRON_LP_OFF_TIME, 0x00); + else if (value <= 8000) + rk806_field_write(rk806, PWRON_LP_OFF_TIME, 0x01); + else if (value <= 10000) + rk806_field_write(rk806, PWRON_LP_OFF_TIME, 0x02); + else + rk806_field_write(rk806, PWRON_LP_OFF_TIME, 0x03); + } + return 0; } 原文链接:https://blog.csdn.net/weixin_43245753/article/details/127852443 |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-12-23 05:11
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.