X2000 Linux 低功耗

一、进入休眠

当系统启动后,在命令终端输入:

echo mem> /sys/power/state

即可立即进入休眠,功耗也随之降低。

二、配置中断唤醒GPIO

1、确认kernel默认配置文件

进入到/tools/iconfigtool/IConfigToolApp/路径下,执行./IConfigTool

X2000 Linux 低功耗_第1张图片

 选择config文件,查看kernel默认配置

X2000 Linux 低功耗_第2张图片

 配置文件为x2000_module_base_linux_sfc_nand_defconfig,然后退出。

2、查看内核所用dts文件

cd kernel/kernel-x2000/
make x2000_module_base_linux_sfc_nand_defconfig
make menuconfig

目标位于

-> Machine selection
        -> SOC Type Selection

X2000 Linux 低功耗_第3张图片

 所用dts文件为x2000_module_base.dts

3、内核中选中GPIO Buttons

目标位于

->Device Drivers  
        ->  Input device support

                -> Keyboards 

                        ->GPIO Buttons  

X2000 Linux 低功耗_第4张图片

 然后Save,之后Exit。退出之后执行

cp .config arch/mips/configs/x2000_module_base_linux_sfc_nand_defconfig

保存配置文件。

4、在dts文件中增加gpio_keys节点

打开\kernel\kernel-x2000\arch\mips\boot\dts\ingenic目录下的x2000_module_base.dts文件。

gpio_keys: gpio_keys {
	compatible = "gpio-keys";

	key0 {
	   label = "GPIO Key Enter";
	   linux,code = ;
	   gpios = <&gpe 31 GPIO_ACTIVE_LOW INGENIC_GPIO_NOBIAS>;
	   gpio-key,wakeup;
	};
};

使用pe31作为唤醒gpio。

三、重新编译内核

cd build
make x2100_nand_defconfig
make kernel

四、测试

重新烧写xImage后,启动设备,查看中断:

# cat /proc/interrupts 

 72:          0          0      GPIO  31  GPIO Key Enter

GPIO31已作为一个中断源。

执行echo mem > /sys/power/state进入休眠模式,此次cpu停止工作,再将pe31短接到地,可以看到cpu又恢复工作。

你可能感兴趣的:(君正X2000,linux,运维,服务器)