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 config support.



details:   https://anonhg.NetBSD.org/src/rev/3014ec917269
branches:  trunk
changeset: 772552:3014ec917269
user:      phx <phx%NetBSD.org@localhost>
date:      Sat Jan 07 21:02:15 2012 +0000

description:
Add direct config support.

diffstat:

 sys/dev/i2c/pcf8563.c |  16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 4ef8e6a84810 -r 3014ec917269 sys/dev/i2c/pcf8563.c
--- a/sys/dev/i2c/pcf8563.c     Sat Jan 07 20:51:23 2012 +0000
+++ b/sys/dev/i2c/pcf8563.c     Sat Jan 07 21:02:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcf8563.c,v 1.2 2011/01/21 22:42:16 jakllsch Exp $     */
+/*     $NetBSD: pcf8563.c,v 1.3 2012/01/07 21:02:15 phx Exp $  */
 
 /*
  * Copyright (c) 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcf8563.c,v 1.2 2011/01/21 22:42:16 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcf8563.c,v 1.3 2012/01/07 21:02:15 phx Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -62,9 +62,15 @@
 {
        struct i2c_attach_args *ia = aux;
 
-       if (ia->ia_addr == PCF8563_ADDR)
-               return 1;
-
+       if (ia->ia_name) {
+               /* direct config - check name */
+               if (strcmp(ia->ia_name, "pcf8563rtc") == 0)
+                       return 1;
+       } else {
+               /* indirect config - check typical address */
+               if (ia->ia_addr == PCF8563_ADDR)
+                       return 1;
+       }
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index