aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/IR')
-rw-r--r--drivers/media/IR/Makefile2
-rw-r--r--drivers/media/IR/ir-sysfs.c4
-rw-r--r--drivers/media/IR/rc-map.c27
3 files changed, 26 insertions, 7 deletions
diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile
index 3a4f590..3d8dd30 100644
--- a/drivers/media/IR/Makefile
+++ b/drivers/media/IR/Makefile
@@ -1,6 +1,8 @@
ir-common-objs := ir-functions.o ir-keymaps.o
ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o
+obj-y += keymaps/
+
obj-$(CONFIG_IR_CORE) += ir-core.o
obj-$(CONFIG_VIDEO_IR) += ir-common.o
obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c
index 36dfe51..58ecca2 100644
--- a/drivers/media/IR/ir-sysfs.c
+++ b/drivers/media/IR/ir-sysfs.c
@@ -251,8 +251,10 @@ static int __init ir_core_init(void)
return rc;
}
- /* Initialize/load the decoders that will be used */
+ /* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
+ rc_map_init();
+
return 0;
}
diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c
index 02c72f0..2f6201c 100644
--- a/drivers/media/IR/rc-map.c
+++ b/drivers/media/IR/rc-map.c
@@ -26,12 +26,14 @@ static struct rc_keymap *seek_rc_map(const char *name)
spin_lock(&rc_map_lock);
list_for_each_entry(map, &rc_map_list, list) {
- if (!strcmp(name, map->map.name))
- break;
+ if (!strcmp(name, map->map.name)) {
+ spin_unlock(&rc_map_lock);
+ return map;
+ }
}
spin_unlock(&rc_map_lock);
- return map;
+ return NULL;
}
struct ir_scancode_table *get_rc_map(const char *name)
@@ -43,15 +45,22 @@ struct ir_scancode_table *get_rc_map(const char *name)
map = seek_rc_map(name);
#ifdef MODULE
if (!map) {
- rc = request_module("name");
- if (rc < 0)
+ rc = request_module(name);
+ if (rc < 0) {
+ printk(KERN_ERR "Couldn't load IR keymap %s\n", name);
return NULL;
+ }
+ msleep(20); /* Give some time for IR to register */
map = seek_rc_map(name);
}
#endif
- if (!map)
+ if (!map) {
+ printk(KERN_ERR "IR keymap %s not found\n", name);
return NULL;
+ }
+
+ printk(KERN_INFO "Registered IR keymap %s\n", map->map.name);
return &map->map;
}
@@ -73,3 +82,9 @@ void ir_unregister_map(struct rc_keymap *map)
spin_unlock(&rc_map_lock);
}
EXPORT_SYMBOL_GPL(ir_unregister_map);
+
+void rc_map_init(void)
+{
+ spin_lock_init(&rc_map_lock);
+
+}