Lines Matching defs:raw

2 // rc-ir-raw.c - handle IR pulse/space events
13 /* Used to keep track of IR raw clients, protected by ir_raw_handler_lock */
16 /* Used to handle IR raw handler extensions */
25 struct ir_raw_event_ctrl *raw = data;
26 struct rc_dev *dev = raw->dev;
30 while (kfifo_out(&raw->kfifo, &ev, 1)) {
34 if (is_timing_event(raw->prev_ev) &&
35 !is_transition(&ev, &raw->prev_ev))
44 raw->prev_ev = ev;
53 } else if (!kfifo_is_empty(&raw->kfifo))
63 * ir_raw_event_store() - pass a pulse/space duration to the raw ir decoders
68 * pulse/space duration for the raw ir decoding state machines. Pulses are
74 if (!dev->raw)
80 if (!kfifo_put(&dev->raw->kfifo, *ev)) {
90 * ir_raw_event_store_edge() - notify raw ir decoders of the start of a pulse/space
96 * reception) for the raw ir decoding state machines. This is used by
105 if (!dev->raw)
109 ev.duration = ktime_to_us(ktime_sub(now, dev->raw->last_event));
117 * ir_raw_event_store_with_timeout() - pass a pulse/space duration to the raw
124 * pulse/space duration for the raw ir decoding state machines, schedules
132 if (!dev->raw)
137 spin_lock(&dev->raw->edge_spinlock);
140 dev->raw->last_event = now;
143 if (!timer_pending(&dev->raw->edge_handle) ||
144 time_after(dev->raw->edge_handle.expires,
146 mod_timer(&dev->raw->edge_handle,
149 spin_unlock(&dev->raw->edge_spinlock);
169 if (!dev->raw)
178 if (!dev->raw->this_ev.duration)
179 dev->raw->this_ev = *ev;
180 else if (ev->pulse == dev->raw->this_ev.pulse)
181 dev->raw->this_ev.duration += ev->duration;
183 ir_raw_event_store(dev, &dev->raw->this_ev);
184 dev->raw->this_ev = *ev;
189 dev->raw->this_ev.duration >= dev->timeout)
203 if (!dev->raw)
209 dev->raw->this_ev.timeout = true;
210 ir_raw_event_store(dev, &dev->raw->this_ev);
211 dev->raw->this_ev = (struct ir_raw_event) {};
229 if (!dev->raw || !dev->raw->thread)
232 wake_up_process(dev->raw->thread);
301 * each raw event filled.
302 * @max: Maximum number of raw events to fill.
309 * to @max raw IR events using the *@ev pointer.
381 * ir_raw_gen_pd() - Encode data to raw events with pulse-distance modulation.
383 * each raw event filled.
384 * @max: Maximum number of raw events to fill.
391 * to @max raw IR events using the *@ev pointer.
440 * ir_raw_gen_pl() - Encode data to raw events with pulse-length modulation.
442 * each raw event filled.
443 * @max: Maximum number of raw events to fill.
450 * to @max raw IR events using the *@ev pointer.
504 * ir_raw_encode_scancode() - Encode a scancode as raw events
508 * @events: array of raw events to write into
509 * @max: max number of raw events
511 * Attempts to encode the scancode as raw events.
555 struct ir_raw_event_ctrl *raw = from_timer(raw, t, edge_handle);
556 struct rc_dev *dev = raw->dev;
560 spin_lock_irqsave(&dev->raw->edge_spinlock, flags);
561 interval = ktime_sub(ktime_get(), dev->raw->last_event);
570 mod_timer(&dev->raw->edge_handle,
574 spin_unlock_irqrestore(&dev->raw->edge_spinlock, flags);
610 * Used to (un)register raw event clients
617 dev->raw = kzalloc(sizeof(*dev->raw), GFP_KERNEL);
618 if (!dev->raw)
621 dev->raw->dev = dev;
624 spin_lock_init(&dev->raw->edge_spinlock);
625 timer_setup(&dev->raw->edge_handle, ir_raw_edge_handle, 0);
626 INIT_KFIFO(dev->raw->kfifo);
635 thread = kthread_run(ir_raw_event_thread, dev->raw, "rc%u", dev->minor);
639 dev->raw->thread = thread;
642 list_add_tail(&dev->raw->list, &ir_raw_client_list);
653 kfree(dev->raw);
654 dev->raw = NULL;
661 if (!dev || !dev->raw)
664 kthread_stop(dev->raw->thread);
665 del_timer_sync(&dev->raw->edge_handle);
668 list_del(&dev->raw->list);
680 * ensure that the raw member is null on unlock; this is how
703 struct ir_raw_event_ctrl *raw;
708 list_for_each_entry(raw, &ir_raw_client_list, list) {
710 (raw->dev->enabled_protocols & protocols))
711 ir_raw_handler->raw_unregister(raw->dev);
712 ir_raw_disable_protocols(raw->dev, protocols);