audio: bugfixes for wm8750 and intel-hda.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJZv6rOAAoJEEy22O7T6HE4qKIQALjOIDMJdRWLl70Upr1LSPYa
 xlcfbBWJtPhT50rfAVv4jYujlIdyUChTAZdgV5DwDYdAJhfWp0KmmZRgVnVnBTlZ
 aYqozx7fMGmgDvJlgzE4BP8UZ7AMsRVypf+6vwDCgw7z2aZKfYjB8QcGpvnmKmvW
 +lS3o4UsULFIWdhB7sD3dONbeUtLWG7fyGoPSipmFKZruum6IzE1NE/1qJl71Kdj
 LGCsGxyLrvLy6F3Ek/yrrr1hX6jtftKIFOlrHyVWyWPz+8S7vAffOIWs4TJvX2mc
 2eRbHa19oLVuixMGlBJP7aHJJiFwoCChLetfxJPCDau5hMLMd793jWT/AYzvWWvL
 56scEOLeyUzl4EZleetEPqi4zQCGxZk94bat78IutJo+mi5d6eI42xOZ83ev7tcn
 1Ac+loc9TqljaBIpCqx9y5y0DfGUtJUTnd8GpbuY1y2tYgo1nPtD4SbrmHIQycky
 IgN0MiWMumKl2ItnH+A5LGt6pp81XtB08jZbL6M0+fYCE1bAFfG8GN8JRuCyWsZw
 aayQu2bDS8cr4QB0rPiL/Zg4OuDIaF07dSlQketeK342G/PK9l3zMYSWSo/Ly3Vf
 gzOJlpG8E/YK49H6Kn+veMmh6nTdSLBXFiJW+JhYBWh6k6nvxi9KrYFIuUV+WiYL
 HHy5JNsp3ceEnzYiRt81
 =m6bE
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/audio-20170918-pull-request' into staging

audio: bugfixes for wm8750 and intel-hda.

# gpg: Signature made Mon 18 Sep 2017 12:15:26 BST
# gpg:                using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/audio-20170918-pull-request:
  audio: intel-hda: do not use old_mmio accesses
  wm8750: add record buffer underrun check

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-09-18 12:40:54 +01:00
commit a9158a5cba
2 changed files with 16 additions and 48 deletions

View file

@ -22,6 +22,7 @@
#include "hw/pci/pci.h"
#include "hw/pci/msi.h"
#include "qemu/timer.h"
#include "qemu/bitops.h"
#include "hw/audio/soundhw.h"
#include "intel-hda.h"
#include "intel-hda-defs.h"
@ -1043,66 +1044,29 @@ static void intel_hda_regs_reset(IntelHDAState *d)
/* --------------------------------------------------------------------- */
static void intel_hda_mmio_writeb(void *opaque, hwaddr addr, uint32_t val)
static void intel_hda_mmio_write(void *opaque, hwaddr addr, uint64_t val,
unsigned size)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
intel_hda_reg_write(d, reg, val, 0xff);
intel_hda_reg_write(d, reg, val, MAKE_64BIT_MASK(0, size * 8));
}
static void intel_hda_mmio_writew(void *opaque, hwaddr addr, uint32_t val)
static uint64_t intel_hda_mmio_read(void *opaque, hwaddr addr, unsigned size)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
intel_hda_reg_write(d, reg, val, 0xffff);
}
static void intel_hda_mmio_writel(void *opaque, hwaddr addr, uint32_t val)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
intel_hda_reg_write(d, reg, val, 0xffffffff);
}
static uint32_t intel_hda_mmio_readb(void *opaque, hwaddr addr)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
return intel_hda_reg_read(d, reg, 0xff);
}
static uint32_t intel_hda_mmio_readw(void *opaque, hwaddr addr)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
return intel_hda_reg_read(d, reg, 0xffff);
}
static uint32_t intel_hda_mmio_readl(void *opaque, hwaddr addr)
{
IntelHDAState *d = opaque;
const IntelHDAReg *reg = intel_hda_reg_find(d, addr);
return intel_hda_reg_read(d, reg, 0xffffffff);
return intel_hda_reg_read(d, reg, MAKE_64BIT_MASK(0, size * 8));
}
static const MemoryRegionOps intel_hda_mmio_ops = {
.old_mmio = {
.read = {
intel_hda_mmio_readb,
intel_hda_mmio_readw,
intel_hda_mmio_readl,
},
.write = {
intel_hda_mmio_writeb,
intel_hda_mmio_writew,
intel_hda_mmio_writel,
},
.read = intel_hda_mmio_read,
.write = intel_hda_mmio_write,
.impl = {
.min_access_size = 1,
.max_access_size = 4,
},
.endianness = DEVICE_NATIVE_ENDIAN,
};

View file

@ -680,8 +680,12 @@ uint32_t wm8750_adc_dat(void *opaque)
WM8750State *s = (WM8750State *) opaque;
uint32_t *data;
if (s->idx_in >= sizeof(s->data_in))
if (s->idx_in >= sizeof(s->data_in)) {
wm8750_in_load(s);
if (s->idx_in >= sizeof(s->data_in)) {
return 0x80008000; /* silence in AUD_FMT_S16 sample format */
}
}
data = (uint32_t *) &s->data_in[s->idx_in];
s->req_in -= 4;