Lines Matching refs:pxrc

23 struct pxrc {  struct
34 struct pxrc *pxrc = urb->context; in pxrc_usb_irq() argument
44 dev_dbg(&pxrc->intf->dev, in pxrc_usb_irq()
53 dev_dbg(&pxrc->intf->dev, "%s - urb shutting down with status: %d\n", in pxrc_usb_irq()
57 dev_dbg(&pxrc->intf->dev, "%s - nonzero urb status received: %d\n", in pxrc_usb_irq()
63 input_report_abs(pxrc->input, ABS_X, data[0]); in pxrc_usb_irq()
64 input_report_abs(pxrc->input, ABS_Y, data[2]); in pxrc_usb_irq()
65 input_report_abs(pxrc->input, ABS_RX, data[3]); in pxrc_usb_irq()
66 input_report_abs(pxrc->input, ABS_RY, data[4]); in pxrc_usb_irq()
67 input_report_abs(pxrc->input, ABS_RUDDER, data[5]); in pxrc_usb_irq()
68 input_report_abs(pxrc->input, ABS_THROTTLE, data[6]); in pxrc_usb_irq()
69 input_report_abs(pxrc->input, ABS_MISC, data[7]); in pxrc_usb_irq()
71 input_report_key(pxrc->input, BTN_A, data[1]); in pxrc_usb_irq()
78 dev_err(&pxrc->intf->dev, in pxrc_usb_irq()
85 struct pxrc *pxrc = input_get_drvdata(input); in pxrc_open() local
88 guard(mutex)(&pxrc->pm_mutex); in pxrc_open()
89 error = usb_submit_urb(pxrc->urb, GFP_KERNEL); in pxrc_open()
91 dev_err(&pxrc->intf->dev, in pxrc_open()
97 pxrc->is_open = true; in pxrc_open()
103 struct pxrc *pxrc = input_get_drvdata(input); in pxrc_close() local
105 guard(mutex)(&pxrc->pm_mutex); in pxrc_close()
106 usb_kill_urb(pxrc->urb); in pxrc_close()
107 pxrc->is_open = false; in pxrc_close()
112 struct pxrc *pxrc = _pxrc; in pxrc_free_urb() local
114 usb_free_urb(pxrc->urb); in pxrc_free_urb()
121 struct pxrc *pxrc; in pxrc_probe() local
138 pxrc = devm_kzalloc(&intf->dev, sizeof(*pxrc), GFP_KERNEL); in pxrc_probe()
139 if (!pxrc) in pxrc_probe()
142 mutex_init(&pxrc->pm_mutex); in pxrc_probe()
143 pxrc->intf = intf; in pxrc_probe()
145 usb_set_intfdata(pxrc->intf, pxrc); in pxrc_probe()
152 pxrc->urb = usb_alloc_urb(0, GFP_KERNEL); in pxrc_probe()
153 if (!pxrc->urb) in pxrc_probe()
156 error = devm_add_action_or_reset(&intf->dev, pxrc_free_urb, pxrc); in pxrc_probe()
160 usb_fill_int_urb(pxrc->urb, udev, in pxrc_probe()
162 xfer_buf, xfer_size, pxrc_usb_irq, pxrc, 1); in pxrc_probe()
164 pxrc->input = devm_input_allocate_device(&intf->dev); in pxrc_probe()
165 if (!pxrc->input) { in pxrc_probe()
170 pxrc->input->name = "PXRC Flight Controller Adapter"; in pxrc_probe()
172 usb_make_path(udev, pxrc->phys, sizeof(pxrc->phys)); in pxrc_probe()
173 strlcat(pxrc->phys, "/input0", sizeof(pxrc->phys)); in pxrc_probe()
174 pxrc->input->phys = pxrc->phys; in pxrc_probe()
176 usb_to_input_id(udev, &pxrc->input->id); in pxrc_probe()
178 pxrc->input->open = pxrc_open; in pxrc_probe()
179 pxrc->input->close = pxrc_close; in pxrc_probe()
181 input_set_capability(pxrc->input, EV_KEY, BTN_A); in pxrc_probe()
182 input_set_abs_params(pxrc->input, ABS_X, 0, 255, 0, 0); in pxrc_probe()
183 input_set_abs_params(pxrc->input, ABS_Y, 0, 255, 0, 0); in pxrc_probe()
184 input_set_abs_params(pxrc->input, ABS_RX, 0, 255, 0, 0); in pxrc_probe()
185 input_set_abs_params(pxrc->input, ABS_RY, 0, 255, 0, 0); in pxrc_probe()
186 input_set_abs_params(pxrc->input, ABS_RUDDER, 0, 255, 0, 0); in pxrc_probe()
187 input_set_abs_params(pxrc->input, ABS_THROTTLE, 0, 255, 0, 0); in pxrc_probe()
188 input_set_abs_params(pxrc->input, ABS_MISC, 0, 255, 0, 0); in pxrc_probe()
190 input_set_drvdata(pxrc->input, pxrc); in pxrc_probe()
192 error = input_register_device(pxrc->input); in pxrc_probe()
206 struct pxrc *pxrc = usb_get_intfdata(intf); in pxrc_suspend() local
208 guard(mutex)(&pxrc->pm_mutex); in pxrc_suspend()
209 if (pxrc->is_open) in pxrc_suspend()
210 usb_kill_urb(pxrc->urb); in pxrc_suspend()
217 struct pxrc *pxrc = usb_get_intfdata(intf); in pxrc_resume() local
219 guard(mutex)(&pxrc->pm_mutex); in pxrc_resume()
220 if (pxrc->is_open && usb_submit_urb(pxrc->urb, GFP_KERNEL) < 0) in pxrc_resume()
228 struct pxrc *pxrc = usb_get_intfdata(intf); in pxrc_pre_reset() local
230 mutex_lock(&pxrc->pm_mutex); in pxrc_pre_reset()
231 usb_kill_urb(pxrc->urb); in pxrc_pre_reset()
237 struct pxrc *pxrc = usb_get_intfdata(intf); in pxrc_post_reset() local
240 if (pxrc->is_open && usb_submit_urb(pxrc->urb, GFP_KERNEL) < 0) in pxrc_post_reset()
243 mutex_unlock(&pxrc->pm_mutex); in pxrc_post_reset()