From 24ef92f0974bf26cf8ca949b7ae21286cbca3fd3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 5 Mar 2009 09:39:30 +0000 Subject: Fix race in infrared polling on rmmod From: Jean Delvare The race on rmmod I just fixed in cx88-input affects 3 other drivers. Fix these the same way. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 00fa57eb9..18ec1dacd 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -14,8 +14,12 @@ struct IR_i2c { /* Used to avoid fast repeating */ unsigned char old; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) struct work_struct work; struct timer_list timer; +#else + struct delayed_work work; +#endif char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; -- cgit v1.2.3 From d7673f843f104186787be352493d8660570163ab Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 11 Mar 2009 07:51:41 -0300 Subject: Revert the last changeset, since there are a rev 2 of those changes From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 18ec1dacd..00fa57eb9 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -14,12 +14,8 @@ struct IR_i2c { /* Used to avoid fast repeating */ unsigned char old; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) struct work_struct work; struct timer_list timer; -#else - struct delayed_work work; -#endif char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; -- cgit v1.2.3 From c698fbc627c51ba8ad0e434848499cb4412072da Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 7 Mar 2009 10:43:43 +0000 Subject: ir-kbd-i2c: Prevent general protection fault on rmmod From: Jean Delvare The removal of the timer which polls the infrared input is racy. Replacing the timer with a delayed work solves the problem. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 00fa57eb9..07963d705 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -14,8 +14,7 @@ struct IR_i2c { /* Used to avoid fast repeating */ unsigned char old; - struct work_struct work; - struct timer_list timer; + struct delayed_work work; char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; -- cgit v1.2.3 From e420aed19a5f4a2715733f2a450e8958fa7e2638 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 13 May 2009 19:48:07 +0000 Subject: ir-kbd-i2c: Don't use i2c_client.name for our own needs From: Jean Delvare In the standard device driver binding model, the name field of struct i2c_client is used to match devices to their drivers, so we must stop using it for internal purposes. Define a separate field in struct IR_i2c as a replacement, and use it. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 1 + 1 file changed, 1 insertion(+) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 07963d705..6a9719c8e 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -15,6 +15,7 @@ struct IR_i2c { unsigned char old; struct delayed_work work; + char name[32]; char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; -- cgit v1.2.3 From b60f8e0b02ee9d9ef582e9df01eb81e5218baf9e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 13 May 2009 19:48:50 +0000 Subject: ir-kbd-i2c: Switch to the new-style device binding model From: Jean Delvare Let card drivers probe for IR receiver devices and instantiate them if found. Ultimately it would be better if we could stop probing completely, but I suspect this won't be possible for all card types. There's certainly room for cleanups. For example, some drivers are sharing I2C adapter IDs, so they also had to share the list of I2C addresses being probed for an IR receiver. Now that each driver explicitly says which addresses should be probed, maybe some addresses can be dropped from some drivers. Also, the special cases in saa7134-i2c should probably be handled on a per-board basis. This would be more efficient and less risky than always probing extra addresses on all boards. I'll give it a try later. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 6a9719c8e..94a77b15a 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -7,7 +7,7 @@ struct IR_i2c; struct IR_i2c { IR_KEYTAB_TYPE *ir_codes; - struct i2c_client c; + struct i2c_client *c; struct input_dev *input; struct ir_input_state ir; -- cgit v1.2.3 From ff5842e7e95c426abf87bbdb32361c523b1b98f0 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 13 May 2009 19:49:32 +0000 Subject: ir-kbd-i2c: Use initialization data From: Jean Delvare For specific boards, pass initialization data to ir-kbd-i2c instead of modifying the settings after the device is initialized. This is more efficient and easier to read. Signed-off-by: Jean Delvare Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 94a77b15a..3ad4ed540 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -19,4 +19,11 @@ struct IR_i2c { char phys[32]; int (*get_key)(struct IR_i2c*, u32*, u32*); }; + +/* Can be passed when instantiating an ir_video i2c device */ +struct IR_i2c_init_data { + IR_KEYTAB_TYPE *ir_codes; + const char *name; + int (*get_key)(struct IR_i2c*, u32*, u32*); +}; #endif -- cgit v1.2.3 From 9c9fd460173573929daf32f42a502283a9aaae26 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 27 May 2009 15:32:23 -0300 Subject: Building system: Restore compilation with kernels older than 2.6.29 From: Mauro Carvalho Chehab Mostly due to ir-kdb-i2c, but also due to two new drivers, compilation with kernels older than 2.6.29 were broken. This quick and dirty changeset, generated semi-automatically, restaures backport to the subsystem by adding lots of #ifs. It is possible to write a much more small changeset that would restore backport without adding so many ifs, but, due to the lack of time, this will also solve it. Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 3ad4ed540..93a6c933b 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -7,7 +7,11 @@ struct IR_i2c; struct IR_i2c { IR_KEYTAB_TYPE *ir_codes; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) + struct i2c_client c; +#else struct i2c_client *c; +#endif struct input_dev *input; struct ir_input_state ir; -- cgit v1.2.3 From 7059988b9d5badb3606286718c371665ff4a70ae Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 28 Jul 2009 11:44:05 -0300 Subject: ir-kbd-i2c: Allow use of ir-kdb-i2c internal get_key funcs and set ir_type From: Andy Walls This patch augments the init data passed by bridge drivers to ir-kbd-i2c, so that the ir_type can be set explicitly, and so ir-kbd-i2c internal get_key functions can be reused without requiring symbols from ir-kbd-i2c in the bridge driver. Priority: normal Signed-off-by: Andy Walls Reviewed-by: Jean Delvare Signed-off-by: Douglas Schilling Landgraf Signed-off-by: Mauro Carvalho Chehab --- linux/include/media/ir-kbd-i2c.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'linux/include/media/ir-kbd-i2c.h') diff --git a/linux/include/media/ir-kbd-i2c.h b/linux/include/media/ir-kbd-i2c.h index 93a6c933b..2a8da5027 100644 --- a/linux/include/media/ir-kbd-i2c.h +++ b/linux/include/media/ir-kbd-i2c.h @@ -24,10 +24,27 @@ struct IR_i2c { int (*get_key)(struct IR_i2c*, u32*, u32*); }; +enum ir_kbd_get_key_fn { + IR_KBD_GET_KEY_CUSTOM = 0, + IR_KBD_GET_KEY_PIXELVIEW, + IR_KBD_GET_KEY_PV951, + IR_KBD_GET_KEY_HAUP, + IR_KBD_GET_KEY_KNC1, + IR_KBD_GET_KEY_FUSIONHDTV, + IR_KBD_GET_KEY_HAUP_XVR, + IR_KBD_GET_KEY_AVERMEDIA_CARDBUS, +}; + /* Can be passed when instantiating an ir_video i2c device */ struct IR_i2c_init_data { IR_KEYTAB_TYPE *ir_codes; const char *name; + int type; /* IR_TYPE_RC5, IR_TYPE_PD, etc */ + /* + * Specify either a function pointer or a value indicating one of + * ir_kbd_i2c's internal get_key functions + */ int (*get_key)(struct IR_i2c*, u32*, u32*); + enum ir_kbd_get_key_fn internal_get_key_func; }; #endif -- cgit v1.2.3