diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 04:15:37 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:16:29 -0500 |
commit | 3e8731740e17f01ec1ecce556ccdc4c42279ce1b (patch) | |
tree | dada863f577ad8c00b152a9538a4cde36aa240d6 /sound/pci/cs5535audio/cs5535audio.c | |
parent | 9b4ffa48ae855c8657a36014c5b0243ff69f4722 (diff) |
[ALSA] Minor clean up and fixes for CS5535 audio driver
Modules: Documentation,CS5535 driver
Minor clean up and fixes for CS5535 audio driver.
Added an entry in ALSA-Configuration.txt, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/cs5535audio/cs5535audio.c')
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 920c857fc223..3f4379da4d26 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(pci, snd_cs5535audio_ids); | |||
55 | 55 | ||
56 | static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout) | 56 | static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout) |
57 | { | 57 | { |
58 | unsigned long tmp; | 58 | unsigned int tmp; |
59 | do { | 59 | do { |
60 | tmp = cs_readl(cs5535au, ACC_CODEC_CNTL); | 60 | tmp = cs_readl(cs5535au, ACC_CODEC_CNTL); |
61 | if (!(tmp & CMD_NEW)) | 61 | if (!(tmp & CMD_NEW)) |
@@ -69,11 +69,11 @@ static void wait_till_cmd_acked(cs5535audio_t *cs5535au, unsigned long timeout) | |||
69 | static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au, | 69 | static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au, |
70 | unsigned short reg) | 70 | unsigned short reg) |
71 | { | 71 | { |
72 | unsigned long regdata; | 72 | unsigned int regdata; |
73 | unsigned long timeout; | 73 | int timeout; |
74 | unsigned long val; | 74 | unsigned int val; |
75 | 75 | ||
76 | regdata = ((unsigned long) reg) << 24; | 76 | regdata = ((unsigned int) reg) << 24; |
77 | regdata |= ACC_CODEC_CNTL_RD_CMD; | 77 | regdata |= ACC_CODEC_CNTL_RD_CMD; |
78 | regdata |= CMD_NEW; | 78 | regdata |= CMD_NEW; |
79 | 79 | ||
@@ -83,24 +83,23 @@ static unsigned short snd_cs5535audio_codec_read(cs5535audio_t *cs5535au, | |||
83 | timeout = 50; | 83 | timeout = 50; |
84 | do { | 84 | do { |
85 | val = cs_readl(cs5535au, ACC_CODEC_STATUS); | 85 | val = cs_readl(cs5535au, ACC_CODEC_STATUS); |
86 | if ( (val & STS_NEW) && | 86 | if ((val & STS_NEW) && reg == (val >> 24)) |
87 | ((unsigned long) reg == ((0xFF000000 & val)>>24)) ) | ||
88 | break; | 87 | break; |
89 | msleep(10); | 88 | msleep(10); |
90 | } while (--timeout); | 89 | } while (--timeout); |
91 | if (!timeout) | 90 | if (!timeout) |
92 | snd_printk(KERN_ERR "Failure reading cs5535 codec\n"); | 91 | snd_printk(KERN_ERR "Failure reading cs5535 codec\n"); |
93 | 92 | ||
94 | return ((unsigned short) val); | 93 | return (unsigned short) val; |
95 | } | 94 | } |
96 | 95 | ||
97 | static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au, | 96 | static void snd_cs5535audio_codec_write(cs5535audio_t *cs5535au, |
98 | unsigned short reg, unsigned short val) | 97 | unsigned short reg, unsigned short val) |
99 | { | 98 | { |
100 | unsigned long regdata; | 99 | unsigned int regdata; |
101 | 100 | ||
102 | regdata = ((unsigned long) reg) << 24; | 101 | regdata = ((unsigned int) reg) << 24; |
103 | regdata |= (unsigned long) val; | 102 | regdata |= val; |
104 | regdata &= CMD_MASK; | 103 | regdata &= CMD_MASK; |
105 | regdata |= CMD_NEW; | 104 | regdata |= CMD_NEW; |
106 | regdata &= ACC_CODEC_CNTL_WR_CMD; | 105 | regdata &= ACC_CODEC_CNTL_WR_CMD; |
@@ -123,12 +122,6 @@ static unsigned short snd_cs5535audio_ac97_codec_read(ac97_t *ac97, | |||
123 | return snd_cs5535audio_codec_read(cs5535au, reg); | 122 | return snd_cs5535audio_codec_read(cs5535au, reg); |
124 | } | 123 | } |
125 | 124 | ||
126 | static void snd_cs5535audio_mixer_free_ac97(ac97_t *ac97) | ||
127 | { | ||
128 | cs5535audio_t *cs5535audio = ac97->private_data; | ||
129 | cs5535audio->ac97 = NULL; | ||
130 | } | ||
131 | |||
132 | static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au) | 125 | static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au) |
133 | { | 126 | { |
134 | snd_card_t *card = cs5535au->card; | 127 | snd_card_t *card = cs5535au->card; |
@@ -147,10 +140,9 @@ static int snd_cs5535audio_mixer(cs5535audio_t *cs5535au) | |||
147 | ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM; | 140 | ac97.scaps = AC97_SCAP_AUDIO|AC97_SCAP_SKIP_MODEM; |
148 | ac97.private_data = cs5535au; | 141 | ac97.private_data = cs5535au; |
149 | ac97.pci = cs5535au->pci; | 142 | ac97.pci = cs5535au->pci; |
150 | ac97.private_free = snd_cs5535audio_mixer_free_ac97; | ||
151 | 143 | ||
152 | if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) { | 144 | if ((err = snd_ac97_mixer(pbus, &ac97, &cs5535au->ac97)) < 0) { |
153 | snd_printk("mixer failed\n"); | 145 | snd_printk(KERN_ERR "mixer failed\n"); |
154 | return err; | 146 | return err; |
155 | } | 147 | } |
156 | 148 | ||
@@ -201,8 +193,8 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id, | |||
201 | 193 | ||
202 | if (!acc_irq_stat) | 194 | if (!acc_irq_stat) |
203 | return IRQ_NONE; | 195 | return IRQ_NONE; |
204 | for (count=0; count < 10; count++) { | 196 | for (count = 0; count < 10; count++) { |
205 | if (acc_irq_stat & (1<<count)) { | 197 | if (acc_irq_stat & (1 << count)) { |
206 | switch (count) { | 198 | switch (count) { |
207 | case IRQ_STS: | 199 | case IRQ_STS: |
208 | cs_readl(cs5535au, ACC_GPIO_STATUS); | 200 | cs_readl(cs5535au, ACC_GPIO_STATUS); |