qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Volker Rümelin" <vr_qemu@t-online.de>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"BALATON Zoltan" <balaton@eik.bme.hu>,
	qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: [PATCH 1/8] hw/audio/es1370: reset current sample counter
Date: Sun, 17 Sep 2023 08:58:06 +0200	[thread overview]
Message-ID: <20230917065813.6692-1-vr_qemu@t-online.de> (raw)
In-Reply-To: <cfc5a196-9939-44b5-8716-9525f1a08a2a@t-online.de>

Reset the current sample counter when writing the Channel Sample
Count Register. The Linux ens1370 driver and the AROS sb128
driver expect the current sample counter counts down from sample
count to 0 after a write to the Channel Sample Count Register.
Currently the current sample counter starts from 0 after a reset
or the last count when the counter was stopped.

The current sample counter is used to raise an interrupt whenever
a complete buffer was transferred. When the counter starts with a
value lower than the reload value, the interrupt triggeres before
the buffer was completly transferred. This may lead to corrupted
audio streams.

Tested-by: Rene Engel <ReneEngel80@emailn.de>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 hw/audio/es1370.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 4f738a0ad8..9a8e29c39c 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -502,7 +502,7 @@ static void es1370_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
     case ES1370_REG_DAC2_SCOUNT:
     case ES1370_REG_ADC_SCOUNT:
         d += (addr - ES1370_REG_DAC1_SCOUNT) >> 2;
-        d->scount = (val & 0xffff) | (d->scount & ~0xffff);
+        d->scount = (val & 0xffff) << 16 | (val & 0xffff);
         ldebug ("chan %td CURR_SAMP_CT %d, SAMP_CT %d\n",
                 d - &s->chan[0], val >> 16, (val & 0xffff));
         break;
-- 
2.35.3



  reply	other threads:[~2023-09-17  6:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17  6:55 [PATCH 0/8] hw/audio/es1370: bug fix Volker Rümelin
2023-09-17  6:58 ` Volker Rümelin [this message]
2023-09-17  6:58 ` [PATCH 2/8] hw/audio/es1370: replace bit-rotted code with tracepoints Volker Rümelin
2023-09-17  6:58 ` [PATCH 3/8] hw/audio/es1370: remove unused dolog macro Volker Rümelin
2023-09-17  6:58 ` [PATCH 4/8] hw/audio/es1370: remove #ifdef ES1370_DEBUG to avoid bit rot Volker Rümelin
2023-09-17  6:58 ` [PATCH 5/8] hw/audio/es1370: remove #ifdef ES1370_VERBOSE " Volker Rümelin
2023-09-17  6:58 ` [PATCH 6/8] hw/audio/es1370: block structure coding style fixes Volker Rümelin
2023-09-17  6:58 ` [PATCH 7/8] hw/audio/es1370: change variable type and name Volker Rümelin
2023-09-17  6:58 ` [PATCH 8/8] hw/audio/es1370: trace lost interrupts Volker Rümelin
2023-09-18 11:19 ` [PATCH 0/8] hw/audio/es1370: bug fix Marc-André Lureau
2023-10-10 12:24 ` BALATON Zoltan
2023-10-11  6:30   ` Marc-André Lureau

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=20230917065813.6692-1-vr_qemu@t-online.de \
    --to=vr_qemu@t-online.de \
    --cc=balaton@eik.bme.hu \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).