Lenovo XiaoXinAir 14 — 性能模式切换

机型:XiaoxinAir 14ALC 2021 (82LM) / CPU:AMD Ryzen

系统:Debian 13 (trixie) / Kernel 6.12.95 / KDE Plasma

一、功能说明

通过 ACPI platform_profile 接口,支持三种性能模式切换:

模式 sysfs 值 场景
节能/安静 low-power 静音、省电、移动办公
均衡/智能散热 balanced 日常办公、网页浏览
野兽/性能 performance 编译、渲染、游戏

二、核心原理

ideapad_laptop 内核模块(已加载)通过 ACPI 向系统暴露了 platform_profile 接口:

bash

复制代码
cat /sys/firmware/acpi/platform_profile_choices
# 输出:low-power balanced performance

切换模式实际上就是向该文件写入对应值:

bash

复制代码
echo performance | sudo tee /sys/firmware/acpi/platform_profile

内核模块收到写入后,通过 ACPI 方法通知 EC(Embedded Controller),EC 调整风扇曲线、PPT(Package 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    # 直接指定节能模式

判断当前模式

bash

复制代码
cat /sys/firmware/acpi/platform_profile
# 输出 low-power / balanced / performance 之一

手动修改(不推荐)

bash

复制代码
echo performance | sudo tee /sys/firmware/acpi/platform_profile

四、脚本实现

~/bin/xiaoai-profile:

bash

复制代码
#!/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)
        NEW="balanced"
        ICON="preferences-system-performance"
        ;;
    balanced)
        NEW="performance"
        ICON="preferences-system-performance"
        ;;
    performance)
        NEW="low-power"
        ICON="battery-low"
        ;;
    *)
        NEW="balanced"
        ICON="preferences-system-performance"
        ;;
esac

echo "$NEW" | sudo tee "$PROFILE_FILE" > /dev/null
notify-send "性能模式" "已切换到 $NEW" -i "$ICON"

五、桌面快捷方式

~/桌面/xiaoai-profile.desktop:

ini

复制代码
[Desktop Entry]
Type=Application
Name=性能模式
Exec=/home/a1/bin/xiaoai-profile
Icon=preferences-system-performance
Terminal=false
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 模式后,可通过以下方式验证:

  1. 查看 CPU 频率上限:

    bash

    复制代码
    cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
  2. 观察风扇转速变化:

    bash

    复制代码
    watch -n 1 'sensors | grep -i fan'
  3. 跑分验证:

    bash

    复制代码
    stress -c 4 --timeout 30 && sensors

八、常见问题

切换后风扇没有变化?

部分联想机型需要重启 ideapad_laptop 模块才能让 EC 重新读取模式:

bash

复制代码
sudo modprobe -r ideapad_laptop && sudo modprobe ideapad_laptop

脚本报错 "Permission denied"?

确认 platform_profile 文件存在且当前用户有读写权限:

bash

复制代码
ls -l /sys/firmware/acpi/platform_profile
# 通常属主 root:root,权限 644

没有 notification 提示?

确认 notify-send 已安装且 DBUS_SESSION_BUS_ADDRESS 环境变量存在。桌面快捷方式启动时环境变量可能丢失,脚本开头可加:

bash

复制代码
export 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_choices

  • ArchWiki:Lenovo IdeaPad 5 Pro 14ACN6

相关推荐
2026小鱼AI21 分钟前
当 LLM 生成的教学设计“不合格”:结构化校验、局部重生成与并发下的质量漂移
前端
疯华整猫22 分钟前
借助 Trae 复刻百度网盘“无权限摇一摇”检测:Android 传感器 AI 辅助实战
前端
deli00726 分钟前
流式输出为什么一段一段蹦?拆开 SSE 分块实测 20094 个乱码
前端
857god31 分钟前
做了个匿名聊天站,我把 7 个前端坑踩了一遍
前端
deli00735 分钟前
GIF 太大怎么压?调帧率、尺寸、颜色数,10 组参数体积对照实测
前端
Momo__37 分钟前
你写的 import 重试,从来没生效过
前端·javascript·typescript
鶴哥只手遮天39 分钟前
Angular 22 源码级深度解析-第 13 章 依赖注入(一):Injector 抽象、`R3Injector` 与 bloom filter
前端·开源·angular.js
青烟小生40 分钟前
前端 AI Agent 编排引擎:从 ReAct 循环到生成式 UI(完整版)
前端
MetWeave44 分钟前
一朵玫瑰,装下一年的风(《风不是一个数》系列第 5 篇
前端·数据可视化
UNIHHIOT1 小时前
开源一套工业物联网平台:驱动崩了不影响别的协议,64MB 堆跑边缘网关
前端·后端