1 /* ir-raw-event.c - handle IR Pulse/Space event
3 * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <media/ir-core.h>
16 #include <linux/spinlock.h>
18 /* Used to handle IR raw handler extensions */
19 static LIST_HEAD(rc_map_list);
20 static spinlock_t rc_map_lock;
23 static struct rc_keymap *seek_rc_map(const char *name)
25 struct rc_keymap *map = NULL;
27 spin_lock(&rc_map_lock);
28 list_for_each_entry(map, &rc_map_list, list) {
29 if (!strcmp(name, map->map.name))
32 spin_unlock(&rc_map_lock);
37 struct ir_scancode_table *get_rc_map(const char *name)
41 struct rc_keymap *map;
43 map = seek_rc_map(name);
46 rc = request_module("name");
50 map = seek_rc_map(name);
58 EXPORT_SYMBOL_GPL(get_rc_map);
60 int ir_register_map(struct rc_keymap *map)
62 spin_lock(&rc_map_lock);
63 list_add_tail(&map->list, &rc_map_list);
64 spin_unlock(&rc_map_lock);
67 EXPORT_SYMBOL_GPL(ir_raw_handler_register);
69 void ir_unregister_map(struct rc_keymap *map)
71 spin_lock(&rc_map_lock);
73 spin_unlock(&rc_map_lock);
75 EXPORT_SYMBOL_GPL(ir_raw_handler_unregister);