I am a newbie in kernel programming, am currently working on a task , writing a driver to control GPIO pins . I have identified JP4 connector and added a LED on gpio91 (JP4.06 => /sys/class/gpio/gpio91 ). After reading many tutorials I have written a simple LKM. This LKM received an input from user space and based on input I am setting gpio like gpio_set_value(91,true) (PS. before calling gpio_set_value, I am calling one more function i.e gpio_direction_output) and thus led is glowing .On the other hand when I am getting other command from user space to get status of PIN (for this I am relying on gpio_get_value(91) and for this also setting direction to input) ,here I am not getting proper value.
Am I missing any step to get desired value ? How should I attempt doing this?