aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/ir-common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/ir-common.h')
-rw-r--r--include/media/ir-common.h43
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
31extern 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
37struct ir_scancode { 39struct ir_scancode {
38 u16 scancode; 40 u16 scancode;
39 u32 keycode; 41 u32 keycode;
@@ -42,11 +44,9 @@ struct ir_scancode {
42struct ir_scancode_table { 44struct 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 {
55struct ir_input_state { 55struct 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
105void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, 105/* Routines from ir-functions.c */
106
107int 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);
107void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir); 109void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
108void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, 110void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
109 u32 ir_key, u32 ir_raw); 111 u32 ir_key);
110u32 ir_extract_bits(u32 data, u32 mask); 112u32 ir_extract_bits(u32 data, u32 mask);
111int ir_dump_samples(u32 *samples, int count); 113int ir_dump_samples(u32 *samples, int count);
112int ir_decode_biphase(u32 *samples, int count, int low, int high); 114int ir_decode_biphase(u32 *samples, int count, int low, int high);
113int ir_decode_pulsedistance(u32 *samples, int count, int low, int high); 115int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
116u32 ir_rc5_decode(unsigned int code);
114 117
115void ir_rc5_timer_end(unsigned long data); 118void ir_rc5_timer_end(unsigned long data);
116void ir_rc5_timer_keyup(unsigned long data); 119void ir_rc5_timer_keyup(unsigned long data);
117 120
118/* Keymaps to be used by other modules */ 121/* Routines from ir-keytable.c */
122
123u32 ir_g_keycode_from_table(struct input_dev *input_dev,
124 u32 scancode);
125
126int ir_set_keycode_table(struct input_dev *input_dev,
127 struct ir_scancode_table *rc_tab);
128
129int ir_roundup_tablesize(int n_elems);
130int ir_copy_table(struct ir_scancode_table *destin,
131 const struct ir_scancode_table *origin);
132void ir_input_free(struct input_dev *input_dev);
133
134/* scancode->keycode map tables from ir-keymaps.c */
119 135
120extern struct ir_scancode_table ir_codes_empty_table; 136extern struct ir_scancode_table ir_codes_empty_table;
121extern struct ir_scancode_table ir_codes_avermedia_table; 137extern struct ir_scancode_table ir_codes_avermedia_table;
@@ -150,6 +166,7 @@ extern struct ir_scancode_table ir_codes_rc5_tv_table;
150extern struct ir_scancode_table ir_codes_winfast_table; 166extern struct ir_scancode_table ir_codes_winfast_table;
151extern struct ir_scancode_table ir_codes_pinnacle_color_table; 167extern struct ir_scancode_table ir_codes_pinnacle_color_table;
152extern struct ir_scancode_table ir_codes_hauppauge_new_table; 168extern struct ir_scancode_table ir_codes_hauppauge_new_table;
169extern struct ir_scancode_table ir_codes_rc5_hauppauge_new_table;
153extern struct ir_scancode_table ir_codes_npgtech_table; 170extern struct ir_scancode_table ir_codes_npgtech_table;
154extern struct ir_scancode_table ir_codes_norwood_table; 171extern struct ir_scancode_table ir_codes_norwood_table;
155extern struct ir_scancode_table ir_codes_proteus_2309_table; 172extern 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;
172extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table; 189extern struct ir_scancode_table ir_codes_kworld_plus_tv_analog_table;
173extern struct ir_scancode_table ir_codes_kaiomy_table; 190extern struct ir_scancode_table ir_codes_kaiomy_table;
174extern struct ir_scancode_table ir_codes_dm1105_nec_table; 191extern struct ir_scancode_table ir_codes_dm1105_nec_table;
192extern struct ir_scancode_table ir_codes_tevii_nec_table;
193extern struct ir_scancode_table ir_codes_tbs_nec_table;
175extern struct ir_scancode_table ir_codes_evga_indtube_table; 194extern struct ir_scancode_table ir_codes_evga_indtube_table;
176extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table; 195extern struct ir_scancode_table ir_codes_terratec_cinergy_xs_table;
177extern struct ir_scancode_table ir_codes_videomate_s350_table; 196extern struct ir_scancode_table ir_codes_videomate_s350_table;