aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common')
-rw-r--r--drivers/media/common/ir-common.c255
1 files changed, 110 insertions, 145 deletions
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c
index 4adb2843f8be..ab7a1fba4427 100644
--- a/drivers/media/common/ir-common.c
+++ b/drivers/media/common/ir-common.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: ir-common.c,v 1.10 2005/05/22 19:23:39 nsh Exp $ 2 * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $
3 * 3 *
4 * some common structs and functions to handle infrared remotes via 4 * some common structs and functions to handle infrared remotes via
5 * input layer ... 5 * input layer ...
@@ -46,79 +46,49 @@ module_param(debug, int, 0644);
46/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ 46/* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */
47/* used by old (black) Hauppauge remotes */ 47/* used by old (black) Hauppauge remotes */
48IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = { 48IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = {
49 [ 0x00 ] = KEY_KP0, // 0 49 /* Keys 0 to 9 */
50 [ 0x01 ] = KEY_KP1, // 1 50 [ 0x00 ] = KEY_KP0,
51 [ 0x02 ] = KEY_KP2, // 2 51 [ 0x01 ] = KEY_KP1,
52 [ 0x03 ] = KEY_KP3, // 3 52 [ 0x02 ] = KEY_KP2,
53 [ 0x04 ] = KEY_KP4, // 4 53 [ 0x03 ] = KEY_KP3,
54 [ 0x05 ] = KEY_KP5, // 5 54 [ 0x04 ] = KEY_KP4,
55 [ 0x06 ] = KEY_KP6, // 6 55 [ 0x05 ] = KEY_KP5,
56 [ 0x07 ] = KEY_KP7, // 7 56 [ 0x06 ] = KEY_KP6,
57 [ 0x08 ] = KEY_KP8, // 8 57 [ 0x07 ] = KEY_KP7,
58 [ 0x09 ] = KEY_KP9, // 9 58 [ 0x08 ] = KEY_KP8,
59 59 [ 0x09 ] = KEY_KP9,
60 [ 0x0b ] = KEY_CHANNEL, // channel / program (japan: 11) 60
61 [ 0x0c ] = KEY_POWER, // standby 61 [ 0x0b ] = KEY_CHANNEL, /* channel / program (japan: 11) */
62 [ 0x0d ] = KEY_MUTE, // mute / demute 62 [ 0x0c ] = KEY_POWER, /* standby */
63 [ 0x0f ] = KEY_TV, // display 63 [ 0x0d ] = KEY_MUTE, /* mute / demute */
64 [ 0x10 ] = KEY_VOLUMEUP, // volume + 64 [ 0x0f ] = KEY_TV, /* display */
65 [ 0x11 ] = KEY_VOLUMEDOWN, // volume - 65 [ 0x10 ] = KEY_VOLUMEUP,
66 [ 0x12 ] = KEY_BRIGHTNESSUP, // brightness + 66 [ 0x11 ] = KEY_VOLUMEDOWN,
67 [ 0x13 ] = KEY_BRIGHTNESSDOWN, // brightness - 67 [ 0x12 ] = KEY_BRIGHTNESSUP,
68 [ 0x1e ] = KEY_SEARCH, // search + 68 [ 0x13 ] = KEY_BRIGHTNESSDOWN,
69 [ 0x20 ] = KEY_CHANNELUP, // channel / program + 69 [ 0x1e ] = KEY_SEARCH, /* search + */
70 [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - 70 [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */
71 [ 0x22 ] = KEY_CHANNEL, // alt / channel 71 [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */
72 [ 0x23 ] = KEY_LANGUAGE, // 1st / 2nd language 72 [ 0x22 ] = KEY_CHANNEL, /* alt / channel */
73 [ 0x26 ] = KEY_SLEEP, // sleeptimer 73 [ 0x23 ] = KEY_LANGUAGE, /* 1st / 2nd language */
74 [ 0x2e ] = KEY_MENU, // 2nd controls (USA: menu) 74 [ 0x26 ] = KEY_SLEEP, /* sleeptimer */
75 [ 0x30 ] = KEY_PAUSE, // pause 75 [ 0x2e ] = KEY_MENU, /* 2nd controls (USA: menu) */
76 [ 0x32 ] = KEY_REWIND, // rewind 76 [ 0x30 ] = KEY_PAUSE,
77 [ 0x33 ] = KEY_GOTO, // go to 77 [ 0x32 ] = KEY_REWIND,
78 [ 0x35 ] = KEY_PLAY, // play 78 [ 0x33 ] = KEY_GOTO,
79 [ 0x36 ] = KEY_STOP, // stop 79 [ 0x35 ] = KEY_PLAY,
80 [ 0x37 ] = KEY_RECORD, // recording 80 [ 0x36 ] = KEY_STOP,
81 [ 0x3c ] = KEY_TEXT, // teletext submode (Japan: 12) 81 [ 0x37 ] = KEY_RECORD, /* recording */
82 [ 0x3d ] = KEY_SUSPEND, // system standby 82 [ 0x3c ] = KEY_TEXT, /* teletext submode (Japan: 12) */
83 83 [ 0x3d ] = KEY_SUSPEND, /* system standby */
84#if 0 /* FIXME */ 84
85 [ 0x0a ] = KEY_RESERVED, // 1/2/3 digits (japan: 10)
86 [ 0x0e ] = KEY_RESERVED, // P.P. (personal preference)
87 [ 0x14 ] = KEY_RESERVED, // colour saturation +
88 [ 0x15 ] = KEY_RESERVED, // colour saturation -
89 [ 0x16 ] = KEY_RESERVED, // bass +
90 [ 0x17 ] = KEY_RESERVED, // bass -
91 [ 0x18 ] = KEY_RESERVED, // treble +
92 [ 0x19 ] = KEY_RESERVED, // treble -
93 [ 0x1a ] = KEY_RESERVED, // balance right
94 [ 0x1b ] = KEY_RESERVED, // balance left
95 [ 0x1c ] = KEY_RESERVED, // contrast +
96 [ 0x1d ] = KEY_RESERVED, // contrast -
97 [ 0x1f ] = KEY_RESERVED, // tint/hue +
98 [ 0x24 ] = KEY_RESERVED, // spacial stereo on/off
99 [ 0x25 ] = KEY_RESERVED, // mono / stereo (USA)
100 [ 0x27 ] = KEY_RESERVED, // tint / hue -
101 [ 0x28 ] = KEY_RESERVED, // RF switch/PIP select
102 [ 0x29 ] = KEY_RESERVED, // vote
103 [ 0x2a ] = KEY_RESERVED, // timed page/channel clck
104 [ 0x2b ] = KEY_RESERVED, // increment (USA)
105 [ 0x2c ] = KEY_RESERVED, // decrement (USA)
106 [ 0x2d ] = KEY_RESERVED, //
107 [ 0x2f ] = KEY_RESERVED, // PIP shift
108 [ 0x31 ] = KEY_RESERVED, // erase
109 [ 0x34 ] = KEY_RESERVED, // wind
110 [ 0x38 ] = KEY_RESERVED, // external 1
111 [ 0x39 ] = KEY_RESERVED, // external 2
112 [ 0x3a ] = KEY_RESERVED, // PIP display mode
113 [ 0x3b ] = KEY_RESERVED, // view data mode / advance
114 [ 0x3e ] = KEY_RESERVED, // crispener on/off
115 [ 0x3f ] = KEY_RESERVED, // system select
116#endif
117}; 85};
118EXPORT_SYMBOL_GPL(ir_codes_rc5_tv); 86EXPORT_SYMBOL_GPL(ir_codes_rc5_tv);
119 87
120/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ 88/* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */
121IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = { 89IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = {
90 /* Keys 0 to 9 */
91 [ 18 ] = KEY_KP0,
122 [ 5 ] = KEY_KP1, 92 [ 5 ] = KEY_KP1,
123 [ 6 ] = KEY_KP2, 93 [ 6 ] = KEY_KP2,
124 [ 7 ] = KEY_KP3, 94 [ 7 ] = KEY_KP3,
@@ -128,39 +98,31 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = {
128 [ 13 ] = KEY_KP7, 98 [ 13 ] = KEY_KP7,
129 [ 14 ] = KEY_KP8, 99 [ 14 ] = KEY_KP8,
130 [ 15 ] = KEY_KP9, 100 [ 15 ] = KEY_KP9,
131 [ 18 ] = KEY_KP0,
132 101
133 [ 0 ] = KEY_POWER, 102 [ 0 ] = KEY_POWER,
134// [ 27 ] = MTS button 103 [ 2 ] = KEY_TUNER, /* TV/FM */
135 [ 2 ] = KEY_TUNER, // TV/FM
136 [ 30 ] = KEY_VIDEO, 104 [ 30 ] = KEY_VIDEO,
137// [ 22 ] = display button
138 [ 4 ] = KEY_VOLUMEUP, 105 [ 4 ] = KEY_VOLUMEUP,
139 [ 8 ] = KEY_VOLUMEDOWN, 106 [ 8 ] = KEY_VOLUMEDOWN,
140 [ 12 ] = KEY_CHANNELUP, 107 [ 12 ] = KEY_CHANNELUP,
141 [ 16 ] = KEY_CHANNELDOWN, 108 [ 16 ] = KEY_CHANNELDOWN,
142 [ 3 ] = KEY_ZOOM, // fullscreen 109 [ 3 ] = KEY_ZOOM, /* fullscreen */
143 [ 31 ] = KEY_SUBTITLE, // closed caption/teletext 110 [ 31 ] = KEY_SUBTITLE, /* closed caption/teletext */
144 [ 32 ] = KEY_SLEEP, 111 [ 32 ] = KEY_SLEEP,
145// [ 41 ] = boss key
146 [ 20 ] = KEY_MUTE, 112 [ 20 ] = KEY_MUTE,
147 [ 43 ] = KEY_RED, 113 [ 43 ] = KEY_RED,
148 [ 44 ] = KEY_GREEN, 114 [ 44 ] = KEY_GREEN,
149 [ 45 ] = KEY_YELLOW, 115 [ 45 ] = KEY_YELLOW,
150 [ 46 ] = KEY_BLUE, 116 [ 46 ] = KEY_BLUE,
151 [ 24 ] = KEY_KPPLUS, //fine tune + 117 [ 24 ] = KEY_KPPLUS, /* fine tune + */
152 [ 25 ] = KEY_KPMINUS, //fine tune - 118 [ 25 ] = KEY_KPMINUS, /* fine tune - */
153// [ 42 ] = picture in picture
154 [ 33 ] = KEY_KPDOT, 119 [ 33 ] = KEY_KPDOT,
155 [ 19 ] = KEY_KPENTER, 120 [ 19 ] = KEY_KPENTER,
156// [ 17 ] = recall
157 [ 34 ] = KEY_BACK, 121 [ 34 ] = KEY_BACK,
158 [ 35 ] = KEY_PLAYPAUSE, 122 [ 35 ] = KEY_PLAYPAUSE,
159 [ 36 ] = KEY_NEXT, 123 [ 36 ] = KEY_NEXT,
160// [ 37 ] = time shifting
161 [ 38 ] = KEY_STOP, 124 [ 38 ] = KEY_STOP,
162 [ 39 ] = KEY_RECORD 125 [ 39 ] = KEY_RECORD
163// [ 40 ] = snapshot
164}; 126};
165EXPORT_SYMBOL_GPL(ir_codes_winfast); 127EXPORT_SYMBOL_GPL(ir_codes_winfast);
166 128
@@ -174,54 +136,61 @@ EXPORT_SYMBOL_GPL(ir_codes_empty);
174 * slightly different versions), shipped with cx88+ivtv cards. 136 * slightly different versions), shipped with cx88+ivtv cards.
175 * almost rc5 coding, but some non-standard keys */ 137 * almost rc5 coding, but some non-standard keys */
176IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = { 138IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = {
177 [ 0x00 ] = KEY_KP0, // 0 139 /* Keys 0 to 9 */
178 [ 0x01 ] = KEY_KP1, // 1 140 [ 0x00 ] = KEY_KP0,
179 [ 0x02 ] = KEY_KP2, // 2 141 [ 0x01 ] = KEY_KP1,
180 [ 0x03 ] = KEY_KP3, // 3 142 [ 0x02 ] = KEY_KP2,
181 [ 0x04 ] = KEY_KP4, // 4 143 [ 0x03 ] = KEY_KP3,
182 [ 0x05 ] = KEY_KP5, // 5 144 [ 0x04 ] = KEY_KP4,
183 [ 0x06 ] = KEY_KP6, // 6 145 [ 0x05 ] = KEY_KP5,
184 [ 0x07 ] = KEY_KP7, // 7 146 [ 0x06 ] = KEY_KP6,
185 [ 0x08 ] = KEY_KP8, // 8 147 [ 0x07 ] = KEY_KP7,
186 [ 0x09 ] = KEY_KP9, // 9 148 [ 0x08 ] = KEY_KP8,
187 [ 0x0a ] = KEY_TEXT, // keypad asterisk as well 149 [ 0x09 ] = KEY_KP9,
188 [ 0x0b ] = KEY_RED, // red button 150
189 [ 0x0c ] = KEY_RADIO, // radio 151 [ 0x0a ] = KEY_TEXT, /* keypad asterisk as well */
190 [ 0x0d ] = KEY_MENU, // menu 152 [ 0x0b ] = KEY_RED, /* red button */
191 [ 0x0e ] = KEY_SUBTITLE, // also the # key 153 [ 0x0c ] = KEY_RADIO,
192 [ 0x0f ] = KEY_MUTE, // mute 154 [ 0x0d ] = KEY_MENU,
193 [ 0x10 ] = KEY_VOLUMEUP, // volume + 155 [ 0x0e ] = KEY_SUBTITLE, /* also the # key */
194 [ 0x11 ] = KEY_VOLUMEDOWN, // volume - 156 [ 0x0f ] = KEY_MUTE,
195 [ 0x12 ] = KEY_PREVIOUS, // previous channel 157 [ 0x10 ] = KEY_VOLUMEUP,
196 [ 0x14 ] = KEY_UP, // up 158 [ 0x11 ] = KEY_VOLUMEDOWN,
197 [ 0x15 ] = KEY_DOWN, // down 159 [ 0x12 ] = KEY_PREVIOUS, /* previous channel */
198 [ 0x16 ] = KEY_LEFT, // left 160 [ 0x14 ] = KEY_UP,
199 [ 0x17 ] = KEY_RIGHT, // right 161 [ 0x15 ] = KEY_DOWN,
200 [ 0x18 ] = KEY_VIDEO, // Videos 162 [ 0x16 ] = KEY_LEFT,
201 [ 0x19 ] = KEY_AUDIO, // Music 163 [ 0x17 ] = KEY_RIGHT,
202 [ 0x1a ] = KEY_MHP, // Pictures - presume this means "Multimedia Home Platform"- no "PICTURES" key in input.h 164 [ 0x18 ] = KEY_VIDEO, /* Videos */
203 [ 0x1b ] = KEY_EPG, // Guide 165 [ 0x19 ] = KEY_AUDIO, /* Music */
204 [ 0x1c ] = KEY_TV, // TV 166 /* 0x1a: Pictures - presume this means
205 [ 0x1e ] = KEY_NEXTSONG, // skip >| 167 "Multimedia Home Platform" -
206 [ 0x1f ] = KEY_EXIT, // back/exit 168 no "PICTURES" key in input.h
207 [ 0x20 ] = KEY_CHANNELUP, // channel / program + 169 */
208 [ 0x21 ] = KEY_CHANNELDOWN, // channel / program - 170 [ 0x1a ] = KEY_MHP,
209 [ 0x22 ] = KEY_CHANNEL, // source (old black remote) 171
210 [ 0x24 ] = KEY_PREVIOUSSONG, // replay |< 172 [ 0x1b ] = KEY_EPG, /* Guide */
211 [ 0x25 ] = KEY_ENTER, // OK 173 [ 0x1c ] = KEY_TV,
212 [ 0x26 ] = KEY_SLEEP, // minimize (old black remote) 174 [ 0x1e ] = KEY_NEXTSONG, /* skip >| */
213 [ 0x29 ] = KEY_BLUE, // blue key 175 [ 0x1f ] = KEY_EXIT, /* back/exit */
214 [ 0x2e ] = KEY_GREEN, // green button 176 [ 0x20 ] = KEY_CHANNELUP, /* channel / program + */
215 [ 0x30 ] = KEY_PAUSE, // pause 177 [ 0x21 ] = KEY_CHANNELDOWN, /* channel / program - */
216 [ 0x32 ] = KEY_REWIND, // backward << 178 [ 0x22 ] = KEY_CHANNEL, /* source (old black remote) */
217 [ 0x34 ] = KEY_FASTFORWARD, // forward >> 179 [ 0x24 ] = KEY_PREVIOUSSONG, /* replay |< */
218 [ 0x35 ] = KEY_PLAY, // play 180 [ 0x25 ] = KEY_ENTER, /* OK */
219 [ 0x36 ] = KEY_STOP, // stop 181 [ 0x26 ] = KEY_SLEEP, /* minimize (old black remote) */
220 [ 0x37 ] = KEY_RECORD, // recording 182 [ 0x29 ] = KEY_BLUE, /* blue key */
221 [ 0x38 ] = KEY_YELLOW, // yellow key 183 [ 0x2e ] = KEY_GREEN, /* green button */
222 [ 0x3b ] = KEY_SELECT, // top right button 184 [ 0x30 ] = KEY_PAUSE, /* pause */
223 [ 0x3c ] = KEY_ZOOM, // full 185 [ 0x32 ] = KEY_REWIND, /* backward << */
224 [ 0x3d ] = KEY_POWER, // system power (green button) 186 [ 0x34 ] = KEY_FASTFORWARD, /* forward >> */
187 [ 0x35 ] = KEY_PLAY,
188 [ 0x36 ] = KEY_STOP,
189 [ 0x37 ] = KEY_RECORD, /* recording */
190 [ 0x38 ] = KEY_YELLOW, /* yellow key */
191 [ 0x3b ] = KEY_SELECT, /* top right button */
192 [ 0x3c ] = KEY_ZOOM, /* full */
193 [ 0x3d ] = KEY_POWER, /* system power (green button) */
225}; 194};
226EXPORT_SYMBOL(ir_codes_hauppauge_new); 195EXPORT_SYMBOL(ir_codes_hauppauge_new);
227 196
@@ -237,9 +206,9 @@ IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = {
237 [ 10 ] = KEY_KP8, 206 [ 10 ] = KEY_KP8,
238 [ 18 ] = KEY_KP9, 207 [ 18 ] = KEY_KP9,
239 208
240 [ 3 ] = KEY_TUNER, // TV/FM 209 [ 3 ] = KEY_TUNER, /* TV/FM */
241 [ 7 ] = KEY_SEARCH, // scan 210 [ 7 ] = KEY_SEARCH, /* scan */
242 [ 28 ] = KEY_ZOOM, // full screen 211 [ 28 ] = KEY_ZOOM, /* full screen */
243 [ 30 ] = KEY_POWER, 212 [ 30 ] = KEY_POWER,
244 [ 23 ] = KEY_VOLUMEDOWN, 213 [ 23 ] = KEY_VOLUMEDOWN,
245 [ 31 ] = KEY_VOLUMEUP, 214 [ 31 ] = KEY_VOLUMEUP,
@@ -247,14 +216,14 @@ IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = {
247 [ 22 ] = KEY_CHANNELUP, 216 [ 22 ] = KEY_CHANNELUP,
248 [ 24 ] = KEY_MUTE, 217 [ 24 ] = KEY_MUTE,
249 218
250 [ 0 ] = KEY_LIST, // source 219 [ 0 ] = KEY_LIST, /* source */
251 [ 19 ] = KEY_INFO, // loop 220 [ 19 ] = KEY_INFO, /* loop */
252 [ 16 ] = KEY_LAST, // +100 221 [ 16 ] = KEY_LAST, /* +100 */
253 [ 13 ] = KEY_CLEAR, // reset 222 [ 13 ] = KEY_CLEAR, /* reset */
254 [ 12 ] = BTN_RIGHT, // fun++ 223 [ 12 ] = BTN_RIGHT, /* fun++ */
255 [ 4 ] = BTN_LEFT, // fun-- 224 [ 4 ] = BTN_LEFT, /* fun-- */
256 [ 14 ] = KEY_GOTO, // function 225 [ 14 ] = KEY_GOTO, /* function */
257 [ 15 ] = KEY_STOP, // freeze 226 [ 15 ] = KEY_STOP, /* freeze */
258}; 227};
259EXPORT_SYMBOL(ir_codes_pixelview); 228EXPORT_SYMBOL(ir_codes_pixelview);
260 229
@@ -321,10 +290,6 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir,
321 ir->keypressed = 1; 290 ir->keypressed = 1;
322 ir_input_key_event(dev,ir); 291 ir_input_key_event(dev,ir);
323 } 292 }
324#if 0
325 /* maybe do something like this ??? */
326 input_event(a, EV_IR, ir->ir_type, ir->ir_raw);
327#endif
328} 293}
329 294
330/* -------------------------------------------------------------------------- */ 295/* -------------------------------------------------------------------------- */