@@ -294,6 +294,7 @@ MODULE_PARM_DESC(seqtimer_scaling, "Set 1024000Hz sequencer timer scale factor (
294294
295295struct snd_azf3328_codec_data {
296296 unsigned long io_base ;
297+ unsigned int dma_base ; /* helper to avoid an indirection in hotpath */
297298 struct snd_pcm_substream * substream ;
298299 bool running ;
299300 const char * name ;
@@ -1165,14 +1166,17 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip,
11651166static int
11661167snd_azf3328_codec_prepare (struct snd_pcm_substream * substream )
11671168{
1168- #if 0
1169- struct snd_azf3328 * chip = snd_pcm_substream_chip (substream );
11701169 struct snd_pcm_runtime * runtime = substream -> runtime ;
1170+ struct snd_azf3328_codec * codec = runtime -> private_data ;
1171+ #if 0
11711172 unsigned int size = snd_pcm_lib_buffer_bytes (substream );
11721173 unsigned int count = snd_pcm_lib_period_bytes (substream );
11731174#endif
11741175
11751176 snd_azf3328_dbgcallenter ();
1177+
1178+ codec -> dma_base = runtime -> dma_addr ;
1179+
11761180#if 0
11771181 snd_azf3328_codec_setfmt (chip , AZF_CODEC_ ...,
11781182 runtime -> rate ,
@@ -1370,18 +1374,17 @@ snd_azf3328_codec_pointer(struct snd_pcm_substream *substream,
13701374{
13711375 const struct snd_azf3328 * chip = snd_pcm_substream_chip (substream );
13721376 const struct snd_azf3328_codec_data * codec = & chip -> codecs [codec_type ];
1373- unsigned long bufptr , result ;
1377+ unsigned long result ;
13741378 snd_pcm_uframes_t frmres ;
13751379
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
13811380 result = snd_azf3328_codec_inl (codec , IDX_IO_CODEC_DMA_CURRPOS );
13821381
13831382 /* 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
13851388 frmres = bytes_to_frames ( substream -> runtime , result );
13861389 snd_azf3328_dbgcodec ("%08li %s @ 0x%8lx, frames %8ld\n" ,
13871390 jiffies , codec -> name , result , frmres );
0 commit comments