aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorStefan Ringel <stefan.ringel@arcor.de>2011-05-09 15:53:51 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 19:01:20 -0400
commitfb7ef9831a432a6ae82587d1477103c18f99be73 (patch)
treec1423ee109b1bfddb27b9f5da3795595a5705291 /drivers/staging
parent886a3c0b58f4c3d11a8cf723b8f5ee167708ebf5 (diff)
[media] tm6000: change to virtual inputs
change to virtual inputs Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c257
-rw-r--r--drivers/staging/tm6000/tm6000-core.c60
-rw-r--r--drivers/staging/tm6000/tm6000.h36
3 files changed, 303 insertions, 50 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 31ccd2f67b35..9f4daac12820 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -74,8 +74,6 @@ struct tm6000_board {
74 unsigned eename_pos; /* Position where it appears at ROM */ 74 unsigned eename_pos; /* Position where it appears at ROM */
75 75
76 struct tm6000_capabilities caps; 76 struct tm6000_capabilities caps;
77 enum tm6000_inaudio aradio;
78 enum tm6000_inaudio avideo;
79 77
80 enum tm6000_devtype type; /* variant of the chipset */ 78 enum tm6000_devtype type; /* variant of the chipset */
81 int tuner_type; /* type of the tuner */ 79 int tuner_type; /* type of the tuner */
@@ -84,6 +82,8 @@ struct tm6000_board {
84 82
85 struct tm6000_gpio gpio; 83 struct tm6000_gpio gpio;
86 84
85 struct tm6000_input vinput[3];
86 struct tm6000_input rinput;
87 char *ir_codes; 87 char *ir_codes;
88}; 88};
89 89
@@ -96,6 +96,20 @@ struct tm6000_board tm6000_boards[] = {
96 .gpio = { 96 .gpio = {
97 .tuner_reset = TM6000_GPIO_1, 97 .tuner_reset = TM6000_GPIO_1,
98 }, 98 },
99 .vinput = { {
100 .type = TM6000_INPUT_TV,
101 .vmux = TM6000_VMUX_VIDEO_B,
102 .amux = TM6000_AMUX_ADC1,
103 }, {
104 .type = TM6000_INPUT_COMPOSITE1,
105 .vmux = TM6000_VMUX_VIDEO_A,
106 .amux = TM6000_AMUX_ADC2,
107 }, {
108 .type = TM6000_INPUT_SVIDEO,
109 .vmux = TM6000_VMUX_VIDEO_AB,
110 .amux = TM6000_AMUX_ADC2,
111 },
112 },
99 }, 113 },
100 [TM5600_BOARD_GENERIC] = { 114 [TM5600_BOARD_GENERIC] = {
101 .name = "Generic tm5600 board", 115 .name = "Generic tm5600 board",
@@ -108,6 +122,20 @@ struct tm6000_board tm6000_boards[] = {
108 .gpio = { 122 .gpio = {
109 .tuner_reset = TM6000_GPIO_1, 123 .tuner_reset = TM6000_GPIO_1,
110 }, 124 },
125 .vinput = { {
126 .type = TM6000_INPUT_TV,
127 .vmux = TM6000_VMUX_VIDEO_B,
128 .amux = TM6000_AMUX_ADC1,
129 }, {
130 .type = TM6000_INPUT_COMPOSITE1,
131 .vmux = TM6000_VMUX_VIDEO_A,
132 .amux = TM6000_AMUX_ADC2,
133 }, {
134 .type = TM6000_INPUT_SVIDEO,
135 .vmux = TM6000_VMUX_VIDEO_AB,
136 .amux = TM6000_AMUX_ADC2,
137 },
138 },
111 }, 139 },
112 [TM6000_BOARD_GENERIC] = { 140 [TM6000_BOARD_GENERIC] = {
113 .name = "Generic tm6000 board", 141 .name = "Generic tm6000 board",
@@ -120,6 +148,20 @@ struct tm6000_board tm6000_boards[] = {
120 .gpio = { 148 .gpio = {
121 .tuner_reset = TM6000_GPIO_1, 149 .tuner_reset = TM6000_GPIO_1,
122 }, 150 },
151 .vinput = { {
152 .type = TM6000_INPUT_TV,
153 .vmux = TM6000_VMUX_VIDEO_B,
154 .amux = TM6000_AMUX_ADC1,
155 }, {
156 .type = TM6000_INPUT_COMPOSITE1,
157 .vmux = TM6000_VMUX_VIDEO_A,
158 .amux = TM6000_AMUX_ADC2,
159 }, {
160 .type = TM6000_INPUT_SVIDEO,
161 .vmux = TM6000_VMUX_VIDEO_AB,
162 .amux = TM6000_AMUX_ADC2,
163 },
164 },
123 }, 165 },
124 [TM6010_BOARD_GENERIC] = { 166 [TM6010_BOARD_GENERIC] = {
125 .name = "Generic tm6010 board", 167 .name = "Generic tm6010 board",
@@ -143,6 +185,20 @@ struct tm6000_board tm6000_boards[] = {
143 .dvb_led = TM6010_GPIO_5, 185 .dvb_led = TM6010_GPIO_5,
144 .ir = TM6010_GPIO_0, 186 .ir = TM6010_GPIO_0,
145 }, 187 },
188 .vinput = { {
189 .type = TM6000_INPUT_TV,
190 .vmux = TM6000_VMUX_VIDEO_B,
191 .amux = TM6000_AMUX_SIF1,
192 }, {
193 .type = TM6000_INPUT_COMPOSITE1,
194 .vmux = TM6000_VMUX_VIDEO_A,
195 .amux = TM6000_AMUX_ADC2,
196 }, {
197 .type = TM6000_INPUT_SVIDEO,
198 .vmux = TM6000_VMUX_VIDEO_AB,
199 .amux = TM6000_AMUX_ADC2,
200 },
201 },
146 }, 202 },
147 [TM5600_BOARD_10MOONS_UT821] = { 203 [TM5600_BOARD_10MOONS_UT821] = {
148 .name = "10Moons UT 821", 204 .name = "10Moons UT 821",
@@ -159,6 +215,20 @@ struct tm6000_board tm6000_boards[] = {
159 .gpio = { 215 .gpio = {
160 .tuner_reset = TM6000_GPIO_1, 216 .tuner_reset = TM6000_GPIO_1,
161 }, 217 },
218 .vinput = { {
219 .type = TM6000_INPUT_TV,
220 .vmux = TM6000_VMUX_VIDEO_B,
221 .amux = TM6000_AMUX_ADC1,
222 }, {
223 .type = TM6000_INPUT_COMPOSITE1,
224 .vmux = TM6000_VMUX_VIDEO_A,
225 .amux = TM6000_AMUX_ADC2,
226 }, {
227 .type = TM6000_INPUT_SVIDEO,
228 .vmux = TM6000_VMUX_VIDEO_AB,
229 .amux = TM6000_AMUX_ADC2,
230 },
231 },
162 }, 232 },
163 [TM5600_BOARD_10MOONS_UT330] = { 233 [TM5600_BOARD_10MOONS_UT330] = {
164 .name = "10Moons UT 330", 234 .name = "10Moons UT 330",
@@ -170,6 +240,20 @@ struct tm6000_board tm6000_boards[] = {
170 .has_zl10353 = 0, 240 .has_zl10353 = 0,
171 .has_eeprom = 1, 241 .has_eeprom = 1,
172 }, 242 },
243 .vinput = { {
244 .type = TM6000_INPUT_TV,
245 .vmux = TM6000_VMUX_VIDEO_B,
246 .amux = TM6000_AMUX_ADC1,
247 }, {
248 .type = TM6000_INPUT_COMPOSITE1,
249 .vmux = TM6000_VMUX_VIDEO_A,
250 .amux = TM6000_AMUX_ADC2,
251 }, {
252 .type = TM6000_INPUT_SVIDEO,
253 .vmux = TM6000_VMUX_VIDEO_AB,
254 .amux = TM6000_AMUX_ADC2,
255 },
256 },
173 }, 257 },
174 [TM6000_BOARD_ADSTECH_DUAL_TV] = { 258 [TM6000_BOARD_ADSTECH_DUAL_TV] = {
175 .name = "ADSTECH Dual TV USB", 259 .name = "ADSTECH Dual TV USB",
@@ -182,6 +266,20 @@ struct tm6000_board tm6000_boards[] = {
182 .has_zl10353 = 1, 266 .has_zl10353 = 1,
183 .has_eeprom = 1, 267 .has_eeprom = 1,
184 }, 268 },
269 .vinput = { {
270 .type = TM6000_INPUT_TV,
271 .vmux = TM6000_VMUX_VIDEO_B,
272 .amux = TM6000_AMUX_ADC1,
273 }, {
274 .type = TM6000_INPUT_COMPOSITE1,
275 .vmux = TM6000_VMUX_VIDEO_A,
276 .amux = TM6000_AMUX_ADC2,
277 }, {
278 .type = TM6000_INPUT_SVIDEO,
279 .vmux = TM6000_VMUX_VIDEO_AB,
280 .amux = TM6000_AMUX_ADC2,
281 },
282 },
185 }, 283 },
186 [TM6000_BOARD_FREECOM_AND_SIMILAR] = { 284 [TM6000_BOARD_FREECOM_AND_SIMILAR] = {
187 .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual", 285 .name = "Freecom Hybrid Stick / Moka DVB-T Receiver Dual",
@@ -198,6 +296,20 @@ struct tm6000_board tm6000_boards[] = {
198 .gpio = { 296 .gpio = {
199 .tuner_reset = TM6000_GPIO_4, 297 .tuner_reset = TM6000_GPIO_4,
200 }, 298 },
299 .vinput = { {
300 .type = TM6000_INPUT_TV,
301 .vmux = TM6000_VMUX_VIDEO_B,
302 .amux = TM6000_AMUX_ADC1,
303 }, {
304 .type = TM6000_INPUT_COMPOSITE1,
305 .vmux = TM6000_VMUX_VIDEO_A,
306 .amux = TM6000_AMUX_ADC2,
307 }, {
308 .type = TM6000_INPUT_SVIDEO,
309 .vmux = TM6000_VMUX_VIDEO_AB,
310 .amux = TM6000_AMUX_ADC2,
311 },
312 },
201 }, 313 },
202 [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = { 314 [TM6000_BOARD_ADSTECH_MINI_DUAL_TV] = {
203 .name = "ADSTECH Mini Dual TV USB", 315 .name = "ADSTECH Mini Dual TV USB",
@@ -213,6 +325,20 @@ struct tm6000_board tm6000_boards[] = {
213 .gpio = { 325 .gpio = {
214 .tuner_reset = TM6000_GPIO_4, 326 .tuner_reset = TM6000_GPIO_4,
215 }, 327 },
328 .vinput = { {
329 .type = TM6000_INPUT_TV,
330 .vmux = TM6000_VMUX_VIDEO_B,
331 .amux = TM6000_AMUX_ADC1,
332 }, {
333 .type = TM6000_INPUT_COMPOSITE1,
334 .vmux = TM6000_VMUX_VIDEO_A,
335 .amux = TM6000_AMUX_ADC2,
336 }, {
337 .type = TM6000_INPUT_SVIDEO,
338 .vmux = TM6000_VMUX_VIDEO_AB,
339 .amux = TM6000_AMUX_ADC2,
340 },
341 },
216 }, 342 },
217 [TM6010_BOARD_HAUPPAUGE_900H] = { 343 [TM6010_BOARD_HAUPPAUGE_900H] = {
218 .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick", 344 .name = "Hauppauge WinTV HVR-900H / WinTV USB2-Stick",
@@ -239,6 +365,20 @@ struct tm6000_board tm6000_boards[] = {
239 .dvb_led = TM6010_GPIO_5, 365 .dvb_led = TM6010_GPIO_5,
240 .ir = TM6010_GPIO_0, 366 .ir = TM6010_GPIO_0,
241 }, 367 },
368 .vinput = { {
369 .type = TM6000_INPUT_TV,
370 .vmux = TM6000_VMUX_VIDEO_B,
371 .amux = TM6000_AMUX_SIF1,
372 }, {
373 .type = TM6000_INPUT_COMPOSITE1,
374 .vmux = TM6000_VMUX_VIDEO_A,
375 .amux = TM6000_AMUX_ADC2,
376 }, {
377 .type = TM6000_INPUT_SVIDEO,
378 .vmux = TM6000_VMUX_VIDEO_AB,
379 .amux = TM6000_AMUX_ADC2,
380 },
381 },
242 }, 382 },
243 [TM6010_BOARD_BEHOLD_WANDER] = { 383 [TM6010_BOARD_BEHOLD_WANDER] = {
244 .name = "Beholder Wander DVB-T/TV/FM USB2.0", 384 .name = "Beholder Wander DVB-T/TV/FM USB2.0",
@@ -246,8 +386,6 @@ struct tm6000_board tm6000_boards[] = {
246 .tuner_addr = 0xc2 >> 1, 386 .tuner_addr = 0xc2 >> 1,
247 .demod_addr = 0x1e >> 1, 387 .demod_addr = 0x1e >> 1,
248 .type = TM6010, 388 .type = TM6010,
249 .avideo = TM6000_AIP_SIF1,
250 .aradio = TM6000_AIP_LINE1,
251 .caps = { 389 .caps = {
252 .has_tuner = 1, 390 .has_tuner = 1,
253 .has_dvb = 1, 391 .has_dvb = 1,
@@ -263,14 +401,30 @@ struct tm6000_board tm6000_boards[] = {
263 .demod_reset = TM6010_GPIO_1, 401 .demod_reset = TM6010_GPIO_1,
264 .power_led = TM6010_GPIO_6, 402 .power_led = TM6010_GPIO_6,
265 }, 403 },
404 .vinput = { {
405 .type = TM6000_INPUT_TV,
406 .vmux = TM6000_VMUX_VIDEO_B,
407 .amux = TM6000_AMUX_SIF1,
408 }, {
409 .type = TM6000_INPUT_COMPOSITE1,
410 .vmux = TM6000_VMUX_VIDEO_A,
411 .amux = TM6000_AMUX_ADC2,
412 }, {
413 .type = TM6000_INPUT_SVIDEO,
414 .vmux = TM6000_VMUX_VIDEO_AB,
415 .amux = TM6000_AMUX_ADC2,
416 },
417 },
418 .rinput = {
419 .type = TM6000_INPUT_RADIO,
420 .amux = TM6000_AMUX_ADC1,
421 },
266 }, 422 },
267 [TM6010_BOARD_BEHOLD_VOYAGER] = { 423 [TM6010_BOARD_BEHOLD_VOYAGER] = {
268 .name = "Beholder Voyager TV/FM USB2.0", 424 .name = "Beholder Voyager TV/FM USB2.0",
269 .tuner_type = TUNER_XC5000, 425 .tuner_type = TUNER_XC5000,
270 .tuner_addr = 0xc2 >> 1, 426 .tuner_addr = 0xc2 >> 1,
271 .type = TM6010, 427 .type = TM6010,
272 .avideo = TM6000_AIP_SIF1,
273 .aradio = TM6000_AIP_LINE1,
274 .caps = { 428 .caps = {
275 .has_tuner = 1, 429 .has_tuner = 1,
276 .has_dvb = 0, 430 .has_dvb = 0,
@@ -285,6 +439,24 @@ struct tm6000_board tm6000_boards[] = {
285 .tuner_reset = TM6010_GPIO_0, 439 .tuner_reset = TM6010_GPIO_0,
286 .power_led = TM6010_GPIO_6, 440 .power_led = TM6010_GPIO_6,
287 }, 441 },
442 .vinput = { {
443 .type = TM6000_INPUT_TV,
444 .vmux = TM6000_VMUX_VIDEO_B,
445 .amux = TM6000_AMUX_SIF1,
446 }, {
447 .type = TM6000_INPUT_COMPOSITE1,
448 .vmux = TM6000_VMUX_VIDEO_A,
449 .amux = TM6000_AMUX_ADC2,
450 }, {
451 .type = TM6000_INPUT_SVIDEO,
452 .vmux = TM6000_VMUX_VIDEO_AB,
453 .amux = TM6000_AMUX_ADC2,
454 },
455 },
456 .rinput = {
457 .type = TM6000_INPUT_RADIO,
458 .amux = TM6000_AMUX_ADC1,
459 },
288 }, 460 },
289 [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = { 461 [TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
290 .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick", 462 .name = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
@@ -309,11 +481,39 @@ struct tm6000_board tm6000_boards[] = {
309 .ir = TM6010_GPIO_0, 481 .ir = TM6010_GPIO_0,
310 }, 482 },
311 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS, 483 .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS,
484 .vinput = { {
485 .type = TM6000_INPUT_TV,
486 .vmux = TM6000_VMUX_VIDEO_B,
487 .amux = TM6000_AMUX_SIF1,
488 }, {
489 .type = TM6000_INPUT_COMPOSITE1,
490 .vmux = TM6000_VMUX_VIDEO_A,
491 .amux = TM6000_AMUX_ADC2,
492 }, {
493 .type = TM6000_INPUT_SVIDEO,
494 .vmux = TM6000_VMUX_VIDEO_AB,
495 .amux = TM6000_AMUX_ADC2,
496 },
497 },
312 }, 498 },
313 [TM5600_BOARD_TERRATEC_GRABSTER] = { 499 [TM5600_BOARD_TERRATEC_GRABSTER] = {
314 .name = "Terratec Grabster AV 150/250 MX", 500 .name = "Terratec Grabster AV 150/250 MX",
315 .type = TM5600, 501 .type = TM5600,
316 .tuner_type = TUNER_ABSENT, 502 .tuner_type = TUNER_ABSENT,
503 .vinput = { {
504 .type = TM6000_INPUT_TV,
505 .vmux = TM6000_VMUX_VIDEO_B,
506 .amux = TM6000_AMUX_ADC1,
507 }, {
508 .type = TM6000_INPUT_COMPOSITE1,
509 .vmux = TM6000_VMUX_VIDEO_A,
510 .amux = TM6000_AMUX_ADC2,
511 }, {
512 .type = TM6000_INPUT_SVIDEO,
513 .vmux = TM6000_VMUX_VIDEO_AB,
514 .amux = TM6000_AMUX_ADC2,
515 },
516 },
317 }, 517 },
318 [TM6010_BOARD_TWINHAN_TU501] = { 518 [TM6010_BOARD_TWINHAN_TU501] = {
319 .name = "Twinhan TU501(704D1)", 519 .name = "Twinhan TU501(704D1)",
@@ -337,6 +537,20 @@ struct tm6000_board tm6000_boards[] = {
337 .dvb_led = TM6010_GPIO_5, 537 .dvb_led = TM6010_GPIO_5,
338 .ir = TM6010_GPIO_0, 538 .ir = TM6010_GPIO_0,
339 }, 539 },
540 .vinput = { {
541 .type = TM6000_INPUT_TV,
542 .vmux = TM6000_VMUX_VIDEO_B,
543 .amux = TM6000_AMUX_SIF1,
544 }, {
545 .type = TM6000_INPUT_COMPOSITE1,
546 .vmux = TM6000_VMUX_VIDEO_A,
547 .amux = TM6000_AMUX_ADC2,
548 }, {
549 .type = TM6000_INPUT_SVIDEO,
550 .vmux = TM6000_VMUX_VIDEO_AB,
551 .amux = TM6000_AMUX_ADC2,
552 },
553 },
340 }, 554 },
341 [TM6010_BOARD_BEHOLD_WANDER_LITE] = { 555 [TM6010_BOARD_BEHOLD_WANDER_LITE] = {
342 .name = "Beholder Wander Lite DVB-T/TV/FM USB2.0", 556 .name = "Beholder Wander Lite DVB-T/TV/FM USB2.0",
@@ -344,8 +558,6 @@ struct tm6000_board tm6000_boards[] = {
344 .tuner_addr = 0xc2 >> 1, 558 .tuner_addr = 0xc2 >> 1,
345 .demod_addr = 0x1e >> 1, 559 .demod_addr = 0x1e >> 1,
346 .type = TM6010, 560 .type = TM6010,
347 .avideo = TM6000_AIP_SIF1,
348 .aradio = TM6000_AIP_LINE1,
349 .caps = { 561 .caps = {
350 .has_tuner = 1, 562 .has_tuner = 1,
351 .has_dvb = 1, 563 .has_dvb = 1,
@@ -361,14 +573,22 @@ struct tm6000_board tm6000_boards[] = {
361 .demod_reset = TM6010_GPIO_1, 573 .demod_reset = TM6010_GPIO_1,
362 .power_led = TM6010_GPIO_6, 574 .power_led = TM6010_GPIO_6,
363 }, 575 },
576 .vinput = { {
577 .type = TM6000_INPUT_TV,
578 .vmux = TM6000_VMUX_VIDEO_B,
579 .amux = TM6000_AMUX_SIF1,
580 },
581 },
582 .rinput = {
583 .type = TM6000_INPUT_RADIO,
584 .amux = TM6000_AMUX_ADC1,
585 },
364 }, 586 },
365 [TM6010_BOARD_BEHOLD_VOYAGER_LITE] = { 587 [TM6010_BOARD_BEHOLD_VOYAGER_LITE] = {
366 .name = "Beholder Voyager Lite TV/FM USB2.0", 588 .name = "Beholder Voyager Lite TV/FM USB2.0",
367 .tuner_type = TUNER_XC5000, 589 .tuner_type = TUNER_XC5000,
368 .tuner_addr = 0xc2 >> 1, 590 .tuner_addr = 0xc2 >> 1,
369 .type = TM6010, 591 .type = TM6010,
370 .avideo = TM6000_AIP_SIF1,
371 .aradio = TM6000_AIP_LINE1,
372 .caps = { 592 .caps = {
373 .has_tuner = 1, 593 .has_tuner = 1,
374 .has_dvb = 0, 594 .has_dvb = 0,
@@ -383,6 +603,16 @@ struct tm6000_board tm6000_boards[] = {
383 .tuner_reset = TM6010_GPIO_0, 603 .tuner_reset = TM6010_GPIO_0,
384 .power_led = TM6010_GPIO_6, 604 .power_led = TM6010_GPIO_6,
385 }, 605 },
606 .vinput = { {
607 .type = TM6000_INPUT_TV,
608 .vmux = TM6000_VMUX_VIDEO_B,
609 .amux = TM6000_AMUX_SIF1,
610 },
611 },
612 .rinput = {
613 .type = TM6000_INPUT_RADIO,
614 .amux = TM6000_AMUX_ADC1,
615 },
386 }, 616 },
387}; 617};
388 618
@@ -763,8 +993,11 @@ static int fill_board_specific_data(struct tm6000_core *dev)
763 993
764 dev->caps = tm6000_boards[dev->model].caps; 994 dev->caps = tm6000_boards[dev->model].caps;
765 995
766 dev->avideo = tm6000_boards[dev->model].avideo; 996 dev->vinput[0] = tm6000_boards[dev->model].vinput[0];
767 dev->aradio = tm6000_boards[dev->model].aradio; 997 dev->vinput[1] = tm6000_boards[dev->model].vinput[1];
998 dev->vinput[2] = tm6000_boards[dev->model].vinput[2];
999 dev->rinput = tm6000_boards[dev->model].rinput;
1000
768 /* initialize hardware */ 1001 /* initialize hardware */
769 rc = tm6000_init(dev); 1002 rc = tm6000_init(dev);
770 if (rc < 0) 1003 if (rc < 0)
diff --git a/drivers/staging/tm6000/tm6000-core.c b/drivers/staging/tm6000/tm6000-core.c
index 778e53413afb..f4b9fcd4985e 100644
--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -661,20 +661,25 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp)
661{ 661{
662 if (dev->dev_type == TM6010) { 662 if (dev->dev_type == TM6010) {
663 /* Audio crossbar setting, default SIF1 */ 663 /* Audio crossbar setting, default SIF1 */
664 u8 areg_f0 = 0x03; 664 u8 areg_f0;
665 665
666 switch (ainp) { 666 switch (dev->rinput.amux) {
667 case TM6000_AIP_SIF1: 667 case TM6000_AMUX_SIF1:
668 case TM6000_AIP_SIF2: 668 case TM6000_AMUX_SIF2:
669 areg_f0 = 0x03; 669 areg_f0 = 0x03;
670 break; 670 break;
671 case TM6000_AIP_LINE1: 671 case TM6000_AMUX_ADC1:
672 areg_f0 = 0x00; 672 areg_f0 = 0x00;
673 break; 673 break;
674 case TM6000_AIP_LINE2: 674 case TM6000_AMUX_ADC2:
675 areg_f0 = 0x08; 675 areg_f0 = 0x08;
676 break; 676 break;
677 case TM6000_AMUX_I2S:
678 areg_f0 = 0x04;
679 break;
677 default: 680 default:
681 printk(KERN_INFO "%s: audio input dosn't support\n",
682 dev->name);
678 return 0; 683 return 0;
679 break; 684 break;
680 } 685 }
@@ -682,17 +687,18 @@ int tm6000_set_audio_input(struct tm6000_core *dev, enum tm6000_inaudio ainp)
682 tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG, 687 tm6000_set_reg_mask(dev, TM6010_REQ08_RF0_DAUDIO_INPUT_CONFIG,
683 areg_f0, 0x0f); 688 areg_f0, 0x0f);
684 } else { 689 } else {
690 u8 areg_eb;
685 /* Audio setting, default LINE1 */ 691 /* Audio setting, default LINE1 */
686 u8 areg_eb = 0x00; 692 switch (dev->rinput.amux) {
687 693 case TM6000_AMUX_ADC1:
688 switch (ainp) {
689 case TM6000_AIP_LINE1:
690 areg_eb = 0x00; 694 areg_eb = 0x00;
691 break; 695 break;
692 case TM6000_AIP_LINE2: 696 case TM6000_AMUX_ADC2:
693 areg_eb = 0x04; 697 areg_eb = 0x04;
694 break; 698 break;
695 default: 699 default:
700 printk(KERN_INFO "%s: audio input dosn't support\n",
701 dev->name);
696 return 0; 702 return 0;
697 break; 703 break;
698 } 704 }
@@ -736,16 +742,16 @@ void tm6010_set_mute_adc(struct tm6000_core *dev, u8 mute)
736 742
737int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute) 743int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute)
738{ 744{
739 enum tm6000_inaudio ainp; 745 enum tm6000_mux mux;
740 746
741 if (dev->radio) 747 if (dev->radio)
742 ainp = dev->aradio; 748 mux = dev->rinput.amux;
743 else 749 else
744 ainp = dev->avideo; 750 mux = dev->vinput[dev->input].amux;
745 751
746 switch (ainp) { 752 switch (mux) {
747 case TM6000_AIP_SIF1: 753 case TM6000_AMUX_SIF1:
748 case TM6000_AIP_SIF2: 754 case TM6000_AMUX_SIF2:
749 if (dev->dev_type == TM6010) 755 if (dev->dev_type == TM6010)
750 tm6010_set_mute_sif(dev, mute); 756 tm6010_set_mute_sif(dev, mute);
751 else { 757 else {
@@ -755,8 +761,8 @@ int tm6000_tvaudio_set_mute(struct tm6000_core *dev, u8 mute)
755 return -EINVAL; 761 return -EINVAL;
756 } 762 }
757 break; 763 break;
758 case TM6000_AIP_LINE1: 764 case TM6000_AMUX_ADC1:
759 case TM6000_AIP_LINE2: 765 case TM6000_AMUX_ADC2:
760 tm6010_set_mute_adc(dev, mute); 766 tm6010_set_mute_adc(dev, mute);
761 break; 767 break;
762 default: 768 default:
@@ -797,17 +803,17 @@ void tm6010_set_volume_adc(struct tm6000_core *dev, int vol)
797 803
798void tm6000_set_volume(struct tm6000_core *dev, int vol) 804void tm6000_set_volume(struct tm6000_core *dev, int vol)
799{ 805{
800 enum tm6000_inaudio ainp; 806 enum tm6000_mux mux;
801 807
802 if (dev->radio) { 808 if (dev->radio) {
803 ainp = dev->aradio; 809 mux = dev->rinput.amux;
804 vol += 8; /* Offset to 0 dB */ 810 vol += 8; /* Offset to 0 dB */
805 } else 811 } else
806 ainp = dev->avideo; 812 mux = dev->vinput[dev->input].amux;
807 813
808 switch (ainp) { 814 switch (mux) {
809 case TM6000_AIP_SIF1: 815 case TM6000_AMUX_SIF1:
810 case TM6000_AIP_SIF2: 816 case TM6000_AMUX_SIF2:
811 if (dev->dev_type == TM6010) 817 if (dev->dev_type == TM6010)
812 tm6010_set_volume_sif(dev, vol); 818 tm6010_set_volume_sif(dev, vol);
813 else 819 else
@@ -815,8 +821,8 @@ void tm6000_set_volume(struct tm6000_core *dev, int vol)
815 " SIF audio inputs. Please check the %s" 821 " SIF audio inputs. Please check the %s"
816 " configuration.\n", dev->name); 822 " configuration.\n", dev->name);
817 break; 823 break;
818 case TM6000_AIP_LINE1: 824 case TM6000_AMUX_ADC1:
819 case TM6000_AIP_LINE2: 825 case TM6000_AMUX_ADC2:
820 tm6010_set_volume_adc(dev, vol); 826 tm6010_set_volume_adc(dev, vol);
821 break; 827 break;
822 default: 828 default:
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h
index 43b0d6265bcb..650decd2afad 100644
--- a/drivers/staging/tm6000/tm6000.h
+++ b/drivers/staging/tm6000/tm6000.h
@@ -40,11 +40,24 @@
40#define TM6000_VERSION KERNEL_VERSION(0, 0, 2) 40#define TM6000_VERSION KERNEL_VERSION(0, 0, 2)
41 41
42/* Inputs */ 42/* Inputs */
43
44enum tm6000_itype { 43enum tm6000_itype {
45 TM6000_INPUT_TV = 0, 44 TM6000_INPUT_TV = 1,
46 TM6000_INPUT_COMPOSITE, 45 TM6000_INPUT_COMPOSITE1,
46 TM6000_INPUT_COMPOSITE2,
47 TM6000_INPUT_SVIDEO, 47 TM6000_INPUT_SVIDEO,
48 TM6000_INPUT_DVB,
49 TM6000_INPUT_RADIO,
50};
51
52enum tm6000_mux {
53 TM6000_VMUX_VIDEO_A = 1,
54 TM6000_VMUX_VIDEO_B,
55 TM6000_VMUX_VIDEO_AB,
56 TM6000_AMUX_ADC1,
57 TM6000_AMUX_ADC2,
58 TM6000_AMUX_SIF1,
59 TM6000_AMUX_SIF2,
60 TM6000_AMUX_I2S,
48}; 61};
49 62
50enum tm6000_devtype { 63enum tm6000_devtype {
@@ -53,12 +66,12 @@ enum tm6000_devtype {
53 TM6010, 66 TM6010,
54}; 67};
55 68
56enum tm6000_inaudio { 69struct tm6000_input {
57 TM6000_AIP_UNK = 0, 70 enum tm6000_itype type;
58 TM6000_AIP_SIF1, 71 enum tm6000_mux vmux;
59 TM6000_AIP_SIF2, 72 enum tm6000_mux amux;
60 TM6000_AIP_LINE1, 73 unsigned int v_gpio;
61 TM6000_AIP_LINE2, 74 unsigned int a_gpio;
62}; 75};
63 76
64/* ------------------------------------------------------------------ 77/* ------------------------------------------------------------------
@@ -214,6 +227,9 @@ struct tm6000_core {
214 struct v4l2_device v4l2_dev; 227 struct v4l2_device v4l2_dev;
215 228
216 int input; 229 int input;
230 struct tm6000_input vinput[3]; /* video input */
231 struct tm6000_input rinput; /* radio input */
232
217 int freq; 233 int freq;
218 unsigned int fourcc; 234 unsigned int fourcc;
219 235
@@ -230,8 +246,6 @@ struct tm6000_core {
230 struct snd_tm6000_card *adev; 246 struct snd_tm6000_card *adev;
231 struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */ 247 struct work_struct wq_trigger; /* Trigger to start/stop audio for alsa module */
232 atomic_t stream_started; /* stream should be running if true */ 248 atomic_t stream_started; /* stream should be running if true */
233 enum tm6000_inaudio avideo;
234 enum tm6000_inaudio aradio;
235 249
236 struct tm6000_IR *ir; 250 struct tm6000_IR *ir;
237 251