Commit b0e6d116 authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Fix C-Media codecs

AC97 Codec Core
Don't create PCM (and Master for CM9739/9761) volume controls for some of
C-Media codecs.  The volume is supposed to be controlled via softvol plugin.

The wrong (duble) entry for a CM9761 model is removed, too.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 601e4fa5
...@@ -364,6 +364,8 @@ ...@@ -364,6 +364,8 @@
#define AC97_CX_SPDIF (1<<3) /* Conexant's spdif interface */ #define AC97_CX_SPDIF (1<<3) /* Conexant's spdif interface */
#define AC97_STEREO_MUTES (1<<4) /* has stereo mute bits */ #define AC97_STEREO_MUTES (1<<4) /* has stereo mute bits */
#define AC97_DOUBLE_RATE (1<<5) /* supports double rate playback */ #define AC97_DOUBLE_RATE (1<<5) /* supports double rate playback */
#define AC97_HAS_NO_MASTER_VOL (1<<6) /* no Master volume */
#define AC97_HAS_NO_PCM_VOL (1<<7) /* no PCM volume */
/* rates indexes */ /* rates indexes */
#define AC97_RATES_FRONT_DAC 0 #define AC97_RATES_FRONT_DAC 0
......
...@@ -118,7 +118,6 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = { ...@@ -118,7 +118,6 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
{ 0x414c4770, 0xfffffff0, "ALC203", NULL, NULL }, { 0x414c4770, 0xfffffff0, "ALC203", NULL, NULL },
{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL }, { 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL },
{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL }, { 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL },
{ 0x434d4983, 0xffffffff, "CMI9739A", patch_cm9739, NULL },
{ 0x434d4978, 0xffffffff, "CMI9761", patch_cm9761, NULL }, { 0x434d4978, 0xffffffff, "CMI9761", patch_cm9761, NULL },
{ 0x434d4982, 0xffffffff, "CMI9761", patch_cm9761, NULL }, { 0x434d4982, 0xffffffff, "CMI9761", patch_cm9761, NULL },
{ 0x434d4983, 0xffffffff, "CMI9761", patch_cm9761, NULL }, { 0x434d4983, 0xffffffff, "CMI9761", patch_cm9761, NULL },
...@@ -1292,7 +1291,11 @@ static int snd_ac97_mixer_build(ac97_t * ac97) ...@@ -1292,7 +1291,11 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
/* build master controls */ /* build master controls */
/* AD claims to remove this control from AD1887, although spec v2.2 does not allow this */ /* AD claims to remove this control from AD1887, although spec v2.2 does not allow this */
if (snd_ac97_try_volume_mix(ac97, AC97_MASTER)) { if (snd_ac97_try_volume_mix(ac97, AC97_MASTER)) {
if ((err = snd_ac97_cmix_new(card, "Master Playback", AC97_MASTER, ac97)) < 0) if (ac97->flags & AC97_HAS_NO_MASTER_VOL)
err = snd_ac97_cmute_new(card, "Master Playback Switch", AC97_MASTER, ac97);
else
err = snd_ac97_cmix_new(card, "Master Playback", AC97_MASTER, ac97);
if (err < 0)
return err; return err;
} }
...@@ -1429,7 +1432,11 @@ static int snd_ac97_mixer_build(ac97_t * ac97) ...@@ -1429,7 +1432,11 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
} }
snd_ac97_write_cache(ac97, AC97_PCM, init_val); snd_ac97_write_cache(ac97, AC97_PCM, init_val);
} else { } else {
if ((err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97)) < 0) if (ac97->flags & AC97_HAS_NO_PCM_VOL)
err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97);
else
err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97);
if (err < 0)
return err; return err;
} }
......
...@@ -1755,6 +1755,11 @@ static struct snd_ac97_build_ops patch_cm9738_ops = { ...@@ -1755,6 +1755,11 @@ static struct snd_ac97_build_ops patch_cm9738_ops = {
int patch_cm9738(ac97_t * ac97) int patch_cm9738(ac97_t * ac97)
{ {
ac97->build_ops = &patch_cm9738_ops; ac97->build_ops = &patch_cm9738_ops;
/* FIXME: can anyone confirm below? */
/* CM9738 has no PCM volume although the register reacts */
ac97->flags |= AC97_HAS_NO_PCM_VOL;
snd_ac97_write_cache(ac97, AC97_PCM, 0x8000);
return 0; return 0;
} }
...@@ -1859,6 +1864,11 @@ int patch_cm9739(ac97_t * ac97) ...@@ -1859,6 +1864,11 @@ int patch_cm9739(ac97_t * ac97)
ac97->build_ops = &patch_cm9739_ops; ac97->build_ops = &patch_cm9739_ops;
/* CM9739/A has no Master and PCM volume although the register reacts */
ac97->flags |= AC97_HAS_NO_MASTER_VOL | AC97_HAS_NO_PCM_VOL;
snd_ac97_write_cache(ac97, AC97_MASTER, 0x8000);
snd_ac97_write_cache(ac97, AC97_PCM, 0x8000);
/* check spdif */ /* check spdif */
val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS); val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
if (val & AC97_EA_SPCV) { if (val & AC97_EA_SPCV) {
...@@ -1974,6 +1984,11 @@ int patch_cm9761(ac97_t *ac97) ...@@ -1974,6 +1984,11 @@ int patch_cm9761(ac97_t *ac97)
{ {
unsigned short val; unsigned short val;
/* CM9761 has no Master and PCM volume although the register reacts */
ac97->flags |= AC97_HAS_NO_MASTER_VOL | AC97_HAS_NO_PCM_VOL;
snd_ac97_write_cache(ac97, AC97_MASTER, 0x8000);
snd_ac97_write_cache(ac97, AC97_PCM, 0x8000);
ac97->spec.dev_flags = 0; /* 1 = model 82 revision B */ ac97->spec.dev_flags = 0; /* 1 = model 82 revision B */
if (ac97->id == AC97_ID_CM9761_82) { if (ac97->id == AC97_ID_CM9761_82) {
unsigned short tmp; unsigned short tmp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment