0

My DT describes GPIO as following:

my-gpio = <&gpio4 20 0>;

In Linux kernel v5.10 I use

gpionum = of_get_named_gpio(np, "my-gpio", 0);
of_get_named_gpio_flags(np, "my-gpio", 0, &flag)
gpio_set_value(gpionum, flag);

to set the GPIO according to the active high/low setting in DT. The of_get_named_gpio_flags() has been removed in Linux kernel v6.6. Can anyone advice how to do it the same way in Linux kernel v6.6?

6
  • Even in v5.10 (and earlier versions) you should have done already differently, i.e. using gpiod_get() and similar APIs. This all written in the LInux kernel documentation and there are tons of drivers (examples) and patches in the Git history of Linux kernel on how to achieve that. Commented Jun 25 at 13:19
  • 1
    It was actually removed in v6.3 Commented Jun 25 at 16:33
  • In dts it's a node, I can only use struct device_node *np to have the GPIO number. The gpiod_get() requires struct device *dev that I don't know how to do it. Commented Jun 26 at 3:03
  • I want to access the GPIO outside it's kernel device. Commented Jun 26 at 5:21
  • Then your design is broken. You should fix the design first. After that done, see my first comment. Commented Jun 26 at 10:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.