hi:
现在有一个gpio的使用问题,帮忙分析下是哪里的问题
在设备树这样配置
rebootctl-gpios = <&gpio_main TEGRA264_MAIN_GPIO(V, 0) GPIO_ACTIVE_HIGH>;
代码在
43 // 从设备树获取 GPIO
44 data->reboot_gpio = devm_gpiod_get(dev, “rebootctl”, GPIOD_OUT_LOW);
45 if (IS_ERR(data->reboot_gpio)) {
46 ret = PTR_ERR(data->reboot_gpio);
47 dev_err(dev, “Failed to get rebootctl GPIO: %d\n”, ret);
48 return ret;
49 }
51 gpiod_set_value(data->reboot_gpio, 1);
52 dev_info(dev, “set rebootctl high\n”);
申请完这个资源之后,gpio就变成低电平了,不申请这个资源在应用层用下面的命令可以设置高和低电平
sudo gpioset sudo gpiofind "PV.00"=0
sudo gpioset sudo gpiofind "PV.00"=1
pinmux的配置
1514 soc_gpio178_pv0 {
1515 nvidia,pins = “soc_gpio178_pv0”;
1516 nvidia,function = “rsvd0”;
1517 nvidia,pull = <TEGRA_PIN_PULL_NONE>;
1518 nvidia,tristate = <TEGRA_PIN_DISABLE>;
1519 nvidia,enable-input = <TEGRA_PIN_DISABLE>;
1520 nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
1521 nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
1522 nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
1523 };
Hi mingming,
Are you using the devkit or custom board for Thor?
Have you verified with the latest Jetpack 7.1 GA(r38.4.0)?
Is your issue that PV.00 cannot be controlled to high after running gpiod_set_value?
How do you configure PV.00 from pinmux spreadsheet?
rebootctl-gpios from device tree does not match rebootctl used from driver.
Are you using the devkit or custom board for Thor?—–》custorm board
Have you verified with the latest Jetpack 7.1 GA(r38.4.0)?—》no
Is your issue that PV.00 cannot be controlled to high after running gpiod_set_value?—》是的,这个接口设置不高,我查了代码就是devm_gpiod_get(dev, “rebootctl”, GPIOD_OUT_LOW); 调用这个函数之后就变为低了
How do you configure PV.00 from pinmux spreadsheet?——》
hi:
我这样写了代码,可以设置高电压,请调查下这个函数接口devm_gpiod_get 为什么不行
gpio_set_value(586, 1);
devm_gpiod_get() is used to initialize the GPIO as Output/Out.
So, the default state should be High after boot up.
Sorry that I get confused for your current status.
Is my understanding correct as following?
devm_gpiod_get(dev, “rebootctl”, GPIOD_OUT_LOW); => not working
gpio_set_value(586, 1); => working
How do you verify the High/Low state? Do you use scope or multimeter to measure the pin state?
So, the default state should be High after boot up.—-》是的,开机起来是高电平
devm_gpiod_get(dev, “rebootctl”, GPIOD_OUT_LOW); => not working—–》代码走到这 变为低电平了,后面设置高电平 not work,意思是开机默认是高电平,这里申请资源之后变为低电平了,后面设置高 不生效,我认为这个是平台的问题,请调查下 谢谢!
gpio_set_value(586, 1); => working —-》是的,这个接口直接操作gpio num 是可以work的
How do you verify the High/Low state?——》multimeter
mingming:
代码走到这 变为低电平了
So, devm_gpiod_get() is working.
mingming:
后面设置高电平 not work
How did you configure it High when it is not working?
(as you said gpio_set_value can control it high)
hi:
看下面这个代码 注释掉的代码 设置高电平 不生效
这个接口gpio_set_value(586, 1)是生效的
Could you try using gpiod_set_raw_value(data->reboot_gpio, 1); instead?
Please share the result of the following command on your board.
$ cat /sys/kernel/debug/gpio|grep 586
Please double confirm you have configured PV.00 as GPIO/Output/Drive 1 in pinmux spreadsheet correctly.
hi:
gpiod_set_value(data->reboot_gpio, 1)这个接口没问题,今天又验证了下是ok的,感觉像是之前pinmux 没烧进去
gpio-586 (PV.00 |rebootctl ) out lo