From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JnJ0H-0000q1-Ld for qemu-devel@nongnu.org; Sat, 19 Apr 2008 15:45:41 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JnJ0G-0000pQ-57 for qemu-devel@nongnu.org; Sat, 19 Apr 2008 15:45:41 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnJ0G-0000pA-0K for qemu-devel@nongnu.org; Sat, 19 Apr 2008 15:45:40 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JnJ0F-00016j-NB for qemu-devel@nongnu.org; Sat, 19 Apr 2008 15:45:39 -0400 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id D3575D7AC4B8 for ; Sat, 19 Apr 2008 21:45:38 +0200 (CEST) Received: from [88.64.18.144] (helo=[192.168.1.198]) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1JnJ0E-0002tF-00 for qemu-devel@nongnu.org; Sat, 19 Apr 2008 21:45:38 +0200 Message-ID: <480A4BE2.5030604@web.de> Date: Sat, 19 Apr 2008 21:45:38 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Sender: jan.kiszka@web.de Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] wm8750: Fix rate init and output fifo flushing Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- hw/wm8750.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: b/hw/wm8750.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 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 =3D (struct wm8750_s *) opaque; - wm8750_out_flush(s); =20 s->req_out =3D free_b; s->data_req(s->opaque, free_b >> 2, s->req_in >> 2); + wm8750_out_flush(s); } =20 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 =3D (struct wm8750_s *) i2c; + s->rate =3D &wm_rate_table[0]; s->enable =3D 0; wm8750_set_format(s); s->diff[0] =3D 0;