From nobody Sat Dec 24 08:36:53 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NfHTd3v70z1HSdm; Sat, 24 Dec 2022 08:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NfHTd3LWCz3NWc; Sat, 24 Dec 2022 08:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ei8yK+h7dk7uU6mYZY6PePTZ5Ywz/9it5zWHszNJTXs=; b=L4RRdQ4kKXAp+ubj8aCx1LA+yY3UnLjIc1IGApcLW1uVrTmlMc7gVOgi9P91KMXOHt4vza XBIkjdBxiLajOsnCmxH4WGLLMkqNl2Uv8ym/orHoIREmwZH2GLUt5XOlqHNUMYVrl11TIm gHQZk2Xn2YUHmF+FlH+TT+P/LEEy87JuuBrW2wcWBq0oYaaqMp6+rtmHuUG2jT31hNcwff rgXe7+ZzgYbVGbTG+iwvE/oNf/LX39MFZLGyvwFKp40hq92KsjglnY9khpNl5/cHdebckn u3GeTZltFAbHG5olMwxKrWgAwCBd2E270Q4F6yYGFlbf/sr/xySxdhXKFZnEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671871013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ei8yK+h7dk7uU6mYZY6PePTZ5Ywz/9it5zWHszNJTXs=; b=SLW2RWS1jjcNmC2GR7NFbQmxwRCf3bEnEht+boREl1uKkrpnWTrIUU+fBmAkFmogzM0mk9 znLU+cj4+nnJEBLY/QS1taj9irWXc6IUGxXEWJsDuSct7LEvqIi4ppiMRy/S+BrTXvWXwk RFPDTChEocWQYj6+57GuQGzNcH8KhOJcI0XNi+VJaeO1bKIY45hwpex1r0JVF2tQmcUTEV Vmu5KEgq3k//aAcdOum//wLv/L4JaJH61quy5fePfm5dlswT5ZuhA/1R4yynaXn2sAwkam OITmGQMRbwtAoWUl6sTk1yyu72ZvHvm3kZPClZIF7jAduvXMQE9Quv1Dg14HZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671871013; a=rsa-sha256; cv=none; b=jpmeO5JWJgeLB6GxK9/FLEL8oQ7bh26kuw3V829MfZ0ggjiKpnXCyGuV4/aQidoJFVRalK p6IxC+Z/Tj6lJFgaxq9wPT2bvx1fKu1yasMlex+0Ioj9ykKwXYR2/R1SLCTxFW3oOdZzVZ yp4rM1ZbVe7iufw9KNRb8GJeAWxr0Wv6y2uXWg+QpaVtkffuCGDinDkUq7L429sxyElkaI 7hv6Egky5qZXvBiL68L+oE9PDVY//hQjgZGCCr49ShU8Ndu3MjY2vL0WPuIKyy/qZ7L/u2 Sy1qnZww1KhXegnxHvLOVLcNpwdQItmvKKWSCbvuXmWgVEZcMUMeIp5XZeKMww== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NfHTd2F2Yz166f; Sat, 24 Dec 2022 08:36:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BO8arLR083274; Sat, 24 Dec 2022 08:36:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BO8ar4Q083273; Sat, 24 Dec 2022 08:36:53 GMT (envelope-from git) Date: Sat, 24 Dec 2022 08:36:53 GMT Message-Id: <202212240836.2BO8ar4Q083273@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 31b00dc71727 - stable/13 - iichid(4): Implement I2CRDWR command in hid_ioctl method List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31b00dc717277671ccdeff1fe5be628490e99926 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=31b00dc717277671ccdeff1fe5be628490e99926 commit 31b00dc717277671ccdeff1fe5be628490e99926 Author: Vladimir Kondratyev AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-12-24 08:17:18 +0000 iichid(4): Implement I2CRDWR command in hid_ioctl method This command is intended to be compatible with I2CRDWR ioctl. It is required to perform arbitrary I2C transfers by device drivers which can switch between HID and native non-HID modes. (cherry picked from commit 6b1da3d223a88d544439d1be4115714f0aee75be) --- sys/dev/iicbus/iichid.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 19cda3802c69..a8b5c930be19 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -947,6 +947,24 @@ iichid_set_protocol(device_t dev, uint16_t protocol) return (ENOTSUP); } +static int +iichid_ioctl(device_t dev, unsigned long cmd, uintptr_t data) +{ + int error; + + switch (cmd) { + case I2CRDWR: + error = iic2errno(iicbus_transfer(dev, + ((struct iic_rdwr_data *)data)->msgs, + ((struct iic_rdwr_data *)data)->nmsgs)); + break; + default: + error = EINVAL; + } + + return (error); +} + static int iichid_fill_device_info(struct i2c_hid_desc *desc, ACPI_HANDLE handle, struct hid_device_info *hw) @@ -1279,6 +1297,7 @@ static device_method_t iichid_methods[] = { DEVMETHOD(hid_set_report, iichid_set_report), DEVMETHOD(hid_set_idle, iichid_set_idle), DEVMETHOD(hid_set_protocol, iichid_set_protocol), + DEVMETHOD(hid_ioctl, iichid_ioctl), DEVMETHOD_END };