I did not find any existing driver for the GPIO port of the Jetway
NF98 mini-itx board, so I would like to write a module for that,
using the gpiolib interface.
Since the board documentation does not include any information about
the GPIOs, I contacted the Jetway support team. However, the only
answer was the attached code for Windows (NF98GPIO.c).
As you can see, it seems clear how to set the pin states for output,
but not how to read them in input mode. I asked again and the
response was (literally):
It makes no sense, and it is very upsetting.
I would try to read from the same address used for output, but this
is just an idea to be tested.
Since I have not written any kernel module before, after reading the
pertinent documentation about memory management, i/o port access,
and gpiolib, I have some questions.
1. How should I request/release the ports mentioned in the attached
file? Should I use the request_region/release_region functions from
linux/ioport.h? In such case, what should I do with the returned
struct resource?
2. I suppose that I should use the same addresses given by the
support team, although their code is for windows. Is it ok?
3. Should/could I use the test_bit, set_bit, clear_bit functions to
get, set the bit in the needed read/write functions I am writing? Or
should I use the sequence 'inb - mask the value properly - outb' ?
The second file attached is an skeleton of the module I am trying to
write, any comments or suggestions are welcome.