diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-03-31 15:34:58 -0500 |
commit | 86579dd06deecfa6ac88d5e84e4d63c397cd6f6d (patch) | |
tree | b4475d3ccde53015ad84a06e4e55e64591171b75 /drivers/media/video/msp3400-driver.c | |
parent | 7ea9ea832212c4a755650f7c7cc1ff0b63292a41 (diff) | |
parent | a0f067802576d4eb4c65d40b8ee7d6ea3c81dd61 (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 317 |
1 files changed, 57 insertions, 260 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 69ed369c2f48..c40e8ba9a2ea 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -53,10 +53,11 @@ | |||
53 | #include <linux/videodev.h> | 53 | #include <linux/videodev.h> |
54 | #include <linux/videodev2.h> | 54 | #include <linux/videodev2.h> |
55 | #include <media/v4l2-common.h> | 55 | #include <media/v4l2-common.h> |
56 | #include <media/audiochip.h> | 56 | #include <media/tvaudio.h> |
57 | #include <media/msp3400.h> | ||
57 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
58 | #include <linux/suspend.h> | 59 | #include <linux/suspend.h> |
59 | #include "msp3400.h" | 60 | #include "msp3400-driver.h" |
60 | 61 | ||
61 | /* ---------------------------------------------------------------------- */ | 62 | /* ---------------------------------------------------------------------- */ |
62 | 63 | ||
@@ -245,31 +246,31 @@ int msp_write_dsp(struct i2c_client *client, int addr, int val) | |||
245 | * ----------------------------------------------------------------------- */ | 246 | * ----------------------------------------------------------------------- */ |
246 | 247 | ||
247 | static int scarts[3][9] = { | 248 | static int scarts[3][9] = { |
248 | /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ | 249 | /* MASK IN1 IN2 IN3 IN4 IN1_DA IN2_DA MONO MUTE */ |
249 | /* SCART DSP Input select */ | 250 | /* SCART DSP Input select */ |
250 | { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, | 251 | { 0x0320, 0x0000, 0x0200, 0x0300, 0x0020, -1, -1, 0x0100, 0x0320 }, |
251 | /* SCART1 Output select */ | 252 | /* SCART1 Output select */ |
252 | { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, | 253 | { 0x0c40, 0x0440, 0x0400, 0x0000, 0x0840, 0x0c00, 0x0040, 0x0800, 0x0c40 }, |
253 | /* SCART2 Output select */ | 254 | /* SCART2 Output select */ |
254 | { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, | 255 | { 0x3080, 0x1000, 0x1080, 0x2080, 0x3080, 0x0000, 0x0080, 0x2000, 0x3000 }, |
255 | }; | 256 | }; |
256 | 257 | ||
257 | static char *scart_names[] = { | 258 | static char *scart_names[] = { |
258 | "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" | 259 | "in1", "in2", "in3", "in4", "in1 da", "in2 da", "mono", "mute" |
259 | }; | 260 | }; |
260 | 261 | ||
261 | void msp_set_scart(struct i2c_client *client, int in, int out) | 262 | void msp_set_scart(struct i2c_client *client, int in, int out) |
262 | { | 263 | { |
263 | struct msp_state *state = i2c_get_clientdata(client); | 264 | struct msp_state *state = i2c_get_clientdata(client); |
264 | 265 | ||
265 | state->in_scart=in; | 266 | state->in_scart = in; |
266 | 267 | ||
267 | if (in >= 1 && in <= 8 && out >= 0 && out <= 2) { | 268 | if (in >= 0 && in <= 7 && out >= 0 && out <= 2) { |
268 | if (-1 == scarts[out][in]) | 269 | if (-1 == scarts[out][in + 1]) |
269 | return; | 270 | return; |
270 | 271 | ||
271 | state->acb &= ~scarts[out][SCART_MASK]; | 272 | state->acb &= ~scarts[out][0]; |
272 | state->acb |= scarts[out][in]; | 273 | state->acb |= scarts[out][in + 1]; |
273 | } else | 274 | } else |
274 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ | 275 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ |
275 | 276 | ||
@@ -336,37 +337,6 @@ void msp_set_audio(struct i2c_client *client) | |||
336 | msp_write_dsp(client, 0x0033, loudness); | 337 | msp_write_dsp(client, 0x0033, loudness); |
337 | } | 338 | } |
338 | 339 | ||
339 | int msp_modus(struct i2c_client *client) | ||
340 | { | ||
341 | struct msp_state *state = i2c_get_clientdata(client); | ||
342 | |||
343 | if (state->radio) { | ||
344 | v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n"); | ||
345 | return 0x0003; | ||
346 | } | ||
347 | |||
348 | if (state->v4l2_std & V4L2_STD_PAL) { | ||
349 | v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n"); | ||
350 | |||
351 | #if 1 | ||
352 | /* experimental: not sure this works with all chip versions */ | ||
353 | return 0x7003; | ||
354 | #else | ||
355 | /* previous value, try this if it breaks ... */ | ||
356 | return 0x1003; | ||
357 | #endif | ||
358 | } | ||
359 | if (state->v4l2_std & V4L2_STD_NTSC) { | ||
360 | v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n"); | ||
361 | return 0x2003; | ||
362 | } | ||
363 | if (state->v4l2_std & V4L2_STD_SECAM) { | ||
364 | v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n"); | ||
365 | return 0x0003; | ||
366 | } | ||
367 | return 0x0003; | ||
368 | } | ||
369 | |||
370 | /* ------------------------------------------------------------------------ */ | 340 | /* ------------------------------------------------------------------------ */ |
371 | 341 | ||
372 | 342 | ||
@@ -411,9 +381,9 @@ static int msp_mode_v4l2_to_v4l1(int rxsubchans) | |||
411 | if (rxsubchans & V4L2_TUNER_SUB_STEREO) | 381 | if (rxsubchans & V4L2_TUNER_SUB_STEREO) |
412 | mode |= VIDEO_SOUND_STEREO; | 382 | mode |= VIDEO_SOUND_STEREO; |
413 | if (rxsubchans & V4L2_TUNER_SUB_LANG2) | 383 | if (rxsubchans & V4L2_TUNER_SUB_LANG2) |
414 | mode |= VIDEO_SOUND_LANG2; | 384 | mode |= VIDEO_SOUND_LANG2 | VIDEO_SOUND_STEREO; |
415 | if (rxsubchans & V4L2_TUNER_SUB_LANG1) | 385 | if (rxsubchans & V4L2_TUNER_SUB_LANG1) |
416 | mode |= VIDEO_SOUND_LANG1; | 386 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_STEREO; |
417 | if (mode == 0) | 387 | if (mode == 0) |
418 | mode |= VIDEO_SOUND_MONO; | 388 | mode |= VIDEO_SOUND_MONO; |
419 | return mode; | 389 | return mode; |
@@ -430,21 +400,6 @@ static int msp_mode_v4l1_to_v4l2(int mode) | |||
430 | return V4L2_TUNER_MODE_MONO; | 400 | return V4L2_TUNER_MODE_MONO; |
431 | } | 401 | } |
432 | 402 | ||
433 | static void msp_any_detect_stereo(struct i2c_client *client) | ||
434 | { | ||
435 | struct msp_state *state = i2c_get_clientdata(client); | ||
436 | |||
437 | switch (state->opmode) { | ||
438 | case OPMODE_MANUAL: | ||
439 | case OPMODE_AUTODETECT: | ||
440 | autodetect_stereo(client); | ||
441 | break; | ||
442 | case OPMODE_AUTOSELECT: | ||
443 | msp34xxg_detect_stereo(client); | ||
444 | break; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | static struct v4l2_queryctrl msp_qctrl_std[] = { | 403 | static struct v4l2_queryctrl msp_qctrl_std[] = { |
449 | { | 404 | { |
450 | .id = V4L2_CID_AUDIO_VOLUME, | 405 | .id = V4L2_CID_AUDIO_VOLUME, |
@@ -506,22 +461,6 @@ static struct v4l2_queryctrl msp_qctrl_sound_processing[] = { | |||
506 | }; | 461 | }; |
507 | 462 | ||
508 | 463 | ||
509 | static void msp_any_set_audmode(struct i2c_client *client, int audmode) | ||
510 | { | ||
511 | struct msp_state *state = i2c_get_clientdata(client); | ||
512 | |||
513 | switch (state->opmode) { | ||
514 | case OPMODE_MANUAL: | ||
515 | case OPMODE_AUTODETECT: | ||
516 | state->watch_stereo = 0; | ||
517 | msp3400c_setstereo(client, audmode); | ||
518 | break; | ||
519 | case OPMODE_AUTOSELECT: | ||
520 | msp34xxg_set_audmode(client, audmode); | ||
521 | break; | ||
522 | } | ||
523 | } | ||
524 | |||
525 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 464 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
526 | { | 465 | { |
527 | struct msp_state *state = i2c_get_clientdata(client); | 466 | struct msp_state *state = i2c_get_clientdata(client); |
@@ -616,52 +555,11 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | |||
616 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | 555 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) |
617 | { | 556 | { |
618 | struct msp_state *state = i2c_get_clientdata(client); | 557 | struct msp_state *state = i2c_get_clientdata(client); |
619 | u16 *sarg = arg; | ||
620 | int scart = 0; | ||
621 | 558 | ||
622 | if (msp_debug >= 2) | 559 | if (msp_debug >= 2) |
623 | v4l_i2c_print_ioctl(client, cmd); | 560 | v4l_i2c_print_ioctl(client, cmd); |
624 | 561 | ||
625 | switch (cmd) { | 562 | switch (cmd) { |
626 | case AUDC_SET_INPUT: | ||
627 | if (*sarg == state->input) | ||
628 | break; | ||
629 | state->input = *sarg; | ||
630 | switch (*sarg) { | ||
631 | case AUDIO_RADIO: | ||
632 | /* Hauppauge uses IN2 for the radio */ | ||
633 | state->mode = MSP_MODE_FM_RADIO; | ||
634 | scart = SCART_IN2; | ||
635 | break; | ||
636 | case AUDIO_EXTERN_1: | ||
637 | /* IN1 is often used for external input ... */ | ||
638 | state->mode = MSP_MODE_EXTERN; | ||
639 | scart = SCART_IN1; | ||
640 | break; | ||
641 | case AUDIO_EXTERN_2: | ||
642 | /* ... sometimes it is IN2 through ;) */ | ||
643 | state->mode = MSP_MODE_EXTERN; | ||
644 | scart = SCART_IN2; | ||
645 | break; | ||
646 | case AUDIO_TUNER: | ||
647 | state->mode = -1; | ||
648 | break; | ||
649 | default: | ||
650 | if (*sarg & AUDIO_MUTE) | ||
651 | msp_set_scart(client, SCART_MUTE, 0); | ||
652 | break; | ||
653 | } | ||
654 | if (scart) { | ||
655 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
656 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
657 | msp_set_scart(client, scart, 0); | ||
658 | msp_write_dsp(client, 0x000d, 0x1900); | ||
659 | if (state->opmode != OPMODE_AUTOSELECT) | ||
660 | msp3400c_setstereo(client, state->audmode); | ||
661 | } | ||
662 | msp_wake_thread(client); | ||
663 | break; | ||
664 | |||
665 | case AUDC_SET_RADIO: | 563 | case AUDC_SET_RADIO: |
666 | if (state->radio) | 564 | if (state->radio) |
667 | return 0; | 565 | return 0; |
@@ -671,8 +569,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
671 | switch (state->opmode) { | 569 | switch (state->opmode) { |
672 | case OPMODE_MANUAL: | 570 | case OPMODE_MANUAL: |
673 | /* set msp3400 to FM radio mode */ | 571 | /* set msp3400 to FM radio mode */ |
674 | msp3400c_setmode(client, MSP_MODE_FM_RADIO); | 572 | msp3400c_set_mode(client, MSP_MODE_FM_RADIO); |
675 | msp3400c_setcarrier(client, MSP_CARRIER(10.7), | 573 | msp3400c_set_carrier(client, MSP_CARRIER(10.7), |
676 | MSP_CARRIER(10.7)); | 574 | MSP_CARRIER(10.7)); |
677 | msp_set_audio(client); | 575 | msp_set_audio(client); |
678 | break; | 576 | break; |
@@ -706,7 +604,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
706 | if (state->radio) | 604 | if (state->radio) |
707 | break; | 605 | break; |
708 | if (state->opmode == OPMODE_AUTOSELECT) | 606 | if (state->opmode == OPMODE_AUTOSELECT) |
709 | msp_any_detect_stereo(client); | 607 | msp_detect_stereo(client); |
710 | va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans); | 608 | va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans); |
711 | break; | 609 | break; |
712 | } | 610 | } |
@@ -722,8 +620,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
722 | state->treble = va->treble; | 620 | state->treble = va->treble; |
723 | msp_set_audio(client); | 621 | msp_set_audio(client); |
724 | 622 | ||
725 | if (va->mode != 0 && state->radio == 0) | 623 | if (va->mode != 0 && state->radio == 0) { |
726 | msp_any_set_audmode(client, msp_mode_v4l1_to_v4l2(va->mode)); | 624 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); |
625 | msp_set_audmode(client); | ||
626 | } | ||
727 | break; | 627 | break; |
728 | } | 628 | } |
729 | 629 | ||
@@ -759,15 +659,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
759 | break; | 659 | break; |
760 | } | 660 | } |
761 | 661 | ||
762 | /* msp34xx specific */ | ||
763 | case MSP_SET_MATRIX: | ||
764 | { | ||
765 | struct msp_matrix *mspm = arg; | ||
766 | |||
767 | msp_set_scart(client, mspm->input, mspm->output); | ||
768 | break; | ||
769 | } | ||
770 | |||
771 | /* --- v4l2 ioctls --- */ | 662 | /* --- v4l2 ioctls --- */ |
772 | case VIDIOC_S_STD: | 663 | case VIDIOC_S_STD: |
773 | { | 664 | { |
@@ -781,100 +672,35 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
781 | return 0; | 672 | return 0; |
782 | } | 673 | } |
783 | 674 | ||
784 | case VIDIOC_ENUMINPUT: | 675 | case VIDIOC_INT_G_AUDIO_ROUTING: |
785 | { | 676 | { |
786 | struct v4l2_input *i = arg; | 677 | struct v4l2_routing *rt = arg; |
787 | |||
788 | if (i->index != 0) | ||
789 | return -EINVAL; | ||
790 | |||
791 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
792 | switch (i->index) { | ||
793 | case AUDIO_RADIO: | ||
794 | strcpy(i->name, "Radio"); | ||
795 | break; | ||
796 | case AUDIO_EXTERN_1: | ||
797 | strcpy(i->name, "Extern 1"); | ||
798 | break; | ||
799 | case AUDIO_EXTERN_2: | ||
800 | strcpy(i->name, "Extern 2"); | ||
801 | break; | ||
802 | case AUDIO_TUNER: | ||
803 | strcpy(i->name, "Television"); | ||
804 | break; | ||
805 | default: | ||
806 | return -EINVAL; | ||
807 | } | ||
808 | return 0; | ||
809 | } | ||
810 | |||
811 | case VIDIOC_G_AUDIO: | ||
812 | { | ||
813 | struct v4l2_audio *a = arg; | ||
814 | |||
815 | memset(a, 0, sizeof(*a)); | ||
816 | |||
817 | switch (a->index) { | ||
818 | case AUDIO_RADIO: | ||
819 | strcpy(a->name, "Radio"); | ||
820 | break; | ||
821 | case AUDIO_EXTERN_1: | ||
822 | strcpy(a->name, "Extern 1"); | ||
823 | break; | ||
824 | case AUDIO_EXTERN_2: | ||
825 | strcpy(a->name, "Extern 2"); | ||
826 | break; | ||
827 | case AUDIO_TUNER: | ||
828 | strcpy(a->name, "Television"); | ||
829 | break; | ||
830 | default: | ||
831 | return -EINVAL; | ||
832 | } | ||
833 | |||
834 | msp_any_detect_stereo(client); | ||
835 | if (state->audmode == V4L2_TUNER_MODE_STEREO) { | ||
836 | a->capability = V4L2_AUDCAP_STEREO; | ||
837 | } | ||
838 | 678 | ||
679 | *rt = state->routing; | ||
839 | break; | 680 | break; |
840 | } | 681 | } |
841 | 682 | ||
842 | case VIDIOC_S_AUDIO: | 683 | case VIDIOC_INT_S_AUDIO_ROUTING: |
843 | { | 684 | { |
844 | struct v4l2_audio *sarg = arg; | 685 | struct v4l2_routing *rt = arg; |
845 | 686 | int tuner = (rt->input >> 3) & 1; | |
846 | switch (sarg->index) { | 687 | int sc_in = rt->input & 0x7; |
847 | case AUDIO_RADIO: | 688 | int sc1_out = rt->output & 0xf; |
848 | /* Hauppauge uses IN2 for the radio */ | 689 | int sc2_out = (rt->output >> 4) & 0xf; |
849 | state->mode = MSP_MODE_FM_RADIO; | 690 | u16 val; |
850 | scart = SCART_IN2; | 691 | |
851 | break; | 692 | state->routing = *rt; |
852 | case AUDIO_EXTERN_1: | 693 | if (state->opmode == OPMODE_AUTOSELECT) { |
853 | /* IN1 is often used for external input ... */ | 694 | val = msp_read_dem(client, 0x30) & ~0x100; |
854 | state->mode = MSP_MODE_EXTERN; | 695 | msp_write_dem(client, 0x30, val | (tuner ? 0x100 : 0)); |
855 | scart = SCART_IN1; | ||
856 | break; | ||
857 | case AUDIO_EXTERN_2: | ||
858 | /* ... sometimes it is IN2 through ;) */ | ||
859 | state->mode = MSP_MODE_EXTERN; | ||
860 | scart = SCART_IN2; | ||
861 | break; | ||
862 | case AUDIO_TUNER: | ||
863 | state->mode = -1; | ||
864 | break; | ||
865 | } | ||
866 | if (scart) { | ||
867 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
868 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
869 | msp_set_scart(client, scart, 0); | ||
870 | msp_write_dsp(client, 0x000d, 0x1900); | ||
871 | } | ||
872 | if (sarg->capability == V4L2_AUDCAP_STEREO) { | ||
873 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
874 | } else { | 696 | } else { |
875 | state->audmode &= ~V4L2_TUNER_MODE_STEREO; | 697 | val = msp_read_dem(client, 0xbb) & ~0x100; |
698 | msp_write_dem(client, 0xbb, val | (tuner ? 0x100 : 0)); | ||
876 | } | 699 | } |
877 | msp_any_set_audmode(client, state->audmode); | 700 | msp_set_scart(client, sc_in, 0); |
701 | msp_set_scart(client, sc1_out, 1); | ||
702 | msp_set_scart(client, sc2_out, 2); | ||
703 | msp_set_audmode(client); | ||
878 | msp_wake_thread(client); | 704 | msp_wake_thread(client); |
879 | break; | 705 | break; |
880 | } | 706 | } |
@@ -886,7 +712,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
886 | if (state->radio) | 712 | if (state->radio) |
887 | break; | 713 | break; |
888 | if (state->opmode == OPMODE_AUTOSELECT) | 714 | if (state->opmode == OPMODE_AUTOSELECT) |
889 | msp_any_detect_stereo(client); | 715 | msp_detect_stereo(client); |
890 | vt->audmode = state->audmode; | 716 | vt->audmode = state->audmode; |
891 | vt->rxsubchans = state->rxsubchans; | 717 | vt->rxsubchans = state->rxsubchans; |
892 | vt->capability = V4L2_TUNER_CAP_STEREO | | 718 | vt->capability = V4L2_TUNER_CAP_STEREO | |
@@ -898,48 +724,11 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
898 | { | 724 | { |
899 | struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; | 725 | struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; |
900 | 726 | ||
901 | if (state->radio) | 727 | if (state->radio) /* TODO: add mono/stereo support for radio */ |
902 | break; | 728 | break; |
729 | state->audmode = vt->audmode; | ||
903 | /* only set audmode */ | 730 | /* only set audmode */ |
904 | if (vt->audmode != -1 && vt->audmode != 0) | 731 | msp_set_audmode(client); |
905 | msp_any_set_audmode(client, vt->audmode); | ||
906 | break; | ||
907 | } | ||
908 | |||
909 | case VIDIOC_G_AUDOUT: | ||
910 | { | ||
911 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
912 | int idx = a->index; | ||
913 | |||
914 | memset(a, 0, sizeof(*a)); | ||
915 | |||
916 | switch (idx) { | ||
917 | case 0: | ||
918 | strcpy(a->name, "Scart1 Out"); | ||
919 | break; | ||
920 | case 1: | ||
921 | strcpy(a->name, "Scart2 Out"); | ||
922 | break; | ||
923 | case 2: | ||
924 | strcpy(a->name, "I2S Out"); | ||
925 | break; | ||
926 | default: | ||
927 | return -EINVAL; | ||
928 | } | ||
929 | break; | ||
930 | |||
931 | } | ||
932 | |||
933 | case VIDIOC_S_AUDOUT: | ||
934 | { | ||
935 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
936 | |||
937 | if (a->index < 0 || a->index > 2) | ||
938 | return -EINVAL; | ||
939 | |||
940 | v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index); | ||
941 | msp_set_scart(client, state->in_scart, a->index + 1); | ||
942 | |||
943 | break; | 732 | break; |
944 | } | 733 | } |
945 | 734 | ||
@@ -993,7 +782,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
993 | const char *p; | 782 | const char *p; |
994 | 783 | ||
995 | if (state->opmode == OPMODE_AUTOSELECT) | 784 | if (state->opmode == OPMODE_AUTOSELECT) |
996 | msp_any_detect_stereo(client); | 785 | msp_detect_stereo(client); |
997 | v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", | 786 | v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", |
998 | client->name, state->rev1, state->rev2); | 787 | client->name, state->rev1, state->rev2); |
999 | v4l_info(client, "Audio: volume %d%s\n", | 788 | v4l_info(client, "Audio: volume %d%s\n", |
@@ -1020,12 +809,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
1020 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 809 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
1021 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 810 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
1022 | } else { | 811 | } else { |
1023 | v4l_info(client, "Mode: %s\n", p); | 812 | if (state->opmode == OPMODE_AUTODETECT) |
813 | v4l_info(client, "Mode: %s\n", p); | ||
1024 | v4l_info(client, "Standard: %s (%s%s)\n", | 814 | v4l_info(client, "Standard: %s (%s%s)\n", |
1025 | msp_standard_std_name(state->std), | 815 | msp_standard_std_name(state->std), |
1026 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 816 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
1027 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 817 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
1028 | } | 818 | } |
819 | v4l_info(client, "Audmode: 0x%04x\n", state->audmode); | ||
820 | v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", | ||
821 | state->routing.input, state->routing.output); | ||
1029 | v4l_info(client, "ACB: 0x%04x\n", state->acb); | 822 | v4l_info(client, "ACB: 0x%04x\n", state->acb); |
1030 | break; | 823 | break; |
1031 | } | 824 | } |
@@ -1094,6 +887,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1094 | 887 | ||
1095 | memset(state, 0, sizeof(*state)); | 888 | memset(state, 0, sizeof(*state)); |
1096 | state->v4l2_std = V4L2_STD_NTSC; | 889 | state->v4l2_std = V4L2_STD_NTSC; |
890 | state->audmode = V4L2_TUNER_MODE_LANG1; | ||
1097 | state->volume = 58880; /* 0db gain */ | 891 | state->volume = 58880; /* 0db gain */ |
1098 | state->balance = 32768; /* 0db gain */ | 892 | state->balance = 32768; /* 0db gain */ |
1099 | state->bass = 32768; | 893 | state->bass = 32768; |
@@ -1103,6 +897,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1103 | state->muted = 0; | 897 | state->muted = 0; |
1104 | state->i2s_mode = 0; | 898 | state->i2s_mode = 0; |
1105 | init_waitqueue_head(&state->wq); | 899 | init_waitqueue_head(&state->wq); |
900 | /* These are the reset input/output positions */ | ||
901 | state->routing.input = MSP_INPUT_DEFAULT; | ||
902 | state->routing.output = MSP_OUTPUT_DEFAULT; | ||
1106 | 903 | ||
1107 | state->rev1 = msp_read_dsp(client, 0x1e); | 904 | state->rev1 = msp_read_dsp(client, 0x1e); |
1108 | if (state->rev1 != -1) | 905 | if (state->rev1 != -1) |