Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/i2c For direct-config devices, pass the whole dictio...



details:   https://anonhg.NetBSD.org/src/rev/6d9b6eb65b24
branches:  trunk
changeset: 828380:6d9b6eb65b24
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Dec 10 16:53:32 2017 +0000

description:
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.

diffstat:

 sys/dev/i2c/i2c.c    |  6 ++++--
 sys/dev/i2c/i2cvar.h |  5 ++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (60 lines):

diff -r 5e5e5bc97bd6 -r 6d9b6eb65b24 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Sun Dec 10 16:51:30 2017 +0000
+++ b/sys/dev/i2c/i2c.c Sun Dec 10 16:53:32 2017 +0000
@@ -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 @@
        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 @@
                        ia.ia_name = name;
                        ia.ia_cookie = cookie;
                        ia.ia_size = size;
+                       ia.ia_prop = dev;
 
                        buf = NULL;
                        cdata = prop_dictionary_get(dev, "compatible");
diff -r 5e5e5bc97bd6 -r 6d9b6eb65b24 sys/dev/i2c/i2cvar.h
--- a/sys/dev/i2c/i2cvar.h      Sun Dec 10 16:51:30 2017 +0000
+++ b/sys/dev/i2c/i2cvar.h      Sun Dec 10 16:53:32 2017 +0000
@@ -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 @@
        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 @@
         * 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 */
 };



Home | Main Index | Thread Index | Old Index