拓冰建站拓冰建站
首页 / 资讯中心 / 正文

Lenovo XiaoXinAir 14 — 性能模式切换

机型XiaoxinAir 14ALC 2021 (82LM) / CPUAMD Ryzen系统Debian 13 (trixie) / Kernel 6.12.95 / KDE Plasma一、功能说明通过 ACPIplatform_profile接口支持三种性能模式切换模式sysfs 值场景节能/安静low-power静音、省电、移动办公均衡/智能散热balanced日常办公、网页浏览野兽/性能performance编译、渲染、游戏二、核心原理ideapad_laptop内核模块已加载通过 ACPI 向系统暴露了platform_profile接口bashcat /sys/firmware/acpi/platform_profile_choices # 输出low-power balanced performance切换模式实际上就是向该文件写入对应值bashecho performance | sudo tee /sys/firmware/acpi/platform_profile内核模块收到写入后通过 ACPI 方法通知 ECEmbedded ControllerEC 调整风扇曲线、PPTPackage Power Target和温度墙。各模式的实际表现low-power安静模式CPU 温度墙降至 75°C 左右风扇转速明显降低几乎听不到风噪CPU 频率上限被限制适合轻度办公和移动场景实测功耗墙降低省电效果明显balanced均衡模式温度墙恢复至 85°C 左右风扇根据负载动态调节CPU 频率放开至正常范围适合日常多任务、网页浏览performance野兽模式温度墙提升至 95°C风扇转速拉满风噪明显CPU 频率可达到最高 Boost长时间高负载下性能释放更充分三、使用方法桌面快捷方式双击桌面上的“性能模式”图标即可切换无终端窗口弹出切换后桌面通知提示当前模式。命令行bash~/bin/xiaoai-profile # 循环切换节能 → 均衡 → 野兽 ~/bin/xiaoai-profile status # 查看当前模式 ~/bin/xiaoai-profile performance # 直接指定性能模式 ~/bin/xiaoai-profile balanced # 直接指定均衡模式 ~/bin/xiaoai-profile low-power # 直接指定节能模式判断当前模式bashcat /sys/firmware/acpi/platform_profile # 输出 low-power / balanced / performance 之一手动修改不推荐bashecho performance | sudo tee /sys/firmware/acpi/platform_profile四、脚本实现~/bin/xiaoai-profilebash#!/bin/bash # 循环切换或指定性能模式 PROFILE_FILE/sys/firmware/acpi/platform_profile # 检查文件是否存在 if [ ! -f $PROFILE_FILE ]; then notify-send 性能模式 当前设备不支持 platform_profile -i dialog-error exit 1 fi # 查看当前模式 if [ $1 status ]; then cat $PROFILE_FILE exit 0 fi # 如果指定了模式直接切换 if [ $1 low-power ] || [ $1 balanced ] || [ $1 performance ]; then echo $1 | sudo tee $PROFILE_FILE /dev/null notify-send 性能模式 已切换到 $1 -i preferences-system-performance exit 0 fi # 否则循环切换 CURRENT$(cat $PROFILE_FILE) case $CURRENT in low-power) NEWbalanced ICONpreferences-system-performance ;; balanced) NEWperformance ICONpreferences-system-performance ;; performance) NEWlow-power ICONbattery-low ;; *) NEWbalanced ICONpreferences-system-performance ;; esac echo $NEW | sudo tee $PROFILE_FILE /dev/null notify-send 性能模式 已切换到 $NEW -i $ICON五、桌面快捷方式~/桌面/xiaoai-profile.desktopini[Desktop Entry] TypeApplication Name性能模式 Exec/home/a1/bin/xiaoai-profile Iconpreferences-system-performance Terminalfalse Comment切换节能/均衡/性能模式六、权限配置脚本需要sudo tee写入/sys/firmware/acpi/platform_profile为免每次弹密码框添加 sudoers 规则bash# /etc/sudoers.d/xiaoai-profile a1 ALL(ALL) NOPASSWD: /usr/bin/tee /sys/firmware/acpi/platform_profile七、验证模式是否生效切换到 performance 模式后可通过以下方式验证查看 CPU 频率上限bashcat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq观察风扇转速变化bashwatch -n 1 sensors | grep -i fan跑分验证bashstress -c 4 --timeout 30 sensors八、常见问题切换后风扇没有变化部分联想机型需要重启ideapad_laptop模块才能让 EC 重新读取模式bashsudo modprobe -r ideapad_laptop sudo modprobe ideapad_laptop脚本报错 Permission denied确认platform_profile文件存在且当前用户有读写权限bashls -l /sys/firmware/acpi/platform_profile # 通常属主 root:root权限 644没有 notification 提示确认notify-send已安装且 DBUS_SESSION_BUS_ADDRESS 环境变量存在。桌面快捷方式启动时环境变量可能丢失脚本开头可加bashexport DBUS_SESSION_BUS_ADDRESS${DBUS_SESSION_BUS_ADDRESS:-unix:path/run/user/$(id -u)/bus}九、相关文件文件用途~/bin/xiaoai-profile主脚本~/桌面/xiaoai-profile.desktop桌面快捷方式/etc/sudoers.d/xiaoai-profile免密 sudo 配置十、参考资料内核模块ideapad_laptop已加载sysfs 路径/sys/firmware/acpi/platform_profile可用模式cat /sys/firmware/acpi/platform_profile_choicesArchWikiLenovo IdeaPad 5 Pro 14ACN6
分享:

看完干货,该让你的企业上线了

免费需求沟通 · 48 小时内出具建站方案 · 河南本地可上门