Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64/sparc64 Add V210/V240 environmental sensors...



details:   https://anonhg.NetBSD.org/src/rev/9cfb4a26eabd
branches:  trunk
changeset: 342311:9cfb4a26eabd
user:      jdc <jdc%NetBSD.org@localhost>
date:      Wed Dec 16 08:01:19 2015 +0000

description:
Add V210/V240 environmental sensors that are not in the OFW tree.
Add device properties for adm1026hm on V210, V240, and V440.

diffstat:

 sys/arch/sparc64/sparc64/autoconf.c |  77 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 75 insertions(+), 2 deletions(-)

diffs (105 lines):

diff -r 2bc6d38497e4 -r 9cfb4a26eabd sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Wed Dec 16 08:00:00 2015 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Wed Dec 16 08:01:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.206 2015/12/13 11:51:37 jmcneill Exp $ */
+/*     $NetBSD: autoconf.c,v 1.207 2015/12/16 08:01:19 jdc Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.206 2015/12/13 11:51:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.207 2015/12/16 08:01:19 jdc Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1142,6 +1142,58 @@
                        prop_object_release(cfg);
                        
                }
+
+               /*
+                * Add V210/V240 environmental sensors that are not in
+                * the OFW tree.
+                */
+               if (device_is_a(busdev, "pcfiic") &&
+                   (!strcmp(machine_model, "SUNW,Sun-Fire-V240") ||
+                   !strcmp(machine_model, "SUNW,Sun-Fire-V210"))) {
+                       prop_dictionary_t props = device_properties(busdev);
+                       prop_array_t cfg = NULL;
+                       prop_dictionary_t sens;
+                       prop_data_t data;
+                       const char name_lm[] = "i2c-lm75";
+                       const char name_adm[] = "i2c-adm1026";
+
+                       DPRINTF(ACDB_PROBE, ("\nAdding sensors for %s ",
+                           machine_model));
+                       cfg = prop_dictionary_get(props, "i2c-child-devices");
+                       if (!cfg) {
+                               cfg = prop_array_create();
+                               prop_dictionary_set(props, "i2c-child-devices",
+                                   cfg);
+                               prop_dictionary_set_bool(props,
+                                   "i2c-indirect-config", false);
+                       }
+
+                       /* ADM1026 at 0x2e */
+                       sens = prop_dictionary_create();
+                       prop_dictionary_set_uint32(sens, "addr", 0x2e);
+                       prop_dictionary_set_uint64(sens, "cookie", 0);
+                       prop_dictionary_set_cstring(sens, "name",
+                           "hardware-monitor");
+                       data = prop_data_create_data(&name_adm[0],
+                           sizeof(name_adm));
+                       prop_dictionary_set(sens, "compatible", data);
+                       prop_object_release(data);
+                       prop_array_add(cfg, sens);
+                       prop_object_release(sens);
+
+                       /* LM75 at 0x4e */
+                       sens = prop_dictionary_create();
+                       prop_dictionary_set_uint32(sens, "addr", 0x4e);
+                       prop_dictionary_set_uint64(sens, "cookie", 0);
+                       prop_dictionary_set_cstring(sens, "name",
+                           "temperature-sensor");
+                       data = prop_data_create_data(&name_lm[0],
+                           sizeof(name_lm));
+                       prop_dictionary_set(sens, "compatible", data);
+                       prop_object_release(data);
+                       prop_array_add(cfg, sens);
+                       prop_object_release(sens);
+               }
        }
 
        /* set properties for PCI framebuffers */
@@ -1205,6 +1257,27 @@
                                instance = OF_open(name);
 #endif
        }
+
+       /* Hardware specific device properties */
+       if ((!strcmp(machine_model, "SUNW,Sun-Fire-V240") ||
+           !strcmp(machine_model, "SUNW,Sun-Fire-V210"))) {
+               device_t busparent = device_parent(busdev);
+               prop_dictionary_t props = device_properties(dev);
+
+               if (busparent != NULL && device_is_a(busparent, "pcfiic") &&
+                   device_is_a(dev, "adm1026hm") && props != NULL) {
+                       prop_dictionary_set_uint8(props, "fan_div2", 0x55);
+                       prop_dictionary_set_bool(props, "multi_read", true);
+               }
+       }
+       if (!strcmp(machine_model, "SUNW,Sun-Fire-V440")) {
+               device_t busparent = device_parent(busdev);
+               prop_dictionary_t props = device_properties(dev);
+               if (busparent != NULL && device_is_a(busparent, "pcfiic") &&
+                   device_is_a(dev, "adm1026hm") && props != NULL) {
+                       prop_dictionary_set_bool(props, "multi_read", true);
+               }
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index