Lines Matching refs:gameport

96 	struct gameport *gameport;  member
116 static int sw_read_packet(struct gameport *gameport, unsigned char *buf, int length, int id) in sw_read_packet() argument
123 …timeout = id ? gameport_time(gameport, SW_TIMEOUT * 1000) : 0; /* Set up global timeout for ID pac… in sw_read_packet()
124 kick = id ? gameport_time(gameport, SW_KICK) : 0; /* Set up kick timeout for ID packet */ in sw_read_packet()
125 start = gameport_time(gameport, SW_START); in sw_read_packet()
126 strobe = gameport_time(gameport, SW_STROBE); in sw_read_packet()
133 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
134 v = gameport_read(gameport); in sw_read_packet()
139 v = gameport_read(gameport); in sw_read_packet()
152 v = gameport_read(gameport); in sw_read_packet()
168 gameport_trigger(gameport); /* Trigger */ in sw_read_packet()
221 static void sw_init_digital(struct gameport *gameport) in sw_init_digital() argument
231 gameport_trigger(gameport); /* Trigger */ in sw_init_digital()
232 t = gameport_time(gameport, SW_TIMEOUT * 1000); in sw_init_digital()
233 while ((gameport_read(gameport) & 1) && t) t--; /* Wait for axis to fall back to 0 */ in sw_init_digital()
237 gameport_trigger(gameport); /* Last trigger */ in sw_init_digital()
411 i = sw_read_packet(sw->gameport, buf, sw->length, 0); in sw_read()
417 " - going to reinitialize.\n", sw->gameport->phys); in sw_read()
443 " - enabling optimization again.\n", sw->gameport->phys); in sw_read()
456 " - disabling optimization.\n", sw->gameport->phys); in sw_read()
464 " - reinitializing joystick.\n", sw->gameport->phys); in sw_read()
468 sw_init_digital(sw->gameport); in sw_read()
472 i = sw_read_packet(sw->gameport, buf, SW_LENGTH, 0); /* Read normal data packet */ in sw_read()
474 sw_read_packet(sw->gameport, buf, SW_LENGTH, i); /* Read ID packet, this initializes the stick */ in sw_read()
481 static void sw_poll(struct gameport *gameport) in sw_poll() argument
483 struct sw *sw = gameport_get_drvdata(gameport); in sw_poll()
494 gameport_start_polling(sw->gameport); in sw_open()
502 gameport_stop_polling(sw->gameport); in sw_close()
567 static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) in sw_connect() argument
588 sw->gameport = gameport; in sw_connect()
590 gameport_set_drvdata(gameport, sw); in sw_connect()
592 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); in sw_connect()
597 gameport->phys, gameport->io, gameport->speed); in sw_connect()
599 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read normal packet */ in sw_connect()
604 sw_init_digital(gameport); /* Switch to digital */ in sw_connect()
606 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
615 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Read ID. This initializes the stick */ in sw_connect()
621 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Retry reading packet */ in sw_connect()
629 j = sw_read_packet(gameport, idbuf, SW_LENGTH, i); /* Retry reading ID */ in sw_connect()
640 i = sw_read_packet(gameport, buf, SW_LENGTH, 0); /* Read data packet */ in sw_connect()
648 sw->gameport = gameport; in sw_connect()
702 "on %s, contact <vojtech@ucw.cz>\n", gameport->phys); in sw_connect()
714 gameport_set_poll_handler(gameport, sw_poll); in sw_connect()
715 gameport_set_poll_interval(gameport, 20); in sw_connect()
726 "%s/input%d", gameport->phys, i); in sw_connect()
740 input_dev->dev.parent = &gameport->dev; in sw_connect()
781 fail2: gameport_close(gameport); in sw_connect()
782 fail1: gameport_set_drvdata(gameport, NULL); in sw_connect()
787 static void sw_disconnect(struct gameport *gameport) in sw_disconnect() argument
789 struct sw *sw = gameport_get_drvdata(gameport); in sw_disconnect()
794 gameport_close(gameport); in sw_disconnect()
795 gameport_set_drvdata(gameport, NULL); in sw_disconnect()