Lines Matching refs:gameport
62 struct gameport *gameport; member
75 static int gf2k_read_packet(struct gameport *gameport, int length, char *data) in gf2k_read_packet() argument
82 t = gameport_time(gameport, GF2K_START); in gf2k_read_packet()
83 p = gameport_time(gameport, GF2K_STROBE); in gf2k_read_packet()
89 gameport_trigger(gameport); in gf2k_read_packet()
90 v = gameport_read(gameport); in gf2k_read_packet()
94 v = gameport_read(gameport); in gf2k_read_packet()
111 static void gf2k_trigger_seq(struct gameport *gameport, short *seq) in gf2k_trigger_seq() argument
121 gameport_trigger(gameport); in gf2k_trigger_seq()
122 t = gameport_time(gameport, GF2K_TIMEOUT * 1000); in gf2k_trigger_seq()
123 while ((gameport_read(gameport) & 1) && t) t--; in gf2k_trigger_seq()
127 gameport_trigger(gameport); in gf2k_trigger_seq()
186 static void gf2k_poll(struct gameport *gameport) in gf2k_poll() argument
188 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_poll()
193 if (gf2k_read_packet(gf2k->gameport, gf2k_length[gf2k->id], data) < gf2k_length[gf2k->id]) in gf2k_poll()
203 gameport_start_polling(gf2k->gameport); in gf2k_open()
211 gameport_stop_polling(gf2k->gameport); in gf2k_close()
218 static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv) in gf2k_connect() argument
232 gf2k->gameport = gameport; in gf2k_connect()
235 gameport_set_drvdata(gameport, gf2k); in gf2k_connect()
237 err = gameport_open(gameport, drv, GAMEPORT_MODE_RAW); in gf2k_connect()
241 gf2k_trigger_seq(gameport, gf2k_seq_reset); in gf2k_connect()
245 gf2k_trigger_seq(gameport, gf2k_seq_digital); in gf2k_connect()
249 if (gf2k_read_packet(gameport, GF2K_LENGTH, data) < 12) { in gf2k_connect()
271 gameport->phys, gf2k->id, gf2k->id > GF2K_ID_MAX ? "Unknown" : gf2k_names[gf2k->id]); in gf2k_connect()
276 gameport_set_poll_handler(gameport, gf2k_poll); in gf2k_connect()
277 gameport_set_poll_interval(gameport, 20); in gf2k_connect()
279 snprintf(gf2k->phys, sizeof(gf2k->phys), "%s/input0", gameport->phys); in gf2k_connect()
289 input_dev->dev.parent = &gameport->dev; in gf2k_connect()
310 gf2k_read_packet(gameport, gf2k->length, data); in gf2k_connect()
330 fail2: gameport_close(gameport); in gf2k_connect()
331 fail1: gameport_set_drvdata(gameport, NULL); in gf2k_connect()
337 static void gf2k_disconnect(struct gameport *gameport) in gf2k_disconnect() argument
339 struct gf2k *gf2k = gameport_get_drvdata(gameport); in gf2k_disconnect()
342 gameport_close(gameport); in gf2k_disconnect()
343 gameport_set_drvdata(gameport, NULL); in gf2k_disconnect()