diff options
Diffstat (limited to 'sound/pci/fm801.c')
-rw-r--r-- | sound/pci/fm801.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index 9597ef1eccca..a416ea8af3e9 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -58,6 +58,7 @@ static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card | |||
58 | * High 16-bits are video (radio) device number + 1 | 58 | * High 16-bits are video (radio) device number + 1 |
59 | */ | 59 | */ |
60 | static int tea575x_tuner[SNDRV_CARDS]; | 60 | static int tea575x_tuner[SNDRV_CARDS]; |
61 | static int radio_nr[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; | ||
61 | 62 | ||
62 | module_param_array(index, int, NULL, 0444); | 63 | module_param_array(index, int, NULL, 0444); |
63 | MODULE_PARM_DESC(index, "Index value for the FM801 soundcard."); | 64 | MODULE_PARM_DESC(index, "Index value for the FM801 soundcard."); |
@@ -67,6 +68,9 @@ module_param_array(enable, bool, NULL, 0444); | |||
67 | MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); | 68 | MODULE_PARM_DESC(enable, "Enable FM801 soundcard."); |
68 | module_param_array(tea575x_tuner, int, NULL, 0444); | 69 | module_param_array(tea575x_tuner, int, NULL, 0444); |
69 | MODULE_PARM_DESC(tea575x_tuner, "TEA575x tuner access method (0 = auto, 1 = SF256-PCS, 2=SF256-PCP, 3=SF64-PCR, 8=disable, +16=tuner-only)."); | 70 | MODULE_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 | module_param_array(radio_nr, int, NULL, 0444); | ||
72 | MODULE_PARM_DESC(radio_nr, "Radio device numbers"); | ||
73 | |||
70 | 74 | ||
71 | #define TUNER_DISABLED (1<<3) | 75 | #define TUNER_DISABLED (1<<3) |
72 | #define TUNER_ONLY (1<<4) | 76 | #define TUNER_ONLY (1<<4) |
@@ -197,6 +201,7 @@ struct fm801 { | |||
197 | struct snd_info_entry *proc_entry; | 201 | struct snd_info_entry *proc_entry; |
198 | 202 | ||
199 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL | 203 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL |
204 | struct v4l2_device v4l2_dev; | ||
200 | struct snd_tea575x tea; | 205 | struct snd_tea575x tea; |
201 | #endif | 206 | #endif |
202 | 207 | ||
@@ -1154,8 +1159,10 @@ static int snd_fm801_free(struct fm801 *chip) | |||
1154 | 1159 | ||
1155 | __end_hw: | 1160 | __end_hw: |
1156 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL | 1161 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL |
1157 | if (!(chip->tea575x_tuner & TUNER_DISABLED)) | 1162 | if (!(chip->tea575x_tuner & TUNER_DISABLED)) { |
1158 | snd_tea575x_exit(&chip->tea); | 1163 | snd_tea575x_exit(&chip->tea); |
1164 | v4l2_device_unregister(&chip->v4l2_dev); | ||
1165 | } | ||
1159 | #endif | 1166 | #endif |
1160 | if (chip->irq >= 0) | 1167 | if (chip->irq >= 0) |
1161 | free_irq(chip->irq, chip); | 1168 | free_irq(chip->irq, chip); |
@@ -1175,6 +1182,7 @@ static int snd_fm801_dev_free(struct snd_device *device) | |||
1175 | static int __devinit snd_fm801_create(struct snd_card *card, | 1182 | static int __devinit snd_fm801_create(struct snd_card *card, |
1176 | struct pci_dev * pci, | 1183 | struct pci_dev * pci, |
1177 | int tea575x_tuner, | 1184 | int tea575x_tuner, |
1185 | int radio_nr, | ||
1178 | struct fm801 ** rchip) | 1186 | struct fm801 ** rchip) |
1179 | { | 1187 | { |
1180 | struct fm801 *chip; | 1188 | struct fm801 *chip; |
@@ -1234,6 +1242,13 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1234 | snd_card_set_dev(card, &pci->dev); | 1242 | snd_card_set_dev(card, &pci->dev); |
1235 | 1243 | ||
1236 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL | 1244 | #ifdef CONFIG_SND_FM801_TEA575X_BOOL |
1245 | err = v4l2_device_register(&pci->dev, &chip->v4l2_dev); | ||
1246 | if (err < 0) { | ||
1247 | snd_fm801_free(chip); | ||
1248 | return err; | ||
1249 | } | ||
1250 | chip->tea.v4l2_dev = &chip->v4l2_dev; | ||
1251 | chip->tea.radio_nr = radio_nr; | ||
1237 | chip->tea.private_data = chip; | 1252 | chip->tea.private_data = chip; |
1238 | chip->tea.ops = &snd_fm801_tea_ops; | 1253 | chip->tea.ops = &snd_fm801_tea_ops; |
1239 | sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); | 1254 | sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci)); |
@@ -1241,6 +1256,7 @@ static int __devinit snd_fm801_create(struct snd_card *card, | |||
1241 | (tea575x_tuner & TUNER_TYPE_MASK) < 4) { | 1256 | (tea575x_tuner & TUNER_TYPE_MASK) < 4) { |
1242 | if (snd_tea575x_init(&chip->tea)) { | 1257 | if (snd_tea575x_init(&chip->tea)) { |
1243 | snd_printk(KERN_ERR "TEA575x radio not found\n"); | 1258 | snd_printk(KERN_ERR "TEA575x radio not found\n"); |
1259 | snd_fm801_free(chip); | ||
1244 | return -ENODEV; | 1260 | return -ENODEV; |
1245 | } | 1261 | } |
1246 | } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) { | 1262 | } else if ((tea575x_tuner & TUNER_TYPE_MASK) == 0) { |
@@ -1287,7 +1303,7 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci, | |||
1287 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); | 1303 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1288 | if (err < 0) | 1304 | if (err < 0) |
1289 | return err; | 1305 | return err; |
1290 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { | 1306 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], radio_nr[dev], &chip)) < 0) { |
1291 | snd_card_free(card); | 1307 | snd_card_free(card); |
1292 | return err; | 1308 | return err; |
1293 | } | 1309 | } |