Module Name:    src
Committed By:   macallan
Date:           Fri Sep 22 03:10:46 UTC 2017

Modified Files:
        src/sys/arch/macppc/dev: deq.c

Log Message:
attach to iic, use direct config


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/macppc/dev/deq.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/macppc/dev/deq.c
diff -u src/sys/arch/macppc/dev/deq.c:1.9 src/sys/arch/macppc/dev/deq.c:1.10
--- src/sys/arch/macppc/dev/deq.c:1.9	Fri Sep 15 21:31:25 2017
+++ src/sys/arch/macppc/dev/deq.c	Fri Sep 22 03:10:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.9 2017/09/15 21:31:25 macallan Exp $	*/
+/*	$NetBSD: deq.c,v 1.10 2017/09/22 03:10:46 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.9 2017/09/15 21:31:25 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.10 2017/09/22 03:10:46 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,7 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.9 
 #include <dev/i2c/i2cvar.h>
 
 #include <machine/autoconf.h>
-#include <macppc/dev/ki2cvar.h>
 #include <macppc/dev/deqvar.h>
 
 static void deq_attach(device_t, device_t, void *);
@@ -53,19 +52,27 @@ static int deq_match(device_t, struct cf
 CFATTACH_DECL_NEW(deq, sizeof(struct deq_softc),
     deq_match, deq_attach, NULL, NULL);
 
+static const char * deq_compats[] = {
+	"deq",
+	"tas3004",
+	"pcm3052",
+	"cs8416",
+	"codec",
+	NULL
+};
+
 int
 deq_match(device_t parent, struct cfdata *cf, void *aux)
 {
-	struct ki2c_confargs *ka = aux;
-	char buf[32];
+	struct i2c_attach_args *ia = aux;
 	
-	if (strcmp(ka->ka_name, "deq") == 0) {
-		if (OF_getprop(ka->ka_node, "i2c-address", buf, sizeof(buf)))
-			return 1;
-	} else if (strcmp(ka->ka_name, "codec") == 0) {
-		if (OF_getprop(ka->ka_node, "compatible", buf, sizeof(buf)))
-			if (strcmp(buf, "tas3004") == 0)
+	if (ia->ia_name) {
+		if (ia->ia_ncompat > 0) {
+			if (iic_compat_match(ia, deq_compats))
 				return 1;
+		}
+		if (strcmp(ia->ia_name, "deq") == 0)
+			return 1;
 	}
 	return 0;
 }
@@ -74,14 +81,12 @@ void
 deq_attach(device_t parent, device_t self, void *aux)
 {
 	struct deq_softc *sc = device_private(self);
-	struct ki2c_confargs *ka = aux;
-	int node;
+	struct i2c_attach_args *ia = aux;
 
 	sc->sc_dev = self;
-	node = ka->ka_node;
-	sc->sc_node = node;
+	sc->sc_node = ia->ia_cookie;
 	sc->sc_parent = parent;
-	sc->sc_address = (ka->ka_addr & 0x7f);
-	sc->sc_i2c = ka->ka_tag;
-	aprint_normal(" Apple Digital Equalizer, addr 0x%x\n", sc->sc_address);
+	sc->sc_address = (ia->ia_addr & 0x7f);
+	sc->sc_i2c = ia->ia_tag;
+	aprint_normal(" Apple Digital Equalizer\n");
 }

Reply via email to