Skip to content

Commit

Permalink
ALSA: cs5535audio: invert EAPD for OLPC (newer than B3)
Browse files Browse the repository at this point in the history
Fix an audible pop described in <http://dev.laptop.org/ticket/977>.  Originally
based upon fixes by Mitch Bradley and Chris Ball.

Signed-off-by: Andres Salomon <dilinger@debian.org>
  • Loading branch information
Andres Salomon authored and Takashi Iwai committed Dec 10, 2008
1 parent c8974be commit 3556d18
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions sound/pci/cs5535audio/cs5535audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
ac97.private_data = cs5535au;
ac97.pci = cs5535au->pci;

/* set any OLPC-specific scaps */
olpc_prequirks(card, &ac97);

if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) {
snd_printk(KERN_ERR "mixer failed\n");
return err;
Expand Down
11 changes: 9 additions & 2 deletions sound/pci/cs5535audio/cs5535audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,16 @@ int snd_cs5535audio_resume(struct pci_dev *pci);
#endif

#ifdef CONFIG_OLPC
int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
void __devinit olpc_prequirks(struct snd_card *card,
struct snd_ac97_template *ac97);
int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
#else
#define olpc_quirks(arg, arg2) (0)
static inline void olpc_prequirks(struct snd_card *card,
struct snd_ac97_template *ac97) { }
static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
{
return 0;
}
#endif

int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
Expand Down
11 changes: 11 additions & 0 deletions sound/pci/cs5535audio/cs5535audio_olpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ static struct snd_kcontrol_new snd_cs5535audio_controls __devinitdata =
.private_value = 0
};

void __devinit olpc_prequirks(struct snd_card *card,
struct snd_ac97_template *ac97)
{
if (!machine_is_olpc())
return;

/* invert EAPD if on an OLPC B3 or higher */
if (olpc_board_at_least(olpc_board_pre(0xb3)))
ac97->scaps |= AC97_SCAP_INV_EAPD;
}

int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
{
if (!machine_is_olpc())
Expand Down

0 comments on commit 3556d18

Please sign in to comment.