pi@WalnutPi:~/Documents/Pydemo$ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
cat: /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies: No such file or directory
pi@WalnutPi:~/Documents/Pydemo$ cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 2
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
processor : 3
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4
pi@WalnutPi:~/Documents/Pydemo$ lscpu
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Vendor ID: ARM
Model name: Cortex-A53
Model: 4
Thread(s) per core: 1
Core(s) per cluster: 4
Socket(s): -
Cluster(s): 1
Stepping: r0p4
BogoMIPS: 48.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
NUMA:
NUMA node(s): 1
NUMA node0 CPU(s): 0-3
Vulnerabilities:
Itlb multihit: Not affected
L1tf: Not affected
Mds: Not affected
Meltdown: Not affected
Mmio stale data: Not affected
Retbleed: Not affected
Spec store bypass: Not affected
Spectre v1: Mitigation; __user pointer sanitization
Spectre v2: Not affected
Srbds: Not affected
Tsx async abort: Not affected
pi@WalnutPi:~/Documents/Pydemo$
好像是内核 / DTS 双重锁死了频率,没法更改。不知道有没有什么能人重新编译了 uboot dts 以及镜像。
内核驱动 (drivers/mfd/axp20x.c) 找匹配时:
axp305 → 驱动里没有这个型号,跳过
axp805 → 驱动里也没有,跳过
axp806 → 在驱动里!匹配上了!
于是内核用 AXP806 的寄存器去读写实际是 AXP313A 的芯片——寄存器地址完全不同,读回来的电压值全是错的。cpufreq 驱动找不到正确的调压器,就放弃注册了。CPU 锁在默认频率(480MHz),不管你怎么设置 governor 都上不去。
改法很简单:把 compatible 改成 “x-powers,axp313a”,AXP313A 驱动在内核 6.1.31 里已经有了,只是一直没被匹配到。
&r_i2c {
status = “okay”;
axp313: pmic@36 {
compatible = "x-powers,axp313a";
reg = <0x36>;
#interrupt-cells = <1>;
interrupt-controller;
vin1-supply = <®_vcc5v>;
vin2-supply = <®_vcc5v>;
vin3-supply = <®_vcc5v>;
regulators {
reg_dcdc1: dcdc1 {
regulator-always-on;
regulator-min-microvolt = <810000>;
regulator-max-microvolt = <1160000>;
regulator-name = "vdd-gpu-sys";
};
reg_dcdc2: dcdc2 {
regulator-always-on;
regulator-min-microvolt = <810000>;
regulator-max-microvolt = <1120000>;
regulator-name = "vdd-cpu";
};
reg_dcdc3: dcdc3 {
regulator-always-on;
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <1500000>;
regulator-name = "vdd-dram";
};
reg_aldo1: aldo1 {
regulator-always-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-name = "vcc-1v8";
};
reg_dldo1: dldo1 {
regulator-always-on;
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-name = "vcc-3v3";
};
};
};
};
改了电源节点以后HDMI的电源节点也需要修改
&hdmi {
hvcc-supply = <®_aldo1>;
status = “okay”;
};
只是这样修改HDMI将无法显示
因为驱动注册中
AXP_DESC(AXP313A, LDO1, “ldo1”, …) // of_match = “ldo1”
AXP_DESC(AXP313A, LDO2, “ldo2”, …) // of_match = “ldo2”
regulator 核心的 OF 匹配流程:
-
desc->regulators_node = "regulators" → 找到子节点 regulators
-
desc->of_match = "ldo1" → 在 regulators 下找名为 "ldo1" 的子节点
-
找不到! 因为真实的节点名是 "aldo1" 
-
→ rdev->dev.of_node = NULL
-
→ HDMI 驱动通过 hvcc-supply = <®_aldo1> 查找时,phandle 指向的节点没有绑定任何 regulator
-
→ "Couldn't get regulator" → deferred probe
所以需要修改驱动代码
在 ~/linux-6.1.31/drivers/regulator/axp20x-regulator.c 中,找到 for 循环里的这段:
if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) ||
(regulators == axp809_regulators && i == AXP809_DC5LDO)) {
new_desc = devm_kzalloc(&pdev->dev, sizeof(\*desc),
GFP_KERNEL);
if (!new_desc)
return -ENOMEM;
\*new_desc = regulators\[i\];
new_desc->supply_name = dcdc5_name;
desc = new_desc;
}
rdev = devm_regulator_register(&pdev->dev, desc, &config);
**在这两段之间,`rdev = devm_regulator_register` 之前**,插入下面的代码:
/*
* AXP313A maps its regulator names differently in DTS.
* The ALDO1/DLDO1 hardware names are used in DTS nodes,
* but the regulator_desc uses generic LDO1/LDO2 names.
* Look up the correct OF node for proper phandle matching.
*/
if (axp20x->variant == AXP313A_ID) {
struct device_node *regs_np, *reg_np;
const char *hw_name = NULL;
if (!strcmp(regulators[i].name, "ldo1"))
hw_name = "aldo1";
else if (!strcmp(regulators[i].name, "ldo2"))
hw_name = "dldo1";
if (hw_name) {
regs_np = of_get_child_by_name(
pdev->dev.parent->of_node, "regulators");
if (regs_np) {
reg_np = of_get_child_by_name(regs_np, hw_name);
if (reg_np)
config.of_node = reg_np;
of_node_put(regs_np);
}
}
}
rdev = devm_regulator_register(&pdev->dev, desc, &config);
然后编译Image 复制过去,但是串口内核启动过程中会出现
\[ 7.492083\] FAT-fs (mmcblk0p1): IO charset iso8859-1 not found
\[FAILED\] Failed to mount /boot.
/boot 分区是 FAT 格式,需要 nls_iso8859_1 模块。你的内核配置里:
CONFIG_NLS_ISO8859_1=m ← 是模块,不是编译进内核的
重新编译 make Image 后,新内核的版本字符串变了(因为编译时间戳变了),于是在 /lib/modules/$(uname -r)/ 下找不到旧模块,所以所有 =m 的模块(包括 nls_iso8859_1)都加载不了 → /boot 挂载失败 → 级联到所有依赖它的服务 → 进 emergency shell。
所以记得重新编译modules 一块放回去 或者 把CONFIG_NLS_ISO8859_1=y 编译进内核里(这个方法我没试过,我把modules一块放进roofts,HDMI就好了)