* [lm-sensors] [PATCH] add support for applesmc sensors
@ 2007-05-07 15:56 Soeren Sonnenburg
2007-05-08 10:36 ` Jean Delvare
0 siblings, 1 reply; 2+ messages in thread
From: Soeren Sonnenburg @ 2007-05-07 15:56 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1.1.1: Type: text/plain, Size: 379 bytes --]
Dear list,
this adds support for the sensors found on macbook/pro's etc. It
requires applesmc to be loaded and on my mbp c1d I get an amazing 14 (!)
sensors (12 temperature, 2 fans in addition to the 2 coretemps).
Please apply!
Soeren
--
For the one fact about the future of which we can be certain is that it
will be utterly fantastic. -- Arthur C. Clarke, 1962
[-- Attachment #1.1.2: sensors-applesmc.patch --]
[-- Type: text/x-patch, Size: 6613 bytes --]
diff -ur lm-sensors-2.10.3/lib/chips.c /home/sonne/lm-sensors-2.10.3/lib/chips.c
--- lm-sensors-2.10.3/lib/chips.c 2007-03-20 00:44:02.000000000 +0100
+++ /home/sonne/lm-sensors-2.10.3/lib/chips.c 2007-05-07 17:31:24.000000000 +0200
@@ -5965,6 +5965,51 @@
{ { 0 }, 0 }
};
+static sensors_chip_feature applesmc_features[] =
+ {
+ { { SENSORS_APPLESMC_TEMP(0), "temp1", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(1), "temp2", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(2), "temp3", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(3), "temp4", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(4), "temp5", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(5), "temp6", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(6), "temp7", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(7), "temp8", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(8), "temp9", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(9), "temp10", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(10), "temp11", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_TEMP(11), "temp12", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 3 },
+ { { SENSORS_APPLESMC_FAN(0), "fan1", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN(1), "fan2", NOMAP, NOMAP, R },
+ NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_MIN(0), "fan1_min", SENSORS_APPLESMC_FAN(0),
+ SENSORS_APPLESMC_FAN(0), R}, NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_MIN(1), "fan2_min", SENSORS_APPLESMC_FAN(1),
+ SENSORS_APPLESMC_FAN(1), R}, NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_MAX(0), "fan1_max", SENSORS_APPLESMC_FAN(0),
+ SENSORS_APPLESMC_FAN(0), R}, NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_MAX(1), "fan2_max", SENSORS_APPLESMC_FAN(1),
+ SENSORS_APPLESMC_FAN(1), R}, NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_SAFE(0), "fan1_safe", SENSORS_APPLESMC_FAN(0),
+ SENSORS_APPLESMC_FAN(0), R}, NOSYSCTL, VALUE(2), 0 },
+ { { SENSORS_APPLESMC_FAN_SAFE(1), "fan2_safe", SENSORS_APPLESMC_FAN(1),
+ SENSORS_APPLESMC_FAN(1), R}, NOSYSCTL, VALUE(2), 0 },
+ { { 0 }, 0 }
+ };
+
sensors_chip_features sensors_chip_features_list[] =
{
{ SENSORS_LM78_PREFIX, lm78_features },
@@ -6077,5 +6122,6 @@
{ SENSORS_ABITUGURU_PREFIX, abituguru_features },
{ SENSORS_K8TEMP_PREFIX, k8temp_features },
{ SENSORS_CORETEMP_PREFIX, coretemp_features },
+ { SENSORS_APPLESMC_PREFIX, applesmc_features },
{ 0 }
};
diff -ur lm-sensors-2.10.3/lib/chips.h /home/sonne/lm-sensors-2.10.3/lib/chips.h
--- lm-sensors-2.10.3/lib/chips.h 2007-03-20 00:44:03.000000000 +0100
+++ /home/sonne/lm-sensors-2.10.3/lib/chips.h 2007-05-07 17:42:22.000000000 +0200
@@ -2262,4 +2262,16 @@
#define SENSORS_CORETEMP_TEMP1_CRIT 0x02 /* R */
#define SENSORS_CORETEMP_TEMP1_CRIT_ALARM 0x03 /* R */
+/* applesmc */
+#define SENSORS_APPLESMC_PREFIX "applesmc"
+
+/* temp n from 0 to 11 */
+#define SENSORS_APPLESMC_TEMP(n) ( 0x01 + (n)) /* R */
+
+/* fan n from 0 to 1 */
+#define SENSORS_APPLESMC_FAN(n) ( 0x21 + (n)) /* R */
+#define SENSORS_APPLESMC_FAN_MIN(n) ( 0x41 + (n)) /* R */
+#define SENSORS_APPLESMC_FAN_MAX(n) ( 0x61 + (n)) /* R */
+#define SENSORS_APPLESMC_FAN_SAFE(n) ( 0x81 + (n)) /* R */
+
#endif /* def LIB_SENSORS_CHIPS_H */
diff -ur lm-sensors-2.10.3/prog/sensors/chips.c /home/sonne/lm-sensors-2.10.3/prog/sensors/chips.c
--- lm-sensors-2.10.3/prog/sensors/chips.c 2007-03-20 00:44:01.000000000 +0100
+++ /home/sonne/lm-sensors-2.10.3/prog/sensors/chips.c 2007-05-07 17:40:21.000000000 +0200
@@ -6337,6 +6337,41 @@
free(label);
}
+void print_applesmc(const sensors_chip_name *name)
+{
+ char *label;
+ double cur, min, max, safe;
+ int valid;
+ int i;
+
+ for (i=0; i<12; i++) {
+ if (!sensors_get_label_and_valid(*name, SENSORS_APPLESMC_TEMP(i), &label, &valid)
+ && !sensors_get_feature(*name, SENSORS_APPLESMC_TEMP(i), &cur)) {
+ if (valid) {
+ print_label(label, 10);
+ print_temp_info(cur, 0, 0, SINGLE, 0, 0);
+ printf("\n");
+ }
+ }
+ free(label);
+ }
+
+ for (i=0; i<2; i++) {
+ if (!sensors_get_label_and_valid(*name, SENSORS_APPLESMC_FAN(i), &label, &valid)
+ && !sensors_get_feature(*name, SENSORS_APPLESMC_FAN(i), &cur)
+ && !sensors_get_feature(*name, SENSORS_APPLESMC_FAN_MIN(i), &min)
+ && !sensors_get_feature(*name, SENSORS_APPLESMC_FAN_MAX(i), &max)
+ && !sensors_get_feature(*name, SENSORS_APPLESMC_FAN_SAFE(i), &safe)){
+ if (valid) {
+ print_label(label, 10);
+ printf("%4.0f RPM (safe = %4.0f RPM, min = %4.0f RPM, max = %4.0f RPM)\n", cur,
+ safe, min, max);
+ }
+ }
+ free(label);
+ }
+}
+
void print_unknown_chip(const sensors_chip_name *name)
{
int a,b,valid;
diff -ur lm-sensors-2.10.3/prog/sensors/chips.h /home/sonne/lm-sensors-2.10.3/prog/sensors/chips.h
--- lm-sensors-2.10.3/prog/sensors/chips.h 2007-03-20 00:44:02.000000000 +0100
+++ /home/sonne/lm-sensors-2.10.3/prog/sensors/chips.h 2007-05-07 17:05:46.000000000 +0200
@@ -78,5 +78,6 @@
extern void print_abituguru(const sensors_chip_name *name);
extern void print_k8temp(const sensors_chip_name *name);
extern void print_coretemp(const sensors_chip_name *name);
+extern void print_applesmc(const sensors_chip_name *name);
#endif /* def PROG_SENSORS_CHIPS_H */
diff -ur lm-sensors-2.10.3/prog/sensors/main.c /home/sonne/lm-sensors-2.10.3/prog/sensors/main.c
--- lm-sensors-2.10.3/prog/sensors/main.c 2007-03-20 00:44:01.000000000 +0100
+++ /home/sonne/lm-sensors-2.10.3/prog/sensors/main.c 2007-05-07 17:05:46.000000000 +0200
@@ -423,6 +423,7 @@
{ "abituguru", print_abituguru },
{ "k8temp", print_k8temp },
{ "coretemp", print_coretemp },
+ { "applesmc", print_applesmc },
{ NULL, NULL }
};
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-05-08 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-07 15:56 [lm-sensors] [PATCH] add support for applesmc sensors Soeren Sonnenburg
2007-05-08 10:36 ` Jean Delvare
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.