Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 1 | /* |
| 2 | * Remote Controller core header |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation version 2 of the License. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU General Public License for more details. |
| 12 | */ |
| 13 | |
| 14 | #ifndef _IR_CORE |
| 15 | #define _IR_CORE |
| 16 | |
| 17 | #include <linux/input.h> |
| 18 | #include <linux/spinlock.h> |
| 19 | |
| 20 | extern int ir_core_debug; |
| 21 | #define IR_dprintk(level, fmt, arg...) if (ir_core_debug >= level) \ |
| 22 | printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) |
| 23 | |
Mauro Carvalho Chehab | 971e829 | 2009-12-14 13:53:37 -0300 | [diff] [blame] | 24 | #define IR_TYPE_UNKNOWN 0 |
| 25 | #define IR_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ |
| 26 | #define IR_TYPE_PD (1 << 1) /* Pulse distance encoded IR */ |
| 27 | #define IR_TYPE_NEC (1 << 2) |
| 28 | #define IR_TYPE_OTHER (((u64)1) << 63l) |
Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 29 | |
| 30 | struct ir_scancode { |
| 31 | u16 scancode; |
| 32 | u32 keycode; |
| 33 | }; |
| 34 | |
| 35 | struct ir_scancode_table { |
| 36 | struct ir_scancode *scan; |
| 37 | int size; |
Mauro Carvalho Chehab | 971e829 | 2009-12-14 13:53:37 -0300 | [diff] [blame] | 38 | u64 ir_type; |
Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 39 | spinlock_t lock; |
| 40 | }; |
| 41 | |
Mauro Carvalho Chehab | e93854d | 2009-12-14 00:16:55 -0300 | [diff] [blame] | 42 | struct ir_dev_props { |
| 43 | unsigned long allowed_protos; |
| 44 | void *priv; |
Mauro Carvalho Chehab | 971e829 | 2009-12-14 13:53:37 -0300 | [diff] [blame] | 45 | int (*change_protocol)(void *priv, u64 ir_type); |
Mauro Carvalho Chehab | e93854d | 2009-12-14 00:16:55 -0300 | [diff] [blame] | 46 | }; |
| 47 | |
Mauro Carvalho Chehab | 53f8702 | 2009-12-14 02:16:36 -0300 | [diff] [blame] | 48 | |
Mauro Carvalho Chehab | 75543cc | 2009-12-11 09:44:23 -0300 | [diff] [blame] | 49 | struct ir_input_dev { |
Mauro Carvalho Chehab | 945cdfa | 2010-03-11 12:41:56 -0300 | [diff] [blame^] | 50 | struct device dev; /* device */ |
Mauro Carvalho Chehab | 4714eda | 2009-12-13 16:00:08 -0300 | [diff] [blame] | 51 | struct ir_scancode_table rc_tab; /* scan/key table */ |
| 52 | unsigned long devno; /* device number */ |
Mauro Carvalho Chehab | e93854d | 2009-12-14 00:16:55 -0300 | [diff] [blame] | 53 | const struct ir_dev_props *props; /* Device properties */ |
Mauro Carvalho Chehab | 75543cc | 2009-12-11 09:44:23 -0300 | [diff] [blame] | 54 | }; |
Mauro Carvalho Chehab | 53f8702 | 2009-12-14 02:16:36 -0300 | [diff] [blame] | 55 | #define to_ir_input_dev(_attr) container_of(_attr, struct ir_input_dev, attr) |
Mauro Carvalho Chehab | 75543cc | 2009-12-11 09:44:23 -0300 | [diff] [blame] | 56 | |
Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 57 | /* Routines from ir-keytable.c */ |
| 58 | |
| 59 | u32 ir_g_keycode_from_table(struct input_dev *input_dev, |
| 60 | u32 scancode); |
| 61 | |
Mauro Carvalho Chehab | 75543cc | 2009-12-11 09:44:23 -0300 | [diff] [blame] | 62 | int ir_input_register(struct input_dev *dev, |
Mauro Carvalho Chehab | e93854d | 2009-12-14 00:16:55 -0300 | [diff] [blame] | 63 | const struct ir_scancode_table *ir_codes, |
| 64 | const struct ir_dev_props *props); |
Mauro Carvalho Chehab | 38ef6aa | 2009-12-11 09:47:42 -0300 | [diff] [blame] | 65 | void ir_input_unregister(struct input_dev *input_dev); |
Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 66 | |
Mauro Carvalho Chehab | 4714eda | 2009-12-13 16:00:08 -0300 | [diff] [blame] | 67 | /* Routines from ir-sysfs.c */ |
| 68 | |
| 69 | int ir_register_class(struct input_dev *input_dev); |
| 70 | void ir_unregister_class(struct input_dev *input_dev); |
| 71 | |
Mauro Carvalho Chehab | 446e4a6 | 2009-12-11 08:34:07 -0300 | [diff] [blame] | 72 | #endif |