[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing

From: Jan Kiszka
Subject: [Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing
Date: Sat, 19 Apr 2008 21:45:38 +0200
User-agent: Thunderbird (X11/20080226)

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 <address@hidden>
 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;
     s->diff[0] = 0;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]