Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/dev/i2c/ihidev.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/dev/i2c/ihidev.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.12.6.1 retrieving revision 1.13 diff -u -p -r1.12.6.1 -r1.13 --- src/sys/dev/i2c/ihidev.c 2021/04/03 22:28:44 1.12.6.1 +++ src/sys/dev/i2c/ihidev.c 2021/01/17 21:47:50 1.13 @@ -1,4 +1,4 @@ -/* $NetBSD: ihidev.c,v 1.12.6.1 2021/04/03 22:28:44 thorpej Exp $ */ +/* $NetBSD: ihidev.c,v 1.13 2021/01/17 21:47:50 thorpej Exp $ */ /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */ /*- @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.12.6.1 2021/04/03 22:28:44 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.13 2021/01/17 21:47:50 thorpej Exp $"); #include #include @@ -125,13 +125,10 @@ static int ihidev_maxrepid(void *, int); static int ihidev_print(void *, const char *); static int ihidev_submatch(device_t, cfdata_t, const int *, void *); -static bool ihidev_acpi_get_info(struct ihidev_softc *); - static const struct device_compatible_entry compat_data[] = { - { .compat = "PNP0C50" }, - { .compat = "ACPI0C50" }, { .compat = "hid-over-i2c" }, - DEVICE_COMPAT_EOL + + { 0 } }; static int @@ -155,22 +152,23 @@ ihidev_attach(device_t parent, device_t device_t dev; int repid, repsz; int isize; + uint32_t v; int locs[IHIDBUSCF_NLOCS]; + sc->sc_dev = self; sc->sc_tag = ia->ia_tag; sc->sc_addr = ia->ia_addr; + sc->sc_phandle = ia->ia_cookie; mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_VM); - sc->sc_phandle = ia->ia_cookie; - if (ia->ia_cookietype != I2C_COOKIE_ACPI) { - aprint_error(": unsupported device tree type\n"); - return; - } - if (! ihidev_acpi_get_info(sc)) { + if (!prop_dictionary_get_uint32(ia->ia_prop, "hid-descr-addr", &v)) { + aprint_error(": no hid-descr-addr value\n"); return; } + sc->sc_hid_desc_addr = v; + if (ihidev_hid_command(sc, I2C_HID_CMD_DESCR, NULL, false) || ihidev_hid_desc_parse(sc)) { aprint_error(": failed fetching initial HID descriptor\n"); @@ -969,32 +967,3 @@ ihidev_set_report(struct device *dev, in return 0; } - -static bool -ihidev_acpi_get_info(struct ihidev_softc *sc) -{ - ACPI_HANDLE hdl = (void *)(uintptr_t)sc->sc_phandle; - ACPI_STATUS status; - ACPI_INTEGER val; - - /* 3cdff6f7-4267-4555-ad05-b30a3d8938de */ - uint8_t i2c_hid_guid[] = { - 0xF7, 0xF6, 0xDF, 0x3C, - 0x67, 0x42, - 0x55, 0x45, - 0xAD, 0x05, - 0xB3, 0x0A, 0x3D, 0x89, 0x38, 0xDE, - }; - - status = acpi_dsm_integer(hdl, i2c_hid_guid, 1, 1, NULL, &val); - if (ACPI_FAILURE(status)) { - aprint_error_dev(sc->sc_dev, - "failed to get HidDescriptorAddress: %s\n", - AcpiFormatException(status)); - return false; - } - - sc->sc_hid_desc_addr = (u_int)val; - - return true; -}