GPIO Kernel Module
#1
So, I would like to use the pinephone to learn more about device driver kernel modules in linux and device nodes. My main goal would be to write a kernel module that I can load, to control an LED in user space but I know, that's a long way to go. Smile As you can see, there's going to be some very naive things I'm going to say, so please bear with me... I'd really like to know how this works!

I am fairly new to the subject and by now I was only developing firmware for STM32 devices and some software backend things, but no embedded linux at all. On a microcontroller I would look up on which GPIO pin the LED is connected, then search the programming manual for the registers that configure and controle the pin and write to those register addresses.

Still, I think I know at least SOME things about how the linux kernel works. Correct me if I'm wrong, but I suppose there is a kernel module which is basically executable machine code and does the "writing-to-register-addresses"-part? This module can be "loaded" in order to control a peripheral. The module then uses files (or nodes) to offer some sort of interface to applications in user space, in order to easily control the peripheral. These files are located either in /sys or /dev (I guess?). Is that kind of true so far? I already saw the files that can be used to turn an LED on or off in /sys/platform/leds/leds/.

If the above isn't too far off, I have many follow-up questions, but one after the other.  Smile
It would be really kind if someone would like to take time and provide some inside knowledge and just help me find my way here!
  Reply


Messages In This Thread
GPIO Kernel Module - by Foxchild - 03-09-2020, 03:10 PM
RE: GPIO Kernel Module - by Foxchild - 03-09-2020, 05:16 PM
RE: GPIO Kernel Module - by Foxchild - 03-14-2020, 10:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PSA: WiFi driver is broken - Unload kernel module to save lots of power Trbl 3 4,634 06-23-2021, 02:28 AM
Last Post: Merc
Lightbulb Python3 - GPIO - controlling LED's etc bonce 1 2,471 06-06-2021, 09:43 AM
Last Post: bonce
  Ubports Wifi Module not Returning Networks acohl 4 5,163 04-21-2021, 03:27 AM
Last Post: NinjaDino29
  Mainline kernel repo hns 5 8,242 02-15-2020, 08:47 AM
Last Post: hns

Forum Jump:


Users browsing this thread: 2 Guest(s)