Lines Matching refs: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);
149 struct streamzap_ir *sz;
156 sz = urb->context;
165 * sz might already be invalid at this point
167 dev_err(sz->dev, "urb terminated, status: %d\n", urb->status);
173 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len);
175 dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n",
176 i, (unsigned char)sz->buf_in[i]);
177 switch (sz->decoder_state) {
179 if ((sz->buf_in[i] & SZ_PULSE_MASK) ==
181 sz->decoder_state = FullPulse;
183 } else if ((sz->buf_in[i] & SZ_SPACE_MASK)
185 sz_push_half_pulse(sz, sz->buf_in[i]);
186 sz->decoder_state = FullSpace;
189 sz_push_half_pulse(sz, sz->buf_in[i]);
190 sz_push_half_space(sz, sz->buf_in[i]);
194 sz_push_full_pulse(sz, sz->buf_in[i]);
195 sz->decoder_state = IgnorePulse;
198 if (sz->buf_in[i] == SZ_TIMEOUT) {
201 .duration = sz->rdev->timeout
203 sz_push(sz, rawir);
205 sz_push_full_space(sz, sz->buf_in[i]);
207 sz->decoder_state = PulseSpace;
210 if ((sz->buf_in[i] & SZ_SPACE_MASK) ==
212 sz->decoder_state = FullSpace;
215 sz_push_half_space(sz, sz->buf_in[i]);
216 sz->decoder_state = PulseSpace;
221 ir_raw_event_handle(sz->rdev);
225 static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz,
229 struct device *dev = sz->dev;
236 usb_make_path(usbdev, sz->phys, sizeof(sz->phys));
237 strlcat(sz->phys, "/input0", sizeof(sz->phys));
240 rdev->input_phys = sz->phys;
243 rdev->priv = sz;
275 struct streamzap_ir *sz = NULL;
280 sz = kzalloc(sizeof(struct streamzap_ir), GFP_KERNEL);
281 if (!sz)
320 sz->buf_in = usb_alloc_coherent(usbdev, maxp, GFP_ATOMIC, &sz->dma_in);
321 if (!sz->buf_in)
324 sz->urb_in = usb_alloc_urb(0, GFP_KERNEL);
325 if (!sz->urb_in)
328 sz->dev = &intf->dev;
329 sz->buf_in_len = maxp;
331 sz->rdev = streamzap_init_rc_dev(sz, usbdev);
332 if (!sz->rdev)
335 sz->decoder_state = PulseSpace;
337 sz->rdev->timeout = SZ_TIMEOUT * SZ_RESOLUTION;
341 sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
342 sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
346 usb_fill_int_urb(sz->urb_in, usbdev, pipe, sz->buf_in,
347 maxp, streamzap_callback, sz, endpoint->bInterval);
348 sz->urb_in->transfer_dma = sz->dma_in;
349 sz->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
351 usb_set_intfdata(intf, sz);
353 if (usb_submit_urb(sz->urb_in, GFP_ATOMIC))
354 dev_err(sz->dev, "urb submit failed\n");
359 usb_free_urb(sz->urb_in);
361 usb_free_coherent(usbdev, maxp, sz->buf_in, sz->dma_in);
363 kfree(sz);
380 struct streamzap_ir *sz = usb_get_intfdata(interface);
385 if (!sz)
388 rc_unregister_device(sz->rdev);
389 usb_kill_urb(sz->urb_in);
390 usb_free_urb(sz->urb_in);
391 usb_free_coherent(usbdev, sz->buf_in_len, sz->buf_in, sz->dma_in);
393 kfree(sz);
398 struct streamzap_ir *sz = usb_get_intfdata(intf);
400 usb_kill_urb(sz->urb_in);
407 struct streamzap_ir *sz = usb_get_intfdata(intf);
409 if (usb_submit_urb(sz->urb_in, GFP_NOIO)) {
410 dev_err(sz->dev, "Error submitting urb\n");