From nobody Tue Apr 7 18:51:35 2026 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010043.outbound.protection.outlook.com [52.101.201.43]) (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 29B872DAFB9 for ; Fri, 27 Feb 2026 14:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772203626; cv=fail; b=f6zIv24btOZYx/4n+b+oahNh/G/YMH7mdPqoNuBC6MdcwaoEKVNeZq+hiEuHyjE2pgyjRHKgrl6rDiup9pmaF2U8g/0Nl6X9YDjKSahCN8AYGWNoFvTJQ/HZYhNmm79kac4QN48l9qIKwkVLlX/NMdMrf2vuJfW/3Cix4uFt6ME= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772203626; c=relaxed/simple; bh=zCkZMK6iJ/vt2lQBZ5GRQZRkSUCBLPu6vOuYHGahkcM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=mRqpRFj6KzVwF3FCOetISvPCWkVxYLiYvOZ0nBdJyqUnQdoFBoJaoHbIuQKQtnpYTTAOHke+QT7WLdRoO6+AnUFmM7vt/hZcBqOEL/9eXik0GBukDfUHCAL+vxPTvS4fDZXdeWnUtzNJSAjXclfgIMK1XIwY0EP+c65lH9TbUvc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=m3mVr7mw; arc=fail smtp.client-ip=52.101.201.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="m3mVr7mw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=f5qGULWzbPcjunpN4co5uA3iKJeBQWbI8bZaoTAQ+IF59lQ/1rDkRURWAgbqoBX9DU7flo3qhMx3/frSk7awOQntqkNJlC6xD0XN75J5uwUhsw9eZ0e30PyUFhqJzKEm9wNQG4MqfgpK3xbDzLGtSnLzy3RqaUMmTnXF54aDiELSsbnOE2EPIlJcLF66K1Yg4b1N0C/ywTK2q62cgBi0peCkOrWRf0Y3XwE9deo8weJTQ4U8fWTPJRzzCcXzPqYH1fyOF6iCOMw9nI9aqUf0Khn6y639nDEUMLcbBYwkWkMjX0inPXiy+yYOCz5mZ1eNohWqH9Aq+vbQdnlHkTdlFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B09mLMF5mHI+niLOw7UijXOvVBbcvD2GjSrOIi5U5Fs=; b=bFPnWrgkByjgs3tX62qu3uOuBLga1U5kpJBiURE9wmqGWR4FgtZJaTBc50+JfEvHGYfm0vuMbBSQf8QHYekuVi8l8zVBzUe/vgTw2EhXCzyK25DLlTrH6leo+Mm6U8p47jlzFpbRFuUatIYdF26TFD1nep7HuXlZNcA4Ikrg3X8IxwAakCF3vHZrZx13+eN+Z8rS0ervaxV9DZa/VyzTghZB2LYOOnqpSVT2uLDUIczKAeFF9M63P0tXgh99HsMSi0dSXLq1AU00XPUhswyVdSb+1WWXjJ0OrvaA0nZzmIg0EKUrUHZD4b+lcwH286rj/ETCxd7STVKtDxrPLraKtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.23.195) smtp.rcpttodomain=antheas.dev smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B09mLMF5mHI+niLOw7UijXOvVBbcvD2GjSrOIi5U5Fs=; b=m3mVr7mwrD91B8+zbuPuJSlvPUzdEObyqxIjtHgmcskXOvAOtwwuJIz7Vhyzgiqj5TOsdCjzGPMBK1b/Abfa8tQpre4I/BMz2KFdHJAzL+jOJeyh43iciUcWvr6mBjnQEk7KMseKHyz+cf/F9sx/qjrSdbWZ9xWa5YQ2mEPOORs= Received: from BN0PR04CA0080.namprd04.prod.outlook.com (2603:10b6:408:ea::25) by SJ0PR10MB5788.namprd10.prod.outlook.com (2603:10b6:a03:3df::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9654.16; Fri, 27 Feb 2026 14:47:01 +0000 Received: from MN1PEPF0000F0E4.namprd04.prod.outlook.com (2603:10b6:408:ea:cafe::15) by BN0PR04CA0080.outlook.office365.com (2603:10b6:408:ea::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9632.27 via Frontend Transport; Fri, 27 Feb 2026 14:47:04 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.23.195) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.23.195 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.23.195; helo=lewvzet201.ext.ti.com; pr=C Received: from lewvzet201.ext.ti.com (198.47.23.195) by MN1PEPF0000F0E4.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9654.16 via Frontend Transport; Fri, 27 Feb 2026 14:47:01 +0000 Received: from DLEE212.ent.ti.com (157.170.170.114) by lewvzet201.ext.ti.com (10.4.14.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Fri, 27 Feb 2026 08:46:56 -0600 Received: from DLEE205.ent.ti.com (157.170.170.85) by DLEE212.ent.ti.com (157.170.170.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Fri, 27 Feb 2026 08:46:56 -0600 Received: from lelvem-mr06.itg.ti.com (10.180.75.8) by DLEE205.ent.ti.com (157.170.170.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Fri, 27 Feb 2026 08:46:56 -0600 Received: from LT5CG31242FY.dhcp.ti.com ([10.250.161.26]) by lelvem-mr06.itg.ti.com (8.18.1/8.18.1) with ESMTP id 61REkqqj3906481; Fri, 27 Feb 2026 08:46:53 -0600 From: Shenghao Ding To: CC: , , , , , <13564923607@139.com>, <13916275206@139.com>, , , Shenghao Ding Subject: [PATCH v1] ALSA: hda/tas2781: A workaround solution to lower-vol issue among lower calibrated-impedance micro-speaker on TAS2781 Date: Fri, 27 Feb 2026 22:46:40 +0800 Message-ID: <20260227144641.1243-1-shenghao-ding@ti.com> X-Mailer: git-send-email 2.33.0.windows.2 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-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E4:EE_|SJ0PR10MB5788:EE_ X-MS-Office365-Filtering-Correlation-Id: a4bed58b-c1e8-40ec-bc48-08de760f10d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|34020700016|36860700013; X-Microsoft-Antispam-Message-Info: Qy4cEdfyQGcV550xThB6iVa0yFW4OyinGmiB3Kcbh7BVWi/dcuIIEMqZwZglfr/HUVqYgV5lbyyqw2BNzojqh0/b76SUmtTbfEVi+EFVeiOBjYbBu3hgpVUdYMznD6r+ysuofkMJpIZutgHFPq54Qvwp2rGDQjfF+tp8EGwvCAagC+0lPu4j0T/BTQbNNBqnPFIa2G2km0C5H334V8xs/aCpYCHQEbvbr3dgV3I/7Sx+tso50tM9H5edU20b6A2YAwyi5NqKhxxZX0m9CRSYGvmV1edWbbmaQEhEkOIjtrvUA3wQNblmtORU6uOhaKBw2bhG+73q1Yxaeji/YUOGuRBwT8wOXDxFAFfBmPSS6IvaIo4gXec8VK1U8KzF2WE634P4bXQkXy5IwfriRddgIiz5l7D6DhjN1ZqKVlQhm2BK1AGZEq82ctEMz5CuPWAQuS+EFnz+fN8y5pUpQ7ApmF+/hk4Pa9/3A64Vx/DF0P4Qjoei+ASDZCmCQKm6DW8tR51p5Vk5Vr3Jkdsv43D/BW5ufRme/R3PlrkDdNWiOVEtASvEAzIP0sjGJnm7AdZWRUX3hcmBzPw8ALaN3hgfWXGpbScIEhh6oWqYFOx9D/EI8WSpOk8UhBWiM5ZACLlCLoZ2xOx8MzBQn4MAWBVLp8eEN9s9KzWkcOFNXHqfnxDWRhynjtLhpfdklXCOLzXDo95MT5AAnnEwLNrs8xJBarT1qD1S4Do+LlBk71YOVzbWJh7TjEFsPLP33Gz4oQqSvm8BWjpoYPag4cwMVulXDEsTmojeK5euKtb92/g0NMLegF69JSYmjC1vRP3B6uFYAy6uEp2s9jDRdrrmR4uuOQ== X-Forefront-Antispam-Report: CIP:198.47.23.195;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:lewvzet201.ext.ti.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(82310400026)(34020700016)(36860700013);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hgrVPDrUup1AritMxaoeC1O4LhNks3FETRuX7rZurT1WVY/oecdMlbmbHMgpg91H+5kP2ON1CFSfl1SAXHGsPqeRVxX4goD5nDqHB2EpjMaWctkwlNiIjzH8VtUJHPyp6p/0QYC0ktvtoffAum4ut48pWfwMSAX0YQS8GSfRjrWqD/KuNY9VjYoikdddHu+ZsfZcAC7rADejzG8EHe21qNJ/wpfXahX8xH9/jvom3PZ16DsB70hvpkaRYfJkM3pnWR6po8Htd4VrR+xdZ1c1gdyS6zUobsuYSXM9HdtubfKCD25YNPnrDtZ/uM9YYCVcECclQngiueXlKHdP2GW+b6mC9NeO3ac8eZVRVpuc6sizCfEmc/e62OToHYuXsURV5vXg7R4iTuCyhvJaHESXsPuvpse0M3Bx1eagdWum1K0cODkNOSHeBDdhHaxYqgAF X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2026 14:47:01.0894 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4bed58b-c1e8-40ec-bc48-08de760f10d3 X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.23.195];Helo=[lewvzet201.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E4.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5788 Content-Type: text/plain; charset="utf-8" On TAS2781, if the Speaker calibrated impedance is lower than default value hard-coded inside the TAS2781, it will cuase vol lower than normal. In order to fix this issue, the parameter of SineGainI need updating. Signed-off-by: Shenghao Ding Tested-by: Matthew Schwartz --- v1: - Add tas2781_cali_preproc() to check whether the calibrated-impedance is = lower than the default value. If so, update the SineGainI. - Specify the TAS2781 chipid for cliabrated data preprocessing. - Revert b7e26c8bdae7 ("ALSA: hda/tas2781: Skip UEFI calibration on ASUS R= OG Xbox Ally X") in tas2781. --- include/sound/tas2781.h | 1 + .../hda/codecs/side-codecs/tas2781_hda_i2c.c | 15 +-- sound/soc/codecs/tas2781-fmwlib.c | 94 +++++++++++++++++++ 3 files changed, 98 insertions(+), 12 deletions(-) diff --git a/include/sound/tas2781.h b/include/sound/tas2781.h index 7c03bdc951bb..e847cf51878c 100644 --- a/include/sound/tas2781.h +++ b/include/sound/tas2781.h @@ -151,6 +151,7 @@ struct tasdevice { struct bulk_reg_val *cali_data_backup; struct bulk_reg_val alp_cali_bckp; struct tasdevice_fw *cali_data_fmw; + void *cali_specific; unsigned int dev_addr; unsigned int err_code; unsigned char cur_book; diff --git a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c b/sound/hda/cod= ecs/side-codecs/tas2781_hda_i2c.c index 74c3cf1e45e1..67240ce184e1 100644 --- a/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c +++ b/sound/hda/codecs/side-codecs/tas2781_hda_i2c.c @@ -60,7 +60,6 @@ struct tas2781_hda_i2c_priv { int (*save_calibration)(struct tas2781_hda *h); =20 int hda_chip_id; - bool skip_calibration; }; =20 static int tas2781_get_i2c_res(struct acpi_resource *ares, void *data) @@ -479,8 +478,7 @@ static void tasdevice_dspfw_init(void *context) /* If calibrated data occurs error, dsp will still works with default * calibrated data inside algo. */ - if (!hda_priv->skip_calibration) - hda_priv->save_calibration(tas_hda); + hda_priv->save_calibration(tas_hda); } =20 static void tasdev_fw_ready(const struct firmware *fmw, void *context) @@ -535,7 +533,6 @@ static int tas2781_hda_bind(struct device *dev, struct = device *master, void *master_data) { struct tas2781_hda *tas_hda =3D dev_get_drvdata(dev); - struct tas2781_hda_i2c_priv *hda_priv =3D tas_hda->hda_priv; struct hda_component_parent *parent =3D master_data; struct hda_component *comp; struct hda_codec *codec; @@ -564,14 +561,6 @@ static int tas2781_hda_bind(struct device *dev, struct= device *master, break; } =20 - /* - * Using ASUS ROG Xbox Ally X (RC73XA) UEFI calibration data - * causes audio dropouts during playback, use fallback data - * from DSP firmware as a workaround. - */ - if (codec->core.subsystem_id =3D=3D 0x10431384) - hda_priv->skip_calibration =3D true; - guard(pm_runtime_active_auto)(dev); =20 comp->dev =3D dev; @@ -643,6 +632,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) */ device_name =3D "TIAS2781"; hda_priv->hda_chip_id =3D HDA_TAS2781; + tas_hda->priv->chip_id =3D TAS2781; hda_priv->save_calibration =3D tas2781_save_calibration; tas_hda->priv->global_addr =3D TAS2781_GLOBAL_ADDR; } else if (strstarts(dev_name(&clt->dev), "i2c-TXNW2770")) { @@ -656,6 +646,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) "i2c-TXNW2781:00-tas2781-hda.0")) { device_name =3D "TXNW2781"; hda_priv->hda_chip_id =3D HDA_TAS2781; + tas_hda->priv->chip_id =3D TAS2781; hda_priv->save_calibration =3D tas2781_save_calibration; tas_hda->priv->global_addr =3D TAS2781_GLOBAL_ADDR; } else if (strstr(dev_name(&clt->dev), "INT8866")) { diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-f= mwlib.c index c969eb38704e..5798d518d94c 100644 --- a/sound/soc/codecs/tas2781-fmwlib.c +++ b/sound/soc/codecs/tas2781-fmwlib.c @@ -32,6 +32,10 @@ #define TAS2781_YRAM1_PAGE 42 #define TAS2781_YRAM1_START_REG 88 =20 +#define TAS2781_PG_REG TASDEVICE_REG(0x00, 0x00, 0x7c) +#define TAS2781_PG_1_0 0xA0 +#define TAS2781_PG_2_0 0xA8 + #define TAS2781_YRAM2_START_PAGE 43 #define TAS2781_YRAM2_END_PAGE 49 #define TAS2781_YRAM2_START_REG 8 @@ -98,6 +102,12 @@ struct blktyp_devidx_map { unsigned char dev_idx; }; =20 +struct tas2781_cali_specific { + unsigned char sin_gni[4]; + int sin_gni_reg; + bool is_sin_gn_flush; +}; + static const char deviceNumber[TASDEVICE_DSP_TAS_MAX_DEVICE] =3D { 1, 2, 1, 2, 1, 1, 0, 2, 4, 3, 1, 2, 3, 4, 1, 2 }; @@ -2454,6 +2464,84 @@ static int tasdevice_load_data(struct tasdevice_priv= *tas_priv, return ret; } =20 +static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i) +{ + struct tas2781_cali_specific *spec =3D priv->tasdevice[i].cali_specific; + struct calidata *cali_data =3D &priv->cali_data; + struct cali_reg *p =3D &cali_data->cali_reg_array; + unsigned char *data =3D cali_data->data; + int rc; + + /* + * On TAS2781, if the Speaker calibrated impedance is lower than + * default value hard-coded inside the TAS2781, it will cuase vol + * lower than normal. In order to fix this issue, the parameter of + * SineGainI need updating. + */ + if (spec =3D=3D NULL) { + int k =3D i * (cali_data->cali_dat_sz_per_dev + 1); + int re_org, re_cal, corrected_sin_gn, pg_id; + unsigned char r0_deflt[4]; + + spec =3D devm_kzalloc(priv->dev, sizeof(*spec), GFP_KERNEL); + if (spec =3D=3D NULL) + return -ENOMEM; + priv->tasdevice[i].cali_specific =3D spec; + rc =3D tasdevice_dev_bulk_read(priv, i, p->r0_reg, r0_deflt, 4); + if (rc < 0) { + dev_err(priv->dev, "invalid RE from %d =3D %d\n", i, rc); + return rc; + } + /* + * SineGainI need to be re-calculated, calculate the high 16 + * bits. + */ + re_org =3D r0_deflt[0] << 8 | r0_deflt[1]; + re_cal =3D data[k + 1] << 8 | data[k + 2]; + if (re_org > re_cal) { + rc =3D tasdevice_dev_read(priv, i, TAS2781_PG_REG, + &pg_id); + if (rc < 0) { + dev_err(priv->dev, "invalid PG id %d =3D %d\n", + i, rc); + return rc; + } + + spec->sin_gni_reg =3D (pg_id =3D=3D TAS2781_PG_1_0) ? + TASDEVICE_REG(0, 0x1b, 0x34) : + TASDEVICE_REG(0, 0x18, 0x1c); + + rc =3D tasdevice_dev_bulk_read(priv, i, + spec->sin_gni_reg, + spec->sin_gni, 4); + if (rc < 0) { + dev_err(priv->dev, "wrong sinegaini %d =3D %d\n", + i, rc); + return rc; + } + corrected_sin_gn =3D re_org * ((spec->sin_gni[0] << 8) + + spec->sin_gni[1]); + corrected_sin_gn /=3D re_cal; + spec->sin_gni[0] =3D corrected_sin_gn >> 8; + spec->sin_gni[1] =3D corrected_sin_gn & 0xff; + + spec->is_sin_gn_flush =3D true; + } + } + + if (spec->is_sin_gn_flush) { + rc =3D tasdevice_dev_bulk_write(priv, i, spec->sin_gni_reg, + spec->sin_gni, 4); + if (rc < 0) { + dev_err(priv->dev, "update failed %d =3D %d\n", + i, rc); + return rc; + } + } + + return 0; +} + static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i) { struct calidata *cali_data =3D &priv->cali_data; @@ -2469,6 +2557,12 @@ static void tasdev_load_calibrated_data(struct tasde= vice_priv *priv, int i) } k++; =20 + if (priv->chip_id =3D=3D TAS2781) { + rc =3D tas2781_cali_preproc(priv, i); + if (rc < 0) + return; + } + rc =3D tasdevice_dev_bulk_write(priv, i, p->r0_reg, &(data[k]), 4); if (rc < 0) { dev_err(priv->dev, "chn %d r0_reg bulk_wr err =3D %d\n", i, rc); --=20 2.43.0