]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/media/ir-common.h
V4L/DVB: ir-common: Use a function to declare an IR table
[net-next-2.6.git] / include / media / ir-common.h
CommitLineData
1da177e4 1/*
1da177e4
LT
2 *
3 * some common structs and functions to handle infrared remotes via
4 * input layer ...
5 *
6 * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
d5e52653
MCC
23#ifndef _IR_COMMON
24#define _IR_COMMON
1da177e4 25
d5e52653 26#include <linux/input.h>
0b778a56 27#include <linux/workqueue.h>
622ecb30 28#include <linux/interrupt.h>
446e4a64 29#include <media/ir-core.h>
1da177e4 30
9160723e
HP
31#define RC5_START(x) (((x)>>12)&3)
32#define RC5_TOGGLE(x) (((x)>>11)&1)
33#define RC5_ADDR(x) (((x)>>6)&31)
34#define RC5_INSTR(x) ((x)&63)
35
1da177e4
LT
36struct ir_input_state {
37 /* configuration */
971e8298 38 u64 ir_type;
1da177e4
LT
39
40 /* key info */
8573b74a 41 u32 ir_key; /* ir scancode */
1da177e4
LT
42 u32 keycode; /* linux key code */
43 int keypressed; /* current state */
44};
45
9160723e
HP
46/* this was saa7134_ir and bttv_ir, moved here for
47 * rc5 decoding. */
48struct card_ir {
49 struct input_dev *dev;
50 struct ir_input_state ir;
51 char name[32];
52 char phys[32];
716aab44 53 int users;
9160723e 54
02108949
MCC
55 u32 running:1;
56 struct ir_dev_props props;
57
9160723e
HP
58 /* Usual gpio signalling */
59
60 u32 mask_keycode;
61 u32 mask_keydown;
62 u32 mask_keyup;
63 u32 polling;
64 u32 last_gpio;
65 int shift_by;
66 int start; // What should RC5_START() be
67 int addr; // What RC5_ADDR() should be.
68 int rc5_key_timeout;
69 int rc5_remote_gap;
70 struct work_struct work;
71 struct timer_list timer;
72
73 /* RC5 gpio */
74 u32 rc5_gpio;
75 struct timer_list timer_end; /* timer_end for code completion */
76 struct timer_list timer_keyup; /* timer_end for key release */
77 u32 last_rc5; /* last good rc5 code */
78 u32 last_bit; /* last raw bit seen */
79 u32 code; /* raw code under construction */
80 struct timeval base_time; /* time of last seen code */
81 int active; /* building raw code */
622ecb30
MCC
82
83 /* NEC decoding */
84 u32 nec_gpio;
85 struct tasklet_struct tlet;
a3572c34
MCC
86
87 /* IR core raw decoding */
88 u32 raw_decode;
9160723e
HP
89};
90
ef53a115
MCC
91/* Routines from ir-functions.c */
92
055cd556 93int ir_input_init(struct input_dev *dev, struct ir_input_state *ir,
971e8298 94 const u64 ir_type);
1da177e4
LT
95void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir);
96void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
8573b74a 97 u32 ir_key);
1da177e4
LT
98u32 ir_extract_bits(u32 data, u32 mask);
99int ir_dump_samples(u32 *samples, int count);
100int ir_decode_biphase(u32 *samples, int count, int low, int high);
793cf9e6 101int ir_decode_pulsedistance(u32 *samples, int count, int low, int high);
1d23a002 102u32 ir_rc5_decode(unsigned int code);
1da177e4 103
9160723e
HP
104void ir_rc5_timer_end(unsigned long data);
105void ir_rc5_timer_keyup(unsigned long data);
106
ef53a115 107/* scancode->keycode map tables from ir-keymaps.c */
4c0f631e 108
8b75acb5
MCC
109#define IR_KEYTABLE(a) \
110(ir_codes_ ## a ## _table)
111
112#define DECLARE_IR_KEYTABLE(a) \
113extern struct ir_scancode_table IR_KEYTABLE(a)
114
115DECLARE_IR_KEYTABLE(empty);
116DECLARE_IR_KEYTABLE(avermedia);
117DECLARE_IR_KEYTABLE(avermedia_dvbt);
118DECLARE_IR_KEYTABLE(avermedia_m135a_rm_jx);
119DECLARE_IR_KEYTABLE(avermedia_cardbus);
120DECLARE_IR_KEYTABLE(apac_viewcomp);
121DECLARE_IR_KEYTABLE(pixelview);
122DECLARE_IR_KEYTABLE(pixelview_new);
123DECLARE_IR_KEYTABLE(nebula);
124DECLARE_IR_KEYTABLE(dntv_live_dvb_t);
125DECLARE_IR_KEYTABLE(iodata_bctv7e);
126DECLARE_IR_KEYTABLE(adstech_dvb_t_pci);
127DECLARE_IR_KEYTABLE(msi_tvanywhere);
128DECLARE_IR_KEYTABLE(cinergy_1400);
129DECLARE_IR_KEYTABLE(avertv_303);
130DECLARE_IR_KEYTABLE(dntv_live_dvbt_pro);
131DECLARE_IR_KEYTABLE(em_terratec);
132DECLARE_IR_KEYTABLE(pinnacle_grey);
133DECLARE_IR_KEYTABLE(flyvideo);
134DECLARE_IR_KEYTABLE(flydvb);
135DECLARE_IR_KEYTABLE(cinergy);
136DECLARE_IR_KEYTABLE(eztv);
137DECLARE_IR_KEYTABLE(avermedia);
138DECLARE_IR_KEYTABLE(videomate_tv_pvr);
139DECLARE_IR_KEYTABLE(manli);
140DECLARE_IR_KEYTABLE(gotview7135);
141DECLARE_IR_KEYTABLE(purpletv);
142DECLARE_IR_KEYTABLE(pctv_sedna);
143DECLARE_IR_KEYTABLE(pv951);
144DECLARE_IR_KEYTABLE(rc5_tv);
145DECLARE_IR_KEYTABLE(winfast);
146DECLARE_IR_KEYTABLE(pinnacle_color);
147DECLARE_IR_KEYTABLE(hauppauge_new);
148DECLARE_IR_KEYTABLE(rc5_hauppauge_new);
149DECLARE_IR_KEYTABLE(npgtech);
150DECLARE_IR_KEYTABLE(norwood);
151DECLARE_IR_KEYTABLE(proteus_2309);
152DECLARE_IR_KEYTABLE(budget_ci_old);
153DECLARE_IR_KEYTABLE(asus_pc39);
154DECLARE_IR_KEYTABLE(encore_enltv);
155DECLARE_IR_KEYTABLE(encore_enltv2);
156DECLARE_IR_KEYTABLE(tt_1500);
157DECLARE_IR_KEYTABLE(fusionhdtv_mce);
158DECLARE_IR_KEYTABLE(behold);
159DECLARE_IR_KEYTABLE(behold_columbus);
160DECLARE_IR_KEYTABLE(pinnacle_pctv_hd);
161DECLARE_IR_KEYTABLE(genius_tvgo_a11mce);
162DECLARE_IR_KEYTABLE(powercolor_real_angel);
163DECLARE_IR_KEYTABLE(avermedia_a16d);
164DECLARE_IR_KEYTABLE(encore_enltv_fm53);
165DECLARE_IR_KEYTABLE(real_audio_220_32_keys);
166DECLARE_IR_KEYTABLE(msi_tvanywhere_plus);
167DECLARE_IR_KEYTABLE(ati_tv_wonder_hd_600);
168DECLARE_IR_KEYTABLE(kworld_plus_tv_analog);
169DECLARE_IR_KEYTABLE(kaiomy);
170DECLARE_IR_KEYTABLE(dm1105_nec);
171DECLARE_IR_KEYTABLE(tevii_nec);
172DECLARE_IR_KEYTABLE(tbs_nec);
173DECLARE_IR_KEYTABLE(evga_indtube);
174DECLARE_IR_KEYTABLE(terratec_cinergy_xs);
175DECLARE_IR_KEYTABLE(videomate_s350);
176DECLARE_IR_KEYTABLE(gadmei_rm008z);
177DECLARE_IR_KEYTABLE(nec_terratec_cinergy_xs);
178DECLARE_IR_KEYTABLE(winfast_usbii_deluxe);
179DECLARE_IR_KEYTABLE(kworld_315u);
d5e52653 180#endif