aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2011-05-10 17:24:15 -0400
committerTakashi Iwai <tiwai@suse.de>2011-05-11 04:52:24 -0400
commitd7ba858a7f7a95d1617756a83ff0717767f624fd (patch)
treee33938c95874948dc4e68bc5646ddd3cd6f4f84c
parent938a1566b162aa485acd8dea2ebd92d92dfa0a45 (diff)
ALSA: fm801: implement TEA575x tuner autodetection
Autodetect TEA575x tuner connection type during init. This allows tuner to work out-of-the box. tea575x_tuner module parameter remains functional to force tuner type. Tested with SF256-PCP and SF64-PCR. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/fm801.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 1db5ead62a98..5aa3fd6f25f7 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -53,7 +53,7 @@ static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card *
53/* 53/*
54 * Enable TEA575x tuner 54 * Enable TEA575x tuner
55 * 1 = MediaForte 256-PCS 55 * 1 = MediaForte 256-PCS
56 * 2 = MediaForte 256-PCPR 56 * 2 = MediaForte 256-PCP
57 * 3 = MediaForte 64-PCR 57 * 3 = MediaForte 64-PCR
58 * 16 = setup tuner only (this is additional bit), i.e. SF64-PCR FM card 58 * 16 = setup tuner only (this is additional bit), i.e. SF64-PCR FM card
59 * High 16-bits are video (radio) device number + 1 59 * High 16-bits are video (radio) device number + 1
@@ -67,7 +67,7 @@ MODULE_PARM_DESC(id, "ID string for the FM801 soundcard.");
67module_param_array(enable, bool, NULL, 0444); 67module_param_array(enable, bool, NULL, 0444);
68MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); 68MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
69module_param_array(tea575x_tuner, int, NULL, 0444); 69module_param_array(tea575x_tuner, int, NULL, 0444);
70MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (1 = SF256-PCS, 2=SF256-PCPR, 3=SF64-PCR, +16=tuner-only)."); 70MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (0 = auto, 1 = SF256-PCS, 2=SF256-PCP, 3=SF64-PCR, 8=disable, +16=tuner-only).");
71 71
72#define TUNER_ONLY (1<<4) 72#define TUNER_ONLY (1<<4)
73#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF) 73#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF)
@@ -720,12 +720,13 @@ static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pc
720/* GPIO to TEA575x maps */ 720/* GPIO to TEA575x maps */
721struct snd_fm801_tea575x_gpio { 721struct snd_fm801_tea575x_gpio {
722 u8 data, clk, wren, most; 722 u8 data, clk, wren, most;
723 char *name;
723}; 724};
724 725
725static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = { 726static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = {
726 { .data = 1, .clk = 3, .wren = 2, .most = 0 }, /* SF256-PCS */ 727 { .data = 1, .clk = 3, .wren = 2, .most = 0, .name = "SF256-PCS" },
727 { .data = 1, .clk = 0, .wren = 2, .most = 3 }, /* SF256-PCP */ 728 { .data = 1, .clk = 0, .wren = 2, .most = 3, .name = "SF256-PCP" },
728 { .data = 2, .clk = 0, .wren = 1, .most = 3 }, /* SF64-PCR */ 729 { .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" },
729}; 730};
730 731
731static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) 732static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
@@ -1229,14 +1230,24 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1229 snd_card_set_dev(card, &pci->dev); 1230 snd_card_set_dev(card, &pci->dev);
1230 1231
1231#ifdef TEA575X_RADIO 1232#ifdef TEA575X_RADIO
1233 chip->tea.card = card;
1234 chip->tea.freq_fixup = 10700;
1235 chip->tea.private_data = chip;
1236 chip->tea.ops = &snd_fm801_tea_ops;
1232 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 && 1237 if ((tea575x_tuner & TUNER_TYPE_MASK) > 0 &&
1233 (tea575x_tuner & TUNER_TYPE_MASK) < 4) { 1238 (tea575x_tuner & TUNER_TYPE_MASK) < 4) {
1234 chip->tea.card = card; 1239 if (snd_tea575x_init(&chip->tea))
1235 chip->tea.freq_fixup = 10700; 1240 snd_printk(KERN_ERR "TEA575x radio not found\n");
1236 chip->tea.private_data = chip; 1241 } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0)
1237 chip->tea.ops = &snd_fm801_tea_ops; 1242 /* autodetect tuner connection */
1238 snd_tea575x_init(&chip->tea); 1243 for (tea575x_tuner = 1; tea575x_tuner <= 3; tea575x_tuner++) {
1239 } 1244 chip->tea575x_tuner = tea575x_tuner;
1245 if (!snd_tea575x_init(&chip->tea)) {
1246 snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
1247 snd_fm801_tea575x_gpios[tea575x_tuner - 1].name);
1248 break;
1249 }
1250 }
1240#endif 1251#endif
1241 1252
1242 *rchip = chip; 1253 *rchip = chip;