Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306353
b: refs/heads/master
c: 340bd4c
h: refs/heads/master
i:
  306351: c5436f2
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed May 14, 2012
1 parent 6fdfa28 commit 34a42bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 62 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eae63ae007fd72d5040d6749339d68fbfd99d8c7
refs/heads/master: 340bd4c16cead8bf8f5205c7d283a3bd9d699f76
78 changes: 17 additions & 61 deletions trunk/drivers/media/radio/si470x/radio-si470x-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static int si470x_set_seek(struct si470x_device *radio,
radio->registers[POWERCFG] &= ~POWERCFG_SEEKUP;
retval = si470x_set_register(radio, POWERCFG);
if (retval < 0)
goto done;
return retval;

/* currently I2C driver only uses interrupt way to seek */
if (radio->stci_enabled) {
Expand Down Expand Up @@ -355,20 +355,15 @@ static int si470x_set_seek(struct si470x_device *radio,
if (radio->registers[STATUSRSSI] & STATUSRSSI_SF)
dev_warn(&radio->videodev.dev,
"seek failed / band limit reached\n");
if (timed_out)
dev_warn(&radio->videodev.dev,
"seek timed out after %u ms\n", seek_timeout);

stop:
/* stop seeking */
radio->registers[POWERCFG] &= ~POWERCFG_SEEK;
retval = si470x_set_register(radio, POWERCFG);

done:
/* try again, if timed out */
if ((retval == 0) && timed_out)
retval = -EAGAIN;

if (retval == 0 && timed_out)
return -EAGAIN;
return retval;
}

Expand Down Expand Up @@ -589,16 +584,14 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *tuner)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
int retval;

if (tuner->index != 0) {
retval = -EINVAL;
goto done;
}
if (tuner->index != 0)
return -EINVAL;

retval = si470x_get_register(radio, STATUSRSSI);
if (retval < 0)
goto done;
return retval;

/* driver constants */
strcpy(tuner->name, "FM");
Expand Down Expand Up @@ -653,10 +646,6 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
/* AFCRL does only indicate that freq. differs, not if too low/high */
tuner->afc = (radio->registers[STATUSRSSI] & STATUSRSSI_AFCRL) ? 1 : 0;

done:
if (retval < 0)
dev_warn(&radio->videodev.dev,
"get tuner failed with %d\n", retval);
return retval;
}

Expand All @@ -668,7 +657,6 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
struct v4l2_tuner *tuner)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;

if (tuner->index != 0)
return -EINVAL;
Expand All @@ -684,12 +672,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
break;
}

retval = si470x_set_register(radio, POWERCFG);

if (retval < 0)
dev_warn(&radio->videodev.dev,
"set tuner failed with %d\n", retval);
return retval;
return si470x_set_register(radio, POWERCFG);
}


Expand All @@ -700,21 +683,12 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *freq)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;

if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
}
if (freq->tuner != 0)
return -EINVAL;

freq->type = V4L2_TUNER_RADIO;
retval = si470x_get_freq(radio, &freq->frequency);

done:
if (retval < 0)
dev_warn(&radio->videodev.dev,
"get frequency failed with %d\n", retval);
return retval;
return si470x_get_freq(radio, &freq->frequency);
}


Expand All @@ -725,20 +699,11 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *freq)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;

if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
}

retval = si470x_set_freq(radio, freq->frequency);
if (freq->tuner != 0)
return -EINVAL;

done:
if (retval < 0)
dev_warn(&radio->videodev.dev,
"set frequency failed with %d\n", retval);
return retval;
return si470x_set_freq(radio, freq->frequency);
}


Expand All @@ -749,20 +714,11 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
struct v4l2_hw_freq_seek *seek)
{
struct si470x_device *radio = video_drvdata(file);
int retval = 0;

if (seek->tuner != 0) {
retval = -EINVAL;
goto done;
}

retval = si470x_set_seek(radio, seek->wrap_around, seek->seek_upward);
if (seek->tuner != 0)
return -EINVAL;

done:
if (retval < 0)
dev_warn(&radio->videodev.dev,
"set hardware frequency seek failed with %d\n", retval);
return retval;
return si470x_set_seek(radio, seek->wrap_around, seek->seek_upward);
}

const struct v4l2_ctrl_ops si470x_ctrl_ops = {
Expand Down

0 comments on commit 34a42bf

Please sign in to comment.