Let's code a Linux Driver - 21: Device Tree GPIO Driver

preview_player
Показать описание
#GNU #Linux #Tutorial #Driver #DriverDevelopment

Let's leave userspace and head towards Kernelspace!

What you normally do is, you add a device to the device tree, add your GPIO and then init the GPIO in your custome device's driver. I will show you how to do this in this video.

Useful videos to understand this:

Here is the link to my git-repo:

You want to learn more? Check out my playlist:

Resources for this video:
Рекомендации по теме
Комментарии
Автор

please bro don`t stop every time I see your videos I feel that my skills are getting better so please think about

1- writing DTS for physical address for device then align it to Driver
2- explain yocto project and demonstrate device driver with that
3- explain writing static in tree driver
4- explain more about overlays and how to search and get what we want
5- play with some devices like Graphical LCD, MPU6050, Ultrasonic, etc
I am trying to suggest videos for you to don`t stop 🙏
finally, I would like to thank you a lot you did great and still doing great things thank you a lot

moatasemelsayed
Автор

I've tried this on Orange PI 3 LTS Board with Allwinner H6 ECU and Armbian Linux distribution. it's also working. Good explained. Thanks.

bartomiejlandoch
Автор

You the best bro, appreciate your work.

MrAaaeve
Автор

Thanks a lot. Very useful. One request, can you please make any video tutorial on any Sound codec driver, or ALSA

dragonmariba
Автор

do we need the raspberry-pi chip name in the first compatible statement ?

perceptron
Автор

I believe that you wrote a bug at 8:57. Shouldn't that be removing it when the driver is removed?

darinvelarde
Автор

With rtk.gpio board is possible use a driver and firmware to use him like gpio input/output without RTK python ? like bash gpiodetect !

Dark_Phoinix
Автор

Interesting, thanks for providing this! In "compatible", what is the "brightlight" for? Could it work without?
Note: I'am not aware of device-tree syntax... So the dts file is confusong to me

fghoussen
Автор

Thanks a lot for these videos. Just an interesting remark. In my case (kernel v5.15 running on Terasic DE10-SoC), I'm not able to use values in the user_buffer directly like you are here. Before the switch statement in my_write I added the following to first copy out the first character:
char new_state = '-';
copy_from_user(&new_state, user_buffer, 1);

and then I could do
gpiod_set_value(my_led, new_state - '0');

If someone knows why I'm all ears :)

benjamin
Автор

is "dtoverlay" RP exclusive? I don't have it on my custom system and can't seem to locate it. Other sources suggest using uboot to load overlays.

johanneswestman
Автор

which kernel version are u using? i am getting error while compiling

Ssanatan
Автор

This isn't really a complete process. You should have shown that the pin multiplexing must also be configured in the device tree pinmux group.

mithrandirthegrey
welcome to shbcf.ru