完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
RK3 3 3 9 和 9 系统的功能可以支持强大的电源功能,同时支持 Linux 系统的简单方式,通过以下方式对这两种方法进行
电源 监控和 CPU 的日常监控。之后的时间,在硬件上和 CPU 上 的PMI 上的支持。 PWRON 继续保持最低限度超过WRONLP ,PMIC 承诺响应,进行停止。 短按休眠和长按关机 log信息: [root@rk3399:/]# [ 10.249921] PM: suspend entry 2019-01-01 00:01:01.967707087 UTC [ 10.250531] PM: Syncing filesystems ... done. [ 10.255148] test message. //加入的测试信息 [ 10.256842] Freezing user space processes ... (elapsed 0.003 seconds) done. [ 10.260770] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 10.263308] Suspending console(s) (use no_console_suspend to debug) INFO: sleep mode config[0xde]: INFO: AP_PWROFF INFO: SLP_ARMPD INFO: SLP_PLLPD INFO: DDR_RET INFO: SLP_CENTER_PD INFO: wakeup source config[0x804]: INFO: GPIO interrupt can wakeup system INFO: PWM interrupt can wakeup system INFO: PWM CONFIG[0x4]: INFO: PWM: PWM2D_REGULATOR_EN INFO: APIOS info[0x0]: INFO: not config INFO: GPIO POWER INFO: INFO: GPIO1_C1 INFO: GPIO1_B6 INFO: PMU_MODE_CONG: 0x1477bf51 涉及驱动文件 kernel/kernel/power/suspend.c 1 /** * enter_state - Do common work needed to enter system sleep state. * @state: System sleep state to enter. * * Make sure that no one else is trying to put the system into a sleep state. * Fail if that's not the case. Otherwise, prepare for system suspend, make the * system enter the given sleep state and clean up after wakeup. */ static int enter_state(suspend_state_t state) { int error; trace_suspend_resume(TPS("suspend_enter"), state, true); if (state == PM_SUSPEND_FREEZE) { #ifdef CONFIG_PM_DEBUG if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { pr_warning("PM: Unsupported test mode for suspend to idle," "please choose none/freezer/devices/platform.n"); return -EAGAIN; } #endif } else if (!valid_state(state)) { return -EINVAL; } if (!mutex_trylock(&pm_mutex)) return -EBUSY; if (state == PM_SUSPEND_FREEZE) freeze_begin(); #ifndef CONFIG_SUSPEND_SKIP_SYNC trace_suspend_resume(TPS("sync_filesystems"), 0, true); printk(KERN_INFO "PM: Syncing filesystems ... "); sys_sync(); printk("done.n"); trace_suspend_resume(TPS("sync_filesystems"), 0, false); #endif pr_debug("PM: Preparing system for sleep (%s)n", pm_states[state]); pm_suspend_clear_flags(); error = suspend_prepare(state); if (error) goto Unlock; if (suspend_test(TEST_FREEZER)) goto Finish; trace_suspend_resume(TPS("suspend_enter"), state, false); pr_debug("PM: Suspending system (%s)n", pm_states[state]); pm_restrict_gfp_mask(); error = suspend_devices_and_enter(state); pm_restore_gfp_mask(); Finish: pr_debug("PM: Finishing wakeup.n"); suspend_finish(); Unlock: mutex_unlock(&pm_mutex); return error; } 通过代码可知,power按键触发的休眠和关机会执行sys_sync函数,进行系统数据的保存,这与突然掉电导致的异常关机是有很大区别的。 关机命令 Linux的关机命令有shutdown、halt、poweroff命令等. poweroff命令关机 log信息: [root@rk3399:/]# poweroff [root@rk3399:/]# stop finishedStopping input-event-daemon: done stop auto-reboot finished Stopping dnsmasq: OK Stopping vsftpd: stopped vsftpd (pid 1072) OK [ 20.099392] [BT_RFKILL]: bt shut off power [ 20.132245] configfs-gadget gadget: unbind function 'Function FS Gadget'/ffffffc07b025a38 Stopping sshd: OK Stopping lighttpd: OK Gracefully shutting down php-fpm . done Stopping dhcpcd... stopped /***in/dhcpcd (pid 924) killall: rkisp_3A_server: no process killed Stopping network: OK stop finishedStopping system message bus: done Saving random seed... done. Stopping logging: OK umount: can't remount adb read-only umount: devtmpfs busy - remounted read-only [ 21.589884] EXT4-fs (mmcblk2p8): re-mounted. Opts: (null) The system is going down NOW! Sent SIGTERM to all processes Sent SIGKILL to all processes Requesting system poweroff [ 23.597578] cpu cpu4: min=816000, max=816000 [ 23.598572] cpu cpu0: min=816000, max=816000 [ 23.669985] I : [File] : drivers/gpu/arm/midgard_for_linux/platform/rk/mali_kbase_config_rk.c; [Line] : 274; [Func] : kbase_platform_rk_shutdown(); to make vdd_gpu enabled for turning off pd_gpu in pm_framework. [ 23.671701] rk-vcodec ff660000.rkvdec: shutdown [ 23.672132] rk-vcodec ff650000.vpu_service: shutdown [ 23.673046] rk808 0-001b: System power off [ 23.673419] rk808 0-001b: test message //加入的测试信息 [root@rk3399:/]# poweroff --help BusyBox v1.27.2 (2020-03-19 09:39:13 UTC) multi-call binary. Usage: poweroff [-d DELAY] [-n] [-f] Halt and shut off power -d SEC Delay interval -n Do not sync -f Force (don't go through init) poweroff命令做的事可以从打印信息上看出来,其实可以分为两部分,一是配置系统,停止当前的服务,进行数据保存。二是调用电源管理驱动对应的接口,完成电源配置,进行关机。 涉及驱动文件 kernel/drivers/mfd/rk808.c 1 static void rk808_syscore_shutdown(void) { int ret; struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); if (!rk808) { dev_warn(&rk808_i2c_client->dev, "have no rk808, so do nothing heren"); return; } /* close rtc int when power off */ regmap_update_bits(rk808->regmap, RK808_INT_STS_MSK_REG1, (0x3 << 5), (0x3 << 5)); regmap_update_bits(rk808->regmap, RK808_RTC_INT_REG, (0x3 << 2), (0x0 << 2)); /* * For PMIC that power off supplies by write register via i2c bus, * it's better to do power off at syscore shutdown here. * * Because when run to kernel's "pm_power_off" call, i2c may has * been stopped or PMIC may not be able to get i2c transfer while * there are too many devices are competiting. */ if (system_state == SYSTEM_POWER_OFF) { /* power off supplies ! */ if (pm_shutdown) { dev_info(&rk808_i2c_client->dev, "System power offn"); ret = pm_shutdown(rk808->regmap); if (ret) dev_err(&rk808_i2c_client->dev, "System power off error!n"); mdelay(10); dev_info(&rk808_i2c_client->dev, "Cpu should never reach here, stop!n"); while (1) ; } } } #define DEV_OFF_RST BIT(3) static int rk808_shutdown(struct regmap *regmap) { int ret; ret = regmap_update_bits(regmap, RK808_DEVCTRL_REG, DEV_OFF_RST, DEV_OFF_RST); return ret; } https://blog.csdn.net/scottmvp/article/details/112515265 |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
1567 浏览 1 评论
synopsys 的design ware:DW_fpv_div,浮点数除法器,默认32位下,想提升覆盖率(TMAX),如果用功能case去提升覆盖率呢?
1790 浏览 1 评论
RK3588 GStreamer调试四路鱼眼摄像头四宫格显示报错
4465 浏览 1 评论
【飞凌嵌入式OK3576-C开发板体验】RKNN神经网络-YOLO图像识别
254 浏览 0 评论
【飞凌嵌入式OK3576-C开发板体验】SSH远程登录网络配置及CAN通讯
1336 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-10 16:00 , Processed in 0.353231 second(s), Total 39, Slave 34 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号