Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c allow child devices to be passed in attach args ...
details: https://anonhg.NetBSD.org/src/rev/3d814591cc9f
branches: trunk
changeset: 342234:3d814591cc9f
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Dec 13 17:14:56 2015 +0000
description:
allow child devices to be passed in attach args instead of device dictionary
diffstat:
sys/dev/i2c/i2c.c | 20 +++++++++++++-------
sys/dev/i2c/i2cvar.h | 4 +++-
2 files changed, 16 insertions(+), 8 deletions(-)
diffs (66 lines):
diff -r de2c6d821fb3 -r 3d814591cc9f sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Sun Dec 13 17:07:13 2015 +0000
+++ b/sys/dev/i2c/i2c.c Sun Dec 13 17:14:56 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.50 2015/12/10 05:33:28 pgoyette Exp $ */
+/* $NetBSD: i2c.c,v 1.51 2015/12/13 17:14:56 jmcneill Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.50 2015/12/10 05:33:28 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.51 2015/12/13 17:14:56 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -217,11 +217,17 @@
if (!pmf_device_register(self, NULL, NULL))
aprint_error_dev(self, "couldn't establish power handler\n");
- props = device_properties(parent);
- if (!prop_dictionary_get_bool(props, "i2c-indirect-config",
- &indirect_config))
- indirect_config = true;
- child_devices = prop_dictionary_get(props, "i2c-child-devices");
+ if (iba->iba_child_devices) {
+ child_devices = iba->iba_child_devices;
+ indirect_config = false;
+ } else {
+ props = device_properties(parent);
+ if (!prop_dictionary_get_bool(props, "i2c-indirect-config",
+ &indirect_config))
+ indirect_config = true;
+ child_devices = prop_dictionary_get(props, "i2c-child-devices");
+ }
+
if (child_devices) {
unsigned int i, count;
prop_dictionary_t dev;
diff -r de2c6d821fb3 -r 3d814591cc9f sys/dev/i2c/i2cvar.h
--- a/sys/dev/i2c/i2cvar.h Sun Dec 13 17:07:13 2015 +0000
+++ b/sys/dev/i2c/i2cvar.h Sun Dec 13 17:14:56 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i2cvar.h,v 1.8 2010/02/28 15:33:21 snj Exp $ */
+/* $NetBSD: i2cvar.h,v 1.9 2015/12/13 17:14:56 jmcneill Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -39,6 +39,7 @@
#define _DEV_I2C_I2CVAR_H_
#include <dev/i2c/i2c_io.h>
+#include <prop/proplib.h>
/* Flags passed to i2c routines. */
#define I2C_F_WRITE 0x00 /* new transfer is a write */
@@ -110,6 +111,7 @@
struct i2cbus_attach_args {
i2c_tag_t iba_tag; /* the controller */
int iba_type; /* bus type */
+ prop_array_t iba_child_devices; /* child devices (direct config) */
};
/* Used to attach devices on the i2c bus. */
Home |
Main Index |
Thread Index |
Old Index