Date: Sat, 24 Dec 2022 08:36:53 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 31b00dc71727 - stable/13 - iichid(4): Implement I2CRDWR command in hid_ioctl method Message-ID: <202212240836.2BO8ar4Q083273@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=31b00dc717277671ccdeff1fe5be628490e99926 commit 31b00dc717277671ccdeff1fe5be628490e99926 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2022-03-02 23:35:23 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> 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 };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212240836.2BO8ar4Q083273>