Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115615
b: refs/heads/master
c: 33632d4
h: refs/heads/master
i:
  115613: e36f06a
  115611: 1da708c
  115607: 0334cf3
  115599: 14996be
  115583: 8990739
v: v3
  • Loading branch information
Tobias Lorenz authored and Mauro Carvalho Chehab committed Oct 17, 2008
1 parent 5ad7595 commit 4dce358
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 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: eb6e3b860e36a3259d3694636ddce2660aabbd2c
refs/heads/master: 33632d4773b8256c29525b7151cd74226352f838
21 changes: 12 additions & 9 deletions trunk/drivers/media/radio/radio-si470x.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
* - hardware frequency seek support
* - afc indication
* - more safety checks, let si470x_get_freq return errno
* - vidioc behavior corrected according to v4l2 spec
*
* ToDo:
* - add firmware download/update support
Expand Down Expand Up @@ -1418,7 +1419,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
retval = -EIO;
goto done;
}
if ((tuner->index != 0) && (tuner->type != V4L2_TUNER_RADIO)) {
if (tuner->index != 0) {
retval = -EINVAL;
goto done;
}
Expand All @@ -1427,7 +1428,11 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
if (retval < 0)
goto done;

/* driver constants */
strcpy(tuner->name, "FM");
tuner->type = V4L2_TUNER_RADIO;
tuner->capability = V4L2_TUNER_CAP_LOW;

/* range limits */
switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) {
/* 0: 87.5 - 108 MHz (USA, Europe, default) */
Expand All @@ -1447,7 +1452,6 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
break;
};
tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
tuner->capability = V4L2_TUNER_CAP_LOW;

/* Stereo indicator == Stereo (instead of Mono) */
if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1)
Expand Down Expand Up @@ -1478,17 +1482,15 @@ 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;
int retval = -EINVAL;

/* safety checks */
if (radio->disconnected) {
retval = -EIO;
goto done;
}
if ((tuner->index != 0) && (tuner->type != V4L2_TUNER_RADIO)) {
retval = -EINVAL;
if (tuner->index != 0)
goto done;
}

if (tuner->audmode == V4L2_TUNER_MODE_MONO)
radio->registers[POWERCFG] |= POWERCFG_MONO; /* force mono */
Expand Down Expand Up @@ -1519,11 +1521,12 @@ static int si470x_vidioc_g_frequency(struct file *file, void *priv,
retval = -EIO;
goto done;
}
if ((freq->tuner != 0) && (freq->type != V4L2_TUNER_RADIO)) {
if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
}

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

done:
Expand All @@ -1548,7 +1551,7 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv,
retval = -EIO;
goto done;
}
if ((freq->tuner != 0) && (freq->type != V4L2_TUNER_RADIO)) {
if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
}
Expand Down Expand Up @@ -1577,7 +1580,7 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv,
retval = -EIO;
goto done;
}
if ((seek->tuner != 0) && (seek->type != V4L2_TUNER_RADIO)) {
if (seek->tuner != 0) {
retval = -EINVAL;
goto done;
}
Expand Down

0 comments on commit 4dce358

Please sign in to comment.