2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 12:14:01 +08:00

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>
This commit is contained in:
Hans Verkuil 2006-01-23 09:46:02 -02:00 committed by Mauro Carvalho Chehab
parent b639f9d286
commit 53a7240416
2 changed files with 16 additions and 30 deletions

View File

@ -653,7 +653,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
} }
if (scart) { if (scart) {
state->rxsubchans = V4L2_TUNER_SUB_STEREO; state->rxsubchans = V4L2_TUNER_SUB_STEREO;
state->audmode = V4L2_TUNER_MODE_STEREO;
msp_set_scart(client, scart, 0); msp_set_scart(client, scart, 0);
msp_write_dsp(client, 0x000d, 0x1900); msp_write_dsp(client, 0x000d, 0x1900);
if (state->opmode != OPMODE_AUTOSELECT) if (state->opmode != OPMODE_AUTOSELECT)
@ -831,11 +830,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
return -EINVAL; return -EINVAL;
} }
msp_any_detect_stereo(client);
if (state->audmode == V4L2_TUNER_MODE_STEREO) {
a->capability = V4L2_AUDCAP_STEREO; a->capability = V4L2_AUDCAP_STEREO;
} a->mode = 0; /* TODO: add support for AVL */
break; break;
} }
@ -865,15 +861,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
} }
if (scart) { if (scart) {
state->rxsubchans = V4L2_TUNER_SUB_STEREO; state->rxsubchans = V4L2_TUNER_SUB_STEREO;
state->audmode = V4L2_TUNER_MODE_STEREO;
msp_set_scart(client, scart, 0); msp_set_scart(client, scart, 0);
msp_write_dsp(client, 0x000d, 0x1900); msp_write_dsp(client, 0x000d, 0x1900);
} }
if (sarg->capability == V4L2_AUDCAP_STEREO) {
state->audmode = V4L2_TUNER_MODE_STEREO;
} else {
state->audmode &= ~V4L2_TUNER_MODE_STEREO;
}
msp_any_set_audmode(client, state->audmode); msp_any_set_audmode(client, state->audmode);
msp_wake_thread(client); msp_wake_thread(client);
break; break;
@ -898,10 +888,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
{ {
struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; struct v4l2_tuner *vt = (struct v4l2_tuner *)arg;
if (state->radio) if (state->radio) /* TODO: add mono/stereo support for radio */
break; break;
/* only set audmode */ /* only set audmode */
if (vt->audmode != -1 && vt->audmode != 0)
msp_any_set_audmode(client, vt->audmode); msp_any_set_audmode(client, vt->audmode);
break; break;
} }
@ -927,7 +916,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
return -EINVAL; return -EINVAL;
} }
break; break;
} }
case VIDIOC_S_AUDOUT: case VIDIOC_S_AUDOUT:
@ -1094,6 +1082,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
memset(state, 0, sizeof(*state)); memset(state, 0, sizeof(*state));
state->v4l2_std = V4L2_STD_NTSC; state->v4l2_std = V4L2_STD_NTSC;
state->audmode = V4L2_TUNER_MODE_STEREO;
state->volume = 58880; /* 0db gain */ state->volume = 58880; /* 0db gain */
state->balance = 32768; /* 0db gain */ state->balance = 32768; /* 0db gain */
state->bass = 32768; state->bass = 32768;

View File

