aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/fm801.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/fm801.c')
-rw-r--r--sound/pci/fm801.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 32b02d906703..136f7232bb7c 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -729,11 +729,14 @@ static struct snd_fm801_tea575x_gpio snd_fm801_tea575x_gpios[] = {
729 { .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" }, 729 { .data = 2, .clk = 0, .wren = 1, .most = 3, .name = "SF64-PCR" },
730}; 730};
731 731
732#define get_tea575x_gpio(chip) \
733 (&snd_fm801_tea575x_gpios[((chip)->tea575x_tuner & TUNER_TYPE_MASK) - 1])
734
732static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins) 735static void snd_fm801_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
733{ 736{
734 struct fm801 *chip = tea->private_data; 737 struct fm801 *chip = tea->private_data;
735 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 738 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
736 struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; 739 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
737 740
738 reg &= ~(FM801_GPIO_GP(gpio.data) | 741 reg &= ~(FM801_GPIO_GP(gpio.data) |
739 FM801_GPIO_GP(gpio.clk) | 742 FM801_GPIO_GP(gpio.clk) |
@@ -751,7 +754,7 @@ static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea)
751{ 754{
752 struct fm801 *chip = tea->private_data; 755 struct fm801 *chip = tea->private_data;
753 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 756 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
754 struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; 757 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
755 758
756 return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 | 759 return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 |
757 (reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0; 760 (reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0;
@@ -761,7 +764,7 @@ static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output
761{ 764{
762 struct fm801 *chip = tea->private_data; 765 struct fm801 *chip = tea->private_data;
763 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL)); 766 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
764 struct snd_fm801_tea575x_gpio gpio = snd_fm801_tea575x_gpios[(chip->tea575x_tuner & TUNER_TYPE_MASK) - 1]; 767 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
765 768
766 /* use GPIO lines and set write enable bit */ 769 /* use GPIO lines and set write enable bit */
767 reg |= FM801_GPIO_GS(gpio.data) | 770 reg |= FM801_GPIO_GS(gpio.data) |
@@ -1246,7 +1249,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1246 chip->tea575x_tuner = tea575x_tuner; 1249 chip->tea575x_tuner = tea575x_tuner;
1247 if (!snd_tea575x_init(&chip->tea)) { 1250 if (!snd_tea575x_init(&chip->tea)) {
1248 snd_printk(KERN_INFO "detected TEA575x radio type %s\n", 1251 snd_printk(KERN_INFO "detected TEA575x radio type %s\n",
1249 snd_fm801_tea575x_gpios[tea575x_tuner - 1].name); 1252 get_tea575x_gpio(chip)->name);
1250 break; 1253 break;
1251 } 1254 }
1252 } 1255 }
@@ -1256,9 +1259,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1256 } 1259 }
1257 } 1260 }
1258 if (!(chip->tea575x_tuner & TUNER_DISABLED)) { 1261 if (!(chip->tea575x_tuner & TUNER_DISABLED)) {
1259 strlcpy(chip->tea.card, 1262 strlcpy(chip->tea.card, get_tea575x_gpio(chip)->name,
1260 snd_fm801_tea575x_gpios[(tea575x_tuner &
1261 TUNER_TYPE_MASK) - 1].name,
1262 sizeof(chip->tea.card)); 1263 sizeof(chip->tea.card));
1263 } 1264 }
1264#endif 1265#endif
@@ -1311,8 +1312,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
1311 } 1312 }
1312 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801, 1313 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
1313 FM801_REG(chip, MPU401_DATA), 1314 FM801_REG(chip, MPU401_DATA),
1314 MPU401_INFO_INTEGRATED, 1315 MPU401_INFO_INTEGRATED |
1315 chip->irq, 0, &chip->rmidi)) < 0) { 1316 MPU401_INFO_IRQ_HOOK,
1317 -1, &chip->rmidi)) < 0) {
1316 snd_card_free(card); 1318 snd_card_free(card);
1317 return err; 1319 return err;
1318 } 1320 }