diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-09 12:25:44 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:25:44 -0500 |
commit | 3faeeae48348959c58f3121d2a6a4fb0bc626da0 (patch) | |
tree | b8a9388826d06542c190d7ce7c3fe44b78e22b30 /drivers/media/video | |
parent | d3900bc42e6bc5e461c29951cc2a50df09e08771 (diff) |
V4L/DVB (3256): When in radio mode ignore VIDIOC_G_TUNER
- Detect when AUDC_SET_RADIO is called.
- When in radio mode ignore VIDIOC_G_TUNER.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 40 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840.h | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7115.c | 12 |
3 files changed, 32 insertions, 21 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index a897d6b7d708..07607264bd41 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -440,6 +440,9 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) | |||
440 | case V4L2_CID_AUDIO_BALANCE: | 440 | case V4L2_CID_AUDIO_BALANCE: |
441 | case V4L2_CID_AUDIO_MUTE: | 441 | case V4L2_CID_AUDIO_MUTE: |
442 | return cx25840_audio(client, VIDIOC_S_CTRL, ctrl); | 442 | return cx25840_audio(client, VIDIOC_S_CTRL, ctrl); |
443 | |||
444 | default: | ||
445 | return -EINVAL; | ||
443 | } | 446 | } |
444 | 447 | ||
445 | return 0; | 448 | return 0; |
@@ -564,12 +567,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
564 | { | 567 | { |
565 | struct cx25840_state *state = i2c_get_clientdata(client); | 568 | struct cx25840_state *state = i2c_get_clientdata(client); |
566 | struct v4l2_tuner *vt = arg; | 569 | struct v4l2_tuner *vt = arg; |
567 | int result = 0; | ||
568 | 570 | ||
569 | switch (cmd) { | 571 | switch (cmd) { |
570 | case 0: | ||
571 | break; | ||
572 | |||
573 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 572 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
574 | /* ioctls to allow direct access to the | 573 | /* ioctls to allow direct access to the |
575 | * cx25840 registers for testing */ | 574 | * cx25840 registers for testing */ |
@@ -600,8 +599,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
600 | return cx25840_vbi(client, cmd, arg); | 599 | return cx25840_vbi(client, cmd, arg); |
601 | 600 | ||
602 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 601 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: |
603 | result = cx25840_audio(client, cmd, arg); | 602 | return cx25840_audio(client, cmd, arg); |
604 | break; | ||
605 | 603 | ||
606 | case VIDIOC_STREAMON: | 604 | case VIDIOC_STREAMON: |
607 | cx25840_dbg("enable output\n"); | 605 | cx25840_dbg("enable output\n"); |
@@ -620,19 +618,21 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
620 | break; | 618 | break; |
621 | 619 | ||
622 | case VIDIOC_G_CTRL: | 620 | case VIDIOC_G_CTRL: |
623 | result = get_v4lctrl(client, (struct v4l2_control *)arg); | 621 | return get_v4lctrl(client, (struct v4l2_control *)arg); |
624 | break; | ||
625 | 622 | ||
626 | case VIDIOC_S_CTRL: | 623 | case VIDIOC_S_CTRL: |
627 | result = set_v4lctrl(client, (struct v4l2_control *)arg); | 624 | return set_v4lctrl(client, (struct v4l2_control *)arg); |
628 | break; | ||
629 | 625 | ||
630 | case VIDIOC_G_STD: | 626 | case VIDIOC_G_STD: |
631 | *(v4l2_std_id *)arg = cx25840_get_v4lstd(client); | 627 | *(v4l2_std_id *)arg = cx25840_get_v4lstd(client); |
632 | break; | 628 | break; |
633 | 629 | ||
634 | case VIDIOC_S_STD: | 630 | case VIDIOC_S_STD: |
635 | result = set_v4lstd(client, *(v4l2_std_id *)arg); | 631 | state->radio = 0; |
632 | return set_v4lstd(client, *(v4l2_std_id *)arg); | ||
633 | |||
634 | case AUDC_SET_RADIO: | ||
635 | state->radio = 1; | ||
636 | break; | 636 | break; |
637 | 637 | ||
638 | case VIDIOC_G_INPUT: | 638 | case VIDIOC_G_INPUT: |
@@ -640,15 +640,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
640 | break; | 640 | break; |
641 | 641 | ||
642 | case VIDIOC_S_INPUT: | 642 | case VIDIOC_S_INPUT: |
643 | result = set_input(client, *(enum cx25840_video_input *)arg, state->aud_input); | 643 | return set_input(client, *(enum cx25840_video_input *)arg, state->aud_input); |
644 | break; | ||
645 | 644 | ||
646 | case VIDIOC_S_AUDIO: | 645 | case VIDIOC_S_AUDIO: |
647 | { | 646 | { |
648 | struct v4l2_audio *input = arg; | 647 | struct v4l2_audio *input = arg; |
649 | 648 | ||
650 | result = set_input(client, state->vid_input, input->index); | 649 | return set_input(client, state->vid_input, input->index); |
651 | break; | ||
652 | } | 650 | } |
653 | 651 | ||
654 | case VIDIOC_G_AUDIO: | 652 | case VIDIOC_G_AUDIO: |
@@ -671,6 +669,9 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
671 | u8 vpres = cx25840_read(client, 0x80a) & 0x10; | 669 | u8 vpres = cx25840_read(client, 0x80a) & 0x10; |
672 | int val = 0; | 670 | int val = 0; |
673 | 671 | ||
672 | if (state->radio) | ||
673 | break; | ||
674 | |||
674 | vt->capability |= | 675 | vt->capability |= |
675 | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | | 676 | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | |
676 | V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP; | 677 | V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP; |
@@ -725,12 +726,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
725 | break; | 726 | break; |
726 | 727 | ||
727 | case VIDIOC_G_FMT: | 728 | case VIDIOC_G_FMT: |
728 | result = get_v4lfmt(client, (struct v4l2_format *)arg); | 729 | return get_v4lfmt(client, (struct v4l2_format *)arg); |
729 | break; | ||
730 | 730 | ||
731 | case VIDIOC_S_FMT: | 731 | case VIDIOC_S_FMT: |
732 | result = set_v4lfmt(client, (struct v4l2_format *)arg); | 732 | return set_v4lfmt(client, (struct v4l2_format *)arg); |
733 | break; | ||
734 | 733 | ||
735 | case VIDIOC_INT_RESET: | 734 | case VIDIOC_INT_RESET: |
736 | cx25840_initialize(client, 0); | 735 | cx25840_initialize(client, 0); |
@@ -742,11 +741,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
742 | break; | 741 | break; |
743 | 742 | ||
744 | default: | 743 | default: |
745 | cx25840_err("invalid ioctl %x\n", cmd); | ||
746 | return -EINVAL; | 744 | return -EINVAL; |
747 | } | 745 | } |
748 | 746 | ||
749 | return result; | 747 | return 0; |
750 | } | 748 | } |
751 | 749 | ||
752 | /* ----------------------------------------------------------------------- */ | 750 | /* ----------------------------------------------------------------------- */ |
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h index 3dc67e79c856..dc58d4292a34 100644 --- a/drivers/media/video/cx25840/cx25840.h +++ b/drivers/media/video/cx25840/cx25840.h | |||
@@ -89,6 +89,7 @@ enum cx25840_audio_input { | |||
89 | 89 | ||
90 | struct cx25840_state { | 90 | struct cx25840_state { |
91 | int pvr150_workaround; | 91 | int pvr150_workaround; |
92 | int radio; | ||
92 | enum cx25840_video_input vid_input; | 93 | enum cx25840_video_input vid_input; |
93 | enum cx25840_audio_input aud_input; | 94 | enum cx25840_audio_input aud_input; |
94 | u32 audclk_freq; | 95 | u32 audclk_freq; |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 5d33d0922e79..9f550fd741d1 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -74,6 +74,7 @@ struct saa7115_state { | |||
74 | v4l2_std_id std; | 74 | v4l2_std_id std; |
75 | int input; | 75 | int input; |
76 | int enable; | 76 | int enable; |
77 | int radio; | ||
77 | int bright; | 78 | int bright; |
78 | int contrast; | 79 | int contrast; |
79 | int hue; | 80 | int hue; |
@@ -634,6 +635,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c | |||
634 | state->hue = ctrl->value; | 635 | state->hue = ctrl->value; |
635 | saa7115_write(client, 0x0d, state->hue); | 636 | saa7115_write(client, 0x0d, state->hue); |
636 | break; | 637 | break; |
638 | |||
639 | default: | ||
640 | return -EINVAL; | ||
637 | } | 641 | } |
638 | 642 | ||
639 | return 0; | 643 | return 0; |
@@ -1043,6 +1047,8 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1043 | struct v4l2_tuner *vt = arg; | 1047 | struct v4l2_tuner *vt = arg; |
1044 | int status; | 1048 | int status; |
1045 | 1049 | ||
1050 | if (state->radio) | ||
1051 | break; | ||
1046 | status = saa7115_read(client, 0x1f); | 1052 | status = saa7115_read(client, 0x1f); |
1047 | 1053 | ||
1048 | saa7115_dbg("status: 0x%02x\n", status); | 1054 | saa7115_dbg("status: 0x%02x\n", status); |
@@ -1065,9 +1071,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
1065 | break; | 1071 | break; |
1066 | 1072 | ||
1067 | case VIDIOC_S_STD: | 1073 | case VIDIOC_S_STD: |
1074 | state->radio = 0; | ||
1068 | saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); | 1075 | saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); |
1069 | break; | 1076 | break; |
1070 | 1077 | ||
1078 | case AUDC_SET_RADIO: | ||
1079 | state->radio = 1; | ||
1080 | break; | ||
1081 | |||
1071 | case VIDIOC_G_INPUT: | 1082 | case VIDIOC_G_INPUT: |
1072 | *(int *)arg = state->input; | 1083 | *(int *)arg = state->input; |
1073 | break; | 1084 | break; |
@@ -1230,6 +1241,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1230 | state->std = V4L2_STD_NTSC; | 1241 | state->std = V4L2_STD_NTSC; |
1231 | state->input = -1; | 1242 | state->input = -1; |
1232 | state->enable = 1; | 1243 | state->enable = 1; |
1244 | state->radio = 0; | ||
1233 | state->bright = 128; | 1245 | state->bright = 128; |
1234 | state->contrast = 64; | 1246 | state->contrast = 64; |
1235 | state->hue = 0; | 1247 | state->hue = 0; |