aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRaymond Yau <superquad.vortex2@gmail.com>2012-01-16 22:41:47 -0500
committerTakashi Iwai <tiwai@suse.de>2012-01-24 09:28:05 -0500
commit4d20bb1d5fe1afbdbff951c06cd3d3654fa5ceed (patch)
tree4700066adcfd73ed0501841e574334cda30d7a74 /sound
parentb4ead019afc201f71c39cd0dfcaafed4a97b3dd2 (diff)
ALSA: ymfpci - Don't create invalid PCM & mixers when AC97 doesn't support
- check SDAC bit of AC97 primary codec when create "rear" device 3, "4ch" device 2 and "4ch Duplication" switch as the card need a four channels AC97 codec to support surround40. Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/ymfpci/ymfpci.c21
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c21
2 files changed, 27 insertions, 15 deletions
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index e57b89e8aa89..94ab728f5ca8 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -286,17 +286,22 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
286 snd_card_free(card); 286 snd_card_free(card);
287 return err; 287 return err;
288 } 288 }
289 if ((err = snd_ymfpci_pcm_4ch(chip, 2, NULL)) < 0) { 289 err = snd_ymfpci_mixer(chip, rear_switch[dev]);
290 if (err < 0) {
290 snd_card_free(card); 291 snd_card_free(card);
291 return err; 292 return err;
292 } 293 }
293 if ((err = snd_ymfpci_pcm2(chip, 3, NULL)) < 0) { 294 if (chip->ac97->ext_id & AC97_EI_SDAC) {
294 snd_card_free(card); 295 err = snd_ymfpci_pcm_4ch(chip, 2, NULL);
295 return err; 296 if (err < 0) {
296 } 297 snd_card_free(card);
297 if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) { 298 return err;
298 snd_card_free(card); 299 }
299 return err; 300 err = snd_ymfpci_pcm2(chip, 3, NULL);
301 if (err < 0) {
302 snd_card_free(card);
303 return err;
304 }
300 } 305 }
301 if ((err = snd_ymfpci_timer(chip, 0)) < 0) { 306 if ((err = snd_ymfpci_timer(chip, 0)) < 0) {
302 snd_card_free(card); 307 snd_card_free(card);
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 03ee4e365311..12a9a2b03387 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -1614,6 +1614,14 @@ static int snd_ymfpci_put_dup4ch(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1614 return change; 1614 return change;
1615} 1615}
1616 1616
1617static struct snd_kcontrol_new snd_ymfpci_dup4ch __devinitdata = {
1618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1619 .name = "4ch Duplication",
1620 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
1621 .info = snd_ymfpci_info_dup4ch,
1622 .get = snd_ymfpci_get_dup4ch,
1623 .put = snd_ymfpci_put_dup4ch,
1624};
1617 1625
1618static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = { 1626static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = {
1619{ 1627{
@@ -1642,13 +1650,6 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
1642YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0), 1650YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
1643YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0), 1651YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
1644YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4), 1652YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
1645{
1646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1647 .name = "4ch Duplication",
1648 .info = snd_ymfpci_info_dup4ch,
1649 .get = snd_ymfpci_get_dup4ch,
1650 .put = snd_ymfpci_put_dup4ch,
1651},
1652}; 1653};
1653 1654
1654 1655
@@ -1838,6 +1839,12 @@ int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
1838 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0) 1839 if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_ymfpci_controls[idx], chip))) < 0)
1839 return err; 1840 return err;
1840 } 1841 }
1842 if (chip->ac97->ext_id & AC97_EI_SDAC) {
1843 kctl = snd_ctl_new1(&snd_ymfpci_dup4ch, chip);
1844 err = snd_ctl_add(chip->card, kctl);
1845 if (err < 0)
1846 return err;
1847 }
1841 1848
1842 /* add S/PDIF control */ 1849 /* add S/PDIF control */
1843 if (snd_BUG_ON(!chip->pcm_spdif)) 1850 if (snd_BUG_ON(!chip->pcm_spdif))