qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing
@ 2008-04-19 19:45 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2008-04-19 19:45 UTC (permalink / raw)
  To: qemu-devel

Two in one, but trivial to split up if preferred:

1. wm8750_s.rate remained uninitialized and caused segfaults here if the
   guest took different init paths than probably tested to far.

2. Flushing the output fifo at the beginning of the related callback
   caused severe jitters and sound clicks to the musicpal emulation
   which builds its audio IRQ timing on top of the periodically reported
   "free". Moving the flush after the data_req callback fixes this - and
   makes more sense given that most users will have written new data from
   within that callback. :)

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
 hw/wm8750.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/hw/wm8750.c
===================================================================
--- a/hw/wm8750.c
+++ b/hw/wm8750.c
@@ -76,10 +76,10 @@ static void wm8750_audio_in_cb(void *opa
 static void wm8750_audio_out_cb(void *opaque, int free_b)
 {
     struct wm8750_s *s = (struct wm8750_s *) opaque;
-    wm8750_out_flush(s);
 
     s->req_out = free_b;
     s->data_req(s->opaque, free_b >> 2, s->req_in >> 2);
+    wm8750_out_flush(s);
 }
 
 struct wm_rate_s {
@@ -213,6 +213,7 @@ static void inline wm8750_mask_update(st
 void wm8750_reset(i2c_slave *i2c)
 {
     struct wm8750_s *s = (struct wm8750_s *) i2c;
+    s->rate = &wm_rate_table[0];
     s->enable = 0;
     wm8750_set_format(s);
     s->diff[0] = 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-19 19:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-19 19:45 [Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).