Module Name: src
Committed By: bouyer
Date: Sun Dec 10 16:53:32 UTC 2017
Modified Files:
src/sys/dev/i2c: i2c.c i2cvar.h
Log Message:
For direct-config devices, pass the whole dictionary to the child as
ia_prop, so that chil drivers can look up device-specific properties.
Needed for the upcoming HID over I2C support, proposed on tech-kern@
on Dec, 1.
To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/i2c/i2c.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/i2cvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.56 src/sys/dev/i2c/i2c.c:1.57
--- src/sys/dev/i2c/i2c.c:1.56 Sat Oct 28 04:53:55 2017
+++ src/sys/dev/i2c/i2c.c Sun Dec 10 16:53:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $ */
+/* $NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.56 2017/10/28 04:53:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.57 2017/12/10 16:53:32 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -140,6 +140,7 @@ iic_search(device_t parent, cfdata_t cf,
ia.ia_name = NULL;
ia.ia_ncompat = 0;
ia.ia_compat = NULL;
+ ia.ia_prop = NULL;
for (ia.ia_addr = 0; ia.ia_addr <= I2C_MAX_ADDR; ia.ia_addr++) {
if (sc->sc_devices[ia.ia_addr] != NULL)
@@ -262,6 +263,7 @@ iic_attach(device_t parent, device_t sel
ia.ia_name = name;
ia.ia_cookie = cookie;
ia.ia_size = size;
+ ia.ia_prop = dev;
buf = NULL;
cdata = prop_dictionary_get(dev, "compatible");
Index: src/sys/dev/i2c/i2cvar.h
diff -u src/sys/dev/i2c/i2cvar.h:1.9 src/sys/dev/i2c/i2cvar.h:1.10
--- src/sys/dev/i2c/i2cvar.h:1.9 Sun Dec 13 17:14:56 2015
+++ src/sys/dev/i2c/i2cvar.h Sun Dec 10 16:53:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i2cvar.h,v 1.9 2015/12/13 17:14:56 jmcneill Exp $ */
+/* $NetBSD: i2cvar.h,v 1.10 2017/12/10 16:53:32 bouyer Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -125,6 +125,7 @@ struct i2c_attach_args {
int ia_ncompat; /* number of pointers in the
ia_compat array */
const char ** ia_compat; /* chip names */
+ prop_dictionary_t ia_prop; /* dictionnary for this device */
/*
* The following is of limited usefulness and should only be used
* in rare cases where we really know what we are doing. Example:
@@ -134,6 +135,8 @@ struct i2c_attach_args {
* may be present. Example: on OpenFirmware machines the device
* tree OF node - if available. This info is hard to transport
* down to MD drivers through the MI i2c bus otherwise.
+ *
+ * On ACPI platforms this is the ACPI_HANDLE of the device.
*/
uintptr_t ia_cookie; /* OF node in openfirmware machines */
};