aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/ad1816a
diff options
context:
space:
mode:
authorKen Arromdee <arromdee@rahul.net>2006-02-09 07:50:26 -0500
committerJaroslav Kysela <perex@suse.cz>2006-03-22 04:28:58 -0500
commitd08a23e2509e8e80637b4dfa5607ea00b9151b0a (patch)
treec5bdea37ac173c092dd6db73ef519c4aad699d84 /sound/isa/ad1816a
parentbd84b0cc99d267d6512f01a55af7dbb673f784af (diff)
[ALSA] ad1816a - Fix PCM trigger direction
Modules: AD1816A driver Fixed the bug of capture with Shark Predator ISA resulting in: arecord: pcm_read:1196: read error: Input/output error Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/isa/ad1816a')
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index ac0d808fff57..fd8fe16c09ee 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 ad1816a.c - lowlevel code for Analog Devices AD1816A chip. 2 ad1816a.c - lowlevel code for Analog Devices AD1816A chip.
4 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 3 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it>
@@ -175,7 +174,7 @@ static void snd_ad1816a_close(struct snd_ad1816a *chip, unsigned int mode)
175 174
176 175
177static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, 176static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what,
178 int channel, int cmd) 177 int channel, int cmd, int iscapture)
179{ 178{
180 int error = 0; 179 int error = 0;
181 180
@@ -184,10 +183,14 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what,
184 case SNDRV_PCM_TRIGGER_STOP: 183 case SNDRV_PCM_TRIGGER_STOP:
185 spin_lock(&chip->lock); 184 spin_lock(&chip->lock);
186 cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00; 185 cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00;
187 if (what & AD1816A_PLAYBACK_ENABLE) 186 /* if (what & AD1816A_PLAYBACK_ENABLE) */
187 /* That is not valid, because playback and capture enable
188 * are the same bit pattern, just to different addresses
189 */
190 if (! iscapture)
188 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, 191 snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG,
189 AD1816A_PLAYBACK_ENABLE, cmd); 192 AD1816A_PLAYBACK_ENABLE, cmd);
190 if (what & AD1816A_CAPTURE_ENABLE) 193 else
191 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, 194 snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG,
192 AD1816A_CAPTURE_ENABLE, cmd); 195 AD1816A_CAPTURE_ENABLE, cmd);
193 spin_unlock(&chip->lock); 196 spin_unlock(&chip->lock);
@@ -204,14 +207,14 @@ static int snd_ad1816a_playback_trigger(struct snd_pcm_substream *substream, int
204{ 207{
205 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); 208 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream);
206 return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE, 209 return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE,
207 SNDRV_PCM_STREAM_PLAYBACK, cmd); 210 SNDRV_PCM_STREAM_PLAYBACK, cmd, 0);
208} 211}
209 212
210static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd) 213static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd)
211{ 214{
212 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); 215 struct snd_ad1816a *chip = snd_pcm_substream_chip(substream);
213 return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE, 216 return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE,
214 SNDRV_PCM_STREAM_CAPTURE, cmd); 217 SNDRV_PCM_STREAM_CAPTURE, cmd, 1);
215} 218}
216 219
217static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, 220static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream,