Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: ROCK64 device tree questions
> Am 21.10.2026 um 05:28 schrieb Matthias Geiger <werdahias%riseup.net@localhost>:
>
> Hi,
>
> I got a bit more acquantained with NetBSD, and I noticed (not that surprisingly) that some hardware bits were not initializing.
> For starters, I looked at the IR receiver since it seems relatively simple:
>
> [ 1.000004] /ir-receiver at simplebus0 not configured
>
> I then found external/gpl2/dts/dist/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts which already has the correct overlay for the receiver.
> In addition, I saw that /dev/ir has the generic IR drivers.
> However, I am not sure what the next steps would be. I think this would be a trivial fix and I would love to get my hands dirty with some kernel hacking. Any pointers would be much appreciated. I have no problem reading schematics or datasheets etc. and have some device tree and C knowledge.
>
The device tree specifies a compatible="gpio-ir-receiver" for the IR receiver, but we don’t have a driver that matches this.
The IR subsystem in /dev/ir is the core of the IR subsystem, with backends spread over the tree, for example the USB based one in sys/dev/usb (see https://man.netbsd.org/irframe.4). There does not seem to be a gpio based driver though.
It looks like you will need to write a driver that:
- attaches based on the device tree
- get access to the GPIO using fdtbus_gpio
- registers as a backend with the IR subsystem
- implements the interface of the IR subsystem
For writing a FDT based driver, you can find some examples in sys/dev/fdt and sys/arch/arm.
- You will need to add a C file for the driver
- You will need to add that C file to the files.something of your directory so it is found by the build system
- You will need to add your driver to your kernel configuration (probably sys/arch/evbarm/conf/GENERIC64 for a ROCK64)
GPIO access in a FDT based driver is done via fdtbus_gpio_* from sys/dev/fdt/fdt_gpio.h
For how to register with the IR subsystem, it is probably the easiest to see how the other drivers do it. See https://man.netbsd.org/irframe.4 for a list.
When I started hacking with NetBSD, I found this presentation by Riastradh helpful: https://netbsd.org/gallery/presentations/riastradh/bsdcan2024/getstarted.pdf
Does that help? Otherwise feel free to ask more questions.
Home |
Main Index |
Thread Index |
Old Index