summaryrefslogtreecommitdiff
path: root/linux/drivers/media/radio
diff options
context:
space:
mode:
authorTobias Lorenz <tobias.lorenz@gmx.net>2008-09-25 00:33:41 +0200
committerTobias Lorenz <tobias.lorenz@gmx.net>2008-09-25 00:33:41 +0200
commit2217490ce646247b0c1c3aa30fedc9b3e26c7c26 (patch)
tree47133af68bcd5a0a5e46c07be46800669e06aed7 /linux/drivers/media/radio
parent77fc68c15b2f59a0efb33face338913becc45c83 (diff)
downloadmediapointer-dvb-s2-2217490ce646247b0c1c3aa30fedc9b3e26c7c26.tar.gz
mediapointer-dvb-s2-2217490ce646247b0c1c3aa30fedc9b3e26c7c26.tar.bz2
si470x: correction of mono/stereo handling
From: Tobias Lorenz <tobias.lorenz@gmx.net> Hi Mauro, this patch corrects the behavior of mono/stereo indication and selection. These functions now work conform to what's defined in the V4L2 specification. Bye, Toby Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Diffstat (limited to 'linux/drivers/media/radio')
-rw-r--r--linux/drivers/media/radio/radio-si470x.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/linux/drivers/media/radio/radio-si470x.c b/linux/drivers/media/radio/radio-si470x.c
index ab9543f6b..7572d434b 100644
--- a/linux/drivers/media/radio/radio-si470x.c
+++ b/linux/drivers/media/radio/radio-si470x.c
@@ -1436,7 +1436,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
/* driver constants */
strcpy(tuner->name, "FM");
tuner->type = V4L2_TUNER_RADIO;
- tuner->capability = V4L2_TUNER_CAP_LOW;
+ tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
/* range limits */
switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) {
@@ -1456,13 +1456,18 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
tuner->rangehigh = 90 * FREQ_MUL;
break;
};
- tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
- /* Stereo indicator == Stereo (instead of Mono) */
+ /* stereo indicator == stereo (instead of mono) */
if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1)
- tuner->audmode = V4L2_TUNER_MODE_STEREO;
+ tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
else
+ tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
+
+ /* mono/stereo selector */
+ if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1)
tuner->audmode = V4L2_TUNER_MODE_MONO;
+ else
+ tuner->audmode = V4L2_TUNER_MODE_STEREO;
/* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */
tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI)
@@ -1497,10 +1502,17 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv,
if (tuner->index != 0)
goto done;
- if (tuner->audmode == V4L2_TUNER_MODE_MONO)
+ /* mono/stereo selector */
+ switch (tuner->audmode) {
+ case V4L2_TUNER_MODE_MONO:
radio->registers[POWERCFG] |= POWERCFG_MONO; /* force mono */
- else
+ break;
+ case V4L2_TUNER_MODE_STEREO:
radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */
+ break;
+ default:
+ goto done;
+ }
retval = si470x_set_register(radio, POWERCFG);