@ -170,7 +170,6 @@ void msp3400c_setmode(struct i2c_client *client, int type)
v4l_dbg(1, msp_debug, client, "setmode: %d\n", type); v4l_dbg(1, msp_debug, client, "setmode: %d\n", type);
state->mode = type; state->mode = type;
state->audmode = V4L2_TUNER_MODE_MONO;
state->rxsubchans = V4L2_TUNER_SUB_MONO; state->rxsubchans = V4L2_TUNER_SUB_MONO;
msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv); msp_write_dem(client, 0x00bb, msp3400c_init_data[type].ad_cv);
@ -210,7 +209,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
} }
/* turn on/off nicam + stereo */ /* turn on/off nicam + stereo */
void msp3400c_setstereo(struct i2c_client *client, int mode) void msp3400c_setstereo(struct i2c_client *client, int audmode)
{ {
static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; static char *strmode[] = { "mono", "stereo", "lang2", "lang1" };
struct msp_state *state = i2c_get_clientdata(client); struct msp_state *state = i2c_get_clientdata(client);
@ -222,16 +221,16 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
* it's never called * it's never called
*/ */
v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n", v4l_dbg(1, msp_debug, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
mode); audmode);
return; return;
} }
/* switch demodulator */ /* switch demodulator */
switch (state->mode) { switch (state->mode) {
case MSP_MODE_FM_TERRA: case MSP_MODE_FM_TERRA:
v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[mode]); v4l_dbg(1, msp_debug, client, "FM setstereo: %s\n", strmode[audmode]);
msp3400c_setcarrier(client, state->second, state->main); msp3400c_setcarrier(client, state->second, state->main);
switch (mode) { switch (audmode) {
case V4L2_TUNER_MODE_STEREO: case V4L2_TUNER_MODE_STEREO:
msp_write_dsp(client, 0x000e, 0x3001); msp_write_dsp(client, 0x000e, 0x3001);
break; break;
@ -243,8 +242,8 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
} }
break; break;
case MSP_MODE_FM_SAT: case MSP_MODE_FM_SAT:
v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[mode]); v4l_dbg(1, msp_debug, client, "SAT setstereo: %s\n", strmode[audmode]);
switch (mode) { switch (audmode) {
case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_MONO:
msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
break; break;
@ -262,21 +261,21 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
case MSP_MODE_FM_NICAM1: case MSP_MODE_FM_NICAM1:
case MSP_MODE_FM_NICAM2: case MSP_MODE_FM_NICAM2:
case MSP_MODE_AM_NICAM: case MSP_MODE_AM_NICAM:
v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[mode]); v4l_dbg(1, msp_debug, client, "NICAM setstereo: %s\n",strmode[audmode]);
msp3400c_setcarrier(client,state->second,state->main); msp3400c_setcarrier(client,state->second,state->main);
if (state->nicam_on) if (state->nicam_on)
nicam=0x0100; nicam=0x0100;
break; break;
case MSP_MODE_BTSC: case MSP_MODE_BTSC:
v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[mode]); v4l_dbg(1, msp_debug, client, "BTSC setstereo: %s\n",strmode[audmode]);
nicam=0x0300; nicam=0x0300;
break; break;
case MSP_MODE_EXTERN: case MSP_MODE_EXTERN:
v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[mode]); v4l_dbg(1, msp_debug, client, "extern setstereo: %s\n",strmode[audmode]);
nicam = 0x0200; nicam = 0x0200;
break; break;
case MSP_MODE_FM_RADIO: case MSP_MODE_FM_RADIO:
v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[mode]); v4l_dbg(1, msp_debug, client, "FM-Radio setstereo: %s\n",strmode[audmode]);
break; break;
default: default:
v4l_dbg(1, msp_debug, client, "mono setstereo\n"); v4l_dbg(1, msp_debug, client, "mono setstereo\n");
@ -284,7 +283,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
} }
/* switch audio */ /* switch audio */
switch (mode) { switch (audmode) {
case V4L2_TUNER_MODE_STEREO: case V4L2_TUNER_MODE_STEREO:
src = 0x0020 | nicam; src = 0x0020 | nicam;
break; break;
@ -759,7 +758,6 @@ int msp3410d_thread(void *data)
case 0x0040: /* FM radio */ case 0x0040: /* FM radio */
state->mode = MSP_MODE_FM_RADIO; state->mode = MSP_MODE_FM_RADIO;
state->rxsubchans = V4L2_TUNER_SUB_STEREO; state->rxsubchans = V4L2_TUNER_SUB_STEREO;
state->audmode = V4L2_TUNER_MODE_STEREO;
state->nicam_on = 0; state->nicam_on = 0;
state->watch_stereo = 0; state->watch_stereo = 0;
/* not needed in theory if we have radio, but /* not needed in theory if we have radio, but
@ -779,7 +777,6 @@ int msp3410d_thread(void *data)
case 0x0005: case 0x0005:
state->mode = MSP_MODE_FM_TERRA; state->mode = MSP_MODE_FM_TERRA;
state->rxsubchans = V4L2_TUNER_SUB_MONO; state->rxsubchans = V4L2_TUNER_SUB_MONO;
state->audmode = V4L2_TUNER_MODE_MONO;
state->nicam_on = 0; state->nicam_on = 0;
state->watch_stereo = 1; state->watch_stereo = 1;
break; break;