trying to understand the device model
hi
sorry for spam if this is actually just naive.
i'm new to linux kernel driver module and planning to write a small driver module for gpio test, here is what confuses me:
1. in the kernel module programming guide from tldp.org, a device is registered with system by major and minor numbers but in recent kernel source( i'm working with 2.6.28.10 ), the files under Documentation/driver-model/ seem to introduce a whole new set of models, also in kernel source, gpiolib and plat-omap/gpio.c seem to follow the new models. i'm not sure if the way described in kernel module programming guide is still valid for recent kernels.
2. for your information, i want to write a simple driver based on gpio interface described in Documentation/gpio.txt and implement a 8-bit read function as well as an interrupt handler, sort of using gpios to emulate a parallel port. this is just a workaround for lacking access to camera interface on IGEPv2 board, so no need to consider portability or whatsoever, is there any problem for me to just use module_init() and module_exit(), as is shown in the kernel module programming guide, instead of going into all those add/remove classes, buses, interfaces?
thanks in advance!
Signature · 1 line
Huayu Yang
Quoted 10 lines · ext Hua Yu Yang
hi
sorry for spam if this is actually just naive.
i'm new to linux kernel driver module and planning to write a small driver module for gpio test, here is what confuses me:
1. in the kernel module programming guide from tldp.org, a device is registered with system by major and minor numbers but in recent kernel source( i'm working with 2.6.28.10 ), the files under
that's not recent at all :-s Could you move to current linux-omap git ?
Quoted 4 lines
Documentation/driver-model/seem to introduce a whole new set of models, also in kernel source, gpiolib andplat-omap/gpio.cseem to follow the new models. i'm not sure if the way described in kernel module programming guide is still valid for recent kernels.
you should try to use current kernels.
Quoted 9 lines
2. for your information, i want to write a simple driver based on gpio interface described in
Documentation/gpio.txtand implement a 8-bit read function as well as an interrupt handler, sort of using gpios to emulate a parallel port. this is just a workaround for lacking access to camera interface on IGEPv2 board, so no need to consider portability or whatsoever, is there any problem for me to just usemodule_init()andmodule_exit(), as is shown in the kernel module programming guide, instead of going into all those add/remove classes, buses, interfaces?
I believe you'll like to look at the platform_driver structures and make a driver that claims the gpios you need and sets correct direction/value when needed.
Signature · 1 line
balbi