Skip to content

Commit

Permalink
ALSA: fm801: Gracefully handle failure of tuner auto-detect
Browse files Browse the repository at this point in the history
Commit 9676001
("ALSA: fm801: add error handling if auto-detect fails") seems to
break systems that were previously working without a tuner.

As a bonus, this should fix init and cleanup for the case where the
tuner is explicitly disabled.

Reported-and-tested-by: Hor Jiun Shyong <[email protected]>
References: http://bugs.debian.org/641946
Signed-off-by: Ben Hutchings <[email protected]>
Cc: [email protected] [v3.0+]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
bwhacks authored and tiwai committed Sep 22, 2011
1 parent 2ba34e4 commit c37279b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sound/pci/fm801.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ MODULE_PARM_DESC(enable, "Enable FM801 soundcard.");
module_param_array(tea575x_tuner, int, NULL, 0444);
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).");

#define TUNER_DISABLED (1<<3)
#define TUNER_ONLY (1<<4)
#define TUNER_TYPE_MASK (~TUNER_ONLY & 0xFFFF)

Expand Down Expand Up @@ -1150,7 +1151,8 @@ static int snd_fm801_free(struct fm801 *chip)

__end_hw:
#ifdef CONFIG_SND_FM801_TEA575X_BOOL
snd_tea575x_exit(&chip->tea);
if (!(chip->tea575x_tuner & TUNER_DISABLED))
snd_tea575x_exit(&chip->tea);
#endif
if (chip->irq >= 0)
free_irq(chip->irq, chip);
Expand Down Expand Up @@ -1250,10 +1252,15 @@ static int __devinit snd_fm801_create(struct snd_card *card,
}
if (tea575x_tuner == 4) {
snd_printk(KERN_ERR "TEA575x radio not found\n");
return -ENODEV;
chip->tea575x_tuner = TUNER_DISABLED;
}
}
strlcpy(chip->tea.card, snd_fm801_tea575x_gpios[(tea575x_tuner & TUNER_TYPE_MASK) - 1].name, sizeof(chip->tea.card));
if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
strlcpy(chip->tea.card,
snd_fm801_tea575x_gpios[(tea575x_tuner &
TUNER_TYPE_MASK) - 1].name,
sizeof(chip->tea.card));
}
#endif

*rchip = chip;
Expand Down

0 comments on commit c37279b

Please sign in to comment.