diff options
author | Tobias Lorenz <tobias.lorenz@gmx.net> | 2008-09-24 18:33:41 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:22:03 -0400 |
commit | 73a529f9a6fee877c4e41f7541b8689dd7561bd7 (patch) | |
tree | 07dc6232c8e5195d27d2fdbab9b180599d735803 /drivers/media/radio | |
parent | 33632d4773b8256c29525b7151cd74226352f838 (diff) |
V4L/DVB (9217): si470x: correction of mono/stereo handling
This patch corrects the behavior of mono/stereo indication and
selection.
These functions now work conform to what's defined in the V4L2
specification.
Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r-- | drivers/media/radio/radio-si470x.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 274d8464c02e..67d74cecdb67 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -1431,7 +1431,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
1431 | /* driver constants */ | 1431 | /* driver constants */ |
1432 | strcpy(tuner->name, "FM"); | 1432 | strcpy(tuner->name, "FM"); |
1433 | tuner->type = V4L2_TUNER_RADIO; | 1433 | tuner->type = V4L2_TUNER_RADIO; |
1434 | tuner->capability = V4L2_TUNER_CAP_LOW; | 1434 | tuner->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; |
1435 | 1435 | ||
1436 | /* range limits */ | 1436 | /* range limits */ |
1437 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { | 1437 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { |
@@ -1451,13 +1451,18 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
1451 | tuner->rangehigh = 90 * FREQ_MUL; | 1451 | tuner->rangehigh = 90 * FREQ_MUL; |
1452 | break; | 1452 | break; |
1453 | }; | 1453 | }; |
1454 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; | ||
1455 | 1454 | ||
1456 | /* Stereo indicator == Stereo (instead of Mono) */ | 1455 | /* stereo indicator == stereo (instead of mono) */ |
1457 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) | 1456 | if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1) |
1458 | tuner->audmode = V4L2_TUNER_MODE_STEREO; | 1457 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
1459 | else | 1458 | else |
1459 | tuner->rxsubchans = V4L2_TUNER_SUB_MONO; | ||
1460 | |||
1461 | /* mono/stereo selector */ | ||
1462 | if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1) | ||
1460 | tuner->audmode = V4L2_TUNER_MODE_MONO; | 1463 | tuner->audmode = V4L2_TUNER_MODE_MONO; |
1464 | else | ||
1465 | tuner->audmode = V4L2_TUNER_MODE_STEREO; | ||
1461 | 1466 | ||
1462 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ | 1467 | /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */ |
1463 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) | 1468 | tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI) |
@@ -1492,10 +1497,17 @@ static int si470x_vidioc_s_tuner(struct file *file, void *priv, | |||
1492 | if (tuner->index != 0) | 1497 | if (tuner->index != 0) |
1493 | goto done; | 1498 | goto done; |
1494 | 1499 | ||
1495 | if (tuner->audmode == V4L2_TUNER_MODE_MONO) | 1500 | /* mono/stereo selector */ |
1501 | switch (tuner->audmode) { | ||
1502 | case V4L2_TUNER_MODE_MONO: | ||
1496 | radio->registers[POWERCFG] |= POWERCFG_MONO; /* force mono */ | 1503 | radio->registers[POWERCFG] |= POWERCFG_MONO; /* force mono */ |
1497 | else | 1504 | break; |
1505 | case V4L2_TUNER_MODE_STEREO: | ||
1498 | radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */ | 1506 | radio->registers[POWERCFG] &= ~POWERCFG_MONO; /* try stereo */ |
1507 | break; | ||
1508 | default: | ||
1509 | goto done; | ||
1510 | } | ||
1499 | 1511 | ||
1500 | retval = si470x_set_register(radio, POWERCFG); | 1512 | retval = si470x_set_register(radio, POWERCFG); |
1501 | 1513 | ||