turbografx.c (5a84d159061d914c8dd4aa372ac6e9529c2be453) turbografx.c (8715c1cfadf8cce24e79d254f95bd4a84c7741f0)
1/*
2 * $Id: turbografx.c,v 1.14 2002/01/22 20:30:39 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik
5 *
6 * Based on the work of:
7 * Steffen Schwenke
8 */

--- 108 unchanged lines hidden (view full) ---

117 input_sync(dev);
118 }
119
120 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
121}
122
123static int tgfx_open(struct input_dev *dev)
124{
1/*
2 * $Id: turbografx.c,v 1.14 2002/01/22 20:30:39 vojtech Exp $
3 *
4 * Copyright (c) 1998-2001 Vojtech Pavlik
5 *
6 * Based on the work of:
7 * Steffen Schwenke
8 */

--- 108 unchanged lines hidden (view full) ---

117 input_sync(dev);
118 }
119
120 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
121}
122
123static int tgfx_open(struct input_dev *dev)
124{
125 struct tgfx *tgfx = dev->private;
125 struct tgfx *tgfx = input_get_drvdata(dev);
126 int err;
127
128 err = mutex_lock_interruptible(&tgfx->sem);
129 if (err)
130 return err;
131
132 if (!tgfx->used++) {
133 parport_claim(tgfx->pd);
134 parport_write_control(tgfx->pd->port, 0x04);
135 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
136 }
137
138 mutex_unlock(&tgfx->sem);
139 return 0;
140}
141
142static void tgfx_close(struct input_dev *dev)
143{
126 int err;
127
128 err = mutex_lock_interruptible(&tgfx->sem);
129 if (err)
130 return err;
131
132 if (!tgfx->used++) {
133 parport_claim(tgfx->pd);
134 parport_write_control(tgfx->pd->port, 0x04);
135 mod_timer(&tgfx->timer, jiffies + TGFX_REFRESH_TIME);
136 }
137
138 mutex_unlock(&tgfx->sem);
139 return 0;
140}
141
142static void tgfx_close(struct input_dev *dev)
143{
144 struct tgfx *tgfx = dev->private;
144 struct tgfx *tgfx = input_get_drvdata(dev);
145
146 mutex_lock(&tgfx->sem);
147 if (!--tgfx->used) {
148 del_timer_sync(&tgfx->timer);
149 parport_write_control(tgfx->pd->port, 0x00);
150 parport_release(tgfx->pd);
151 }
152 mutex_unlock(&tgfx->sem);

--- 66 unchanged lines hidden (view full) ---

219
220 input_dev->name = tgfx->name[i];
221 input_dev->phys = tgfx->phys[i];
222 input_dev->id.bustype = BUS_PARPORT;
223 input_dev->id.vendor = 0x0003;
224 input_dev->id.product = n_buttons[i];
225 input_dev->id.version = 0x0100;
226
145
146 mutex_lock(&tgfx->sem);
147 if (!--tgfx->used) {
148 del_timer_sync(&tgfx->timer);
149 parport_write_control(tgfx->pd->port, 0x00);
150 parport_release(tgfx->pd);
151 }
152 mutex_unlock(&tgfx->sem);

--- 66 unchanged lines hidden (view full) ---

219
220 input_dev->name = tgfx->name[i];
221 input_dev->phys = tgfx->phys[i];
222 input_dev->id.bustype = BUS_PARPORT;
223 input_dev->id.vendor = 0x0003;
224 input_dev->id.product = n_buttons[i];
225 input_dev->id.version = 0x0100;
226
227 input_dev->private = tgfx;
227 input_set_drvdata(input_dev, tgfx);
228
228 input_dev->open = tgfx_open;
229 input_dev->close = tgfx_close;
230
231 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
232 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0);
233 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0);
234
235 for (j = 0; j < n_buttons[i]; j++)

--- 88 unchanged lines hidden ---
229 input_dev->open = tgfx_open;
230 input_dev->close = tgfx_close;
231
232 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
233 input_set_abs_params(input_dev, ABS_X, -1, 1, 0, 0);
234 input_set_abs_params(input_dev, ABS_Y, -1, 1, 0, 0);
235
236 for (j = 0; j < n_buttons[i]; j++)

--- 88 unchanged lines hidden ---