使用gpiod_get直接获取IO
This commit is contained in:
parent
40b2bc2385
commit
0373241160
16
.vscode/c_cpp_properties.json
vendored
Normal file
16
.vscode/c_cpp_properties.json
vendored
Normal file
@ -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
|
||||||
|
}
|
||||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"fb.h": "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);
|
printk(KERN_EMERG "cst816d = %d \n",io_cst816d_reset);
|
||||||
|
|
||||||
irq_gpio = devm_gpiod_get(&client->dev, "intirq", GPIOD_IN);
|
/* 获取第一个 GPIO 引脚,并设置为输入 */
|
||||||
if (IS_ERR(irq_gpio))
|
irq_gpio = gpiod_get(&client->dev, "intirq", GPIOD_IN);
|
||||||
return -ENODEV;
|
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);
|
ret = alloc_chrdev_region(&cst816x_devno, 0, DEV_CNT, DEV_NAME);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printk("fail to alloc cst816x_devno\n");
|
printk(KERN_EMERG "fail to alloc cst816x_devno\n");
|
||||||
goto alloc_err;
|
goto alloc_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user