From nobody Fri Jul 24 21:53:40 2026 Received: from smtpbgau1.qq.com (smtpbgau1.qq.com [54.206.16.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A49E219049B; Thu, 23 Jul 2026 08:57:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.206.16.166 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784797086; cv=none; b=GLVGvKwDSPvyUzFdaF5PnER9dUDgHW4g3kGiSVdCINgu3Y4NjD6y4nvVGjqwHTFHPrFWTftDnyGrslBmdIcwTGxLh7QX4y4Fx93ClF8SQULCsxru0FyqM9XE8chpTVoButxjJnLpRjKr7RuxnwO0enA2h5h0KW1spQxP2Wrksns= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784797086; c=relaxed/simple; bh=y/PJ1R5oznmnskhWGSo1h4XlEa1yKwHjG/YAGbzOJG4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QIExds24ogxLNSn4hdCzh+6Yt1AB78HBmoZvypV0YBWWocGsxUjCOj+A60jjt3Zq00NGA/kRYkfTlCwRFB3XcVeqo+STBEY825k1VqntIB+k+CjKbiePfZixEhww/wi1qZ8gVAUkA8FRWqRJrtd8uXH/e5xLK656+WrNC8zq+m4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b=JtuK1gws; arc=none smtp.client-ip=54.206.16.166 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=uniontech.com header.i=@uniontech.com header.b="JtuK1gws" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uniontech.com; s=onoh2408; t=1784797050; bh=4E8jyp7xaBeSrb6i9ABxyDkz6Z3sx2wdtDMfzuD9q9w=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=JtuK1gwsfSZiGXFNm7OyKzaQgP9kHzHAptHfGZbaCaFbbiy0AtvIdt4zd/nV8uRA1 IKqHedJS8KU9L6mg5hhnqz2htl7BoLyppSi5CE2Up9M8rfj+pXklTkXfUsLqCUsZVB PJfaNrv84TrXv5dUpqtFbzd/XZ6UDo7FUmyIZP14= X-QQ-mid: esmtpsz21t1784797034t8cc23156 X-QQ-Originating-IP: O+Ij3hZPgPkLWEG2ml/9XtXvylZYdjV2+cq9/X1eB50= Received: from PEN202512010004 ( [113.57.152.160]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 23 Jul 2026 16:57:12 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 1 X-BIZMAIL-ID: 8717825214625693770 EX-QQ-RecipientCnt: 7 From: raoxu To: perex@perex.cz Cc: tiwai@suse.com, rongqianfeng@vivo.com, raoxu@uniontech.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] ALSA: lx6464es: fix period byte count for 16-bit streams Date: Thu, 23 Jul 2026 16:57:10 +0800 Message-ID: <8BB12E8D92A7CDBA+20260723085710.2567463-1-raoxu@uniontech.com> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-QQ-SENDSIZE: 520 Feedback-ID: esmtpsz:uniontech.com:qybglogicsvrgz:qybglogicsvrgz6b-0 X-QQ-XMAILINFO: OSjTqsWSa+11ZaxGrL3RDhJxlnyirjzIAIFwUlL2uKcHrN5aFfEORdb1 T6t8uqm4YYEcOWB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FYKkN4Ny6FuXrnB5Ye7Aabb3ujjtK+gg== X-QQ-RECHKSPAM: 0 Content-Type: text/plain; charset="utf-8" From: Xu Rao The lx6464es driver advertises both 16-bit and packed 24-bit PCM formats, but lx_trigger_start() and lx_interrupt_request_new_buffer() calculate the DMA period size as runtime->period_size * runtime->channels * 3. That is only correct for the packed 24-bit formats. For 16-bit streams the driver submits buffers that are 50% larger than the actual ALSA period and advances the DMA address by the same wrong amount. For example, with 2 channels, 256 frames and 4 periods, the third buffer already extends beyond the ALSA buffer and the fourth buffer starts outside it. Use snd_pcm_lib_period_bytes() so the byte count matches the runtime format, channel count and period size. Fixes: 02bec4904508 ("ALSA: lx6464es - driver for the digigram lx6464es int= erface") Cc: stable@vger.kernel.org Signed-off-by: Xu Rao --- sound/pci/lx6464es/lx6464es.c | 5 +---- sound/pci/lx6464es/lx_core.c | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 96df00db51d5..3b40ec071379 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -402,11 +402,8 @@ static void lx_trigger_start(struct lx6464es *chip, st= ruct lx_stream *lx_stream) int err; - const u32 channels =3D substream->runtime->channels; - const u32 bytes_per_frame =3D channels * 3; - const u32 period_size =3D substream->runtime->period_size; const u32 periods =3D substream->runtime->periods; - const u32 period_bytes =3D period_size * bytes_per_frame; + const u32 period_bytes =3D snd_pcm_lib_period_bytes(substream); dma_addr_t buf =3D substream->dma_buffer.addr; int i; diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c index 6f0843cfb3be..9909f1067871 100644 --- a/sound/pci/lx6464es/lx_core.c +++ b/sound/pci/lx6464es/lx_core.c @@ -969,10 +969,7 @@ static int lx_interrupt_request_new_buffer(struct lx64= 64es *chip, const unsigned int is_capture =3D lx_stream->is_capture; int err; - const u32 channels =3D substream->runtime->channels; - const u32 bytes_per_frame =3D channels * 3; - const u32 period_size =3D substream->runtime->period_size; - const u32 period_bytes =3D period_size * bytes_per_frame; + const u32 period_bytes =3D snd_pcm_lib_period_bytes(substream); const u32 pos =3D lx_stream->frame_pos; const u32 next_pos =3D ((pos+1) =3D=3D substream->runtime->periods) ? 0 : pos + 1; -- 2.50.1