qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing
Date: Sat, 19 Apr 2008 21:45:38 +0200	[thread overview]
Message-ID: <480A4BE2.5030604@web.de> (raw)

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;

                 reply	other threads:[~2008-04-19 19:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=480A4BE2.5030604@web.de \
    --to=jan.kiszka@web.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).