wm8750: Fix rate init and output fifo flushing
PATCH 1/1 wm8750: Fix rate init and output fifo flushing
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 <[email protected]>
--- hw/wm8750.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/wm8750.c +2 -1
@@ -76,10 +76,10 @@ static void wm8750_audio_in_cb(void *opastatic 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(stvoid 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 ;