Lines Matching refs:ir

46 static void igorplugusb_cmd(struct igorplugusb *ir, int cmd);
48 static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) in igorplugusb_irdata() argument
53 dev_dbg(ir->dev, "irdata: %*ph (len=%u)", len, ir->buf_in, len); in igorplugusb_irdata()
61 overflow = ir->buf_in[2]; in igorplugusb_irdata()
65 dev_err(ir->dev, "receive overflow invalid: %u", overflow); in igorplugusb_irdata()
68 dev_warn(ir->dev, "receive overflow, at least %u lost", in igorplugusb_irdata()
70 ir_raw_event_overflow(ir->rc); in igorplugusb_irdata()
74 rawir.duration = ir->buf_in[i] * 85; in igorplugusb_irdata()
77 ir_raw_event_store_with_filter(ir->rc, &rawir); in igorplugusb_irdata()
84 rawir.duration = ir->rc->timeout; in igorplugusb_irdata()
86 ir_raw_event_store_with_filter(ir->rc, &rawir); in igorplugusb_irdata()
88 ir_raw_event_handle(ir->rc); in igorplugusb_irdata()
91 igorplugusb_cmd(ir, SET_INFRABUFFER_EMPTY); in igorplugusb_irdata()
97 struct igorplugusb *ir = urb->context; in igorplugusb_callback() local
105 igorplugusb_irdata(ir, urb->actual_length); in igorplugusb_callback()
107 mod_timer(&ir->timer, jiffies + msecs_to_jiffies(50)); in igorplugusb_callback()
115 dev_warn(ir->dev, "Error: urb status = %d\n", urb->status); in igorplugusb_callback()
116 igorplugusb_cmd(ir, SET_INFRABUFFER_EMPTY); in igorplugusb_callback()
121 static void igorplugusb_cmd(struct igorplugusb *ir, int cmd) in igorplugusb_cmd() argument
125 ir->request.bRequest = cmd; in igorplugusb_cmd()
126 ir->urb->transfer_flags = 0; in igorplugusb_cmd()
127 ret = usb_submit_urb(ir->urb, GFP_ATOMIC); in igorplugusb_cmd()
129 dev_err(ir->dev, "submit urb failed: %d", ret); in igorplugusb_cmd()
134 struct igorplugusb *ir = from_timer(ir, t, timer); in igorplugusb_timer() local
136 igorplugusb_cmd(ir, GET_INFRACODE); in igorplugusb_timer()
145 struct igorplugusb *ir; in igorplugusb_probe() local
163 ir = devm_kzalloc(&intf->dev, sizeof(*ir), GFP_KERNEL); in igorplugusb_probe()
164 if (!ir) in igorplugusb_probe()
167 ir->dev = &intf->dev; in igorplugusb_probe()
169 timer_setup(&ir->timer, igorplugusb_timer, 0); in igorplugusb_probe()
171 ir->request.bRequest = GET_INFRACODE; in igorplugusb_probe()
172 ir->request.bRequestType = USB_TYPE_VENDOR | USB_DIR_IN; in igorplugusb_probe()
173 ir->request.wLength = cpu_to_le16(MAX_PACKET); in igorplugusb_probe()
175 ir->urb = usb_alloc_urb(0, GFP_KERNEL); in igorplugusb_probe()
176 if (!ir->urb) in igorplugusb_probe()
179 ir->buf_in = kmalloc(MAX_PACKET, GFP_KERNEL); in igorplugusb_probe()
180 if (!ir->buf_in) in igorplugusb_probe()
182 usb_fill_control_urb(ir->urb, udev, in igorplugusb_probe()
183 usb_rcvctrlpipe(udev, 0), (uint8_t *)&ir->request, in igorplugusb_probe()
184 ir->buf_in, MAX_PACKET, igorplugusb_callback, ir); in igorplugusb_probe()
186 usb_make_path(udev, ir->phys, sizeof(ir->phys)); in igorplugusb_probe()
193 rc->input_phys = ir->phys; in igorplugusb_probe()
206 rc->priv = ir; in igorplugusb_probe()
212 ir->rc = rc; in igorplugusb_probe()
219 usb_set_intfdata(intf, ir); in igorplugusb_probe()
221 igorplugusb_cmd(ir, SET_INFRABUFFER_EMPTY); in igorplugusb_probe()
225 usb_poison_urb(ir->urb); in igorplugusb_probe()
226 del_timer(&ir->timer); in igorplugusb_probe()
227 usb_unpoison_urb(ir->urb); in igorplugusb_probe()
228 usb_free_urb(ir->urb); in igorplugusb_probe()
229 rc_free_device(ir->rc); in igorplugusb_probe()
230 kfree(ir->buf_in); in igorplugusb_probe()
237 struct igorplugusb *ir = usb_get_intfdata(intf); in igorplugusb_disconnect() local
239 rc_unregister_device(ir->rc); in igorplugusb_disconnect()
240 usb_poison_urb(ir->urb); in igorplugusb_disconnect()
241 del_timer_sync(&ir->timer); in igorplugusb_disconnect()
243 usb_unpoison_urb(ir->urb); in igorplugusb_disconnect()
244 usb_free_urb(ir->urb); in igorplugusb_disconnect()
245 kfree(ir->buf_in); in igorplugusb_disconnect()