#include "usb_gpio.h" static struct gpio_chip ft232_chip; #include "gpio_callbacks.c" static void usb_gpio_exit(void) { gpiochip_remove(&ft232_chip); printk("<1>%s: Bye!\n",MOD_NAME); } static int usb_gpio_init(void) { int ret; printk("<1>%s: Loading... \n",MOD_NAME); ft232_chip.label = MOD_NAME; //Callback functions ft232_chip.direction_input = set_in; ft232_chip.direction_output = set_out; ft232_chip.get = get_value; ft232_chip.set = set_value; //Automaticaly choose GPIO numbers - manual seems not to be possible ft232_chip.base = -1; //Number of GPIO pins ft232_chip.ngpio = NUM_OF_GPIO; //This indicates that get and set functions can sleep ft232_chip.can_sleep = 1; ft232_chip.owner = THIS_MODULE; ret = gpiochip_add(&ft232_chip); DEBUG_OUT("<1>%s: gpiochip_add returned %d\n",MOD_NAME,ret); if (ret){ printk("<1>%s: Can't register chip!\n",MOD_NAME); } return ret; } module_init(usb_gpio_init); module_exit(usb_gpio_exit); MODULE_LICENSE("Dual BSD/GPL");