diff options
author | Andreas Mohr <andi@lisas.de> | 2010-12-27 15:17:11 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-01-02 05:09:43 -0500 |
commit | 345855951a7d36eed815fd129c49b7ee2b7a6864 (patch) | |
tree | aeae249ff28f888bc2b4383c22bfa86ddd603652 /sound/pci/azt3328.c | |
parent | 9fd8d36caabaf3102f14cf652d5ca012d775aaa8 (diff) |
ALSA: azt3328: use a helper variable to remove one indirection in hotpath
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/azt3328.c')
-rw-r--r-- | sound/pci/azt3328.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 0cb5499ad36a..b1fad46a7b02 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -294,6 +294,7 @@ MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor ( | |||
294 | 294 | ||
295 | struct snd_azf3328_codec_data { | 295 | struct snd_azf3328_codec_data { |
296 | unsigned long io_base; | 296 | unsigned long io_base; |
297 | unsigned int dma_base; /* helper to avoid an indirection in hotpath */ | ||
297 | struct snd_pcm_substream *substream; | 298 | struct snd_pcm_substream *substream; |
298 | bool running; | 299 | bool running; |
299 | const char *name; | 300 | const char *name; |
@@ -1165,14 +1166,17 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip, | |||
1165 | static int | 1166 | static int |
1166 | snd_azf3328_codec_prepare(struct snd_pcm_substream *substream) | 1167 | snd_azf3328_codec_prepare(struct snd_pcm_substream *substream) |
1167 | { | 1168 | { |
1168 | #if 0 | ||
1169 | struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | ||
1170 | struct snd_pcm_runtime *runtime = substream->runtime; | 1169 | struct snd_pcm_runtime *runtime = substream->runtime; |
1170 | struct snd_azf3328_codec *codec = runtime->private_data; | ||
1171 | #if 0 | ||
1171 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 1172 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
1172 | unsigned int count = snd_pcm_lib_period_bytes(substream); | 1173 | unsigned int count = snd_pcm_lib_period_bytes(substream); |
1173 | #endif | 1174 | #endif |
1174 | 1175 | ||
1175 | snd_azf3328_dbgcallenter(); | 1176 | snd_azf3328_dbgcallenter(); |
1177 | |||
1178 | codec->dma_base = runtime->dma_addr; | ||
1179 | |||
1176 | #if 0 | 1180 | #if 0 |
1177 | snd_azf3328_codec_setfmt(chip, AZF_CODEC_..., | 1181 | snd_azf3328_codec_setfmt(chip, AZF_CODEC_..., |
1178 | runtime->rate, | 1182 | runtime->rate, |
@@ -1370,18 +1374,17 @@ snd_azf3328_codec_pointer(struct snd_pcm_substream *substream, | |||
1370 | { | 1374 | { |
1371 | const struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); | 1375 | const struct snd_azf3328 *chip = snd_pcm_substream_chip(substream); |
1372 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | 1376 | const struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; |
1373 | unsigned long bufptr, result; | 1377 | unsigned long result; |
1374 | snd_pcm_uframes_t frmres; | 1378 | snd_pcm_uframes_t frmres; |
1375 | 1379 | ||
1376 | #ifdef QUERY_HARDWARE | ||
1377 | bufptr = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1); | ||
1378 | #else | ||
1379 | bufptr = substream->runtime->dma_addr; | ||
1380 | #endif | ||
1381 | result = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_CURRPOS); | 1380 | result = snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_CURRPOS); |
1382 | 1381 | ||
1383 | /* calculate offset */ | 1382 | /* calculate offset */ |
1384 | result -= bufptr; | 1383 | #ifdef QUERY_HARDWARE |
1384 | result -= snd_azf3328_codec_inl(codec, IDX_IO_CODEC_DMA_START_1); | ||
1385 | #else | ||
1386 | result -= codec->dma_base; | ||
1387 | #endif | ||
1385 | frmres = bytes_to_frames( substream->runtime, result); | 1388 | frmres = bytes_to_frames( substream->runtime, result); |
1386 | snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n", | 1389 | snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n", |
1387 | jiffies, codec->name, result, frmres); | 1390 | jiffies, codec->name, result, frmres); |