Now that the ACPI layer no longer does this for us, evaluate the _DSM
that returns the HID descriptor address at attach time.
This commit is contained in:
parent
84eb440b90
commit
8dc2ddfa74
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ihidev.c,v 1.16 2021/01/26 01:23:08 thorpej Exp $ */
|
||||
/* $NetBSD: ihidev.c,v 1.17 2021/01/26 02:33:54 thorpej Exp $ */
|
||||
/* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
|
||||
|
||||
/*-
|
||||
|
@ -54,7 +54,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.16 2021/01/26 01:23:08 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.17 2021/01/26 02:33:54 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -125,6 +125,8 @@ 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" },
|
||||
|
@ -153,22 +155,21 @@ ihidev_attach(device_t parent, device_t self, void *aux)
|
|||
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);
|
||||
|
||||
if (!prop_dictionary_get_uint32(ia->ia_prop, "hid-descr-addr", &v)) {
|
||||
aprint_error(": no hid-descr-addr value\n");
|
||||
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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_hid_desc_addr = v;
|
||||
|
||||
if (ihidev_hid_command(sc, I2C_HID_CMD_DESCR, NULL, false) ||
|
||||
ihidev_hid_desc_parse(sc)) {
|
||||
|
@ -968,3 +969,32 @@ ihidev_set_report(struct device *dev, int type, int id, void *data,
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue