Lines Matching defs:sz
100 static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir)
102 dev_dbg(sz->dev, "Storing %s with duration %u us\n",
104 ir_raw_event_store_with_filter(sz->rdev, &rawir);
107 static void sz_push_full_pulse(struct streamzap_ir *sz,
115 sz_push(sz, rawir);
118 static void sz_push_half_pulse(struct streamzap_ir *sz,
121 sz_push_full_pulse(sz, (value & SZ_PULSE_MASK) >> 4);
124 static void sz_push_full_space(struct streamzap_ir *sz,
132 sz_push(sz, rawir);
135 static void sz_push_half_space(struct streamzap_ir *sz,
138 sz_push_full_space(sz, value & SZ_SPACE_MASK);
141 static void sz_process_ir_data(struct streamzap_ir *sz, int len)
146 dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n",
147 i, (unsigned char)sz->buf_in[i]);
148 switch (sz->decoder_state) {
150 if ((sz->buf_in[i] & SZ_PULSE_MASK) ==
152 sz->decoder_state = FullPulse;
154 } else if ((sz->buf_in[i] & SZ_SPACE_MASK)
156 sz_push_half_pulse(sz, sz->buf_in[i]);
157 sz->decoder_state = FullSpace;
160 sz_push_half_pulse(sz, sz->buf_in[i]);
161 sz_push_half_space(sz, sz->buf_in[i]);
165 sz_push_full_pulse(sz, sz->buf_in[i]);
166 sz->decoder_state = IgnorePulse;
169 if (sz->buf_in[i] == SZ_TIMEOUT) {
172 .duration = sz->rdev->timeout
174 sz_push(sz, rawir);
176 sz_push_full_space(sz, sz->buf_in[i]);
178 sz->decoder_state = PulseSpace;
181 if ((sz->buf_in[i] & SZ_SPACE_MASK) ==
183 sz->decoder_state = FullSpace;
186 sz_push_half_space(sz, sz->buf_in[i]);
187 sz->decoder_state = PulseSpace;
192 ir_raw_event_handle(sz->rdev);
203 struct streamzap_ir *sz;
209 sz = urb->context;
214 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len);
215 sz_process_ir_data(sz, len);
222 * sz might already be invalid at this point
224 dev_err(sz->dev, "urb terminated, status: %d\n", urb->status);
233 static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz,
237 struct device *dev = sz->dev;
244 usb_make_path(usbdev, sz->phys, sizeof(sz->phys));
245 strlcat(sz->phys, "/input0", sizeof(sz->phys));
248 rdev->input_phys = sz->phys;
251 rdev->priv = sz;
283 struct streamzap_ir *sz = NULL;
288 sz = kzalloc(sizeof(struct streamzap_ir), GFP_KERNEL);
289 if (!sz)
328 sz->buf_in = usb_alloc_coherent(usbdev, maxp, GFP_ATOMIC, &sz->dma_in);
329 if (!sz->buf_in)
332 sz->urb_in = usb_alloc_urb(0, GFP_KERNEL);
333 if (!sz->urb_in)
336 sz->dev = &intf->dev;
337 sz->buf_in_len = maxp;
339 sz->rdev = streamzap_init_rc_dev(sz, usbdev);
340 if (!sz->rdev)
343 sz->decoder_state = PulseSpace;
345 sz->rdev->timeout = SZ_TIMEOUT * SZ_RESOLUTION;
349 sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
350 sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
354 usb_fill_int_urb(sz->urb_in, usbdev, pipe, sz->buf_in,
355 maxp, streamzap_callback, sz, endpoint->bInterval);
356 sz->urb_in->transfer_dma = sz->dma_in;
357 sz->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
359 usb_set_intfdata(intf, sz);
361 if (usb_submit_urb(sz->urb_in, GFP_ATOMIC))
362 dev_err(sz->dev, "urb submit failed\n");
367 usb_free_urb(sz->urb_in);
369 usb_free_coherent(usbdev, maxp, sz->buf_in, sz->dma_in);
371 kfree(sz);
388 struct streamzap_ir *sz = usb_get_intfdata(interface);
393 if (!sz)
396 usb_kill_urb(sz->urb_in);
397 rc_unregister_device(sz->rdev);
398 usb_free_urb(sz->urb_in);
399 usb_free_coherent(usbdev, sz->buf_in_len, sz->buf_in, sz->dma_in);
401 kfree(sz);
406 struct streamzap_ir *sz = usb_get_intfdata(intf);
408 usb_kill_urb(sz->urb_in);
415 struct streamzap_ir *sz = usb_get_intfdata(intf);
417 if (usb_submit_urb(sz->urb_in, GFP_NOIO)) {
418 dev_err(sz->dev, "Error submitting urb\n");