Commit 54f6019b authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] S_HW_FREQ_SEEK: set capability flags and return ENODATA instead of EAGAIN

Set the new capability flags in G_TUNER and return ENODATA if no channels
were found.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e4cca4ed
...@@ -295,7 +295,8 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -295,7 +295,8 @@ static int vidioc_g_tuner(struct file *file, void *priv,
v->type = V4L2_TUNER_RADIO; v->type = V4L2_TUNER_RADIO;
v->rangelow = FREQ_MIN * FREQ_MUL; v->rangelow = FREQ_MIN * FREQ_MUL;
v->rangehigh = FREQ_MAX * FREQ_MUL; v->rangehigh = FREQ_MAX * FREQ_MUL;
v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
V4L2_TUNER_CAP_HWSEEK_WRAP;
v->rxsubchans = is_stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; v->rxsubchans = is_stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
v->audmode = radio->stereo ? v->audmode = radio->stereo ?
V4L2_TUNER_MODE_STEREO : V4L2_TUNER_MODE_MONO; V4L2_TUNER_MODE_STEREO : V4L2_TUNER_MODE_MONO;
...@@ -372,7 +373,7 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *priv, ...@@ -372,7 +373,7 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *priv,
timeout = jiffies + msecs_to_jiffies(30000); timeout = jiffies + msecs_to_jiffies(30000);
for (;;) { for (;;) {
if (time_after(jiffies, timeout)) { if (time_after(jiffies, timeout)) {
retval = -EAGAIN; retval = -ENODATA;
break; break;
} }
if (schedule_timeout_interruptible(msecs_to_jiffies(10))) { if (schedule_timeout_interruptible(msecs_to_jiffies(10))) {
......
...@@ -1514,7 +1514,8 @@ static int wl1273_fm_vidioc_g_tuner(struct file *file, void *priv, ...@@ -1514,7 +1514,8 @@ static int wl1273_fm_vidioc_g_tuner(struct file *file, void *priv,
tuner->rangehigh = WL1273_FREQ(WL1273_BAND_OTHER_HIGH); tuner->rangehigh = WL1273_FREQ(WL1273_BAND_OTHER_HIGH);
tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_RDS | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_RDS |
V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS_BLOCK_IO; V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS_BLOCK_IO |
V4L2_TUNER_CAP_HWSEEK_BOUNDED | V4L2_TUNER_CAP_HWSEEK_WRAP;
if (radio->stereo) if (radio->stereo)
tuner->audmode = V4L2_TUNER_MODE_STEREO; tuner->audmode = V4L2_TUNER_MODE_STEREO;
......
...@@ -363,7 +363,7 @@ static int si470x_set_seek(struct si470x_device *radio, ...@@ -363,7 +363,7 @@ static int si470x_set_seek(struct si470x_device *radio,
/* try again, if timed out */ /* try again, if timed out */
if (retval == 0 && timed_out) if (retval == 0 && timed_out)
return -EAGAIN; return -ENODATA;
return retval; return retval;
} }
...@@ -596,7 +596,9 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, ...@@ -596,7 +596,9 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
strcpy(tuner->name, "FM"); strcpy(tuner->name, "FM");
tuner->type = V4L2_TUNER_RADIO; tuner->type = V4L2_TUNER_RADIO;
tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO; V4L2_TUNER_CAP_RDS | V4L2_TUNER_CAP_RDS_BLOCK_IO |
V4L2_TUNER_CAP_HWSEEK_BOUNDED |
V4L2_TUNER_CAP_HWSEEK_WRAP;
/* range limits */ /* range limits */
switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) {
......
...@@ -251,7 +251,7 @@ int fm_rx_seek(struct fmdev *fmdev, u32 seek_upward, ...@@ -251,7 +251,7 @@ int fm_rx_seek(struct fmdev *fmdev, u32 seek_upward,
if (!timeleft) { if (!timeleft) {
fmerr("Timeout(%d sec),didn't get tune ended int\n", fmerr("Timeout(%d sec),didn't get tune ended int\n",
jiffies_to_msecs(FM_DRV_RX_SEEK_TIMEOUT) / 1000); jiffies_to_msecs(FM_DRV_RX_SEEK_TIMEOUT) / 1000);
return -ETIMEDOUT; return -ENODATA;
} }
int_reason = fmdev->irq_info.flag & (FM_TUNE_COMPLETE | FM_BAND_LIMIT); int_reason = fmdev->irq_info.flag & (FM_TUNE_COMPLETE | FM_BAND_LIMIT);
......
...@@ -285,7 +285,9 @@ static int fm_v4l2_vidioc_g_tuner(struct file *file, void *priv, ...@@ -285,7 +285,9 @@ static int fm_v4l2_vidioc_g_tuner(struct file *file, void *priv,
tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO |
((fmdev->rx.rds.flag == FM_RDS_ENABLE) ? V4L2_TUNER_SUB_RDS : 0); ((fmdev->rx.rds.flag == FM_RDS_ENABLE) ? V4L2_TUNER_SUB_RDS : 0);
tuner->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS | tuner->capability = V4L2_TUNER_CAP_STEREO | V4L2_TUNER_CAP_RDS |
V4L2_TUNER_CAP_LOW; V4L2_TUNER_CAP_LOW |
V4L2_TUNER_CAP_HWSEEK_BOUNDED |
V4L2_TUNER_CAP_HWSEEK_WRAP;
tuner->audmode = (stereo_mono_mode ? tuner->audmode = (stereo_mono_mode ?
V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO); V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO);
......
...@@ -191,6 +191,8 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -191,6 +191,8 @@ static int vidioc_g_tuner(struct file *file, void *priv,
strcpy(v->name, "FM"); strcpy(v->name, "FM");
v->type = V4L2_TUNER_RADIO; v->type = V4L2_TUNER_RADIO;
v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
if (!tea->cannot_read_data)
v->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED;
v->rangelow = FREQ_LO; v->rangelow = FREQ_LO;
v->rangehigh = FREQ_HI; v->rangehigh = FREQ_HI;
v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO;
...@@ -299,7 +301,7 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh, ...@@ -299,7 +301,7 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh,
} }
tea->val &= ~TEA575X_BIT_SEARCH; tea->val &= ~TEA575X_BIT_SEARCH;
snd_tea575x_set_freq(tea); snd_tea575x_set_freq(tea);
return -EAGAIN; return -ENODATA;
} }
static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl) static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
......
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