aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-input.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-07-12 16:58:44 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-12 19:01:04 -0400
commit41ef7c1ed48cb273c7b7a9ffd48a262a22f84483 (patch)
treec3a2772ae4eb3ea34c5023921095b78d2acd352e /drivers/media/video/cx88/cx88-input.c
parentfa9846a8c5965636fbade8655ae0ce1f9a655bd4 (diff)
[PATCH] v4l: CX88 Update
- Removed unused structures. - Removed BTTV version check. - Some debug structs moved to their own .c file and converted to static - Comment changed to express better when attach_inform is running - set_freq removed from set_mode at tuner-core.c. - I2C cleanups and converged to a basic reference structure. - Rename tuner structures fields. - It calls VIDIOC_G_FREQUENCY to get tuner freq from tuner. - added missing contrast offset value, set to 0. - Let Kconfig decide whether to include frontend-specific code. Signed-Off-By: Nickolay V. Shmyrev <nshmyrev@yandex.ru> Signed-off-by: Michael Krufky <mkrufky@m1k.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media/video/cx88/cx88-input.c')
-rw-r--r--drivers/media/video/cx88/cx88-input.c448
1 files changed, 227 insertions, 221 deletions
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index bdc26e75ab5f..214887798192 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: cx88-input.c,v 1.13 2005/06/13 16:07:46 nsh Exp $ 2 * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $
3 * 3 *
4 * Device driver for GPIO attached remote control interfaces 4 * Device driver for GPIO attached remote control interfaces
5 * on Conexant 2388x based TV/DVB cards. 5 * on Conexant 2388x based TV/DVB cards.
@@ -38,199 +38,206 @@
38 38
39/* DigitalNow DNTV Live DVB-T Remote */ 39/* DigitalNow DNTV Live DVB-T Remote */
40static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = { 40static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = {
41 [ 0x00 ] = KEY_ESC, // 'go up a level?' 41 [0x00] = KEY_ESC, /* 'go up a level?' */
42 [ 0x01 ] = KEY_KP1, // '1' 42 /* Keys 0 to 9 */
43 [ 0x02 ] = KEY_KP2, // '2' 43 [0x0a] = KEY_KP0,
44 [ 0x03 ] = KEY_KP3, // '3' 44 [0x01] = KEY_KP1,
45 [ 0x04 ] = KEY_KP4, // '4' 45 [0x02] = KEY_KP2,
46 [ 0x05 ] = KEY_KP5, // '5' 46 [0x03] = KEY_KP3,
47 [ 0x06 ] = KEY_KP6, // '6' 47 [0x04] = KEY_KP4,
48 [ 0x07 ] = KEY_KP7, // '7' 48 [0x05] = KEY_KP5,
49 [ 0x08 ] = KEY_KP8, // '8' 49 [0x06] = KEY_KP6,
50 [ 0x09 ] = KEY_KP9, // '9' 50 [0x07] = KEY_KP7,
51 [ 0x0a ] = KEY_KP0, // '0' 51 [0x08] = KEY_KP8,
52 [ 0x0b ] = KEY_TUNER, // 'tv/fm' 52 [0x09] = KEY_KP9,
53 [ 0x0c ] = KEY_SEARCH, // 'scan' 53
54 [ 0x0d ] = KEY_STOP, // 'stop' 54 [0x0b] = KEY_TUNER, /* tv/fm */
55 [ 0x0e ] = KEY_PAUSE, // 'pause' 55 [0x0c] = KEY_SEARCH, /* scan */
56 [ 0x0f ] = KEY_LIST, // 'source' 56 [0x0d] = KEY_STOP,
57 57 [0x0e] = KEY_PAUSE,
58 [ 0x10 ] = KEY_MUTE, // 'mute' 58 [0x0f] = KEY_LIST, /* source */
59 [ 0x11 ] = KEY_REWIND, // 'backward <<' 59
60 [ 0x12 ] = KEY_POWER, // 'power' 60 [0x10] = KEY_MUTE,
61 [ 0x13 ] = KEY_S, // 'snap' 61 [0x11] = KEY_REWIND, /* backward << */
62 [ 0x14 ] = KEY_AUDIO, // 'stereo' 62 [0x12] = KEY_POWER,
63 [ 0x15 ] = KEY_CLEAR, // 'reset' 63 [0x13] = KEY_S, /* snap */
64 [ 0x16 ] = KEY_PLAY, // 'play' 64 [0x14] = KEY_AUDIO, /* stereo */
65 [ 0x17 ] = KEY_ENTER, // 'enter' 65 [0x15] = KEY_CLEAR, /* reset */
66 [ 0x18 ] = KEY_ZOOM, // 'full screen' 66 [0x16] = KEY_PLAY,
67 [ 0x19 ] = KEY_FASTFORWARD, // 'forward >>' 67 [0x17] = KEY_ENTER,
68 [ 0x1a ] = KEY_CHANNELUP, // 'channel +' 68 [0x18] = KEY_ZOOM, /* full screen */
69 [ 0x1b ] = KEY_VOLUMEUP, // 'volume +' 69 [0x19] = KEY_FASTFORWARD, /* forward >> */
70 [ 0x1c ] = KEY_INFO, // 'preview' 70 [0x1a] = KEY_CHANNELUP,
71 [ 0x1d ] = KEY_RECORD, // 'record' 71 [0x1b] = KEY_VOLUMEUP,
72 [ 0x1e ] = KEY_CHANNELDOWN, // 'channel -' 72 [0x1c] = KEY_INFO, /* preview */
73 [ 0x1f ] = KEY_VOLUMEDOWN, // 'volume -' 73 [0x1d] = KEY_RECORD, /* record */
74 [0x1e] = KEY_CHANNELDOWN,
75 [0x1f] = KEY_VOLUMEDOWN,
74}; 76};
75 77
76/* ---------------------------------------------------------------------- */ 78/* ---------------------------------------------------------------------- */
77 79
78/* IO-DATA BCTV7E Remote */ 80/* IO-DATA BCTV7E Remote */
79static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = { 81static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = {
80 [ 0x40 ] = KEY_TV, // TV 82 [0x40] = KEY_TV,
81 [ 0x20 ] = KEY_RADIO, // FM 83 [0x20] = KEY_RADIO, /* FM */
82 [ 0x60 ] = KEY_EPG, // EPG 84 [0x60] = KEY_EPG,
83 [ 0x00 ] = KEY_POWER, // power 85 [0x00] = KEY_POWER,
84 86
85 [ 0x50 ] = KEY_KP1, // 1 87 /* Keys 0 to 9 */
86 [ 0x30 ] = KEY_KP2, // 2 88 [0x44] = KEY_KP0, /* 10 */
87 [ 0x70 ] = KEY_KP3, // 3 89 [0x50] = KEY_KP1,
88 [ 0x10 ] = KEY_L, // Live 90 [0x30] = KEY_KP2,
89 91 [0x70] = KEY_KP3,
90 [ 0x48 ] = KEY_KP4, // 4 92 [0x48] = KEY_KP4,
91 [ 0x28 ] = KEY_KP5, // 5 93 [0x28] = KEY_KP5,
92 [ 0x68 ] = KEY_KP6, // 6 94 [0x68] = KEY_KP6,
93 [ 0x08 ] = KEY_T, // Time Shift 95 [0x58] = KEY_KP7,
94 96 [0x38] = KEY_KP8,
95 [ 0x58 ] = KEY_KP7, // 7 97 [0x78] = KEY_KP9,
96 [ 0x38 ] = KEY_KP8, // 8 98
97 [ 0x78 ] = KEY_KP9, // 9 99 [0x10] = KEY_L, /* Live */
98 [ 0x18 ] = KEY_PLAYPAUSE, // Play 100 [0x08] = KEY_T, /* Time Shift */
99 101
100 [ 0x44 ] = KEY_KP0, // 10 102 [0x18] = KEY_PLAYPAUSE, /* Play */
101 [ 0x24 ] = KEY_ENTER, // 11 103
102 [ 0x64 ] = KEY_ESC, // 12 104 [0x24] = KEY_ENTER, /* 11 */
103 [ 0x04 ] = KEY_M, // Multi 105 [0x64] = KEY_ESC, /* 12 */
104 106 [0x04] = KEY_M, /* Multi */
105 [ 0x54 ] = KEY_VIDEO, // VIDEO 107
106 [ 0x34 ] = KEY_CHANNELUP, // channel + 108 [0x54] = KEY_VIDEO,
107 [ 0x74 ] = KEY_VOLUMEUP, // volume + 109 [0x34] = KEY_CHANNELUP,
108 [ 0x14 ] = KEY_MUTE, // Mute 110 [0x74] = KEY_VOLUMEUP,
109 111 [0x14] = KEY_MUTE,
110 [ 0x4c ] = KEY_S, // SVIDEO 112
111 [ 0x2c ] = KEY_CHANNELDOWN, // channel - 113 [0x4c] = KEY_S, /* SVIDEO */
112 [ 0x6c ] = KEY_VOLUMEDOWN, // volume - 114 [0x2c] = KEY_CHANNELDOWN,
113 [ 0x0c ] = KEY_ZOOM, // Zoom 115 [0x6c] = KEY_VOLUMEDOWN,
114 116 [0x0c] = KEY_ZOOM,
115 [ 0x5c ] = KEY_PAUSE, // pause 117
116 [ 0x3c ] = KEY_C, // || (red) 118 [0x5c] = KEY_PAUSE,
117 [ 0x7c ] = KEY_RECORD, // recording 119 [0x3c] = KEY_C, /* || (red) */
118 [ 0x1c ] = KEY_STOP, // stop 120 [0x7c] = KEY_RECORD, /* recording */
119 121 [0x1c] = KEY_STOP,
120 [ 0x41 ] = KEY_REWIND, // backward << 122
121 [ 0x21 ] = KEY_PLAY, // play 123 [0x41] = KEY_REWIND, /* backward << */
122 [ 0x61 ] = KEY_FASTFORWARD, // forward >> 124 [0x21] = KEY_PLAY,
123 [ 0x01 ] = KEY_NEXT, // skip >| 125 [0x61] = KEY_FASTFORWARD, /* forward >> */
126 [0x01] = KEY_NEXT, /* skip >| */
124}; 127};
125 128
126/* ---------------------------------------------------------------------- */ 129/* ---------------------------------------------------------------------- */
127 130
128/* ADS Tech Instant TV DVB-T PCI Remote */ 131/* ADS Tech Instant TV DVB-T PCI Remote */
129static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = { 132static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = {
130 [ 0x5b ] = KEY_POWER, 133 /* Keys 0 to 9 */
131 [ 0x5f ] = KEY_MUTE, 134 [0x4d] = KEY_0,
132 [ 0x57 ] = KEY_1, 135 [0x57] = KEY_1,
133 [ 0x4f ] = KEY_2, 136 [0x4f] = KEY_2,
134 [ 0x53 ] = KEY_3, 137 [0x53] = KEY_3,
135 [ 0x56 ] = KEY_4, 138 [0x56] = KEY_4,
136 [ 0x4e ] = KEY_5, 139 [0x4e] = KEY_5,
137 [ 0x5e ] = KEY_6, 140 [0x5e] = KEY_6,
138 [ 0x54 ] = KEY_7, 141 [0x54] = KEY_7,
139 [ 0x4c ] = KEY_8, 142 [0x4c] = KEY_8,
140 [ 0x5c ] = KEY_9, 143 [0x5c] = KEY_9,
141 [ 0x4d ] = KEY_0, 144
142 [ 0x55 ] = KEY_GOTO, 145 [0x5b] = KEY_POWER,
143 [ 0x5d ] = KEY_SEARCH, 146 [0x5f] = KEY_MUTE,
144 [ 0x17 ] = KEY_EPG, // Guide 147 [0x55] = KEY_GOTO,
145 [ 0x1f ] = KEY_MENU, 148 [0x5d] = KEY_SEARCH,
146 [ 0x0f ] = KEY_UP, 149 [0x17] = KEY_EPG, /* Guide */
147 [ 0x46 ] = KEY_DOWN, 150 [0x1f] = KEY_MENU,
148 [ 0x16 ] = KEY_LEFT, 151 [0x0f] = KEY_UP,
149 [ 0x1e ] = KEY_RIGHT, 152 [0x46] = KEY_DOWN,
150 [ 0x0e ] = KEY_SELECT, // Enter 153 [0x16] = KEY_LEFT,
151 [ 0x5a ] = KEY_INFO, 154 [0x1e] = KEY_RIGHT,
152 [ 0x52 ] = KEY_EXIT, 155 [0x0e] = KEY_SELECT, /* Enter */
153 [ 0x59 ] = KEY_PREVIOUS, 156 [0x5a] = KEY_INFO,
154 [ 0x51 ] = KEY_NEXT, 157 [0x52] = KEY_EXIT,
155 [ 0x58 ] = KEY_REWIND, 158 [0x59] = KEY_PREVIOUS,
156 [ 0x50 ] = KEY_FORWARD, 159 [0x51] = KEY_NEXT,
157 [ 0x44 ] = KEY_PLAYPAUSE, 160 [0x58] = KEY_REWIND,
158 [ 0x07 ] = KEY_STOP, 161 [0x50] = KEY_FORWARD,
159 [ 0x1b ] = KEY_RECORD, 162 [0x44] = KEY_PLAYPAUSE,
160 [ 0x13 ] = KEY_TUNER, // Live 163 [0x07] = KEY_STOP,
161 [ 0x0a ] = KEY_A, 164 [0x1b] = KEY_RECORD,
162 [ 0x12 ] = KEY_B, 165 [0x13] = KEY_TUNER, /* Live */
163 [ 0x03 ] = KEY_PROG1, // 1 166 [0x0a] = KEY_A,
164 [ 0x01 ] = KEY_PROG2, // 2 167 [0x12] = KEY_B,
165 [ 0x00 ] = KEY_PROG3, // 3 168 [0x03] = KEY_PROG1, /* 1 */
166 [ 0x06 ] = KEY_DVD, 169 [0x01] = KEY_PROG2, /* 2 */
167 [ 0x48 ] = KEY_AUX, // Photo 170 [0x00] = KEY_PROG3, /* 3 */
168 [ 0x40 ] = KEY_VIDEO, 171 [0x06] = KEY_DVD,
169 [ 0x19 ] = KEY_AUDIO, // Music 172 [0x48] = KEY_AUX, /* Photo */
170 [ 0x0b ] = KEY_CHANNELUP, 173 [0x40] = KEY_VIDEO,
171 [ 0x08 ] = KEY_CHANNELDOWN, 174 [0x19] = KEY_AUDIO, /* Music */
172 [ 0x15 ] = KEY_VOLUMEUP, 175 [0x0b] = KEY_CHANNELUP,
173 [ 0x1c ] = KEY_VOLUMEDOWN, 176 [0x08] = KEY_CHANNELDOWN,
177 [0x15] = KEY_VOLUMEUP,
178 [0x1c] = KEY_VOLUMEDOWN,
174}; 179};
175 180
176/* ---------------------------------------------------------------------- */ 181/* ---------------------------------------------------------------------- */
177 182
178/* MSI TV@nywhere remote */ 183/* MSI TV@nywhere remote */
179static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = { 184static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = {
180 [ 0x00 ] = KEY_0, /* '0' */ 185 /* Keys 0 to 9 */
181 [ 0x01 ] = KEY_1, /* '1' */ 186 [0x00] = KEY_0,
182 [ 0x02 ] = KEY_2, /* '2' */ 187 [0x01] = KEY_1,
183 [ 0x03 ] = KEY_3, /* '3' */ 188 [0x02] = KEY_2,
184 [ 0x04 ] = KEY_4, /* '4' */ 189 [0x03] = KEY_3,
185 [ 0x05 ] = KEY_5, /* '5' */ 190 [0x04] = KEY_4,
186 [ 0x06 ] = KEY_6, /* '6' */ 191 [0x05] = KEY_5,
187 [ 0x07 ] = KEY_7, /* '7' */ 192 [0x06] = KEY_6,
188 [ 0x08 ] = KEY_8, /* '8' */ 193 [0x07] = KEY_7,
189 [ 0x09 ] = KEY_9, /* '9' */ 194 [0x08] = KEY_8,
190 [ 0x0c ] = KEY_MUTE, /* 'Mute' */ 195 [0x09] = KEY_9,
191 [ 0x0f ] = KEY_SCREEN, /* 'Full Screen' */ 196
192 [ 0x10 ] = KEY_F, /* 'Funtion' */ 197 [0x0c] = KEY_MUTE,
193 [ 0x11 ] = KEY_T, /* 'Time shift' */ 198 [0x0f] = KEY_SCREEN, /* Full Screen */
194 [ 0x12 ] = KEY_POWER, /* 'Power' */ 199 [0x10] = KEY_F, /* Funtion */
195 [ 0x13 ] = KEY_MEDIA, /* 'MTS' */ 200 [0x11] = KEY_T, /* Time shift */
196 [ 0x14 ] = KEY_SLOW, /* 'Slow' */ 201 [0x12] = KEY_POWER,
197 [ 0x16 ] = KEY_REWIND, /* 'backward <<' */ 202 [0x13] = KEY_MEDIA, /* MTS */
198 [ 0x17 ] = KEY_ENTER, /* 'Return' */ 203 [0x14] = KEY_SLOW,
199 [ 0x18 ] = KEY_FASTFORWARD, /* 'forward >>' */ 204 [0x16] = KEY_REWIND, /* backward << */
200 [ 0x1a ] = KEY_CHANNELUP, /* 'Channel+' */ 205 [0x17] = KEY_ENTER, /* Return */
201 [ 0x1b ] = KEY_VOLUMEUP, /* 'Volume+' */ 206 [0x18] = KEY_FASTFORWARD, /* forward >> */
202 [ 0x1e ] = KEY_CHANNELDOWN, /* 'Channel-' */ 207 [0x1a] = KEY_CHANNELUP,
203 [ 0x1f ] = KEY_VOLUMEDOWN, /* 'Volume-' */ 208 [0x1b] = KEY_VOLUMEUP,
209 [0x1e] = KEY_CHANNELDOWN,
210 [0x1f] = KEY_VOLUMEDOWN,
204}; 211};
205 212
206/* ---------------------------------------------------------------------- */ 213/* ---------------------------------------------------------------------- */
207 214
208struct cx88_IR { 215struct cx88_IR {
209 struct cx88_core *core; 216 struct cx88_core *core;
210 struct input_dev input; 217 struct input_dev input;
211 struct ir_input_state ir; 218 struct ir_input_state ir;
212 char name[32]; 219 char name[32];
213 char phys[32]; 220 char phys[32];
214 221
215 /* sample from gpio pin 16 */ 222 /* sample from gpio pin 16 */
216 int sampling; 223 int sampling;
217 u32 samples[16]; 224 u32 samples[16];
218 int scount; 225 int scount;
219 unsigned long release; 226 unsigned long release;
220 227
221 /* poll external decoder */ 228 /* poll external decoder */
222 int polling; 229 int polling;
223 struct work_struct work; 230 struct work_struct work;
224 struct timer_list timer; 231 struct timer_list timer;
225 u32 gpio_addr; 232 u32 gpio_addr;
226 u32 last_gpio; 233 u32 last_gpio;
227 u32 mask_keycode; 234 u32 mask_keycode;
228 u32 mask_keydown; 235 u32 mask_keydown;
229 u32 mask_keyup; 236 u32 mask_keyup;
230}; 237};
231 238
232static int ir_debug = 0; 239static int ir_debug = 0;
233module_param(ir_debug, int, 0644); /* debug level [IR] */ 240module_param(ir_debug, int, 0644); /* debug level [IR] */
234MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]"); 241MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
235 242
236#define ir_dprintk(fmt, arg...) if (ir_debug) \ 243#define ir_dprintk(fmt, arg...) if (ir_debug) \
@@ -254,37 +261,37 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
254 /* extract data */ 261 /* extract data */
255 data = ir_extract_bits(gpio, ir->mask_keycode); 262 data = ir_extract_bits(gpio, ir->mask_keycode);
256 ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n", 263 ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
257 gpio, data, 264 gpio, data,
258 ir->polling ? "poll" : "irq", 265 ir->polling ? "poll" : "irq",
259 (gpio & ir->mask_keydown) ? " down" : "", 266 (gpio & ir->mask_keydown) ? " down" : "",
260 (gpio & ir->mask_keyup) ? " up" : ""); 267 (gpio & ir->mask_keyup) ? " up" : "");
261 268
262 if (ir->mask_keydown) { 269 if (ir->mask_keydown) {
263 /* bit set on keydown */ 270 /* bit set on keydown */
264 if (gpio & ir->mask_keydown) { 271 if (gpio & ir->mask_keydown) {
265 ir_input_keydown(&ir->input,&ir->ir,data,data); 272 ir_input_keydown(&ir->input, &ir->ir, data, data);
266 } else { 273 } else {
267 ir_input_nokey(&ir->input,&ir->ir); 274 ir_input_nokey(&ir->input, &ir->ir);
268 } 275 }
269 276
270 } else if (ir->mask_keyup) { 277 } else if (ir->mask_keyup) {
271 /* bit cleared on keydown */ 278 /* bit cleared on keydown */
272 if (0 == (gpio & ir->mask_keyup)) { 279 if (0 == (gpio & ir->mask_keyup)) {
273 ir_input_keydown(&ir->input,&ir->ir,data,data); 280 ir_input_keydown(&ir->input, &ir->ir, data, data);
274 } else { 281 } else {
275 ir_input_nokey(&ir->input,&ir->ir); 282 ir_input_nokey(&ir->input, &ir->ir);
276 } 283 }
277 284
278 } else { 285 } else {
279 /* can't distinguish keydown/up :-/ */ 286 /* can't distinguish keydown/up :-/ */
280 ir_input_keydown(&ir->input,&ir->ir,data,data); 287 ir_input_keydown(&ir->input, &ir->ir, data, data);
281 ir_input_nokey(&ir->input,&ir->ir); 288 ir_input_nokey(&ir->input, &ir->ir);
282 } 289 }
283} 290}
284 291
285static void ir_timer(unsigned long data) 292static void ir_timer(unsigned long data)
286{ 293{
287 struct cx88_IR *ir = (struct cx88_IR*)data; 294 struct cx88_IR *ir = (struct cx88_IR *)data;
288 295
289 schedule_work(&ir->work); 296 schedule_work(&ir->work);
290} 297}
@@ -307,62 +314,62 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
307 IR_KEYTAB_TYPE *ir_codes = NULL; 314 IR_KEYTAB_TYPE *ir_codes = NULL;
308 int ir_type = IR_TYPE_OTHER; 315 int ir_type = IR_TYPE_OTHER;
309 316
310 ir = kmalloc(sizeof(*ir),GFP_KERNEL); 317 ir = kmalloc(sizeof(*ir), GFP_KERNEL);
311 if (NULL == ir) 318 if (NULL == ir)
312 return -ENOMEM; 319 return -ENOMEM;
313 memset(ir,0,sizeof(*ir)); 320 memset(ir, 0, sizeof(*ir));
314 321
315 /* detect & configure */ 322 /* detect & configure */
316 switch (core->board) { 323 switch (core->board) {
317 case CX88_BOARD_DNTV_LIVE_DVB_T: 324 case CX88_BOARD_DNTV_LIVE_DVB_T:
318 case CX88_BOARD_KWORLD_DVB_T: 325 case CX88_BOARD_KWORLD_DVB_T:
319 ir_codes = ir_codes_dntv_live_dvb_t; 326 ir_codes = ir_codes_dntv_live_dvb_t;
320 ir->gpio_addr = MO_GP1_IO; 327 ir->gpio_addr = MO_GP1_IO;
321 ir->mask_keycode = 0x1f; 328 ir->mask_keycode = 0x1f;
322 ir->mask_keyup = 0x60; 329 ir->mask_keyup = 0x60;
323 ir->polling = 50; // ms 330 ir->polling = 50; /* ms */
324 break; 331 break;
325 case CX88_BOARD_HAUPPAUGE: 332 case CX88_BOARD_HAUPPAUGE:
326 case CX88_BOARD_HAUPPAUGE_DVB_T1: 333 case CX88_BOARD_HAUPPAUGE_DVB_T1:
327 ir_codes = ir_codes_hauppauge_new; 334 ir_codes = ir_codes_hauppauge_new;
328 ir_type = IR_TYPE_RC5; 335 ir_type = IR_TYPE_RC5;
329 ir->sampling = 1; 336 ir->sampling = 1;
330 break; 337 break;
331 case CX88_BOARD_WINFAST2000XP_EXPERT: 338 case CX88_BOARD_WINFAST2000XP_EXPERT:
332 ir_codes = ir_codes_winfast; 339 ir_codes = ir_codes_winfast;
333 ir->gpio_addr = MO_GP0_IO; 340 ir->gpio_addr = MO_GP0_IO;
334 ir->mask_keycode = 0x8f8; 341 ir->mask_keycode = 0x8f8;
335 ir->mask_keyup = 0x100; 342 ir->mask_keyup = 0x100;
336 ir->polling = 1; // ms 343 ir->polling = 1; /* ms */
337 break; 344 break;
338 case CX88_BOARD_IODATA_GVBCTV7E: 345 case CX88_BOARD_IODATA_GVBCTV7E:
339 ir_codes = ir_codes_iodata_bctv7e; 346 ir_codes = ir_codes_iodata_bctv7e;
340 ir->gpio_addr = MO_GP0_IO; 347 ir->gpio_addr = MO_GP0_IO;
341 ir->mask_keycode = 0xfd; 348 ir->mask_keycode = 0xfd;
342 ir->mask_keydown = 0x02; 349 ir->mask_keydown = 0x02;
343 ir->polling = 5; // ms 350 ir->polling = 5; /* ms */
344 break; 351 break;
345 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: 352 case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
346 ir_codes = ir_codes_pixelview; 353 ir_codes = ir_codes_pixelview;
347 ir->gpio_addr = MO_GP1_IO; 354 ir->gpio_addr = MO_GP1_IO;
348 ir->mask_keycode = 0x1f; 355 ir->mask_keycode = 0x1f;
349 ir->mask_keyup = 0x80; 356 ir->mask_keyup = 0x80;
350 ir->polling = 1; // ms 357 ir->polling = 1; /* ms */
351 break; 358 break;
352 case CX88_BOARD_ADSTECH_DVB_T_PCI: 359 case CX88_BOARD_ADSTECH_DVB_T_PCI:
353 ir_codes = ir_codes_adstech_dvb_t_pci; 360 ir_codes = ir_codes_adstech_dvb_t_pci;
354 ir->gpio_addr = MO_GP1_IO; 361 ir->gpio_addr = MO_GP1_IO;
355 ir->mask_keycode = 0xbf; 362 ir->mask_keycode = 0xbf;
356 ir->mask_keyup = 0x40; 363 ir->mask_keyup = 0x40;
357 ir->polling = 50; // ms 364 ir->polling = 50; /* ms */
365 break;
366 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
367 ir_codes = ir_codes_msi_tvanywhere;
368 ir->gpio_addr = MO_GP1_IO;
369 ir->mask_keycode = 0x1f;
370 ir->mask_keyup = 0x40;
371 ir->polling = 1; /* ms */
358 break; 372 break;
359 case CX88_BOARD_MSI_TVANYWHERE_MASTER:
360 ir_codes = ir_codes_msi_tvanywhere;
361 ir->gpio_addr = MO_GP1_IO;
362 ir->mask_keycode = 0x1f;
363 ir->mask_keyup = 0x40;
364 ir->polling = 1;
365 break;
366 } 373 }
367 374
368 if (NULL == ir_codes) { 375 if (NULL == ir_codes) {
@@ -373,8 +380,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
373 /* init input device */ 380 /* init input device */
374 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", 381 snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)",
375 cx88_boards[core->board].name); 382 cx88_boards[core->board].name);
376 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", 383 snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
377 pci_name(pci));
378 384
379 ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes); 385 ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes);
380 ir->input.name = ir->name; 386 ir->input.name = ir->name;
@@ -382,10 +388,10 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
382 ir->input.id.bustype = BUS_PCI; 388 ir->input.id.bustype = BUS_PCI;
383 ir->input.id.version = 1; 389 ir->input.id.version = 1;
384 if (pci->subsystem_vendor) { 390 if (pci->subsystem_vendor) {
385 ir->input.id.vendor = pci->subsystem_vendor; 391 ir->input.id.vendor = pci->subsystem_vendor;
386 ir->input.id.product = pci->subsystem_device; 392 ir->input.id.product = pci->subsystem_device;
387 } else { 393 } else {
388 ir->input.id.vendor = pci->vendor; 394 ir->input.id.vendor = pci->vendor;
389 ir->input.id.product = pci->device; 395 ir->input.id.product = pci->device;
390 } 396 }
391 397
@@ -397,13 +403,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
397 INIT_WORK(&ir->work, cx88_ir_work, ir); 403 INIT_WORK(&ir->work, cx88_ir_work, ir);
398 init_timer(&ir->timer); 404 init_timer(&ir->timer);
399 ir->timer.function = ir_timer; 405 ir->timer.function = ir_timer;
400 ir->timer.data = (unsigned long)ir; 406 ir->timer.data = (unsigned long)ir;
401 schedule_work(&ir->work); 407 schedule_work(&ir->work);
402 } 408 }
403 if (ir->sampling) { 409 if (ir->sampling) {
404 core->pci_irqmask |= (1<<18); // IR_SMP_INT 410 core->pci_irqmask |= (1 << 18); /* IR_SMP_INT */
405 cx_write(MO_DDS_IO, 0xa80a80); // 4 kHz sample rate 411 cx_write(MO_DDS_IO, 0xa80a80); /* 4 kHz sample rate */
406 cx_write(MO_DDSCFG_IO, 0x5); // enable 412 cx_write(MO_DDSCFG_IO, 0x5); /* enable */
407 } 413 }
408 414
409 /* all done */ 415 /* all done */
@@ -439,7 +445,7 @@ int cx88_ir_fini(struct cx88_core *core)
439void cx88_ir_irq(struct cx88_core *core) 445void cx88_ir_irq(struct cx88_core *core)
440{ 446{
441 struct cx88_IR *ir = core->ir; 447 struct cx88_IR *ir = core->ir;
442 u32 samples,rc5; 448 u32 samples, rc5;
443 int i; 449 int i;
444 450
445 if (NULL == ir) 451 if (NULL == ir)
@@ -448,7 +454,7 @@ void cx88_ir_irq(struct cx88_core *core)
448 return; 454 return;
449 455
450 samples = cx_read(MO_SAMPLE_IO); 456 samples = cx_read(MO_SAMPLE_IO);
451 if (0 != samples && 0xffffffff != samples) { 457 if (0 != samples && 0xffffffff != samples) {
452 /* record sample data */ 458 /* record sample data */
453 if (ir->scount < ARRAY_SIZE(ir->samples)) 459 if (ir->scount < ARRAY_SIZE(ir->samples))
454 ir->samples[ir->scount++] = samples; 460 ir->samples[ir->scount++] = samples;
@@ -456,8 +462,8 @@ void cx88_ir_irq(struct cx88_core *core)
456 } 462 }
457 if (!ir->scount) { 463 if (!ir->scount) {
458 /* nothing to sample */ 464 /* nothing to sample */
459 if (ir->ir.keypressed && time_after(jiffies,ir->release)) 465 if (ir->ir.keypressed && time_after(jiffies, ir->release))
460 ir_input_nokey(&ir->input,&ir->ir); 466 ir_input_nokey(&ir->input, &ir->ir);
461 return; 467 return;
462 } 468 }
463 469
@@ -467,14 +473,14 @@ void cx88_ir_irq(struct cx88_core *core)
467 for (i = 0; i < ir->scount; i++) 473 for (i = 0; i < ir->scount; i++)
468 ir->samples[i] = ~ir->samples[i]; 474 ir->samples[i] = ~ir->samples[i];
469 if (ir_debug) 475 if (ir_debug)
470 ir_dump_samples(ir->samples,ir->scount); 476 ir_dump_samples(ir->samples, ir->scount);
471 477
472 /* decode it */ 478 /* decode it */
473 switch (core->board) { 479 switch (core->board) {
474 case CX88_BOARD_HAUPPAUGE: 480 case CX88_BOARD_HAUPPAUGE:
475 case CX88_BOARD_HAUPPAUGE_DVB_T1: 481 case CX88_BOARD_HAUPPAUGE_DVB_T1:
476 rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7); 482 rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
477 ir_dprintk("biphase decoded: %x\n",rc5); 483 ir_dprintk("biphase decoded: %x\n", rc5);
478 if ((rc5 & 0xfffff000) != 0x3000) 484 if ((rc5 & 0xfffff000) != 0x3000)
479 break; 485 break;
480 ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5); 486 ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5);