aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-08-21 07:00:13 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-25 03:57:18 -0400
commit77a23f2695bb2de0cd74599400dc55109c531b72 (patch)
tree4960195e04016928dea83deb85e0f3bf97024a8a /sound/pci/rme9652
parent46480b3a5f88f20dbf25d95fe74d7b4798d5bc86 (diff)
ALSA: Clean up SG-buffer helper functions and macros
Clean up SG-buffer helper functions and macros. Helpers take substream as arguments now. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r--sound/pci/rme9652/hdspm.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 83c92e6082a2..98762f909d64 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -535,7 +535,8 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm * hdspm);
535static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm); 535static int hdspm_update_simple_mixer_controls(struct hdspm * hdspm);
536static int hdspm_autosync_ref(struct hdspm * hdspm); 536static int hdspm_autosync_ref(struct hdspm * hdspm);
537static int snd_hdspm_set_defaults(struct hdspm * hdspm); 537static int snd_hdspm_set_defaults(struct hdspm * hdspm);
538static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf, 538static void hdspm_set_sgbuf(struct hdspm * hdspm,
539 struct snd_pcm_substream *substream,
539 unsigned int reg, int channels); 540 unsigned int reg, int channels);
540 541
541static inline int HDSPM_bit2freq(int n) 542static inline int HDSPM_bit2freq(int n)
@@ -3604,8 +3605,6 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
3604 int i; 3605 int i;
3605 pid_t this_pid; 3606 pid_t this_pid;
3606 pid_t other_pid; 3607 pid_t other_pid;
3607 struct snd_sg_buf *sgbuf;
3608
3609 3608
3610 spin_lock_irq(&hdspm->lock); 3609 spin_lock_irq(&hdspm->lock);
3611 3610
@@ -3673,11 +3672,9 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
3673 if (err < 0) 3672 if (err < 0)
3674 return err; 3673 return err;
3675 3674
3676 sgbuf = snd_pcm_substream_sgbuf(substream);
3677
3678 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 3675 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
3679 3676
3680 hdspm_set_sgbuf(hdspm, sgbuf, HDSPM_pageAddressBufferOut, 3677 hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferOut,
3681 params_channels(params)); 3678 params_channels(params));
3682 3679
3683 for (i = 0; i < params_channels(params); ++i) 3680 for (i = 0; i < params_channels(params); ++i)
@@ -3688,7 +3685,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
3688 snd_printdd("Allocated sample buffer for playback at %p\n", 3685 snd_printdd("Allocated sample buffer for playback at %p\n",
3689 hdspm->playback_buffer); 3686 hdspm->playback_buffer);
3690 } else { 3687 } else {
3691 hdspm_set_sgbuf(hdspm, sgbuf, HDSPM_pageAddressBufferIn, 3688 hdspm_set_sgbuf(hdspm, substream, HDSPM_pageAddressBufferIn,
3692 params_channels(params)); 3689 params_channels(params));
3693 3690
3694 for (i = 0; i < params_channels(params); ++i) 3691 for (i = 0; i < params_channels(params); ++i)
@@ -3703,7 +3700,7 @@ static int snd_hdspm_hw_params(struct snd_pcm_substream *substream,
3703 snd_printdd("Allocated sample buffer for %s at 0x%08X\n", 3700 snd_printdd("Allocated sample buffer for %s at 0x%08X\n",
3704 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 3701 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
3705 "playback" : "capture", 3702 "playback" : "capture",
3706 snd_pcm_sgbuf_get_addr(sgbuf, 0)); 3703 snd_pcm_sgbuf_get_addr(substream, 0));
3707 */ 3704 */
3708 /* 3705 /*
3709 snd_printdd("set_hwparams: %s %d Hz, %d channels, bs = %d\n", 3706 snd_printdd("set_hwparams: %s %d Hz, %d channels, bs = %d\n",
@@ -4253,13 +4250,14 @@ static int __devinit snd_hdspm_preallocate_memory(struct hdspm * hdspm)
4253 return 0; 4250 return 0;
4254} 4251}
4255 4252
4256static void hdspm_set_sgbuf(struct hdspm * hdspm, struct snd_sg_buf *sgbuf, 4253static void hdspm_set_sgbuf(struct hdspm * hdspm,
4254 struct snd_pcm_substream *substream,
4257 unsigned int reg, int channels) 4255 unsigned int reg, int channels)
4258{ 4256{
4259 int i; 4257 int i;
4260 for (i = 0; i < (channels * 16); i++) 4258 for (i = 0; i < (channels * 16); i++)
4261 hdspm_write(hdspm, reg + 4 * i, 4259 hdspm_write(hdspm, reg + 4 * i,
4262 snd_pcm_sgbuf_get_addr(sgbuf, (size_t) 4096 * i)); 4260 snd_pcm_sgbuf_get_addr(substream, 4096 * i));
4263} 4261}
4264 4262
4265/* ------------- ALSA Devices ---------------------------- */ 4263/* ------------- ALSA Devices ---------------------------- */