diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-23 06:46:02 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-23 06:46:02 -0500 |
commit | 53a7240416adabb84e32334a9f118b7f05392ba2 (patch) | |
tree | 3589d708545b4ba84fcdc39b696f4bd7269dcd5f /drivers/media/video | |
parent | b639f9d286f2216795492eac2a39b8ed6b4d555c (diff) |
V4L/DVB (3402): Fix handling of VIDIOC_G_TUNER audmode in msp3400
- Fix handling of VIDIOC_G_TUNER audmode in msp3400: audmode
is only changed by the user with S_TUNER, never by the driver.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 21 | ||||
-rw-r--r-- | drivers/media/video/msp3400-kthreads.c | 25 |
2 files changed, 16 insertions, 30 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 69ed369c2f48..994c340f9d02 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -653,7 +653,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
653 | } | 653 | } |
654 | if (scart) { | 654 | if (scart) { |
655 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | 655 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; |
656 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
657 | msp_set_scart(client, scart, 0); | 656 | msp_set_scart(client, scart, 0); |
658 | msp_write_dsp(client, 0x000d, 0x1900); | 657 | msp_write_dsp(client, 0x000d, 0x1900); |
659 | if (state->opmode != OPMODE_AUTOSELECT) | 658 | if (state->opmode != OPMODE_AUTOSELECT) |
@@ -831,11 +830,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
831 | return -EINVAL; | 830 | return -EINVAL; |
832 | } | 831 | } |
833 | 832 | ||
834 | msp_any_detect_stereo(client); | 833 | a->capability = V4L2_AUDCAP_STEREO; |
835 | if (state->audmode == V4L2_TUNER_MODE_STEREO) { | 834 | a->mode = 0; /* TODO: add support for AVL */ |
836 | a->capability = V4L2_AUDCAP_STEREO; | ||
837 | } | ||
838 | |||
839 | break; | 835 | break; |
840 | } | 836 | } |
841 | 837 | ||
@@ -865,15 +861,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
865 | } | 861 | } |
866 | if (scart) { | 862 | if (scart) { |
867 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | 863 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; |
868 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
869 | msp_set_scart(client, scart, 0); | 864 | msp_set_scart(client, scart, 0); |
870 | msp_write_dsp(client, 0x000d, 0x1900); | 865 | msp_write_dsp(client, 0x000d, 0x1900); |
871 | } | 866 | } |
872 | if (sarg->capability == V4L2_AUDCAP_STEREO) { | ||
873 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
874 | } else { | ||
875 | state->audmode &= ~V4L2_TUNER_MODE_STEREO; | ||
876 | } | ||
877 | msp_any_set_audmode(client, state->audmode); | 867 | msp_any_set_audmode(client, state->audmode); |
878 | msp_wake_thread(client); | 868 | msp_wake_thread(client); |
879 | break; | 869 | break; |
@@ -898,11 +888,10 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
898 | { | 888 | { |
899 | struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; | 889 | struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; |
900 | 890 | ||
901 | if (state->radio) | 891 | if (state->radio) /* TODO: add mono/stereo support for radio */ |
902 | break; | 892 | break; |
903 | /* only set audmode */ | 893 | /* only set audmode */ |
904 | if (vt->audmode != -1 && vt->audmode != 0) | 894 | msp_any_set_audmode(client, vt->audmode); |
905 | msp_any_set_audmode(client, vt->audmode); | ||
906 | break; | 895 | break; |
907 | } | 896 | } |
908 | 897 | ||
@@ -927,7 +916,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
927 | return -EINVAL; | 916 | return -EINVAL; |
928 | } | 917 | } |
929 | break; | 918 | break; |
930 | |||
931 | } | 919 | } |
932 | 920 | ||
933 | case VIDIOC_S_AUDOUT: | 921 | case VIDIOC_S_AUDOUT: |
@@ -1094,6 +1082,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1094 | 1082 | ||
1095 | memset(state, 0, sizeof(*state)); | 1083 | memset(state, 0, sizeof(*state)); |
1096 | state->v4l2_std = V4L2_STD_NTSC; | 1084 | state->v4l2_std = V4L2_STD_NTSC; |
1085 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
1097 | state->volume = 58880; /* 0db gain */ | 1086 | state->volume = 58880; /* 0db gain */ |
1098 | state->balance = 32768; /* 0db gain */ | 1087 | state->balance = 32768; /* 0db gain */ |
1099 | state->bass = 32768; | 1088 | state->bass = 32768; |
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index 2072c3efebb3..3235a15db59f 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c | |||
@@ -170,7 +170,6 @@ void msp3400c_setmode(struct i2c_client *client, int type) | |||
170 | 170 | ||
171 | v4l_dbg(1, msp_debug, client, "setmode: %d\n", type); | 171 | v4l_dbg(1, msp_debug, client, "setmode: %d\n", type); |
172 | state->mode = type; | 172 | state->mode = type; |
173 | state->audmode = V4L2_TUNER_MODE_MONO; | ||
174 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 173 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
175 | 174 | ||
176 | msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv); | 175 | msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv); |
@@ -210,7 +209,7 @@ void msp3400c_setmode(struct i2c_client *client, int type) | |||
210 | } | 209 | } |
211 | 210 | ||
212 | /* turn on/off nicam + stereo */ | 211 | /* turn on/off nicam + stereo */ |
213 | void msp3400c_setstereo(struct i2c_client *client, int mode) | 212 | void msp3400c_setstereo(struct i2c_client *client, int audmode) |
214 | { | 213 | { |
215 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; | 214 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; |
216 | struct msp_state *state = i2c_get_clientdata(client); | 215 | struct msp_state *state = i2c_get_clientdata(client); |
@@ -222,16 +221,16 @@ void msp3400c_setstereo(struct i2c_client *client, int mode) | |||
222 | * it's never called | 221 | * it's never called |
223 | */ | 222 | */ |
224 | v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n", | 223 | v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n", |
225 | mode); | 224 | audmode); |
226 | return; | 225 | return; |
227 | } | 226 | } |
228 | 227 | ||
229 | /* switch demodulator */ | 228 | /* switch demodulator */ |
230 | switch (state->mode) { | 229 | switch (state->mode) { |
231 | case MSP_MODE_FM_TERRA: | 230 | case MSP_MODE_FM_TERRA: |
232 | v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]); | 231 | v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[audmode]); |
233 | msp3400c_setcarrier(client, state->second, state->main); | 232 | msp3400c_setcarrier(client, state->second, state->main); |
234 | switch (mode) { | 233 | switch (audmode) { |
235 | case V4L2_TUNER_MODE_STEREO: | 234 | case V4L2_TUNER_MODE_STEREO: |
236 | msp_write_dsp(client, 0x000e, 0x3001); | 235 | msp_write_dsp(client, 0x000e, 0x3001); |
237 | break; | 236 | break; |
@@ -243,8 +242,8 @@ void msp3400c_setstereo(struct i2c_client *client, int mode) | |||
243 | } | 242 | } |
244 | break; | 243 | break; |
245 | case MSP_MODE_FM_SAT: | 244 | case MSP_MODE_FM_SAT: |
246 | v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]); | 245 | v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[audmode]); |
247 | switch (mode) { | 246 | switch (audmode) { |
248 | case V4L2_TUNER_MODE_MONO: | 247 | case V4L2_TUNER_MODE_MONO: |
249 | msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); | 248 | msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); |
250 | break; | 249 | break; |
@@ -262,21 +261,21 @@ void msp3400c_setstereo(struct i2c_client *client, int mode) | |||
262 | case MSP_MODE_FM_NICAM1: | 261 | case MSP_MODE_FM_NICAM1: |
263 | case MSP_MODE_FM_NICAM2: | 262 | case MSP_MODE_FM_NICAM2: |
264 | case MSP_MODE_AM_NICAM: | 263 | case MSP_MODE_AM_NICAM: |
265 | v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]); | 264 | v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[audmode]); |
266 | msp3400c_setcarrier(client,state->second,state->main); | 265 | msp3400c_setcarrier(client,state->second,state->main); |
267 | if (state->nicam_on) | 266 | if (state->nicam_on) |
268 | nicam=0x0100; | 267 | nicam=0x0100; |
269 | break; | 268 | break; |
270 | case MSP_MODE_BTSC: | 269 | case MSP_MODE_BTSC: |
271 | v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]); | 270 | v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[audmode]); |
272 | nicam=0x0300; | 271 | nicam=0x0300; |
273 | break; | 272 | break; |
274 | case MSP_MODE_EXTERN: | 273 | case MSP_MODE_EXTERN: |
275 | v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]); | 274 | v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[audmode]); |
276 | nicam = 0x0200; | 275 | nicam = 0x0200; |
277 | break; | 276 | break; |
278 | case MSP_MODE_FM_RADIO: | 277 | case MSP_MODE_FM_RADIO: |
279 | v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]); | 278 | v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[audmode]); |
280 | break; | 279 | break; |
281 | default: | 280 | default: |
282 | v4l_dbg(1, msp_debug, client, "mono setstereo\n"); | 281 | v4l_dbg(1, msp_debug, client, "mono setstereo\n"); |
@@ -284,7 +283,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode) | |||
284 | } | 283 | } |
285 | 284 | ||
286 | /* switch audio */ | 285 | /* switch audio */ |
287 | switch (mode) { | 286 | switch (audmode) { |
288 | case V4L2_TUNER_MODE_STEREO: | 287 | case V4L2_TUNER_MODE_STEREO: |
289 | src = 0x0020 | nicam; | 288 | src = 0x0020 | nicam; |
290 | break; | 289 | break; |
@@ -759,7 +758,6 @@ int msp3410d_thread(void *data) | |||
759 | case 0x0040: /* FM radio */ | 758 | case 0x0040: /* FM radio */ |
760 | state->mode = MSP_MODE_FM_RADIO; | 759 | state->mode = MSP_MODE_FM_RADIO; |
761 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | 760 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; |
762 | state->audmode = V4L2_TUNER_MODE_STEREO; | ||
763 | state->nicam_on = 0; | 761 | state->nicam_on = 0; |
764 | state->watch_stereo = 0; | 762 | state->watch_stereo = 0; |
765 | /* not needed in theory if we have radio, but | 763 | /* not needed in theory if we have radio, but |
@@ -779,7 +777,6 @@ int msp3410d_thread(void *data) | |||
779 | case 0x0005: | 777 | case 0x0005: |
780 | state->mode = MSP_MODE_FM_TERRA; | 778 | state->mode = MSP_MODE_FM_TERRA; |
781 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 779 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
782 | state->audmode = V4L2_TUNER_MODE_MONO; | ||
783 | state->nicam_on = 0; | 780 | state->nicam_on = 0; |
784 | state->watch_stereo = 1; | 781 | state->watch_stereo = 1; |
785 | break; | 782 | break; |