Commit 3faeeae4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent d3900bc4
...@@ -440,6 +440,9 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -440,6 +440,9 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BALANCE:
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
return cx25840_audio(client, VIDIOC_S_CTRL, ctrl); return cx25840_audio(client, VIDIOC_S_CTRL, ctrl);
default:
return -EINVAL;
} }
return 0; return 0;
...@@ -564,12 +567,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -564,12 +567,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
{ {
struct cx25840_state *state = i2c_get_clientdata(client); struct cx25840_state *state = i2c_get_clientdata(client);
struct v4l2_tuner *vt = arg; struct v4l2_tuner *vt = arg;
int result = 0;
switch (cmd) { switch (cmd) {
case 0:
break;
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
/* ioctls to allow direct access to the /* ioctls to allow direct access to the
* cx25840 registers for testing */ * cx25840 registers for testing */
...@@ -600,8 +599,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -600,8 +599,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
return cx25840_vbi(client, cmd, arg); return cx25840_vbi(client, cmd, arg);
case VIDIOC_INT_AUDIO_CLOCK_FREQ: case VIDIOC_INT_AUDIO_CLOCK_FREQ:
result = cx25840_audio(client, cmd, arg); return cx25840_audio(client, cmd, arg);
break;
case VIDIOC_STREAMON: case VIDIOC_STREAMON:
cx25840_dbg("enable output\n"); cx25840_dbg("enable output\n");
...@@ -620,19 +618,21 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -620,19 +618,21 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
break; break;
case VIDIOC_G_CTRL: case VIDIOC_G_CTRL:
result = get_v4lctrl(client, (struct v4l2_control *)arg); return get_v4lctrl(client, (struct v4l2_control *)arg);
break;
case VIDIOC_S_CTRL: case VIDIOC_S_CTRL:
result = set_v4lctrl(client, (struct v4l2_control *)arg); return set_v4lctrl(client, (struct v4l2_control *)arg);
break;
case VIDIOC_G_STD: case VIDIOC_G_STD:
*(v4l2_std_id *)arg = cx25840_get_v4lstd(client); *(v4l2_std_id *)arg = cx25840_get_v4lstd(client);
break; break;
case VIDIOC_S_STD: case VIDIOC_S_STD:
result = set_v4lstd(client, *(v4l2_std_id *)arg); state->radio = 0;
return set_v4lstd(client, *(v4l2_std_id *)arg);
case AUDC_SET_RADIO:
state->radio = 1;
break; break;
case VIDIOC_G_INPUT: case VIDIOC_G_INPUT:
...@@ -640,15 +640,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -640,15 +640,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
break; break;
case VIDIOC_S_INPUT: case VIDIOC_S_INPUT:
result = set_input(client, *(enum cx25840_video_input *)arg, state->aud_input); return set_input(client, *(enum cx25840_video_input *)arg, state->aud_input);
break;
case VIDIOC_S_AUDIO: case VIDIOC_S_AUDIO:
{ {
struct v4l2_audio *input = arg; struct v4l2_audio *input = arg;
result = set_input(client, state->vid_input, input->index); return set_input(client, state->vid_input, input->index);
break;
} }
case VIDIOC_G_AUDIO: case VIDIOC_G_AUDIO:
...@@ -671,6 +669,9 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -671,6 +669,9 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
u8 vpres = cx25840_read(client, 0x80a) & 0x10; u8 vpres = cx25840_read(client, 0x80a) & 0x10;
int val = 0; int val = 0;
if (state->radio)
break;
vt->capability |= vt->capability |=
V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_LANG1 |
V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP; V4L2_TUNER_CAP_LANG2 | V4L2_TUNER_CAP_SAP;
...@@ -725,12 +726,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -725,12 +726,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
break; break;
case VIDIOC_G_FMT: case VIDIOC_G_FMT:
result = get_v4lfmt(client, (struct v4l2_format *)arg); return get_v4lfmt(client, (struct v4l2_format *)arg);
break;
case VIDIOC_S_FMT: case VIDIOC_S_FMT:
result = set_v4lfmt(client, (struct v4l2_format *)arg); return set_v4lfmt(client, (struct v4l2_format *)arg);
break;
case VIDIOC_INT_RESET: case VIDIOC_INT_RESET:
cx25840_initialize(client, 0); cx25840_initialize(client, 0);
...@@ -742,11 +741,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, ...@@ -742,11 +741,10 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
break; break;
default: default:
cx25840_err("invalid ioctl %x\n", cmd);
return -EINVAL; return -EINVAL;
} }
return result; return 0;
} }
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
......
...@@ -89,6 +89,7 @@ enum cx25840_audio_input { ...@@ -89,6 +89,7 @@ enum cx25840_audio_input {
struct cx25840_state { struct cx25840_state {
int pvr150_workaround; int pvr150_workaround;
int radio;
enum cx25840_video_input vid_input; enum cx25840_video_input vid_input;
enum cx25840_audio_input aud_input; enum cx25840_audio_input aud_input;
u32 audclk_freq; u32 audclk_freq;
......
...@@ -74,6 +74,7 @@ struct saa7115_state { ...@@ -74,6 +74,7 @@ struct saa7115_state {
v4l2_std_id std; v4l2_std_id std;
int input; int input;
int enable; int enable;
int radio;
int bright; int bright;
int contrast; int contrast;
int hue; int hue;
...@@ -634,6 +635,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c ...@@ -634,6 +635,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
state->hue = ctrl->value; state->hue = ctrl->value;
saa7115_write(client, 0x0d, state->hue); saa7115_write(client, 0x0d, state->hue);
break; break;
default:
return -EINVAL;
} }
return 0; return 0;
...@@ -1043,6 +1047,8 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar ...@@ -1043,6 +1047,8 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
struct v4l2_tuner *vt = arg; struct v4l2_tuner *vt = arg;
int status; int status;
if (state->radio)
break;
status = saa7115_read(client, 0x1f); status = saa7115_read(client, 0x1f);
saa7115_dbg("status: 0x%02x\n", status); 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,9 +1071,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
break; break;
case VIDIOC_S_STD: case VIDIOC_S_STD:
state->radio = 0;
saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); saa7115_set_v4lstd(client, *(v4l2_std_id *)arg);
break; break;
case AUDC_SET_RADIO:
state->radio = 1;
break;
case VIDIOC_G_INPUT: case VIDIOC_G_INPUT:
*(int *)arg = state->input; *(int *)arg = state->input;
break; break;
...@@ -1230,6 +1241,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) ...@@ -1230,6 +1241,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
state->std = V4L2_STD_NTSC; state->std = V4L2_STD_NTSC;
state->input = -1; state->input = -1;
state->enable = 1; state->enable = 1;
state->radio = 0;
state->bright = 128; state->bright = 128;
state->contrast = 64; state->contrast = 64;
state->hue = 0; state->hue = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment