Lines Matching +full:motor +full:- +full:driver

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
4 * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
6 * USB/RS232 I-Force joysticks and wheels.
13 MODULE_DESCRIPTION("Core I-Force joysticks and wheels driver");
19 BTN_B, BTN_C, BTN_DEAD, -1 };
23 BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_DEAD, -1 };
27 BTN_BASE4, BTN_BASE5, BTN_BASE6, -1 };
30 { ABS_X, ABS_Y, ABS_THROTTLE, ABS_HAT0X, ABS_HAT0Y, -1 };
33 { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER, ABS_HAT0X, ABS_HAT0Y, -1 };
37 ABS_HAT1X, ABS_HAT1Y, -1 };
40 { ABS_WHEEL, ABS_GAS, ABS_BRAKE, ABS_HAT0X, ABS_HAT0Y, -1 };
45 FF_AUTOCENTER, -1 };
48 { 0x044f, 0xa01c, "Thrustmaster Motor Sport GT", btn_wheel, abs_wheel, ff_iforce },
63 { 0x0000, 0x0000, "Unknown I-Force Device [%04x:%04x]", btn_joystick, abs_joystick, ff_iforce }
69 struct iforce_core_effect *core_effect = &iforce->core_effects[effect_id]; in iforce_playback()
72 set_bit(FF_CORE_SHOULD_PLAY, core_effect->flags); in iforce_playback()
74 clear_bit(FF_CORE_SHOULD_PLAY, core_effect->flags); in iforce_playback()
110 struct iforce_core_effect *core_effect = &iforce->core_effects[effect->id]; in iforce_upload_effect()
113 if (__test_and_set_bit(FF_CORE_IS_USED, core_effect->flags)) { in iforce_upload_effect()
115 if (test_bit(FF_CORE_UPDATE, core_effect->flags)) in iforce_upload_effect()
116 return -EAGAIN; in iforce_upload_effect()
122 switch (effect->type) { in iforce_upload_effect()
137 return -EINVAL; in iforce_upload_effect()
144 set_bit(FF_CORE_UPDATE, core_effect->flags); in iforce_upload_effect()
156 struct iforce_core_effect *core_effect = &iforce->core_effects[effect_id]; in iforce_erase_effect()
159 if (test_bit(FF_MOD1_IS_USED, core_effect->flags)) in iforce_erase_effect()
160 err = release_resource(&core_effect->mod1_chunk); in iforce_erase_effect()
162 if (!err && test_bit(FF_MOD2_IS_USED, core_effect->flags)) in iforce_erase_effect()
163 err = release_resource(&core_effect->mod2_chunk); in iforce_erase_effect()
166 core_effect->flags[0] = 0; in iforce_erase_effect()
175 iforce->xport_ops->start_io(iforce); in iforce_open()
177 if (test_bit(EV_FF, dev->evbit)) { in iforce_open()
190 if (test_bit(EV_FF, dev->evbit)) { in iforce_close()
192 for (i = 0; i < dev->ff->max_effects; i++) { in iforce_close()
193 if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { in iforce_close()
194 dev_warn(&dev->dev, in iforce_close()
204 wait_event_interruptible(iforce->wait, in iforce_close()
205 !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)); in iforce_close()
208 iforce->xport_ops->stop_io(iforce); in iforce_close()
224 return -ENOMEM; in iforce_init_device()
226 init_waitqueue_head(&iforce->wait); in iforce_init_device()
227 spin_lock_init(&iforce->xmit_lock); in iforce_init_device()
228 mutex_init(&iforce->mem_mutex); in iforce_init_device()
229 iforce->xmit.buf = iforce->xmit_data; in iforce_init_device()
230 iforce->dev = input_dev; in iforce_init_device()
236 input_dev->id.bustype = bustype; in iforce_init_device()
237 input_dev->dev.parent = parent; in iforce_init_device()
241 input_dev->name = "Unknown I-Force device"; in iforce_init_device()
242 input_dev->open = iforce_open; in iforce_init_device()
243 input_dev->close = iforce_close; in iforce_init_device()
246 * On-device memory allocation. in iforce_init_device()
249 iforce->device_memory.name = "I-Force device effect memory"; in iforce_init_device()
250 iforce->device_memory.start = 0; in iforce_init_device()
251 iforce->device_memory.end = 200; in iforce_init_device()
252 iforce->device_memory.flags = IORESOURCE_MEM; in iforce_init_device()
253 iforce->device_memory.parent = NULL; in iforce_init_device()
254 iforce->device_memory.child = NULL; in iforce_init_device()
255 iforce->device_memory.sibling = NULL; in iforce_init_device()
258 * Wait until device ready - until it sends its first response. in iforce_init_device()
266 dev_err(&input_dev->dev, in iforce_init_device()
268 error = -ENODEV; in iforce_init_device()
277 input_dev->id.vendor = get_unaligned_le16(buf + 1); in iforce_init_device()
279 dev_warn(&iforce->dev->dev, "Device does not respond to id packet M\n"); in iforce_init_device()
282 input_dev->id.product = get_unaligned_le16(buf + 1); in iforce_init_device()
284 dev_warn(&iforce->dev->dev, "Device does not respond to id packet P\n"); in iforce_init_device()
287 iforce->device_memory.end = get_unaligned_le16(buf + 1); in iforce_init_device()
289 dev_warn(&iforce->dev->dev, "Device does not respond to id packet B\n"); in iforce_init_device()
294 dev_warn(&iforce->dev->dev, "Device does not respond to id packet N\n"); in iforce_init_device()
296 /* Check if the device can store more effects than the driver can really handle */ in iforce_init_device()
298 dev_warn(&iforce->dev->dev, "Limiting number of effects to %d (device reports %d)\n", in iforce_init_device()
322 if (iforce_device[i].idvendor == input_dev->id.vendor && in iforce_init_device()
323 iforce_device[i].idproduct == input_dev->id.product) in iforce_init_device()
326 iforce->type = iforce_device + i; in iforce_init_device()
327 input_dev->name = iforce->type->name; in iforce_init_device()
333 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | in iforce_init_device()
336 for (i = 0; iforce->type->btn[i] >= 0; i++) in iforce_init_device()
337 set_bit(iforce->type->btn[i], input_dev->keybit); in iforce_init_device()
339 for (i = 0; iforce->type->abs[i] >= 0; i++) { in iforce_init_device()
341 signed short t = iforce->type->abs[i]; in iforce_init_device()
347 input_set_abs_params(input_dev, t, -1920, 1920, 16, 128); in iforce_init_device()
348 set_bit(t, input_dev->ffbit); in iforce_init_device()
358 input_set_abs_params(input_dev, t, -128, 127, 0, 0); in iforce_init_device()
365 input_set_abs_params(input_dev, t, -1, 1, 0, 0); in iforce_init_device()
372 for (i = 0; iforce->type->ff[i] >= 0; i++) in iforce_init_device()
373 set_bit(iforce->type->ff[i], input_dev->ffbit); in iforce_init_device()
379 ff = input_dev->ff; in iforce_init_device()
380 ff->upload = iforce_upload_effect; in iforce_init_device()
381 ff->erase = iforce_erase_effect; in iforce_init_device()
382 ff->set_gain = iforce_set_gain; in iforce_init_device()
383 ff->set_autocenter = iforce_set_autocenter; in iforce_init_device()
384 ff->playback = iforce_playback; in iforce_init_device()
390 error = input_register_device(iforce->dev); in iforce_init_device()