diff options
Diffstat (limited to 'include/media/ir-common.h')
| -rw-r--r-- | include/media/ir-common.h | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/include/media/ir-common.h b/include/media/ir-common.h index 29f0e53cff94..e41a99ee353e 100644 --- a/include/media/ir-common.h +++ b/include/media/ir-common.h | |||
| @@ -26,14 +26,16 @@ | |||
| 26 | #include <linux/input.h> | 26 | #include <linux/input.h> |
| 27 | #include <linux/workqueue.h> | 27 | #include <linux/workqueue.h> |
| 28 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
| 29 | #include <linux/spinlock.h> | ||
| 30 | |||
| 31 | extern int media_ir_debug; /* media_ir_debug level (0,1,2) */ | ||
| 32 | #define IR_dprintk(level, fmt, arg...) if (media_ir_debug >= level) \ | ||
| 33 | printk(KERN_DEBUG "%s: " fmt , __func__, ## arg) | ||
| 29 | 34 | ||
| 30 | #define IR_TYPE_RC5 1 | 35 | #define IR_TYPE_RC5 1 |
| 31 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ | 36 | #define IR_TYPE_PD 2 /* Pulse distance encoded IR */ |
| 32 | #define IR_TYPE_OTHER 99 | 37 | #define IR_TYPE_OTHER 99 |
| 33 | 38 | ||
| 34 | #define IR_KEYTAB_TYPE u32 | ||
| 35 | #define IR_KEYTAB_SIZE 128 /* enougth for rc5, probably need more some day */ | ||
| 36 | |||
| 37 | struct ir_scancode { | 39 | struct ir_scancode { |
| 38 | u16 scancode; | 40 | u16 scancode; |
| 39 | u32 keycode; | 41 | u32 keycode; |
| @@ -42,11 +44,9 @@ struct ir_scancode { | |||
| 42 | struct ir_scancode_table { | 44 | struct ir_scancode_table { |
| 43 | struct ir_scancode *scan; | 45 | struct ir_scancode *scan; |
| 44 | int size; | 46 | int size; |
| 47 | spinlock_t lock; | ||
| 45 | }; | 48 | }; |
| 46 | 49 | ||
| 47 | #define IR_KEYCODE(tab,code) (((unsigned)code < IR_KEYTAB_SIZE) \ | ||
| 48 | ? tab[code] : KEY_RESERVED) | ||
| 49 | |||
| 50 | #define RC5_START(x) (((x)>>12)&3) | 50 | #define RC5_START(x) (((x)>>12)&3) |
| 51 | #define RC5_TOGGLE(x) (((x)>>11)&1) | 51 | #define RC5_TOGGLE(x) (((x)>>11)&1) |
| 52 | #define RC5_ADDR(x) (((x)>>6)&31) | 52 | #define RC5_ADDR(x) (((x)>>6)&31) |
| @@ -55,11 +55,11 @@ struct ir_scancode_table { | |||
| 55 | struct ir_input_state { | 55 | struct ir_input_state { |
| 56 | /* configuration */ | 56 | /* configuration */ |
| 57 | int ir_type; | 57 | int ir_type; |
| 58 | IR_KEYTAB_TYPE ir_codes[IR_KEYTAB_SIZE]; | 58 | |
| 59 | struct ir_scancode_table keytable; | ||
| 59 | 60 | ||
| 60 | /* key info */ | 61 | /* key info */ |
| 61 | u32 ir_raw; /* raw data */ | 62 | u32 ir_key; /* ir scancode */ |
| 62 | u32 ir_key; /* ir key code */ | ||
| 63 | u32 keycode; /* linux key code */ | 63 | u32 keycode; /* linux key code */ |
| 64 | int keypressed; /* current state */ | 64 | int keypressed; /* current state */ |
| 65 | }; | 65 | }; |
| @@ -102,20 +102,36 @@ struct card_ir { | |||
| 102 | struct tasklet_struct tlet; | 102 | struct tasklet_struct tlet; |
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| 105 | void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | 105 | /* Routines from ir-functions.c */ |
| 106 | |||
| 107 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | ||
| 106 | int ir_type, struct ir_scancode_table *ir_codes); | 108 | int ir_type, struct ir_scancode_table *ir_codes); |
| 107 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); | 109 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); |
| 108 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | 110 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, |
| 109 | u32 ir_key, u32 ir_raw); | 111 | u32 ir_key); |
| 110 | u32 ir_extract_bits(u32 data, u32 mask); | 112 | u32 ir_extract_bits(u32 data, u32 mask); |
| 111 | int ir_dump_samples(u32 *samples, int count); | 113 | int ir_dump_samples(u32 *samples, int count); |
| 112 | int ir_decode_biphase(u32 *samples, int count, int low, int high); | 114 | int ir_decode_biphase(u32 *samples, int count, int low, int high); |
| 113 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); | 115 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); |
| 116 | u32 ir_rc5_decode(unsigned int code); | ||
| 114 | 117 | ||
| 115 | void ir_rc5_timer_end(unsigned long data); | 118 | void ir_rc5_timer_end(unsigned long data); |
| 116 | void ir_rc5_timer_keyup(unsigned long data); | 119 | void ir_rc5_timer_keyup(unsigned long data); |
| 117 | 120 | ||
| 118 | /* Keymaps to be used by other modules */ | 121 | /* Routines from ir-keytable.c */ |
| 122 | |||
| 123 | u32 ir_g_keycode_from_table(struct input_dev *input_dev, | ||
| 124 | u32 scancode); | ||
| 125 | |||
| 126 | int ir_set_keycode_table(struct input_dev *input_dev, | ||
| 127 | struct ir_scancode_table *rc_tab); | ||
| 128 | |||
| 129 | int ir_roundup_tablesize(int n_elems); | ||
| 130 | int ir_copy_table(struct ir_scancode_table *destin, | ||
| 131 | const struct ir_scancode_table *origin); | ||
| 132 | void ir_input_free(struct input_dev *input_dev); | ||
| 133 | |||
| 134 | /* scancode->keycode map tables from ir-keymaps.c */ | ||
| 119 | 135 | ||
| 120 | extern struct ir_scancode_table ir_codes_empty_table; | 136 | extern struct ir_scancode_table ir_codes_empty_table; |
| 121 | extern struct ir_scancode_table ir_codes_avermedia_table; | 137 | extern struct ir_scancode_table ir_codes_avermedia_table; |
| @@ -150,6 +166,7 @@ extern struct ir_scancode_table ir_codes_rc5_tv_table; | |||
| 150 | extern struct ir_scancode_table ir_codes_winfast_table; | 166 | extern struct ir_scancode_table ir_codes_winfast_table; |
| 151 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; | 167 | extern struct ir_scancode_table ir_codes_pinnacle_color_table; |
| 152 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; | 168 | extern struct ir_scancode_table ir_codes_hauppauge_new_table; |
| 169 | extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table; | ||
| 153 | extern struct ir_scancode_table ir_codes_npgtech_table; | 170 | extern struct ir_scancode_table ir_codes_npgtech_table; |
| 154 | extern struct ir_scancode_table ir_codes_norwood_table; | 171 | extern struct ir_scancode_table ir_codes_norwood_table; |
| 155 | extern struct ir_scancode_table ir_codes_proteus_2309_table; | 172 | extern struct ir_scancode_table ir_codes_proteus_2309_table; |
| @@ -172,6 +189,8 @@ extern struct ir_scancode_table ir_codes_ati_tv_wonder_hd_600_table; | |||
| 172 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; | 189 | extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; |
| 173 | extern struct ir_scancode_table ir_codes_kaiomy_table; | 190 | extern struct ir_scancode_table ir_codes_kaiomy_table; |
| 174 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; | 191 | extern struct ir_scancode_table ir_codes_dm1105_nec_table; |
| 192 | extern struct ir_scancode_table ir_codes_tevii_nec_table; | ||
| 193 | extern struct ir_scancode_table ir_codes_tbs_nec_table; | ||
| 175 | extern struct ir_scancode_table ir_codes_evga_indtube_table; | 194 | extern struct ir_scancode_table ir_codes_evga_indtube_table; |
| 176 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; | 195 | extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; |
| 177 | extern struct ir_scancode_table ir_codes_videomate_s350_table; | 196 | extern struct ir_scancode_table ir_codes_videomate_s350_table; |
