diff options
author | Tobias Lorenz <tobias.lorenz@gmx.net> | 2008-09-24 18:21:50 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-17 16:21:11 -0400 |
commit | a17c0019f24e46c608945d988375cc14a8bbde28 (patch) | |
tree | 884e21803a006e6451f466196702de6c6c7f1182 | |
parent | 374ab68615592043dadbbe54f3beadf9556704f8 (diff) |
V4L/DVB (9214): si470x: improvement of module device support
This patch improves support for multiple radio devices.
In previous versions all region relevant settings were derived from one
module parameter. As in future versions, the region and other
configuration should be configurable per device from the user space,
this patch already retrieves all relevant information from the actual
device specific settings.
Signed-off-by: Tobias Lorenz <tobias.lorenz@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/radio/radio-si470x.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 3efc08f424fd..2f680268c545 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -667,23 +667,29 @@ static int si470x_get_freq(struct si470x_device *radio, unsigned int *freq) | |||
667 | int retval; | 667 | int retval; |
668 | 668 | ||
669 | /* Spacing (kHz) */ | 669 | /* Spacing (kHz) */ |
670 | switch (space) { | 670 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_SPACE) >> 4) { |
671 | /* 0: 200 kHz (USA, Australia) */ | 671 | /* 0: 200 kHz (USA, Australia) */ |
672 | case 0 : spacing = 0.200 * FREQ_MUL; break; | 672 | case 0: |
673 | spacing = 0.200 * FREQ_MUL; break; | ||
673 | /* 1: 100 kHz (Europe, Japan) */ | 674 | /* 1: 100 kHz (Europe, Japan) */ |
674 | case 1 : spacing = 0.100 * FREQ_MUL; break; | 675 | case 1: |
676 | spacing = 0.100 * FREQ_MUL; break; | ||
675 | /* 2: 50 kHz */ | 677 | /* 2: 50 kHz */ |
676 | default: spacing = 0.050 * FREQ_MUL; break; | 678 | default: |
679 | spacing = 0.050 * FREQ_MUL; break; | ||
677 | }; | 680 | }; |
678 | 681 | ||
679 | /* Bottom of Band (MHz) */ | 682 | /* Bottom of Band (MHz) */ |
680 | switch (band) { | 683 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { |
681 | /* 0: 87.5 - 108 MHz (USA, Europe) */ | 684 | /* 0: 87.5 - 108 MHz (USA, Europe) */ |
682 | case 0 : band_bottom = 87.5 * FREQ_MUL; break; | 685 | case 0: |
686 | band_bottom = 87.5 * FREQ_MUL; break; | ||
683 | /* 1: 76 - 108 MHz (Japan wide band) */ | 687 | /* 1: 76 - 108 MHz (Japan wide band) */ |
684 | default: band_bottom = 76 * FREQ_MUL; break; | 688 | default: |
689 | band_bottom = 76 * FREQ_MUL; break; | ||
685 | /* 2: 76 - 90 MHz (Japan) */ | 690 | /* 2: 76 - 90 MHz (Japan) */ |
686 | case 2 : band_bottom = 76 * FREQ_MUL; break; | 691 | case 2: |
692 | band_bottom = 76 * FREQ_MUL; break; | ||
687 | }; | 693 | }; |
688 | 694 | ||
689 | /* read channel */ | 695 | /* read channel */ |
@@ -706,23 +712,29 @@ static int si470x_set_freq(struct si470x_device *radio, unsigned int freq) | |||
706 | unsigned short chan; | 712 | unsigned short chan; |
707 | 713 | ||
708 | /* Spacing (kHz) */ | 714 | /* Spacing (kHz) */ |
709 | switch (space) { | 715 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_SPACE) >> 4) { |
710 | /* 0: 200 kHz (USA, Australia) */ | 716 | /* 0: 200 kHz (USA, Australia) */ |
711 | case 0 : spacing = 0.200 * FREQ_MUL; break; | 717 | case 0: |
718 | spacing = 0.200 * FREQ_MUL; break; | ||
712 | /* 1: 100 kHz (Europe, Japan) */ | 719 | /* 1: 100 kHz (Europe, Japan) */ |
713 | case 1 : spacing = 0.100 * FREQ_MUL; break; | 720 | case 1: |
721 | spacing = 0.100 * FREQ_MUL; break; | ||
714 | /* 2: 50 kHz */ | 722 | /* 2: 50 kHz */ |
715 | default: spacing = 0.050 * FREQ_MUL; break; | 723 | default: |
724 | spacing = 0.050 * FREQ_MUL; break; | ||
716 | }; | 725 | }; |
717 | 726 | ||
718 | /* Bottom of Band (MHz) */ | 727 | /* Bottom of Band (MHz) */ |
719 | switch (band) { | 728 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { |
720 | /* 0: 87.5 - 108 MHz (USA, Europe) */ | 729 | /* 0: 87.5 - 108 MHz (USA, Europe) */ |
721 | case 0 : band_bottom = 87.5 * FREQ_MUL; break; | 730 | case 0: |
731 | band_bottom = 87.5 * FREQ_MUL; break; | ||
722 | /* 1: 76 - 108 MHz (Japan wide band) */ | 732 | /* 1: 76 - 108 MHz (Japan wide band) */ |
723 | default: band_bottom = 76 * FREQ_MUL; break; | 733 | default: |
734 | band_bottom = 76 * FREQ_MUL; break; | ||
724 | /* 2: 76 - 90 MHz (Japan) */ | 735 | /* 2: 76 - 90 MHz (Japan) */ |
725 | case 2 : band_bottom = 76 * FREQ_MUL; break; | 736 | case 2: |
737 | band_bottom = 76 * FREQ_MUL; break; | ||
726 | }; | 738 | }; |
727 | 739 | ||
728 | /* Chan = [ Freq (Mhz) - Bottom of Band (MHz) ] / Spacing (kHz) */ | 740 | /* Chan = [ Freq (Mhz) - Bottom of Band (MHz) ] / Spacing (kHz) */ |
@@ -1425,7 +1437,8 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv, | |||
1425 | goto done; | 1437 | goto done; |
1426 | 1438 | ||
1427 | strcpy(tuner->name, "FM"); | 1439 | strcpy(tuner->name, "FM"); |
1428 | switch (band) { | 1440 | /* range limits */ |
1441 | switch ((radio->registers[SYSCONFIG2] & SYSCONFIG2_BAND) >> 6) { | ||
1429 | /* 0: 87.5 - 108 MHz (USA, Europe, default) */ | 1442 | /* 0: 87.5 - 108 MHz (USA, Europe, default) */ |
1430 | default: | 1443 | default: |
1431 | tuner->rangelow = 87.5 * FREQ_MUL; | 1444 | tuner->rangelow = 87.5 * FREQ_MUL; |