Linux驱动开发 gpio_get_value读取输出io的电平返回值一直为0的问题

当时gpio子系统进行读取时返回必定是0

因此,首先必须使用platform驱动来管理gpio和pinctrl子系统,然后如果按照正点原子所教的设备树引脚设置为0x10B0则会导致读取到的电平值为0。

解决方法:

将设备树中的引脚设置为

c 复制代码
pinctrl_gpioled: gpioledgrp {
			fsl,pins =<
				MX6UL_PAD_GPIO1_IO03__GPIO1_IO03	0x400110B0
			>;
		};

即将原来的0X10B0改为0x400110B0,即可顺利读取到设置成输出模式的io的电平值了

具体原理可以参考
NXP i.MX6 GPIO value值读取为0

但其实我还遇到了一个问题,那就是我所写的项目中需要注册多个gpio,并且需要监控他们的变化。在注册过程中,

c 复制代码
static const struct of_device_id LNG_platform_of_match[] = {
	{.compatible = "mini,gpioled"},
    { .compatible = "gpio-bounce" },
    { .compatible = "gpio-water-high" },
    { .compatible = "gpio-water-low" },
    { .compatible = "gpio-vacuum" },
    { .compatible = "gpio-absorb" },
    { .compatible = "gpio-stir" },
    { .compatible = "gpio-up1" },
    { .compatible = "gpio-up2" },
    { .compatible = "mini,gpio-add1" },
    { .compatible = "gpio-add2" },
	{/* sentinel */},
};

该匹配函数每有一个子节点便会匹配一次并执行一次probe函数。然后我的probe函数中放入了驱动的注册部分,就会一直报错,但并不影响最终的使用。具体情况如下

目前还没有找到具体的解决方法。先挖个坑,后续找到了我会进行更新。

相关推荐
orion574 小时前
Missing Semester Class1:course overview and introduction of shell
linux
用户1204872216110 小时前
Linux驱动编译与加载
linux·嵌入式
用户8055336980316 小时前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户8055336980316 小时前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房1 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia2 天前
linux curl命令详解_curl详解
linux
扛枪的书生2 天前
Linux 网络管理器用法速查
linux
顺风尿一寸2 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫3 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux