Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Add direct configuration support.
details: https://anonhg.NetBSD.org/src/rev/24f68de3804d
branches: trunk
changeset: 356046:24f68de3804d
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Aug 29 09:55:03 2017 +0000
description:
Add direct configuration support.
diffstat:
sys/dev/i2c/axp20x.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diffs (61 lines):
diff -r dcbbae3d704d -r 24f68de3804d sys/dev/i2c/axp20x.c
--- a/sys/dev/i2c/axp20x.c Tue Aug 29 09:17:43 2017 +0000
+++ b/sys/dev/i2c/axp20x.c Tue Aug 29 09:55:03 2017 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $ */
+/* $NetBSD: axp20x.c,v 1.6 2017/08/29 09:55:03 jmcneill Exp $ */
/*-
- * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
+ * Copyright (c) 2014-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,8 +26,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "opt_fdt.h"
+
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.5 2017/05/14 11:39:17 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axp20x.c,v 1.6 2017/08/29 09:55:03 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -180,6 +182,7 @@
device_t sc_dev;
i2c_tag_t sc_i2c;
i2c_addr_t sc_addr;
+ int sc_phandle;
uint8_t sc_inputstatus;
uint8_t sc_powermode;
@@ -198,9 +201,19 @@
CFATTACH_DECL_NEW(axp20x, sizeof(struct axp20x_softc),
axp20x_match, axp20x_attach, NULL, NULL);
+static const char * compatible[] = {
+ "x-powers,axp209",
+ NULL
+};
+
static int
axp20x_match(device_t parent, cfdata_t match, void *aux)
{
+ struct i2c_attach_args * const ia = aux;
+
+ if (ia->ia_name != NULL)
+ return iic_compat_match(ia, compatible);
+
return 1;
}
@@ -216,6 +229,7 @@
sc->sc_dev = self;
sc->sc_i2c = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
+ sc->sc_phandle = ia->ia_cookie;
error = axp20x_read(sc, AXP_INPUT_STATUS,
&sc->sc_inputstatus, 1, I2C_F_POLL);
Home |
Main Index |
Thread Index |
Old Index