gt911设备树
时间: 2023-07-29 22:07:38 浏览: 45
设备树(Device Tree)是一种用于描述硬件信息和配置的数据结构,通常用于嵌入式系统中。GT911是一种常见的触摸屏控制器,其设备树节点通常包括以下内容:
```
gt911@5d {
compatible = "goodix,gt911";
reg = <0x5d>;
interrupt-parent = <&gpio>;
interrupts = <18 2>;
pinctrl-names = "default";
pinctrl-0 = <>911_pins>;
reset-gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
interrupt-names = "touch";
};
```
其中,`gt911@5d` 表示设备树节点的名称和地址,`compatible` 表示设备兼容性信息,`reg` 表示设备地址,`interrupt-parent` 和 `interrupts` 表示中断信息,`pinctrl-names` 和 `pinctrl-0` 表示引脚配置信息,`reset-gpios` 表示复位引脚,`interrupt-names` 表示中断名称。这些信息可以帮助操作系统识别和配置GT911触摸屏控制器。
相关问题
树莓派4B 设备树配置GT9271和PCA9536,以及PCA9536的P1和P2引脚与GT911的RESET和INT引脚的设备树驱动
好的,针对您的问题,我可以提供以下设备树配置示例:
```
&i2c {
status = "okay";
gt911@5d {
compatible = "goodix,gt9271";
reg = <0x5d>;
interrupt-parent = <&gpio>;
interrupts = <14 2>;
reset-gpios = <&gpio 15 0>;
irq-gpios = <&gpio 16 0>;
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
touchscreen-inverted-x;
touchscreen-swapped-x-y;
touchscreen-inverted-y;
touchscreen-fuzz-x = <8>;
touchscreen-fuzz-y = <8>;
touchscreen-min-pressure = <10>;
touchscreen-max-pressure = <255>;
interrupt-on-touch = <1>;
/* PCA9536 P1 and P2 pins */
pca9536: pca9536@21 {
compatible = "nxp,pca9536";
reg = <0x21>;
gpio-controller;
#gpio-cells = <2>;
interrupt-parent = <&gpio>;
interrupts = <13 2>;
pinctrl-names = "default";
pinctrl-0 = <&pca9536_pins>;
/* PCA9536 P1 pin */
pca9536_p1: pca9536_p1 {
gpio-hog;
gpios = <&pca9536 0 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "pca9536-p1";
};
/* PCA9536 P2 pin */
pca9536_p2: pca9536_p2 {
gpio-hog;
gpios = <&pca9536 1 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "pca9536-p2";
};
};
};
};
&pca9536 {
status = "okay";
pca9536_pins: pca9536_pins {
pca9536_p1_pin: pca9536_p1_pin {
gpio-hog;
gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "pca9536-p1";
};
pca9536_p2_pin: pca9536_p2_pin {
gpio-hog;
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
output-low;
line-name = "pca9536-p2";
};
};
};
```
上述示例代码中,我们在设备树中首先定义了 I2C 总线,并在该总线下定义了 GT9271 触摸屏设备(节点 `gt911@5d`)。同时,在 GT9271 设备下,我们还定义了 PCA9536 IO 扩展器设备(节点 `pca9536@21`),并通过设备树的 `pinctrl` 属性将其与两个 GPIO 引脚(节点 `pca9536_p1` 和 `pca9536_p2`)进行绑定。
需要注意的是,上述代码中的具体引脚编号可能与您的具体硬件连接方式有所不同,因此您需要根据实际情况进行修改。
希望以上内容能够对您有所帮助!
linux中gt9xx驱动在哪里获取设备树的节点内容
在 Linux 中 gt9xx 驱动通常会在 `probe` 函数中获取设备树节点的内容。具体来说,它会通过 `devicetree` 相关的 API 从设备树中获取节点的属性,以初始化驱动程序所需的数据结构。通常情况下,驱动程序会在 `probe` 函数中执行以下操作:
1. 调用 `devm_i2c_new_device` 函数创建一个新的 I2C 设备,并将返回的设备句柄存储在驱动程序的 `ts->client` 成员中。
2. 调用 `device_get_match_data` 函数从设备树节点中获取设备类型信息,并将返回的类型信息存储在驱动程序的 `ts->chip` 成员中。
3. 调用 `of_property_read_u32` 函数从设备树节点中获取设备的一些属性,如 I2C 地址、触摸屏尺寸等,并将这些属性值存储在驱动程序的对应成员中。
这些操作可以根据具体的驱动程序实现而有所不同,但是它们都是在 `probe` 函数中执行的,以初始化驱动程序所需的数据结构。