Lines Matching refs:tgfx

57 static struct tgfx {  struct
75 struct tgfx *tgfx = from_timer(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
108 err = mutex_lock_interruptible(&tgfx->sem); in tgfx_open()
112 if (!tgfx->used++) { in tgfx_open()
113 parport_claim(tgfx->pd); in tgfx_open()
114 parport_write_control(tgfx->pd->port, 0x04); in tgfx_open()
115 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME); in tgfx_open()
118 mutex_unlock(&tgfx->sem); in tgfx_open()
124 struct tgfx *tgfx = input_get_drvdata(dev); in tgfx_close() local
126 mutex_lock(&tgfx->sem); in tgfx_close()
127 if (!--tgfx->used) { in tgfx_close()
128 del_timer_sync(&tgfx->timer); in tgfx_close()
129 parport_write_control(tgfx->pd->port, 0x00); in tgfx_close()
130 parport_release(tgfx->pd); in tgfx_close()
132 mutex_unlock(&tgfx->sem); in tgfx_close()
143 struct tgfx *tgfx; in tgfx_attach() local
175 tgfx = kzalloc(sizeof(struct tgfx), GFP_KERNEL); in tgfx_attach()
176 if (!tgfx) { in tgfx_attach()
181 mutex_init(&tgfx->sem); in tgfx_attach()
182 tgfx->pd = pd; in tgfx_attach()
183 tgfx->parportno = pp->number; in tgfx_attach()
184 timer_setup(&tgfx->timer, tgfx_timer, 0); in tgfx_attach()
195 tgfx->dev[i] = input_dev = input_allocate_device(); in tgfx_attach()
201 tgfx->sticks |= (1 << i); in tgfx_attach()
202 snprintf(tgfx->name[i], sizeof(tgfx->name[i]), in tgfx_attach()
204 snprintf(tgfx->phys[i], sizeof(tgfx->phys[i]), in tgfx_attach()
205 "%s/input%d", tgfx->pd->port->name, i); in tgfx_attach()
207 input_dev->name = tgfx->name[i]; in tgfx_attach()
208 input_dev->phys = tgfx->phys[i]; in tgfx_attach()
214 input_set_drvdata(input_dev, tgfx); in tgfx_attach()
226 if (input_register_device(tgfx->dev[i])) in tgfx_attach()
230 if (!tgfx->sticks) { in tgfx_attach()
235 tgfx_base[port_idx] = tgfx; in tgfx_attach()
239 input_free_device(tgfx->dev[i]); in tgfx_attach()
242 if (tgfx->dev[i]) in tgfx_attach()
243 input_unregister_device(tgfx->dev[i]); in tgfx_attach()
245 kfree(tgfx); in tgfx_attach()
253 struct tgfx *tgfx; in tgfx_detach() local
263 tgfx = tgfx_base[i]; in tgfx_detach()
267 if (tgfx->dev[i]) in tgfx_detach()
268 input_unregister_device(tgfx->dev[i]); in tgfx_detach()
269 parport_unregister_device(tgfx->pd); in tgfx_detach()
270 kfree(tgfx); in tgfx_detach()