From 4714eda87748f226833c32400ab60dd6a3b80766 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 13 Dec 2009 16:00:08 -0300 Subject: V4L/DVB (13633): ir-core: create a new class for remote controllers Add sysfs skeleton to export remote controller information via /sys/class/irrcv. For now, the code doesn't do much. It just exports an attribute that is meant to report and control the IR protocol used by the keytable. However, the callbacks for this new attribute weren't set yet. Also, it lacks symlinks to the used event interface. Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 299d201e133..a5a3bda354d 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -42,8 +42,11 @@ struct ir_scancode_table { }; struct ir_input_dev { - struct input_dev *dev; - struct ir_scancode_table rc_tab; + struct input_dev *dev; /* Input device*/ + struct ir_scancode_table rc_tab; /* scan/key table */ + unsigned long devno; /* device number */ + struct attribute_group attr; /* IR attributes */ + struct device *class_dev; /* virtual class dev */ }; /* Routines from ir-keytable.c */ @@ -59,4 +62,9 @@ int ir_input_register(struct input_dev *dev, struct ir_scancode_table *ir_codes); void ir_input_unregister(struct input_dev *input_dev); +/* Routines from ir-sysfs.c */ + +int ir_register_class(struct input_dev *input_dev); +void ir_unregister_class(struct input_dev *input_dev); + #endif -- cgit v1.2.3 From e93854da880d6dc357c00625d8371b6a926fd19b Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Dec 2009 00:16:55 -0300 Subject: V4L/DVB (13634): ir-core: allow passing IR device parameters to ir-core Adds an structure to ir_input_register to contain IR device characteristics, like supported protocols and a callback to handle protocol event changes. Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index a5a3bda354d..dbdffd1458f 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -23,10 +23,10 @@ extern int ir_core_debug; enum ir_type { IR_TYPE_UNKNOWN = 0, - IR_TYPE_RC5 = 1, - IR_TYPE_PD = 2, /* Pulse distance encoded IR */ - IR_TYPE_NEC = 3, - IR_TYPE_OTHER = 99, + IR_TYPE_RC5 = 1L << 0, /* Philips RC5 protocol */ + IR_TYPE_PD = 1L << 1, /* Pulse distance encoded IR */ + IR_TYPE_NEC = 1L << 2, + IR_TYPE_OTHER = 1L << 63, }; struct ir_scancode { @@ -41,12 +41,19 @@ struct ir_scancode_table { spinlock_t lock; }; +struct ir_dev_props { + unsigned long allowed_protos; + void *priv; + int (*change_protocol)(void *priv, unsigned long protocol); +}; + struct ir_input_dev { struct input_dev *dev; /* Input device*/ struct ir_scancode_table rc_tab; /* scan/key table */ unsigned long devno; /* device number */ struct attribute_group attr; /* IR attributes */ struct device *class_dev; /* virtual class dev */ + const struct ir_dev_props *props; /* Device properties */ }; /* Routines from ir-keytable.c */ @@ -59,7 +66,8 @@ int ir_set_keycode_table(struct input_dev *input_dev, int ir_roundup_tablesize(int n_elems); int ir_input_register(struct input_dev *dev, - struct ir_scancode_table *ir_codes); + const struct ir_scancode_table *ir_codes, + const struct ir_dev_props *props); void ir_input_unregister(struct input_dev *input_dev); /* Routines from ir-sysfs.c */ -- cgit v1.2.3 From 53f870228db0855f2031270ba5774dab0f33facd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Dec 2009 02:16:36 -0300 Subject: V4L/DVB (13635): ir-core: Implement protocol table type reading Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index dbdffd1458f..a6d07dede09 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -44,9 +44,10 @@ struct ir_scancode_table { struct ir_dev_props { unsigned long allowed_protos; void *priv; - int (*change_protocol)(void *priv, unsigned long protocol); + int (*change_protocol)(void *priv, enum ir_type ir_type); }; + struct ir_input_dev { struct input_dev *dev; /* Input device*/ struct ir_scancode_table rc_tab; /* scan/key table */ @@ -55,6 +56,7 @@ struct ir_input_dev { struct device *class_dev; /* virtual class dev */ const struct ir_dev_props *props; /* Device properties */ }; +#define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) /* Routines from ir-keytable.c */ -- cgit v1.2.3 From 971e8298dee4835fc2dfbd207a9786702aa01666 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 14 Dec 2009 13:53:37 -0300 Subject: V4L/DVB (13680): ir: use unsigned long instead of enum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When preparing the linux-next patches, I got those errors: include/media/ir-core.h:29: warning: left shift count >= width of type In file included from include/media/ir-common.h:29, from drivers/media/video/ir-kbd-i2c.c:50: drivers/media/video/ir-kbd-i2c.c: In function ‘ir_probe’: drivers/media/video/ir-kbd-i2c.c:324: warning: left shift count >= width of type Unfortunately, enum is 32 bits on i386. As we define IR_TYPE_OTHER as 1<<63, it won't work on non 64 bits arch. Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index a6d07dede09..d96f25a0845 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -21,13 +21,11 @@ extern int ir_core_debug; #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) -enum ir_type { - IR_TYPE_UNKNOWN = 0, - IR_TYPE_RC5 = 1L << 0, /* Philips RC5 protocol */ - IR_TYPE_PD = 1L << 1, /* Pulse distance encoded IR */ - IR_TYPE_NEC = 1L << 2, - IR_TYPE_OTHER = 1L << 63, -}; +#define IR_TYPE_UNKNOWN 0 +#define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ +#define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ +#define IR_TYPE_NEC (1 << 2) +#define IR_TYPE_OTHER (((u64)1) << 63l) struct ir_scancode { u16 scancode; @@ -37,14 +35,14 @@ struct ir_scancode { struct ir_scancode_table { struct ir_scancode *scan; int size; - enum ir_type ir_type; + u64 ir_type; spinlock_t lock; }; struct ir_dev_props { unsigned long allowed_protos; void *priv; - int (*change_protocol)(void *priv, enum ir_type ir_type); + int (*change_protocol)(void *priv, u64 ir_type); }; -- cgit v1.2.3 From 8719cfdb4aa5bc7402bef873f607ed406960019f Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 17 Dec 2009 09:24:37 -0300 Subject: V4L/DVB (13833): ir-core: some functions can be static Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-core.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/media/ir-core.h') diff --git a/include/media/ir-core.h b/include/media/ir-core.h index d96f25a0845..61c223bc395 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h @@ -61,10 +61,6 @@ struct ir_input_dev { u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode); -int ir_set_keycode_table(struct input_dev *input_dev, - struct ir_scancode_table *rc_tab); - -int ir_roundup_tablesize(int n_elems); int ir_input_register(struct input_dev *dev, const struct ir_scancode_table *ir_codes, const struct ir_dev_props *props); -- cgit v1.2.3