Add V210/V240 environmental sensors that are not in the OFW tree.

Add device properties for adm1026hm on V210, V240, and V440.
This commit is contained in:
jdc 2015-12-16 08:01:19 +00:00
parent 846fbf61f2
commit a0596c5c2c

View File

@ -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 @@ noether:
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 @@ noether:
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);
}
}
}
/*