From nobody Sun May 24 22:42:32 2026 Received: from mx0b-0046e701.pphosted.com (mx0b-0046e701.pphosted.com [67.231.157.77]) (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 18C62348C7B; Wed, 20 May 2026 16:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.157.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779293965; cv=none; b=hgKLZCyw6PTB2ckghUeQzmTYnDx2YWHU/fGxElHHKBEKGmZ+9r54rSvcD+Yj7mPVPZWqEcWo5uWv5p+cGipaAoYl/xlRgRKgkORF2AZ8VoWLOzWH1B1pEOR7BL275iCfdTgKIvqmGMvb8n6vfs7xDBJnIQsPcDXRz5+RLfbyepg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779293965; c=relaxed/simple; bh=Vn/Ovhm5VhPLnxgZk2a2WANdeSJq9dzAZgsjAL2hnuY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LoynmaGJplVgg7sDjowXw1s7PK1g0VIh103BkeqlkvsoQdhNKESBz1MnGX8PRe/s6mWTZtbsLZgQJJcqi0OAWNUy06ikcbId+NdcdUhkoNfLLOjTGMxk0rjcr9vj+v5S1P1BMZ8aekNOx0YpIR3M4Ut643dXmBQQMWmrmyNYTb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=plexus.com; spf=pass smtp.mailfrom=plexus.com; dkim=pass (2048-bit key) header.d=plexus.com header.i=@plexus.com header.b=lNMAqVW7; arc=none smtp.client-ip=67.231.157.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=plexus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=plexus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plexus.com header.i=@plexus.com header.b="lNMAqVW7" Received: from pps.filterd (m0425993.ppops.net [127.0.0.1]) by mx0b-0046e701.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64KA6Cdr3861369; Wed, 20 May 2026 11:14:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps1; bh=i22HS W9zpYw15GmstHadUvDMsa016iWU0x6dfAxsT44=; b=lNMAqVW7yllznVA0QhWpP py4RgsJaY0PyQfH+xmCexMkO1HFPQPj3W5l1cxZAUDBkgpq2iF3uQfInIodLBbXk LX9eWdRXvg7GAmZJ2qSVqhu6KJh6kzd5fix9FG/VG6Vjzqmp1+8qMH2n84pl8azP MSr1Q3yyJx7xBxrHGy+O8ZfgHWKMoPtrKt8B71I5zTlo5My6iBrfQPQTSVFrBOFm x52Hci4VR9kxGGqXvt++V2W+XjFondwmeWIVmGFGmoXihtRfxwv9qgzEVqFrx74g +8fTVJnSC4qVzZrbpK/w8LmnklWwqw++aOkycH83rOJnNLPNq2xETCDasu4zINKY w== Received: from intranet-smtp.plexus.com ([64.215.193.254]) by mx0b-0046e701.pphosted.com (PPS) with ESMTPS id 4e8tdctk9n-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 20 May 2026 11:14:39 -0500 (CDT) Received: from LNDCL34533.neenah.na.plexus.com (unknown [10.255.48.203]) by intranet-smtp.plexus.com (Postfix) with ESMTP id 69A0939540; Wed, 20 May 2026 11:14:38 -0500 (CDT) From: Danny Kaehn Date: Wed, 20 May 2026 11:13:06 -0500 Subject: [PATCH v14 1/2] HID: cp2112: Add fwnode support 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: <20260520-cp2112-dt-v14-1-b1b4b6734b6f@plexus.com> References: <20260520-cp2112-dt-v14-0-b1b4b6734b6f@plexus.com> In-Reply-To: <20260520-cp2112-dt-v14-0-b1b4b6734b6f@plexus.com> To: Benjamin Tissoires , Andy Shevchenko , Danny Kaehn , Andi Shyti , Conor Dooley Cc: Jiri Kosina , linux-input@vger.kernel.org, Dmitry Torokhov , Ethan Twardy , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Leo Huang , Arun D Patil , Willie Thai , Ting-Kai Chen , Bartosz Golaszewski X-Mailer: b4 0.14-dev-d4707 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779293611; l=2602; i=danny.kaehn@plexus.com; s=20260127; h=from:subject:message-id; bh=Vn/Ovhm5VhPLnxgZk2a2WANdeSJq9dzAZgsjAL2hnuY=; b=G/S8q4hj4pjXklnkTAzfPzquNO4H4vwZX8UYpinqN8ZgXg/G0FGkI7PP1CIJS91ZE+tHpGszS S/0E043Uy89AyZbVUr62Eqrw6Vb8C5Xpxb1uKj99VkwDMasGPZ/5elB X-Developer-Key: i=danny.kaehn@plexus.com; a=ed25519; pk=cbcR30mXg2VNyXtpE2SxVSXEDWLYwrxgnPCjJZn6A8s= X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: PZzqbl7dvOcZTFJJMoR-8UzrMSaQZgM7 X-Proofpoint-GUID: qJxFiIvr5wtqRpdGokVsS3cXcc9clq0u X-Authority-Analysis: v=2.4 cv=f5F4wuyM c=1 sm=1 tr=0 ts=6a0dddef cx=c_pps a=356DXeqjepxy6lyVU6o3hA==:117 a=356DXeqjepxy6lyVU6o3hA==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=SL0Da4cj2IsybHzvybfz:22 a=bWp6hkYQOWa87JmFC6wa:22 a=Y_joWELsAAAA:8 a=pVqXFfmJREZmDo3ecgYA:9 a=QEXdDO2ut3YA:10 a=g_BQsM8wYJVSTWLOHH1t:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIwMDE1NyBTYWx0ZWRfXyV597Mn2eDt/ WwG+9VVt4RPxW6tVpDNECIlLlejg9tlphS+FVQRTmv9CzPtBMvRxETqVqRr7JNXXBfAwkUzJyKv fEOo/efqUsJyifon8pNr5SimpqC40CQ/psoq4SW4KWFsuiEH2YaeHJzOB/rTk6zv1AxjP1fLWQp BCOV5lr7kWOfS85jr0VYeUuzthzQPbV+mSax5es6UPToW84u7mzHMYvW95ROs7c/pJ441bnUZw9 u2ZN8NI460gxxxTvOukUhF5EnmrgwkTuXL0pdu/Xiz7a5+QpdfjbiIxJgWgtmK82QfkQgtCYAuM viFksxiLMOYdREn3Hc6OXCXXwAMNrQlUS38cPFHXOij4NkNQvvq0H6ugsPszLM7D6DHxi+/f+j7 qYAD05gxQ2E5hmaaA5YoEX8H6bUL/ojuX+US1u/zkcz57Srcz4COfxOms7beD0OWmbd2XcWIzcB /CQrh+jY3ixWNDobGVQ== X-Proofpoint-Spam-Reason: orgsafe Support describing the CP2112's I2C and GPIO interfaces in firmware. Bindings between the firmware nodes and the functions of the device are distinct between ACPI and DeviceTree. For ACPI, the i2c_adapter will use the child with _ADR equal to Zero and the gpio_chip will use the child with _ADR equal to One. For DeviceTree, the i2c_adapter will use the child with name "i2c", but the gpio_chip will share a firmware node with the CP2112. Signed-off-by: Danny Kaehn --- drivers/hid/hid-cp2112.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 803b883ae875..e960fc988058 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -29,6 +29,18 @@ #include #include "hid-ids.h" =20 +/** + * enum cp2112_child_acpi_cell_addrs - Child ACPI addresses for CP2112 sub= -functions + * Note that the enum values are explicitly defined, as this defines the i= nterface + * between ACPI and Linux + * @CP2112_I2C_ADR: Address for I2C node + * @CP2112_GPIO_ADR: Address for GPIO node + */ +enum cp2112_child_acpi_cell_addrs { + CP2112_I2C_ADR =3D 0, + CP2112_GPIO_ADR =3D 1, +}; + #define CP2112_REPORT_MAX_LENGTH 64 #define CP2112_GPIO_CONFIG_LENGTH 5 #define CP2112_GPIO_GET_LENGTH 2 @@ -1208,7 +1220,10 @@ static int cp2112_probe(struct hid_device *hdev, con= st struct hid_device_id *id) struct cp2112_device *dev; u8 buf[3]; struct cp2112_smbus_config_report config; + struct fwnode_handle *cp2112_fwnode; + struct fwnode_handle *child; struct gpio_irq_chip *girq; + u32 addr; int ret; =20 dev =3D devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL); @@ -1226,6 +1241,28 @@ static int cp2112_probe(struct hid_device *hdev, con= st struct hid_device_id *id) return ret; } =20 + cp2112_fwnode =3D dev_fwnode(&hdev->dev); + if (is_acpi_device_node(cp2112_fwnode)) { + fwnode_for_each_child_node(cp2112_fwnode, child) { + ret =3D acpi_get_local_address(ACPI_HANDLE_FWNODE(child), &addr); + if (ret) + continue; + + switch (addr) { + case CP2112_I2C_ADR: + device_set_node(&dev->adap.dev, child); + break; + case CP2112_GPIO_ADR: + dev->gc.fwnode =3D child; + break; + } + } + } else if (is_of_node(cp2112_fwnode)) { + child =3D fwnode_get_named_child_node(cp2112_fwnode, "i2c"); + device_set_node(&dev->adap.dev, child); + fwnode_handle_put(child); + } + ret =3D hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); --=20 2.25.1 From nobody Sun May 24 22:42:32 2026 Received: from mx0b-0046e701.pphosted.com (mx0b-0046e701.pphosted.com [67.231.157.77]) (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 C8B1B37269C; Wed, 20 May 2026 16:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.157.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779294549; cv=none; b=DM+AKTWZfZB6GypFK1L3G9wLtDued3uaAHhReCPf2dOtJpo7svC7bZj6kbL6Yj/G1lFthaqbMkHVaLdNx8hsheuvE2gnzrJfgpDs1tOwejGKTFgVPlDrQ4cQddqYetTuthPG+vd88BSQhLOJMcYD7ce30mx5BnHw88P4Y8Zjn80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779294549; c=relaxed/simple; bh=suG8dC6iFbGT01beBy+Or5AFgL4+rw6hkPp79UlPWZY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IHwEgjyTm+CaDx5aUMsD74sSA120UDmRP952S+RK16d+haGJjPCZko3dcdeUFBinXUDuPZuGRDrDCLxoT5mZGhGylEIoNzI3OBMxyB/HC/JlTLxgqkR9bm6PGHsVMHSFY3dg4OFaeAuDajqdkzb/j1/HHkcbEUHxYo7nz3JIDb4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=plexus.com; spf=pass smtp.mailfrom=plexus.com; dkim=pass (2048-bit key) header.d=plexus.com header.i=@plexus.com header.b=EblFFYuB; arc=none smtp.client-ip=67.231.157.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=plexus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=plexus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=plexus.com header.i=@plexus.com header.b="EblFFYuB" Received: from pps.filterd (m0425993.ppops.net [127.0.0.1]) by mx0b-0046e701.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64K5xJkP3281845; Wed, 20 May 2026 11:14:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pps1; bh=FDepI XZ2BcoCLxo+ojIJjscBodpAZyDdZeRvgHshr8w=; b=EblFFYuBd/FUA4YgdlDlj VCIrLA4AMBZtDhUregIuPz/kBLzjyR178/o8rlKkJaWkhoFHkfYXu6w8Rzysdhgx aYyLAlxUmeVOk6bcY6TaiK2e/I2k1EJ/3dPpmTzDopc29u9VJDhZyh46pUsa9mPC rnyd6Wtn/qegjdy30dLz6hYvqUDbF9aIxfuDnwIAUO11IaXuVqf3h22YWymqkEYZ mcLY0sXpA4Qk6/DKRoGwPDU2R6AkppJpu4F1mzBy7nzth5XqX2WU4gqygVVEX+rt jrJs0fripUWIT6UB4qBt07Fh4wJGS/ML3vqPmZ+Ecm6vhqNrFrQVlqrEivd0SshW A== Received: from intranet-smtp.plexus.com ([64.215.193.254]) by mx0b-0046e701.pphosted.com (PPS) with ESMTPS id 4e8tdctk9p-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 20 May 2026 11:14:39 -0500 (CDT) Received: from LNDCL34533.neenah.na.plexus.com (unknown [10.255.48.203]) by intranet-smtp.plexus.com (Postfix) with ESMTP id 704163956B; Wed, 20 May 2026 11:14:38 -0500 (CDT) From: Danny Kaehn Date: Wed, 20 May 2026 11:13:07 -0500 Subject: [PATCH v14 2/2] HID: cp2112: Configure I2C bus speed from firmware 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: <20260520-cp2112-dt-v14-2-b1b4b6734b6f@plexus.com> References: <20260520-cp2112-dt-v14-0-b1b4b6734b6f@plexus.com> In-Reply-To: <20260520-cp2112-dt-v14-0-b1b4b6734b6f@plexus.com> To: Benjamin Tissoires , Andy Shevchenko , Danny Kaehn , Andi Shyti , Conor Dooley Cc: Jiri Kosina , linux-input@vger.kernel.org, Dmitry Torokhov , Ethan Twardy , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Leo Huang , Arun D Patil , Willie Thai , Ting-Kai Chen , Bartosz Golaszewski X-Mailer: b4 0.14-dev-d4707 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779293611; l=1142; i=danny.kaehn@plexus.com; s=20260127; h=from:subject:message-id; bh=suG8dC6iFbGT01beBy+Or5AFgL4+rw6hkPp79UlPWZY=; b=8Mz/TY76BJOYJis6PzwclggXCF1Nc74G+qHuAII8Fb0XVm6LsE10iltu9CuyE40hkKxSADqNW 3cW+j1D3tB3Brs7cugKHubTHS/EmUuhymvXzROr4vARy4pFSilJ5E2a X-Developer-Key: i=danny.kaehn@plexus.com; a=ed25519; pk=cbcR30mXg2VNyXtpE2SxVSXEDWLYwrxgnPCjJZn6A8s= X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: N-3wVdKoT0WvDFSx_CR9qURGX7aHYcA3 X-Proofpoint-GUID: RU9o51AxCeYnUBvF5OuRmYZx-9_J8oNP X-Authority-Analysis: v=2.4 cv=f5F4wuyM c=1 sm=1 tr=0 ts=6a0dddef cx=c_pps a=356DXeqjepxy6lyVU6o3hA==:117 a=356DXeqjepxy6lyVU6o3hA==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=SL0Da4cj2IsybHzvybfz:22 a=bWp6hkYQOWa87JmFC6wa:22 a=QyXUC8HyAAAA:8 a=Y_joWELsAAAA:8 a=5Q0cJInN0W8t8_l8kPkA:9 a=QEXdDO2ut3YA:10 a=g_BQsM8wYJVSTWLOHH1t:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTIwMDE1NyBTYWx0ZWRfX5Jtpg/Mzdaht SgUJyh4SsD1KwSywY7bfIjRKq95TrOf4Rz5kUNgkyZRXGf/HhmMsnTJ+IM6tW7/9YMdGO24CEM/ 948CxBDGkQpz1tsm6i3oOLF/55LCRm75P3POsG21xaZ90efs+E95ap4ZerwJUfbVD1Ave2DF2ai j1qaaA1unGrIQ2oZNXxEh5zvhtP9uGLovJk8VBAbQVX+Ga8f95Pm4MUnniCkvRR5Q45q+rZFx8W 5ORkZsaXq+BMK4jnTMxv0T0NvnKGmCZMH752AOyDoGtQ/OKjlVeG9Ya4xZULwS39dFFavh0CSRB qqq8bz/8K30GraPRr7Cppw1b1JR1NVoRKiEN/XXJFvFM1MEB1v/AjC7E+i3WRk/MGC6zMzEfCQr z1tkYNxDUPeFce5bXamF17FqyWsUo0R4m0jNgLi9GK9SrKF6s4hymlwO3bbTqht9CZiOEJYc9g9 SqcVrDm/9OTGnj2hdhQ== X-Proofpoint-Spam-Reason: orgsafe Now that the I2C adapter on the CP2112 can have an associated firmware node, set the bus speed based on firmware configuration Reviewed-by: Andy Shevchenko Signed-off-by: Danny Kaehn --- drivers/hid/hid-cp2112.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index e960fc988058..04379db93571 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -1223,6 +1223,7 @@ static int cp2112_probe(struct hid_device *hdev, cons= t struct hid_device_id *id) struct fwnode_handle *cp2112_fwnode; struct fwnode_handle *child; struct gpio_irq_chip *girq; + struct i2c_timings timings; u32 addr; int ret; =20 @@ -1308,6 +1309,9 @@ static int cp2112_probe(struct hid_device *hdev, cons= t struct hid_device_id *id) goto err_power_normal; } =20 + i2c_parse_fw_timings(&dev->adap.dev, &timings, true); + + config.clock_speed =3D cpu_to_be32(timings.bus_freq_hz); config.retry_time =3D cpu_to_be16(1); =20 ret =3D cp2112_hid_output(hdev, (u8 *)&config, sizeof(config), --=20 2.25.1