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.
29 guard(spinlock_irqsave)(&iforce->xmit_lock); in __iforce_usb_xmit()
31 if (iforce->xmit.head == iforce->xmit.tail) { in __iforce_usb_xmit()
36 ((char *)iforce_usb->out->transfer_buffer)[0] = iforce->xmit.buf[iforce->xmit.tail]; in __iforce_usb_xmit()
37 XMIT_INC(iforce->xmit.tail, 1); in __iforce_usb_xmit()
38 n = iforce->xmit.buf[iforce->xmit.tail]; in __iforce_usb_xmit()
39 XMIT_INC(iforce->xmit.tail, 1); in __iforce_usb_xmit()
41 iforce_usb->out->transfer_buffer_length = n + 1; in __iforce_usb_xmit()
42 iforce_usb->out->dev = iforce_usb->usbdev; in __iforce_usb_xmit()
45 c = CIRC_CNT_TO_END(iforce->xmit.head, iforce->xmit.tail, XMIT_SIZE); in __iforce_usb_xmit()
49 memcpy(iforce_usb->out->transfer_buffer + 1, in __iforce_usb_xmit()
50 &iforce->xmit.buf[iforce->xmit.tail], in __iforce_usb_xmit()
53 memcpy(iforce_usb->out->transfer_buffer + 1 + c, in __iforce_usb_xmit()
54 &iforce->xmit.buf[0], in __iforce_usb_xmit()
55 n - c); in __iforce_usb_xmit()
57 XMIT_INC(iforce->xmit.tail, n); in __iforce_usb_xmit()
59 n=usb_submit_urb(iforce_usb->out, GFP_ATOMIC); in __iforce_usb_xmit()
61 dev_warn(&iforce_usb->intf->dev, in __iforce_usb_xmit()
73 if (!test_and_set_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags)) in iforce_usb_xmit()
87 return -ENOMEM; in iforce_usb_get_id()
89 status = usb_control_msg(iforce_usb->usbdev, in iforce_usb_get_id()
90 usb_rcvctrlpipe(iforce_usb->usbdev, 0), in iforce_usb_get_id()
96 dev_err(&iforce_usb->intf->dev, in iforce_usb_get_id()
99 status = -EIO; in iforce_usb_get_id()
115 if (usb_submit_urb(iforce_usb->irq, GFP_KERNEL)) in iforce_usb_start_io()
116 return -EIO; in iforce_usb_start_io()
126 usb_kill_urb(iforce_usb->irq); in iforce_usb_stop_io()
127 usb_kill_urb(iforce_usb->out); in iforce_usb_stop_io()
139 struct iforce_usb *iforce_usb = urb->context; in iforce_usb_irq()
140 struct iforce *iforce = &iforce_usb->iforce; in iforce_usb_irq()
141 struct device *dev = &iforce_usb->intf->dev; in iforce_usb_irq()
144 switch (urb->status) { in iforce_usb_irq()
148 case -ECONNRESET: in iforce_usb_irq()
149 case -ENOENT: in iforce_usb_irq()
150 case -ESHUTDOWN: in iforce_usb_irq()
152 dev_dbg(dev, "%s - urb shutting down with status: %d\n", in iforce_usb_irq()
153 __func__, urb->status); in iforce_usb_irq()
156 dev_dbg(dev, "%s - urb has status of: %d\n", in iforce_usb_irq()
157 __func__, urb->status); in iforce_usb_irq()
161 iforce_process_packet(iforce, iforce_usb->data_in[0], in iforce_usb_irq()
162 iforce_usb->data_in + 1, urb->actual_length - 1); in iforce_usb_irq()
167 dev_err(dev, "%s - usb_submit_urb failed with result %d\n", in iforce_usb_irq()
173 struct iforce_usb *iforce_usb = urb->context; in iforce_usb_out()
174 struct iforce *iforce = &iforce_usb->iforce; in iforce_usb_out()
176 if (urb->status) { in iforce_usb_out()
177 dev_dbg(&iforce_usb->intf->dev, "urb->status %d, exiting\n", in iforce_usb_out()
178 urb->status); in iforce_usb_out()
185 wake_up_all(&iforce->wait); in iforce_usb_out()
195 int err = -ENOMEM; in iforce_usb_probe()
197 interface = intf->cur_altsetting; in iforce_usb_probe()
199 if (interface->desc.bNumEndpoints < 2) in iforce_usb_probe()
200 return -ENODEV; in iforce_usb_probe()
202 epirq = &interface->endpoint[0].desc; in iforce_usb_probe()
204 return -ENODEV; in iforce_usb_probe()
206 epout = &interface->endpoint[1].desc; in iforce_usb_probe()
208 return -ENODEV; in iforce_usb_probe()
214 iforce_usb->irq = usb_alloc_urb(0, GFP_KERNEL); in iforce_usb_probe()
215 if (!iforce_usb->irq) in iforce_usb_probe()
218 iforce_usb->out = usb_alloc_urb(0, GFP_KERNEL); in iforce_usb_probe()
219 if (!iforce_usb->out) in iforce_usb_probe()
222 iforce_usb->iforce.xport_ops = &iforce_usb_xport_ops; in iforce_usb_probe()
224 iforce_usb->usbdev = dev; in iforce_usb_probe()
225 iforce_usb->intf = intf; in iforce_usb_probe()
227 usb_fill_int_urb(iforce_usb->irq, dev, in iforce_usb_probe()
228 usb_rcvintpipe(dev, epirq->bEndpointAddress), in iforce_usb_probe()
229 iforce_usb->data_in, sizeof(iforce_usb->data_in), in iforce_usb_probe()
230 iforce_usb_irq, iforce_usb, epirq->bInterval); in iforce_usb_probe()
232 usb_fill_int_urb(iforce_usb->out, dev, in iforce_usb_probe()
233 usb_sndintpipe(dev, epout->bEndpointAddress), in iforce_usb_probe()
234 iforce_usb->data_out, sizeof(iforce_usb->data_out), in iforce_usb_probe()
235 iforce_usb_out, iforce_usb, epout->bInterval); in iforce_usb_probe()
237 err = iforce_init_device(&intf->dev, BUS_USB, &iforce_usb->iforce); in iforce_usb_probe()
246 usb_free_urb(iforce_usb->irq); in iforce_usb_probe()
247 usb_free_urb(iforce_usb->out); in iforce_usb_probe()
260 input_unregister_device(iforce_usb->iforce.dev); in iforce_usb_disconnect()
262 usb_free_urb(iforce_usb->irq); in iforce_usb_disconnect()
263 usb_free_urb(iforce_usb->out); in iforce_usb_disconnect()
269 { USB_DEVICE(0x044f, 0xa01c) }, /* Thrustmaster Motor Sport GT */
297 MODULE_DESCRIPTION("USB I-Force joysticks and wheels driver");