From nobody Wed Mar 02 23:36:40 2022 X-Original-To: dev-commits-src-all@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 88A7319F84A8; Wed, 2 Mar 2022 23:36:41 +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 4K89Vx1gWsz3wHV; Wed, 2 Mar 2022 23:36:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646264201; 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=tf/zbVtxDkbayqb0rZQ+oS54KjR0bE7Uooz/TZeh13w=; b=Oo634+IjoT0TY5zbEe9yfGPwf68mR+b6+KZei9lrQIymyZ7O2jHsu31t7rlx6L/40Dzs7M ftwVW9AqXI+P6x/3x5w6PJXGBAiAjaGGx7ZqsHw28W36A4lDdqQzM7zzUKOq/P/wYg/ITl DNrLEZ0lvRZAxfTOcsVeTpBIqrhdK0oACO8JQFZr7NaFKLYuzMxUPzjmO4ffKWzQoj1wz7 n/Ru+IiOr2sLvA22k+3FbHccD00InhpEXoFaRBsfY29N8du/IMpPGravgxJgEZZg6hETjW 3jy/3SV9Ty3cHK0CgOFRhkGeW5+6kADmpAqL7s2k0zr7fVTTAgLyOVWUK3urEA== 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 F3E95520C; Wed, 2 Mar 2022 23:36:40 +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 222Nae2D001626; Wed, 2 Mar 2022 23:36:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 222NaeCt001625; Wed, 2 Mar 2022 23:36:40 GMT (envelope-from git) Date: Wed, 2 Mar 2022 23:36:40 GMT Message-Id: <202203022336.222NaeCt001625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 6b1da3d223a8 - main - iichid(4): Implement I2CRDWR command in hid_ioctl method List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 6b1da3d223a88d544439d1be4115714f0aee75be Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646264201; 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=tf/zbVtxDkbayqb0rZQ+oS54KjR0bE7Uooz/TZeh13w=; b=DLmToue1metf5EKMdFHXIkWiCbSyYTOYXfCjAeoV3X5pZQ1fYkioVFowwRS1Yxw57wW+nf 5UAMzdxRiZbDHQxN3/fZZCwkoyf4zuBowICqNPzpXdtnEy7TfOzBFZ5p1rjmxIsIRzgpLJ eAmHNCrKf4+2tQAF2hROqT9mKmH4jFQepqt+k0II5kBDHpVswAja4pyv842ZQPasaRFcDM u8olorWBD+UWlOw9wHd2RWNEUcFmTQGoFneMw5+K8dvbYqDzYtTNOyLNmXGe501gatq/e9 t9MVRcTuwYJGZfR6hwdvQ2XDAUuGlz9C2igNFU+TmjpigrGm5DyeXMM2ZM6Spg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646264201; a=rsa-sha256; cv=none; b=IWqebVxkZhGsXqsxoCVGbkUfrMEqwcn8BiLJ1Ff8kfSng3YrAsPWElWia5rqeqXS+G2W3x BsbL/6JCGu96ezkWSoU3auIqkJzJoRDj+DLvx/y4OZosXvBC1jgSFM8lnYi8+zkCADK09K iLNZZoDjD3BABJYvrt1b0CSZ3rij/GCqTpW98YFQLB1i1+Xoiyjrd5VBl6h1QuwwAA/3aW knr0Km8eX2/hz0SEoyytVWV48Zz36qfk2kVntbKO4iVHKw0OdbtrtwcY5IRpA85ODvkolq gHHUJjNUVfQBmUHtD2Xyv0w8aL1uV57O/+01PQu2qt29VSEcw6T8C083zS1Tdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=6b1da3d223a88d544439d1be4115714f0aee75be commit 6b1da3d223a88d544439d1be4115714f0aee75be Author: Vladimir Kondratyev AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev CommitDate: 2022-03-02 23:35:23 +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. MFC after: 2 month --- 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 a36ed9bb8538..271a71ccc50e 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 };