Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c use direct config



details:   https://anonhg.NetBSD.org/src/rev/ef0e3b6d0a4c
branches:  trunk
changeset: 356386:ef0e3b6d0a4c
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Sep 22 04:07:34 2017 +0000

description:
use direct config

diffstat:

 sys/dev/i2c/sgsmix.c |  24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r b071a8e79596 -r ef0e3b6d0a4c sys/dev/i2c/sgsmix.c
--- a/sys/dev/i2c/sgsmix.c      Fri Sep 22 04:01:41 2017 +0000
+++ b/sys/dev/i2c/sgsmix.c      Fri Sep 22 04:07:34 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sgsmix.c,v 1.7 2010/11/13 13:51:59 uebayasi Exp $      */
+/*     $NetBSD: sgsmix.c,v 1.8 2017/09/22 04:07:34 macallan Exp $      */
 
 /*-
  * Copyright (C) 2005 Michael Lorenz.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.7 2010/11/13 13:51:59 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sgsmix.c,v 1.8 2017/09/22 04:07:34 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -82,14 +82,20 @@
        int ret = -1;
        uint8_t out[2] = {1, 0x20};
 
-       /* see if we can talk to something at address 0x8a */
-       if (args->ia_addr == 0x8a) {
-               iic_acquire_bus(args->ia_tag, 0);
-               ret = iic_exec(args->ia_tag, I2C_OP_WRITE, args->ia_addr,
-                   out, 2, NULL, 0, 0);
-               iic_release_bus(args->ia_tag, 0);
+       if (args->ia_name) {
+               if (strcmp(args->ia_name, "sgsmix") == 0)
+                       return 1;
+       } else {
+               /* see if we can talk to something at address 0x8a */
+               if (args->ia_addr == 0x8a) {
+                       iic_acquire_bus(args->ia_tag, 0);
+                       ret = iic_exec(args->ia_tag, I2C_OP_WRITE, args->ia_addr,
+                           out, 2, NULL, 0, 0);
+                       iic_release_bus(args->ia_tag, 0);
+               }
+               return (ret >= 0);
        }
-       return (ret >= 0);
+       return 0;
 }
 
 static void



Home | Main Index | Thread Index | Old Index