diff options
author | Andreas Mohr <andi@lisas.de> | 2010-12-27 15:16:43 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-02 05:07:45 -0500 |
commit | adf5931f8c412e90f47033ca6bc7a0bc8a930ba1 (patch) | |
tree | 49b9a3c5e2728371033cb3bc1d390ac4c15415a7 /sound/pci | |
parent | a8cc0f421b37956262a92591f7397b200d232da6 (diff) |
ALSA: azt3328: cosmetics, minor updates
- correct samples to be POSIX shell compatible
- add logging of jiffies value in _pointer()
- several comments
- cleanup
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/azt3328.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 2f3cacbd5528..006f8c0ffb56 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). | 2 | * azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). |
3 | * Copyright (C) 2002, 2005 - 2009 by Andreas Mohr <andi AT lisas.de> | 3 | * Copyright (C) 2002, 2005 - 2010 by Andreas Mohr <andi AT lisas.de> |
4 | * | 4 | * |
5 | * Framework borrowed from Bart Hartgers's als4000.c. | 5 | * Framework borrowed from Bart Hartgers's als4000.c. |
6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), | 6 | * Driver developed on PCI168 AP(W) version (PCI rev. 10, subsystem ID 1801), |
@@ -201,14 +201,15 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
201 | 201 | ||
202 | /* === Debug settings === | 202 | /* === Debug settings === |
203 | Further diagnostic functionality than the settings below | 203 | Further diagnostic functionality than the settings below |
204 | does not need to be provided, since one can easily write a bash script | 204 | does not need to be provided, since one can easily write a POSIX shell script |
205 | to dump the card's I/O ports (those listed in lspci -v -v): | 205 | to dump the card's I/O ports (those listed in lspci -v -v): |
206 | function dump() | 206 | dump() |
207 | { | 207 | { |
208 | local descr=$1; local addr=$2; local count=$3 | 208 | local descr=$1; local addr=$2; local count=$3 |
209 | 209 | ||
210 | echo "${descr}: ${count} @ ${addr}:" | 210 | echo "${descr}: ${count} @ ${addr}:" |
211 | dd if=/dev/port skip=$[${addr}] count=${count} bs=1 2>/dev/null| hexdump -C | 211 | dd if=/dev/port skip=`printf %d ${addr}` count=${count} bs=1 \ |
212 | 2>/dev/null| hexdump -C | ||
212 | } | 213 | } |
213 | and then use something like | 214 | and then use something like |
214 | "dump joy200 0x200 8", "dump mpu388 0x388 4", "dump joy 0xb400 8", | 215 | "dump joy200 0x200 8", "dump mpu388 0x388 4", "dump joy 0xb400 8", |
@@ -216,14 +217,14 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
216 | possibly within a "while true; do ... sleep 1; done" loop. | 217 | possibly within a "while true; do ... sleep 1; done" loop. |
217 | Tweaking ports could be done using | 218 | Tweaking ports could be done using |
218 | VALSTRING="`printf "%02x" $value`" | 219 | VALSTRING="`printf "%02x" $value`" |
219 | printf "\x""$VALSTRING"|dd of=/dev/port seek=$[${addr}] bs=1 2>/dev/null | 220 | printf "\x""$VALSTRING"|dd of=/dev/port seek=`printf %d ${addr}` bs=1 \ |
221 | 2>/dev/null | ||
220 | */ | 222 | */ |
221 | 223 | ||
222 | #define DEBUG_MISC 0 | 224 | #define DEBUG_MISC 0 |
223 | #define DEBUG_CALLS 0 | 225 | #define DEBUG_CALLS 0 |
224 | #define DEBUG_MIXER 0 | 226 | #define DEBUG_MIXER 0 |
225 | #define DEBUG_CODEC 0 | 227 | #define DEBUG_CODEC 0 |
226 | #define DEBUG_IO 0 | ||
227 | #define DEBUG_TIMER 0 | 228 | #define DEBUG_TIMER 0 |
228 | #define DEBUG_GAME 0 | 229 | #define DEBUG_GAME 0 |
229 | #define DEBUG_PM 0 | 230 | #define DEBUG_PM 0 |
@@ -299,6 +300,7 @@ struct snd_azf3328_codec_data { | |||
299 | }; | 300 | }; |
300 | 301 | ||
301 | enum snd_azf3328_codec_type { | 302 | enum snd_azf3328_codec_type { |
303 | /* warning: fixed indices (also used for bitmask checks!) */ | ||
302 | AZF_CODEC_PLAYBACK = 0, | 304 | AZF_CODEC_PLAYBACK = 0, |
303 | AZF_CODEC_CAPTURE = 1, | 305 | AZF_CODEC_CAPTURE = 1, |
304 | AZF_CODEC_I2S_OUT = 2, | 306 | AZF_CODEC_I2S_OUT = 2, |
@@ -362,6 +364,9 @@ MODULE_DEVICE_TABLE(pci, snd_azf3328_ids); | |||
362 | static int | 364 | static int |
363 | snd_azf3328_io_reg_setb(unsigned reg, u8 mask, bool do_set) | 365 | snd_azf3328_io_reg_setb(unsigned reg, u8 mask, bool do_set) |
364 | { | 366 | { |
367 | /* Well, strictly spoken, the inb/outb sequence isn't atomic | ||
368 | and would need locking. However we currently don't care | ||
369 | since it potentially complicates matters. */ | ||
365 | u8 prev = inb(reg), new; | 370 | u8 prev = inb(reg), new; |
366 | 371 | ||
367 | new = (do_set) ? (prev|mask) : (prev & ~mask); | 372 | new = (do_set) ? (prev|mask) : (prev & ~mask); |
@@ -1004,7 +1009,8 @@ snd_azf3328_codec_setfmt(struct snd_azf3328 *chip, | |||
1004 | * (FIXME: yes, it works, but what exactly am I doing here?? :) | 1009 | * (FIXME: yes, it works, but what exactly am I doing here?? :) |
1005 | * FIXME: does this have some side effects for full-duplex | 1010 | * FIXME: does this have some side effects for full-duplex |
1006 | * or other dramatic side effects? */ | 1011 | * or other dramatic side effects? */ |
1007 | if (codec_type == AZF_CODEC_PLAYBACK) /* only do it for playback */ | 1012 | /* do it for non-capture codecs only */ |
1013 | if (codec_type == AZF_CODEC_PLAYBACK) | ||
1008 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, | 1014 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1009 | snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS) | | 1015 | snd_azf3328_codec_inw(codec, IDX_IO_CODEC_DMA_FLAGS) | |
1010 | DMA_RUN_SOMETHING1 | | 1016 | DMA_RUN_SOMETHING1 | |
@@ -1368,8 +1374,8 @@ snd_azf3328_codec_pointer(struct snd_pcm_substream *substream, | |||
1368 | /* calculate offset */ | 1374 | /* calculate offset */ |
1369 | result -= bufptr; | 1375 | result -= bufptr; |
1370 | frmres = bytes_to_frames( substream->runtime, result); | 1376 | frmres = bytes_to_frames( substream->runtime, result); |
1371 | snd_azf3328_dbgcodec("%s @ 0x%8lx, frames %8ld\n", | 1377 | snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n", |
1372 | codec->name, result, frmres); | 1378 | jiffies, codec->name, result, frmres); |
1373 | return frmres; | 1379 | return frmres; |
1374 | } | 1380 | } |
1375 | 1381 | ||
@@ -1532,7 +1538,7 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport, | |||
1532 | } | 1538 | } |
1533 | } | 1539 | } |
1534 | 1540 | ||
1535 | /* trigger next axes sampling, to be evaluated the next time we | 1541 | /* trigger next sampling of axes, to be evaluated the next time we |
1536 | * enter this function */ | 1542 | * enter this function */ |
1537 | 1543 | ||
1538 | /* for some very, very strange reason we cannot enable | 1544 | /* for some very, very strange reason we cannot enable |
@@ -1966,7 +1972,7 @@ snd_azf3328_timer_start(struct snd_timer *timer) | |||
1966 | snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay); | 1972 | snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay); |
1967 | delay = 49; /* minimum time is 49 ticks */ | 1973 | delay = 49; /* minimum time is 49 ticks */ |
1968 | } | 1974 | } |
1969 | snd_azf3328_dbgtimer("setting timer countdown value %d, add COUNTDOWN|IRQ\n", delay); | 1975 | snd_azf3328_dbgtimer("setting timer countdown value %d\n", delay); |
1970 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; | 1976 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; |
1971 | spin_lock_irqsave(&chip->reg_lock, flags); | 1977 | spin_lock_irqsave(&chip->reg_lock, flags); |
1972 | snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); | 1978 | snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); |
@@ -2257,7 +2263,7 @@ snd_azf3328_create(struct snd_card *card, | |||
2257 | struct snd_azf3328_codec_data *codec = | 2263 | struct snd_azf3328_codec_data *codec = |
2258 | &chip->codecs[codec_type]; | 2264 | &chip->codecs[codec_type]; |
2259 | 2265 | ||
2260 | /* shutdown codecs to save power */ | 2266 | /* shutdown codecs to reduce power / noise */ |
2261 | /* have ...ctrl_codec_activity() act properly */ | 2267 | /* have ...ctrl_codec_activity() act properly */ |
2262 | codec->running = 1; | 2268 | codec->running = 1; |
2263 | snd_azf3328_ctrl_codec_activity(chip, codec_type, 0); | 2269 | snd_azf3328_ctrl_codec_activity(chip, codec_type, 0); |
@@ -2419,6 +2425,7 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state) | |||
2419 | 2425 | ||
2420 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); | 2426 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
2421 | 2427 | ||
2428 | /* same pcm object for playback/capture */ | ||
2422 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]); | 2429 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]); |
2423 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]); | 2430 | snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]); |
2424 | 2431 | ||