Commit c15000b4 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6:
  [media] msp3400: fill in v4l2_tuner based on vt->type field
  [media] tuner-core.c: don't change type field in g_tuner or g_frequency
  [media] cx18/ivtv: fix g_tuner support
  [media] tuner-core: power up tuner when called with s_power(1)
  [media] v4l2-ioctl.c: check for valid tuner type in S_HW_FREQ_SEEK
  [media] tuner-core: simplify the standard fixup
  [media] tuner-core/v4l2-subdev: document that the type field has to be filled in
  [media] v4l2-subdev.h: remove unused s_mode tuner op
  [media] feature-removal-schedule: change in how radio device nodes are handled
  [media] bttv: fix s_tuner for radio
  [media] pvrusb2: fix g/s_tuner support
  [media] v4l2-ioctl.c: prefill tuner type for g_frequency and g/s_tuner
  [media] tuner-core: fix tuner_resume: use t->mode instead of t->type
  [media] tuner-core: fix s_std and s_tuner
parents 9ddf7f50 ddc6ff31
...@@ -583,3 +583,25 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl. ...@@ -583,3 +583,25 @@ Why: Superseded by the UVCIOC_CTRL_QUERY ioctl.
Who: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Who: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---------------------------- ----------------------------
What: For VIDIOC_S_FREQUENCY the type field must match the device node's type.
If not, return -EINVAL.
When: 3.2
Why: It makes no sense to switch the tuner to radio mode by calling
VIDIOC_S_FREQUENCY on a video node, or to switch the tuner to tv mode by
calling VIDIOC_S_FREQUENCY on a radio node. This is the first step of a
move to more consistent handling of tv and radio tuners.
Who: Hans Verkuil <hans.verkuil@cisco.com>
----------------------------
What: Opening a radio device node will no longer automatically switch the
tuner mode from tv to radio.
When: 3.3
Why: Just opening a V4L device should not change the state of the hardware
like that. It's very unexpected and against the V4L spec. Instead, you
switch to radio mode by calling VIDIOC_S_FREQUENCY. This is the second
and last step of the move to consistent handling of tv and radio tuners.
Who: Hans Verkuil <hans.verkuil@cisco.com>
----------------------------
...@@ -3474,7 +3474,7 @@ static int radio_s_tuner(struct file *file, void *priv, ...@@ -3474,7 +3474,7 @@ static int radio_s_tuner(struct file *file, void *priv,
if (0 != t->index) if (0 != t->index)
return -EINVAL; return -EINVAL;
bttv_call_all(btv, tuner, g_tuner, t); bttv_call_all(btv, tuner, s_tuner, t);
return 0; return 0;
} }
......
...@@ -695,14 +695,10 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) ...@@ -695,14 +695,10 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
cx18_call_all(cx, tuner, g_tuner, vt); cx18_call_all(cx, tuner, g_tuner, vt);
if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags)) { if (vt->type == V4L2_TUNER_RADIO)
strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name)); strlcpy(vt->name, "cx18 Radio Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_RADIO; else
} else {
strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name)); strlcpy(vt->name, "cx18 TV Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_ANALOG_TV;
}
return 0; return 0;
} }
......
...@@ -1184,14 +1184,10 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) ...@@ -1184,14 +1184,10 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
ivtv_call_all(itv, tuner, g_tuner, vt); ivtv_call_all(itv, tuner, g_tuner, vt);
if (test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) { if (vt->type == V4L2_TUNER_RADIO)
strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name)); strlcpy(vt->name, "ivtv Radio Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_RADIO; else
} else {
strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name)); strlcpy(vt->name, "ivtv TV Tuner", sizeof(vt->name));
vt->type = V4L2_TUNER_ANALOG_TV;
}
return 0; return 0;
} }
......
...@@ -480,12 +480,14 @@ static int msp_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) ...@@ -480,12 +480,14 @@ static int msp_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
struct msp_state *state = to_state(sd); struct msp_state *state = to_state(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd); struct i2c_client *client = v4l2_get_subdevdata(sd);
if (state->radio) if (vt->type != V4L2_TUNER_ANALOG_TV)
return 0; return 0;
if (!state->radio) {
if (state->opmode == OPMODE_AUTOSELECT) if (state->opmode == OPMODE_AUTOSELECT)
msp_detect_stereo(client); msp_detect_stereo(client);
vt->audmode = state->audmode;
vt->rxsubchans = state->rxsubchans; vt->rxsubchans = state->rxsubchans;
}
vt->audmode = state->audmode;
vt->capability |= V4L2_TUNER_CAP_STEREO | vt->capability |= V4L2_TUNER_CAP_STEREO |
V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2; V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2;
return 0; return 0;
......
...@@ -3046,6 +3046,8 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw) ...@@ -3046,6 +3046,8 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) { if (hdw->input_dirty || hdw->audiomode_dirty || hdw->force_dirty) {
struct v4l2_tuner vt; struct v4l2_tuner vt;
memset(&vt, 0, sizeof(vt)); memset(&vt, 0, sizeof(vt));
vt.type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
vt.audmode = hdw->audiomode_val; vt.audmode = hdw->audiomode_val;
v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt); v4l2_device_call_all(&hdw->v4l2_dev, 0, tuner, s_tuner, &vt);
} }
...@@ -5171,6 +5173,8 @@ void pvr2_hdw_status_poll(struct pvr2_hdw *hdw) ...@@ -5171,6 +5173,8 @@ void pvr2_hdw_status_poll(struct pvr2_hdw *hdw)
{ {
struct v4l2_tuner *vtp = &hdw->tuner_signal_info; struct v4l2_tuner *vtp = &hdw->tuner_signal_info;
memset(vtp, 0, sizeof(*vtp)); memset(vtp, 0, sizeof(*vtp));
vtp->type = (hdw->input_val == PVR2_CVAL_INPUT_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
hdw->tuner_signal_stale = 0; hdw->tuner_signal_stale = 0;
/* Note: There apparently is no replacement for VIDIOC_CROPCAP /* Note: There apparently is no replacement for VIDIOC_CROPCAP
using v4l2-subdev - therefore we can't support that AT ALL right using v4l2-subdev - therefore we can't support that AT ALL right
......
This diff is collapsed.
...@@ -1822,6 +1822,8 @@ static long __video_do_ioctl(struct file *file, ...@@ -1822,6 +1822,8 @@ static long __video_do_ioctl(struct file *file,
if (!ops->vidioc_g_tuner) if (!ops->vidioc_g_tuner)
break; break;
p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
ret = ops->vidioc_g_tuner(file, fh, p); ret = ops->vidioc_g_tuner(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
...@@ -1840,6 +1842,8 @@ static long __video_do_ioctl(struct file *file, ...@@ -1840,6 +1842,8 @@ static long __video_do_ioctl(struct file *file,
if (!ops->vidioc_s_tuner) if (!ops->vidioc_s_tuner)
break; break;
p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
dbgarg(cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
"capability=0x%x, rangelow=%d, " "capability=0x%x, rangelow=%d, "
"rangehigh=%d, signal=%d, afc=%d, " "rangehigh=%d, signal=%d, afc=%d, "
...@@ -1858,6 +1862,8 @@ static long __video_do_ioctl(struct file *file, ...@@ -1858,6 +1862,8 @@ static long __video_do_ioctl(struct file *file,
if (!ops->vidioc_g_frequency) if (!ops->vidioc_g_frequency)
break; break;
p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
ret = ops->vidioc_g_frequency(file, fh, p); ret = ops->vidioc_g_frequency(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
...@@ -1940,12 +1946,18 @@ static long __video_do_ioctl(struct file *file, ...@@ -1940,12 +1946,18 @@ static long __video_do_ioctl(struct file *file,
case VIDIOC_S_HW_FREQ_SEEK: case VIDIOC_S_HW_FREQ_SEEK:
{ {
struct v4l2_hw_freq_seek *p = arg; struct v4l2_hw_freq_seek *p = arg;
enum v4l2_tuner_type type;
if (!ops->vidioc_s_hw_freq_seek) if (!ops->vidioc_s_hw_freq_seek)
break; break;
type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
dbgarg(cmd, dbgarg(cmd,
"tuner=%d, type=%d, seek_upward=%d, wrap_around=%d\n", "tuner=%u, type=%u, seek_upward=%u, wrap_around=%u, spacing=%u\n",
p->tuner, p->type, p->seek_upward, p->wrap_around); p->tuner, p->type, p->seek_upward, p->wrap_around, p->spacing);
if (p->type != type)
ret = -EINVAL;
else
ret = ops->vidioc_s_hw_freq_seek(file, fh, p); ret = ops->vidioc_s_hw_freq_seek(file, fh, p);
break; break;
} }
......
...@@ -173,16 +173,20 @@ struct v4l2_subdev_core_ops { ...@@ -173,16 +173,20 @@ struct v4l2_subdev_core_ops {
struct v4l2_event_subscription *sub); struct v4l2_event_subscription *sub);
}; };
/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. /* s_radio: v4l device was opened in radio mode.
s_radio: v4l device was opened in Radio mode, to be replaced by s_mode. g_frequency: freq->type must be filled in. Normally done by video_ioctl2
or the bridge driver.
g_tuner:
s_tuner: vt->type must be filled in. Normally done by video_ioctl2 or the
bridge driver.
s_type_addr: sets tuner type and its I2C addr. s_type_addr: sets tuner type and its I2C addr.
s_config: sets tda9887 specific stuff, like port1, port2 and qss s_config: sets tda9887 specific stuff, like port1, port2 and qss
*/ */
struct v4l2_subdev_tuner_ops { struct v4l2_subdev_tuner_ops {
int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
int (*s_radio)(struct v4l2_subdev *sd); int (*s_radio)(struct v4l2_subdev *sd);
int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); int (*s_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq); int (*g_frequency)(struct v4l2_subdev *sd, struct v4l2_frequency *freq);
......
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