From nobody Sat Jul 25 18:03:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AAC8E308F23; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784095482; cv=none; b=OwjezlouLvJ60bZtn6L2bq41skXS/LovegrjUlp52oxGj9bPLeLL90ghMxnZ5LgKTi6asL77mzrN/2aY2GDCziauUQcclOhx2wPHERopAAjoEhyYW+A2lTr/gkssTK8GFG3ejz2v1V/EFnt0qNFr6xgoDu+FBH6AhZ8+TAAqV6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784095482; c=relaxed/simple; bh=p0z8OfcS1fdiYyedH2MZyLZY7VEHaJFdRELjOTQv8uA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bCG8MFdWVXDozIL1mmx2qZ7BJv2BKzR9f2M2eSM4ZFRhCfOM5pcWDs/yQ9rGBALLY33XVKwmVI33wjpzZ4cipdtLxOoeIVmBFkmAz4TzJlWaUBRndYahT0SuQjzCgkWXSPLRJcaYQ6+PjGP0Wt36sUeQoQ9Bv/M2GuQsz/ZuXLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LHY952wb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LHY952wb" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3CBF7C2BCF5; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1784095482; bh=p0z8OfcS1fdiYyedH2MZyLZY7VEHaJFdRELjOTQv8uA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LHY952wbD00sIWzXEIPNLNo/4741CiFQVMFH+yoka+ROGcdwwyOAdwBFxwMtH/Rg2 P1jEuWB7YUBHTg5gG5t11kTC379yR1GqjlUWHMTcMU3OJSIb5mfJZDJeM4J1GfLPPp ebUeX8d0WPfJlxcSeeMXWFthZdOGi5lXKu6ZMa9JLkUHl67Mi2q6RmW/+JpaoGGmwp j5m5uOOVu+LaVQ7HbabUvX3PqSUBoHot0aEsklwTzE7Bkme0tUIjGdMajsRlxjzHaG /x8ARK7kdAsNWkvckmy6j5rXxjW8IVRtjArnNXEiGZ9OMpsM6PFn5Li6DZakMmt4C+ Vq/Kjvd1/L89A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F46EC44508; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) From: Haidar Lee via B4 Relay Date: Wed, 15 Jul 2026 14:04:40 +0800 Subject: [PATCH 1/2] ASoC: tas2562: fix DVC coefficient write order Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260715-tas2562-dvc-fix-v1-1-072b13901b20@adlinktech.com> References: <20260715-tas2562-dvc-fix-v1-0-072b13901b20@adlinktech.com> In-Reply-To: <20260715-tas2562-dvc-fix-v1-0-072b13901b20@adlinktech.com> To: Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Dan Murphy Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Haidar Lee , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784095481; l=2928; i=haidar.lee@adlinktech.com; s=20260715; h=from:subject:message-id; bh=NrDARQuuRTnNObQOb1pPNHaoWGmUellYTb5N5X9Elwo=; b=Jojabzbyv2lFEZ+hhb+FNhvvFy6aGlg1FWjgRUKsynbkhjiuLUXTy09CvpQAQFY8xgCKVnmSm Q2E7sIt6QfkC/9HXXYyFL1aXKW+yliFQZNA4kFu7bWAhrtCh+aSTr38 X-Developer-Key: i=haidar.lee@adlinktech.com; a=ed25519; pk=p37KzVgRl0a8om8VCM7iEwQvNuZz2fxL4lBCBp5qrno= X-Endpoint-Received: by B4 Relay for haidar.lee@adlinktech.com/20260715 with auth_id=872 X-Original-From: Haidar Lee Reply-To: haidar.lee@adlinktech.com From: Haidar Lee The TAS2562 applies the 32-bit digital volume coefficient to the playback path when the last byte, DVC_CFG4 (book 0 page 2 reg 0x0F), is written. tas2562_volume_control_put() wrote DVC_CFG4 first and DVC_CFG1 (the MSB) last, so every volume change latched a value made of the previous coefficient's upper three bytes combined with the new LSB; the remaining bytes only took effect on the next volume change. In practice the control was unusable: the first setting after power-on always played at roughly 0 dB no matter what value was requested (the chip's default upper bytes were still latched), and most subsequent changes muted the output entirely or produced a distorted, over-unity gain. Verified on a TAS2562 (ADLINK OSM-520 / MT8189 board) by tracing the I2C writes with ftrace and by writing the same coefficients manually in both byte orders: written MSB-first the register block behaves exactly as the driver expects, LSB-first reproduces the broken behaviour. Write the bytes MSB first with DVC_CFG4 last so the complete new coefficient is latched atomically. Fixes: bf726b1c86f2 ("ASoC: tas2562: Add support for digital volume control= ") Cc: stable@vger.kernel.org Signed-off-by: Haidar Lee --- sound/soc/codecs/tas2562.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index e1d62f30418a..ec32ef0afd7e 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -475,20 +475,27 @@ static int tas2562_volume_control_put(struct snd_kcon= trol *kcontrol, u32 reg_val; =20 reg_val =3D float_vol_db_lookup[ucontrol->value.integer.value[0]/2]; - ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG4, - (reg_val & 0xff)); - if (ret) - return ret; - ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG3, - ((reg_val >> 8) & 0xff)); + /* + * The device applies the 32-bit coefficient to the playback path on + * the write to DVC_CFG4 (the LSB, book 0 page 2 reg 0x0F), so the + * bytes must be written MSB first and DVC_CFG4 last. Writing CFG4 + * first latches a mix of the previous coefficient's upper bytes and + * the new LSB instead of the requested value. + */ + ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG1, + ((reg_val >> 24) & 0xff)); if (ret) return ret; ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG2, ((reg_val >> 16) & 0xff)); if (ret) return ret; - ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG1, - ((reg_val >> 24) & 0xff)); + ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG3, + ((reg_val >> 8) & 0xff)); + if (ret) + return ret; + ret =3D snd_soc_component_write(component, TAS2562_DVC_CFG4, + (reg_val & 0xff)); if (ret) return ret; =20 --=20 2.34.1 From nobody Sat Jul 25 18:03:47 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7C4722DA757; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784095482; cv=none; b=o039ktYjdSyVX+7v4pOE8dRLZlkd8EpWTlaLYQsg76QzU2DsYACU7sIu8+ZpwSY4coSdK7npsFHs7L5QsUFM+/ziU9+9BBI/VOdhdU/AEdLBd4V70NXIPlnzZmR56f1dlySQXupkMpuZ40mr1Y/29P7dt9+cFH84rm4hlqgF7fU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784095482; c=relaxed/simple; bh=cDBfR7VZXzWQDfHQGuw+uTgGsKYv2brCjYecZtayH0s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kURPZbRfemsWfXjtu1C86M55OdOyB0ye45gmt11bWjS75SmK7ueuEkPy/KCK/GMFOV8ri55XB1TZVIvdz3KEcb7P7P+mj9zVKGXITHO3vq6H6YDCFYl7cxLrNw5zakqDF5MxlXc2rk7HlkDp8aias7aOPv1w/O+xmkE/CeilKr8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=horbHq44; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="horbHq44" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4E608C2BCF7; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1784095482; bh=cDBfR7VZXzWQDfHQGuw+uTgGsKYv2brCjYecZtayH0s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=horbHq44ucNi5wKus9eLFzwlUzDo0JgSjx6+CI9eggpGkkXSKGvr7GoklkweOL9Q0 YkeUGvty+4JIBdKrHrPmOWFPIC+VMmEFvV79HZgCGZ4iZ0jJwHOrr64NgKXSLq41JW Ln6Z+cpKy712Ta6UFPlb/i6DGaPBaGORmTs5vVTIQ/Oys9XDN3UVW2mWdHrFuvaMh/ IEaIqlyFAQauVf450ujfd3JJ8Ph3KleiKA9gXpY8kd9TeUgcS6+OCADPdZDlHcVyTj btFLpPK7uyQFhJS0h2RqEDg1jh5IjELpHqB9HqS7TwrdBbUhxydarA2dY70jwdr9Z8 CI7dWnNo+vxew== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32928C4450C; Wed, 15 Jul 2026 06:04:42 +0000 (UTC) From: Haidar Lee via B4 Relay Date: Wed, 15 Jul 2026 14:04:41 +0800 Subject: [PATCH 2/2] ASoC: tas2562: fix broken entries in the volume lookup table Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260715-tas2562-dvc-fix-v1-2-072b13901b20@adlinktech.com> References: <20260715-tas2562-dvc-fix-v1-0-072b13901b20@adlinktech.com> In-Reply-To: <20260715-tas2562-dvc-fix-v1-0-072b13901b20@adlinktech.com> To: Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Dan Murphy Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Haidar Lee , stable@vger.kernel.org X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784095481; l=2082; i=haidar.lee@adlinktech.com; s=20260715; h=from:subject:message-id; bh=/UoYM9/AkmbMBBJjFQcKRx8doPtiLNXUryHarALR2+U=; b=G9R4a9/biCE5j2qrRqzkcOOvZyDxPTIRNr79T2t0ducKc9Tt4HqtswlAC3QpdvBmk2z43C/nu eJYxLW4aKKpBcsCiUIBGOFhOytQrPsgYAilMEImq3LJMl9tY0+rLA2/ X-Developer-Key: i=haidar.lee@adlinktech.com; a=ed25519; pk=p37KzVgRl0a8om8VCM7iEwQvNuZz2fxL4lBCBp5qrno= X-Endpoint-Received: by B4 Relay for haidar.lee@adlinktech.com/20260715 with auth_id=872 X-Original-From: Haidar Lee Reply-To: haidar.lee@adlinktech.com From: Haidar Lee The float_vol_db_lookup table is supposed to hold round(10^(dB/20) * 2^30) for every 2 dB step from -110 dB to 0 dB, which is 56 entries, but it only has 55: the -90 dB entry duplicates the -92 dB value (0x0000695b) and the -20 dB entry (0x06666666) is missing altogether. As a result every step between -90 dB and -22 dB is off by 2 dB, and the control's maximum raw value of 110 indexes one element past the end of the array. Replace the duplicated -90 dB entry with the correct value 0x000084a3 and add the missing -20 dB entry, bringing the table to the full 56 entries so index 55 (raw value 110, 0 dB) is in range again. Fixes: bf726b1c86f2 ("ASoC: tas2562: Add support for digital volume control= ") Cc: stable@vger.kernel.org Signed-off-by: Haidar Lee --- sound/soc/codecs/tas2562.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c index ec32ef0afd7e..cdd695c3807e 100644 --- a/sound/soc/codecs/tas2562.c +++ b/sound/soc/codecs/tas2562.c @@ -32,15 +32,16 @@ static const unsigned int float_vol_db_lookup[] =3D { 0x00000d43, 0x000010b2, 0x00001505, 0x00001a67, 0x00002151, 0x000029f1, 0x000034cd, 0x00004279, 0x000053af, 0x0000695b, -0x0000695b, 0x0000a6fa, 0x0000d236, 0x000108a4, 0x00014d2a, +0x000084a3, 0x0000a6fa, 0x0000d236, 0x000108a4, 0x00014d2a, 0x0001a36e, 0x00021008, 0x000298c0, 0x000344df, 0x00041d8f, 0x00052e5a, 0x000685c8, 0x00083621, 0x000a566d, 0x000d03a7, 0x0010624d, 0x0014a050, 0x0019f786, 0x0020b0bc, 0x0029279d, 0x0033cf8d, 0x004139d3, 0x00521d50, 0x00676044, 0x0082248a, 0x00a3d70a, 0x00ce4328, 0x0103ab3d, 0x0146e75d, 0x019b8c27, 0x02061b89, 0x028c423f, 0x03352529, 0x0409c2b0, 0x05156d68, -0x080e9f96, 0x0a24b062, 0x0cc509ab, 0x10137987, 0x143d1362, -0x197a967f, 0x2013739e, 0x28619ae9, 0x32d64617, 0x40000000 +0x06666666, 0x080e9f96, 0x0a24b062, 0x0cc509ab, 0x10137987, +0x143d1362, 0x197a967f, 0x2013739e, 0x28619ae9, 0x32d64617, +0x40000000 }; =20 struct tas2562_data { --=20 2.34.1