From 0373241160745c814e7ca8eb6b0f2babc0f36c2c Mon Sep 17 00:00:00 2001 From: Yu Xifeng <2860280851@qq.com> Date: Fri, 20 Dec 2024 06:33:12 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8gpiod=5Fget=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=8E=B7=E5=8F=96IO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/c_cpp_properties.json | 16 ++++++++++++++++ .vscode/settings.json | 5 +++++ src/cst816x.c | 10 ++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 .vscode/c_cpp_properties.json create mode 100644 .vscode/settings.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..0eccee0 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/opt/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc", + "cStandard": "c17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-arm64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..162f60b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "fb.h": "c" + } +} \ No newline at end of file diff --git a/src/cst816x.c b/src/cst816x.c index c844fd4..5410e3b 100644 --- a/src/cst816x.c +++ b/src/cst816x.c @@ -386,14 +386,16 @@ static int cst816d_probe(struct i2c_client *client, const struct i2c_device_id * printk(KERN_EMERG "cst816d = %d \n",io_cst816d_reset); - irq_gpio = devm_gpiod_get(&client->dev, "intirq", GPIOD_IN); - if (IS_ERR(irq_gpio)) - return -ENODEV; + /* 获取第一个 GPIO 引脚,并设置为输入 */ + irq_gpio = gpiod_get(&client->dev, "intirq", GPIOD_IN); + if (IS_ERR(irq_gpio)) + return -ENODEV; + printk(KERN_EMERG "gpio num intirq\n"); ret = alloc_chrdev_region(&cst816x_devno, 0, DEV_CNT, DEV_NAME); if (ret < 0) { - printk("fail to alloc cst816x_devno\n"); + printk(KERN_EMERG "fail to alloc cst816x_devno\n"); goto alloc_err; }