imax 6UI的按键输入子系统input 注意点

本文档详细介绍了如何修改Linux内核设备树(DTS)来配置IMX6UL的GPIO按键输入子系统,包括DTS文件的修改,涉及按键事件的设备节点创建。此外,提供了读取并处理GPIO按键事件的C代码示例,用于响应按键按下和释放事件。
摘要由CSDN通过智能技术生成

1.修改menuconfig文件


2.DTS文件的修改




修改的后的文件为:

/*
* Copyright (C) 2015 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/

/dts-v1/;

#include <dt-bindings/input/input.h>
#include "imx6g2c-base.dtsi"

/ {
model = "ZLG EPC-M6G2C Board";
compatible = "fsl,imx6ul-14x14-evk", "fsl,imx6ul";

chosen {
stdout-path = &uart1;
};

memory {
reg = <0x80000000 0x10000000>; /* 256M */
};

reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;

linux,cma {
compatible = "shared-dma-pool";
reusable;
size = <0x2000000>; /* 32M */
linux,cma-default;
};
};

watchdog: watchdog {
compatible = "cat82x-gpio-wdt";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_wdt>;
gpios = <&gpio5 0 0>;
hw_margin_ms = <700>;
};

backlight {
compatible = "pwm-backlight";
pwms = <&pwm5 0 5000000>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <7>;
status = "okay";
};

beep {
compatible = "pwm-leds";

beep-leds {
label = "beeper-pwm";
pwms = <&pwm6 0 400000>;
max-brightness = <127>;
};
};

pxp_v4l2 {
compatible = "fsl,imx6ul-pxp-v4l2", "fsl,imx6sx-pxp-v4l2", "fsl,imx6sl-pxp-v4l2";
status = "okay";
};
/*
sound-mqs {
compatible = "fsl,imx-audio-mqs";
model = "mqs-audio";
cpu-dai = <&sai1>;
asrc-controller = <&asrc>;
audio-codec = <&mqs>;
};
*/
leds {
compatible = "gpio-leds";

green-led {
label = "led-run";
gpios = <&gpio4 16 1>;
linux,default-trigger = "heartbeat";
};

red-led {
label = "led-err";
gpios = <&gpio4 14 1>;
default-state = "keep";
};
};

/* add by Codebreaker */
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;

reg_3p3v: 3p3v {
compatible = "regulator-fixed";
regulator-name = "3P3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};

reg_1p8v: 1p8v {
compatible = "regulator-fixed";
regulator-name = "1P8V";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};

i2c_gpio: analog-i2c {
compatible = "i2c-gpio";
gpios = <&gpio5 8 0 /* sda */
&gpio5 7 0 /* scl */
>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2c>;
i2c-gpio,delay-us = <5>;
i2c-gpio,timeout-ms = <100>;
#address-cells = <1>;
#size-cells = <0>;

rtc@51 {
compatible = "nxp,pcf85063";
reg = <0x51>;
};

adv7180: adv7180@20 {
compatible = "adv,adv7180";
reg = <0x20>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_csi0>;
clocks = <&clks IMX6UL_CLK_CSI>;
clock-names = "csi_mclk";
DOVDD-supply = <®_3p3v>;
AVDD-supply = <®_1p8v>;
DVDD-supply = <®_1p8v>;
PVDD-supply = <®_1p8v>;
pwn-gpios = <&gpio5 6 0>;
rst-gpios = <&gpio5 5 0>;
csi_id = <0>;
mclk = <22000000>;
mclk_source = <0>;
cvbs = <1>;
status = "disabled";
port {
adv7180_ep: adv-endpoint {
remote-endpoint = <&csi1_ep>;
};
};
};
};
/*
gpio_keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
autorepeat;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpiokey>;

button0 {
label = "up";
linux,code = <171>;
gpios = <&gpio3 28 GPIO_ACTIVE_LOW>;
};

button1 {
label = "d

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值