From 6f2e4f0b919c633224767a3d1838a6161b321924 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 8 May 2007 10:36:06 +0000 Subject: [PATCH] Add user-space support for the applesmc driver. Patch contributed by Soeren Sonnenburg. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4390 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ lib/chips.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ lib/chips.h | 13 +++++++++++++ prog/sensors/chips.c | 35 +++++++++++++++++++++++++++++++++ prog/sensors/chips.h | 1 + prog/sensors/main.c | 1 + 6 files changed, 98 insertions(+) diff --git a/CHANGES b/CHANGES index 9b5ec1e9..64ea103b 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN HEAD File lm_sensors.sysconfig: Delete, now generated by sensors-detect Library: Clean up pwm symbol names translation Add dme1737 support + Add applesmc support Man page sensors.conf.5: Update the chip statement section Module i2c-nforce2: Add nForce MCP61, MCP65 support (2.6 backport) Program isadump: Detect when address bit 7 is a busy flag @@ -15,6 +16,7 @@ SVN HEAD Update URI Program sensors: Drop ddcmon and eeprom support Add dme1737 support + Add applesmc support Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/lib/chips.c b/lib/chips.c index 8d78b28d..5b08c242 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -6048,6 +6048,51 @@ static sensors_chip_feature dme1737_features[] = { { 0 }, 0 } }; +static sensors_chip_feature applesmc_features[] = + { + { { SENSORS_APPLESMC_TEMP(0), "temp1", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(1), "temp2", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(2), "temp3", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(3), "temp4", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(4), "temp5", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(5), "temp6", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(6), "temp7", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(7), "temp8", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(8), "temp9", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(9), "temp10", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(10), "temp11", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 3 }, + { { SENSORS_APPLESMC_TEMP(11), "temp12", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(1), 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(1), 0 }, + { { SENSORS_APPLESMC_FAN_MIN(1), "fan2_min", SENSORS_APPLESMC_FAN(1), + SENSORS_APPLESMC_FAN(1), R }, NOSYSCTL, VALUE(1), 0 }, + { { SENSORS_APPLESMC_FAN_MAX(0), "fan1_max", SENSORS_APPLESMC_FAN(0), + SENSORS_APPLESMC_FAN(0), R }, NOSYSCTL, VALUE(1), 0 }, + { { SENSORS_APPLESMC_FAN_MAX(1), "fan2_max", SENSORS_APPLESMC_FAN(1), + SENSORS_APPLESMC_FAN(1), R }, NOSYSCTL, VALUE(1), 0 }, + { { SENSORS_APPLESMC_FAN_SAFE(0), "fan1_safe", SENSORS_APPLESMC_FAN(0), + SENSORS_APPLESMC_FAN(0), R }, NOSYSCTL, VALUE(1), 0 }, + { { SENSORS_APPLESMC_FAN_SAFE(1), "fan2_safe", SENSORS_APPLESMC_FAN(1), + SENSORS_APPLESMC_FAN(1), R }, NOSYSCTL, VALUE(1), 0 }, + { { 0 }, 0 } + }; + sensors_chip_features sensors_chip_features_list[] = { { SENSORS_LM78_PREFIX, lm78_features }, @@ -6161,5 +6206,6 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_K8TEMP_PREFIX, k8temp_features }, { SENSORS_CORETEMP_PREFIX, coretemp_features }, { SENSORS_DME1737_PREFIX, dme1737_features }, + { SENSORS_APPLESMC_PREFIX, applesmc_features }, { 0 } }; diff --git a/lib/chips.h b/lib/chips.h index e2d5cff1..367cce60 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -2292,4 +2292,17 @@ #define SENSORS_DME1737_VID (0xf0) /* R */ #define SENSORS_DME1737_VRM (0xf1) /* RW */ +/* 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 --git a/prog/sensors/chips.c b/prog/sensors/chips.c index bf0d3349..2e0f9121 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -6041,6 +6041,41 @@ void print_dme1737(const sensors_chip_name *name) print_vid_info(name, SENSORS_DME1737_VID, SENSORS_DME1737_VRM); } +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 --git a/prog/sensors/chips.h b/prog/sensors/chips.h index d2cac286..2472d4bc 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -77,5 +77,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_dme1737(const sensors_chip_name *name); +extern void print_applesmc(const sensors_chip_name *name); #endif /* def PROG_SENSORS_CHIPS_H */ diff --git a/prog/sensors/main.c b/prog/sensors/main.c index e2fa91b9..1944b752 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -422,6 +422,7 @@ struct match matches[] = { { "k8temp", print_k8temp }, { "coretemp", print_coretemp }, { "dme1737", print_dme1737 }, + { "applesmc", print_applesmc }, { NULL, NULL } };