GPIO Kernel Module
#4
(03-09-2020, 05:16 PM)Foxchild Wrote: That is very good to know, thank you! Smile

Well, yes I'd like to reimplement leds-gpio, I think. I guess a very simple LED driver would be a good learning experience for a beginner.

So, I have a question... When I write to "brightness" in /sys/devices/platform/leds/leds/pinephone:blue:user/ (Ubuntu Touch), then the brightness can be modified. Which, I assume, is a value that is used by the leds-gpio module and written in the corresponding memory mapped register. So, why is there no leds-gpio module present when I execute lsmod?


Maybe the kernel module is built-in? What does


Code:
zgrep -i led /proc/config.gz

say?


Before you ask:

A module has an init() function that registers the driver with the kernel proper. It is executed if the module is built in or when the module is insmod'ed. The driver informs the kernel in this frunction for what peripherals it is in charge of.

If the kernel is aware of a peripheral for this driver then the kernel is calling the driver's probe() function. In this function, the driver would set in your example the sysfs callback functions.

There are discoverable busses (PCI, USB) and the kernel knows the peripherals. For non-discoverable buses, the kernel learns the peripherals from the device tree. See my first link.
  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 Der Geist der Maschine - 03-09-2020, 05:29 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,642 06-23-2021, 02:28 AM
Last Post: Merc
Lightbulb Python3 - GPIO - controlling LED's etc bonce 1 2,474 06-06-2021, 09:43 AM
Last Post: bonce
  Ubports Wifi Module not Returning Networks acohl 4 5,165 04-21-2021, 03:27 AM
Last Post: NinjaDino29
  Mainline kernel repo hns 5 8,255 02-15-2020, 08:47 AM
Last Post: hns

Forum Jump:


Users browsing this thread: 1 Guest(s)