Lines Matching refs:tgfx

57 static struct tgfx {  struct
75 struct tgfx *tgfx = timer_container_of(tgfx, t, timer); in tgfx_timer() argument
80 if (tgfx->sticks & (1 << i)) { in tgfx_timer()
82 dev = tgfx->dev[i]; in tgfx_timer()
84 parport_write_data(tgfx->pd->port, ~(1 << i)); in tgfx_timer()
85 data1 = parport_read_status(tgfx->pd->port) ^ 0x7f; in tgfx_timer()
86 data2 = parport_read_control(tgfx->pd->port) ^ 0x04; /* CAVEAT parport */ in tgfx_timer()
100 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); in tgfx_timer()
105 struct tgfx *tgfx = input_get_drvdata(dev); in tgfx_open() local
107 scoped_guard(mutex_intr, &tgfx->sem) { in tgfx_open()
108 if (!tgfx->used++) { in tgfx_open()
109 parport_claim(tgfx->pd); in tgfx_open()
110 parport_write_control(tgfx->pd->port, 0x04); in tgfx_open()
111 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); in tgfx_open()
122 struct tgfx *tgfx = input_get_drvdata(dev); in tgfx_close() local
124 guard(mutex)(&tgfx->sem); in tgfx_close()
126 if (!--tgfx->used) { in tgfx_close()
127 timer_delete_sync(&tgfx->timer); in tgfx_close()
128 parport_write_control(tgfx->pd->port, 0x00); in tgfx_close()
129 parport_release(tgfx->pd); in tgfx_close()
141 struct tgfx *tgfx; in tgfx_attach() local
173 tgfx = kzalloc(sizeof(*tgfx), GFP_KERNEL); in tgfx_attach()
174 if (!tgfx) { in tgfx_attach()
179 mutex_init(&tgfx->sem); in tgfx_attach()
180 tgfx->pd = pd; in tgfx_attach()
181 tgfx->parportno = pp->number; in tgfx_attach()
182 timer_setup(&tgfx->timer, tgfx_timer, 0); in tgfx_attach()
193 tgfx->dev[i] = input_dev = input_allocate_device(); in tgfx_attach()
199 tgfx->sticks |= (1 << i); in tgfx_attach()
200 snprintf(tgfx->name[i], sizeof(tgfx->name[i]), in tgfx_attach()
202 snprintf(tgfx->phys[i], sizeof(tgfx->phys[i]), in tgfx_attach()
203 "%s/input%d", tgfx->pd->port->name, i); in tgfx_attach()
205 input_dev->name = tgfx->name[i]; in tgfx_attach()
206 input_dev->phys = tgfx->phys[i]; in tgfx_attach()
212 input_set_drvdata(input_dev, tgfx); in tgfx_attach()
224 if (input_register_device(tgfx->dev[i])) in tgfx_attach()
228 if (!tgfx->sticks) { in tgfx_attach()
233 tgfx_base[port_idx] = tgfx; in tgfx_attach()
237 input_free_device(tgfx->dev[i]); in tgfx_attach()
240 if (tgfx->dev[i]) in tgfx_attach()
241 input_unregister_device(tgfx->dev[i]); in tgfx_attach()
243 kfree(tgfx); in tgfx_attach()
251 struct tgfx *tgfx; in tgfx_detach() local
261 tgfx = tgfx_base[i]; in tgfx_detach()
265 if (tgfx->dev[i]) in tgfx_detach()
266 input_unregister_device(tgfx->dev[i]); in tgfx_detach()
267 parport_unregister_device(tgfx->pd); in tgfx_detach()
268 kfree(tgfx); in tgfx_detach()