9 #include <linux/module.h>
17 static bool nforce_wa;
20 "(expect bad sound)");
22 #define DMIX_WANTS_S16 1
28 static void pcsp_call_pcm_elapsed(
unsigned long priv)
45 unsigned char timer_cnt,
val;
66 timer_cnt = val *
CUR_DIV() / 256;
68 if (timer_cnt && chip->
enable) {
87 static void pcsp_pointer_update(
struct snd_pcsp *chip)
90 size_t period_bytes, buffer_bytes;
99 period_bytes = snd_pcm_lib_period_bytes(substream);
100 buffer_bytes = snd_pcm_lib_buffer_bytes(substream);
105 if (periods_elapsed < 0) {
111 periods_elapsed += buffer_bytes;
113 periods_elapsed /= period_bytes;
118 if (periods_elapsed) {
119 chip->
period_ptr += periods_elapsed * period_bytes;
125 tasklet_schedule(&pcsp_pcm_tasklet);
137 pointer_update = !chip->
thalf;
138 ns = pcsp_timer_update(chip);
145 pcsp_pointer_update(chip);
152 static int pcsp_start_playing(
struct snd_pcsp *chip)
173 static void pcsp_stop_playing(
struct snd_pcsp *chip)
195 pcsp_stop_playing(chip);
246 "size=%zi psize=%zi f=%zi f1=%i fsize=%i\n",
247 snd_pcm_lib_buffer_bytes(substream),
248 snd_pcm_lib_period_bytes(substream),
249 snd_pcm_lib_buffer_bytes(substream) /
250 snd_pcm_lib_period_bytes(substream),
266 return pcsp_start_playing(chip);
269 pcsp_stop_playing(chip);
285 return bytes_to_frames(substream->
runtime, pos);
303 .period_bytes_min = 64,
321 runtime->
hw = snd_pcsp_playback;
326 static struct snd_pcm_ops snd_pcsp_playback_ops = {
327 .open = snd_pcsp_playback_open,
328 .close = snd_pcsp_playback_close,
330 .hw_params = snd_pcsp_playback_hw_params,
331 .hw_free = snd_pcsp_playback_hw_free,
332 .prepare = snd_pcsp_playback_prepare,
333 .trigger = snd_pcsp_trigger,
334 .pointer = snd_pcsp_playback_pointer,
346 &snd_pcsp_playback_ops);
348 chip->
pcm->private_data =
chip;