diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-03-19 10:35:57 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:57 -0500 |
commit | 2474ed444b475614ef795523076be7cc8437ae00 (patch) | |
tree | 87808b3c7ff145b63a638e6e42ffce9db7db1b8c /drivers/media/video/msp3400-driver.c | |
parent | 49965a80a4c4f5cbe15fb3bb1f8f8b0ec4ef02bc (diff) |
V4L/DVB (3582): Implement correct msp3400 input/output routing
- implement VIDIOC_INT_S_AUDIO_ROUTING for msp3400 and tvaudio
- use the new command in bttv, pvrusb2 and em28xx.
- remove the now obsolete MSP_SET_MATRIX from msp3400 (yeah!)
- remove the obsolete VIDIOC_S_AUDIO from msp3400.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 04250284ff1e..8ba1c960388a 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -555,7 +555,6 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | |||
555 | 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) |
556 | { | 556 | { |
557 | struct msp_state *state = i2c_get_clientdata(client); | 557 | struct msp_state *state = i2c_get_clientdata(client); |
558 | int scart = -1; | ||
559 | 558 | ||
560 | if (msp_debug >= 2) | 559 | if (msp_debug >= 2) |
561 | v4l_i2c_print_ioctl(client, cmd); | 560 | v4l_i2c_print_ioctl(client, cmd); |
@@ -660,15 +659,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
660 | break; | 659 | break; |
661 | } | 660 | } |
662 | 661 | ||
663 | /* msp34xx specific */ | ||
664 | case MSP_SET_MATRIX: | ||
665 | { | ||
666 | struct msp_matrix *mspm = arg; | ||
667 | |||
668 | msp_set_scart(client, mspm->input - 1, mspm->output); | ||
669 | break; | ||
670 | } | ||
671 | |||
672 | /* --- v4l2 ioctls --- */ | 662 | /* --- v4l2 ioctls --- */ |
673 | case VIDIOC_S_STD: | 663 | case VIDIOC_S_STD: |
674 | { | 664 | { |
@@ -682,36 +672,38 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
682 | return 0; | 672 | return 0; |
683 | } | 673 | } |
684 | 674 | ||
685 | case VIDIOC_S_AUDIO: | 675 | case VIDIOC_INT_G_AUDIO_ROUTING: |
686 | { | 676 | { |
687 | struct v4l2_audio *sarg = arg; | 677 | struct v4l2_routing *rt = arg; |
688 | 678 | ||
689 | switch (sarg->index) { | 679 | *rt = state->routing; |
690 | case TVAUDIO_INPUT_RADIO: | 680 | break; |
691 | /* Hauppauge uses IN2 for the radio */ | 681 | } |
692 | state->mode = MSP_MODE_FM_RADIO; | 682 | |
693 | scart = SCART_IN2; | 683 | case VIDIOC_INT_S_AUDIO_ROUTING: |
694 | break; | 684 | { |
695 | case TVAUDIO_INPUT_EXTERN: | 685 | struct v4l2_routing *rt = arg; |
696 | /* IN1 is often used for external input ... */ | 686 | int tuner = (rt->input >> 3) & 1; |
697 | state->mode = MSP_MODE_EXTERN; | 687 | int old_tuner = (state->routing.input >> 3) & 1; |
698 | scart = SCART_IN1; | 688 | int sc_in = rt->input & 0x7; |
699 | break; | 689 | int sc1_out = rt->output & 0xf; |
700 | case TVAUDIO_INPUT_INTERN: | 690 | int sc2_out = (rt->output >> 4) & 0xf; |
701 | /* ... sometimes it is IN2 through ;) */ | 691 | u16 val; |
702 | state->mode = MSP_MODE_EXTERN; | 692 | |
703 | scart = SCART_IN2; | 693 | state->routing = *rt; |
704 | break; | 694 | if (state->opmode == OPMODE_AUTOSELECT) { |
705 | case TVAUDIO_INPUT_TUNER: | 695 | val = msp_read_dem(client, 0x30) & ~0x100; |
706 | state->mode = -1; | 696 | msp_write_dem(client, 0x30, val | (tuner ? 0x100 : 0)); |
707 | break; | 697 | } else { |
708 | } | 698 | val = msp_read_dem(client, 0xbb) & ~0x100; |
709 | if (scart >= 0) { | 699 | msp_write_dem(client, 0xbb, val | (tuner ? 0x100 : 0)); |
710 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
711 | msp_set_scart(client, scart, 0); | ||
712 | } | 700 | } |
701 | msp_set_scart(client, sc_in, 0); | ||
702 | msp_set_scart(client, sc1_out, 1); | ||
703 | msp_set_scart(client, sc2_out, 2); | ||
713 | msp_set_audmode(client); | 704 | msp_set_audmode(client); |
714 | msp_wake_thread(client); | 705 | if (tuner != old_tuner) |
706 | msp_wake_thread(client); | ||
715 | break; | 707 | break; |
716 | } | 708 | } |
717 | 709 | ||
@@ -941,6 +933,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
941 | state->muted = 0; | 933 | state->muted = 0; |
942 | state->i2s_mode = 0; | 934 | state->i2s_mode = 0; |
943 | init_waitqueue_head(&state->wq); | 935 | init_waitqueue_head(&state->wq); |
936 | /* These are the reset input/output positions */ | ||
937 | state->routing.input = MSP_INPUT_DEFAULT; | ||
938 | state->routing.output = MSP_OUTPUT_DEFAULT; | ||
944 | 939 | ||
945 | state->rev1 = msp_read_dsp(client, 0x1e); | 940 | state->rev1 = msp_read_dsp(client, 0x1e); |
946 | if (state->rev1 != -1) | 941 | if (state->rev1 != -1) |