Lines Matching refs:tgfx

60 static struct tgfx {  struct
78 struct tgfx *tgfx = from_timer(tgfx, t, timer); in tgfx_timer() argument
83 if (tgfx->sticks & (1 << i)) { in tgfx_timer()
85 dev = tgfx->dev[i]; in tgfx_timer()
87 parport_write_data(tgfx->pd->port, ~(1 << i)); in tgfx_timer()
88 data1 = parport_read_status(tgfx->pd->port) ^ 0x7f; in tgfx_timer()
89 data2 = parport_read_control(tgfx->pd->port) ^ 0x04; /* CAVEAT parport */ in tgfx_timer()
103 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); in tgfx_timer()
108 struct tgfx *tgfx = input_get_drvdata(dev); in tgfx_open() local
111 err = mutex_lock_interruptible(&tgfx->sem); in tgfx_open()
115 if (!tgfx->used++) { in tgfx_open()
116 parport_claim(tgfx->pd); in tgfx_open()
117 parport_write_control(tgfx->pd->port, 0x04); in tgfx_open()
118 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); in tgfx_open()
121 mutex_unlock(&tgfx->sem); in tgfx_open()
127 struct tgfx *tgfx = input_get_drvdata(dev); in tgfx_close() local
129 mutex_lock(&tgfx->sem); in tgfx_close()
130 if (!--tgfx->used) { in tgfx_close()
131 del_timer_sync(&tgfx->timer); in tgfx_close()
132 parport_write_control(tgfx->pd->port, 0x00); in tgfx_close()
133 parport_release(tgfx->pd); in tgfx_close()
135 mutex_unlock(&tgfx->sem); in tgfx_close()
146 struct tgfx *tgfx; in tgfx_attach() local
178 tgfx = kzalloc(sizeof(struct tgfx), GFP_KERNEL); in tgfx_attach()
179 if (!tgfx) { in tgfx_attach()
184 mutex_init(&tgfx->sem); in tgfx_attach()
185 tgfx->pd = pd; in tgfx_attach()
186 tgfx->parportno = pp->number; in tgfx_attach()
187 timer_setup(&tgfx->timer, tgfx_timer, 0); in tgfx_attach()
198 tgfx->dev[i] = input_dev = input_allocate_device(); in tgfx_attach()
204 tgfx->sticks |= (1 << i); in tgfx_attach()
205 snprintf(tgfx->name[i], sizeof(tgfx->name[i]), in tgfx_attach()
207 snprintf(tgfx->phys[i], sizeof(tgfx->phys[i]), in tgfx_attach()
208 "%s/input%d", tgfx->pd->port->name, i); in tgfx_attach()
210 input_dev->name = tgfx->name[i]; in tgfx_attach()
211 input_dev->phys = tgfx->phys[i]; in tgfx_attach()
217 input_set_drvdata(input_dev, tgfx); in tgfx_attach()
229 if (input_register_device(tgfx->dev[i])) in tgfx_attach()
233 if (!tgfx->sticks) { in tgfx_attach()
238 tgfx_base[port_idx] = tgfx; in tgfx_attach()
242 input_free_device(tgfx->dev[i]); in tgfx_attach()
245 if (tgfx->dev[i]) in tgfx_attach()
246 input_unregister_device(tgfx->dev[i]); in tgfx_attach()
248 kfree(tgfx); in tgfx_attach()
256 struct tgfx *tgfx; in tgfx_detach() local
266 tgfx = tgfx_base[i]; in tgfx_detach()
270 if (tgfx->dev[i]) in tgfx_detach()
271 input_unregister_device(tgfx->dev[i]); in tgfx_detach()
272 parport_unregister_device(tgfx->pd); in tgfx_detach()
273 kfree(tgfx); in tgfx_detach()