summaryrefslogtreecommitdiffstats
path: root/sys/dev/asmc
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/asmc')
-rw-r--r--sys/dev/asmc/asmc.c56
-rw-r--r--sys/dev/asmc/asmcvar.h35
2 files changed, 85 insertions, 6 deletions
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 9c8c89a..f69f77d 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
static int asmc_probe(device_t dev);
static int asmc_attach(device_t dev);
static int asmc_detach(device_t dev);
+static int asmc_resume(device_t dev);
/*
* SMC functions.
@@ -137,10 +138,18 @@ static struct asmc_model *asmc_match(device_t dev);
#define ASMC_SMS_FUNCS asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
asmc_mb_sysctl_sms_z
+#define ASMC_SMS_FUNCS_DISABLED NULL,NULL,NULL
+
#define ASMC_FAN_FUNCS asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
asmc_mb_sysctl_fanminspeed, \
asmc_mb_sysctl_fanmaxspeed, \
asmc_mb_sysctl_fantargetspeed
+
+#define ASMC_FAN_FUNCS2 asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, NULL, \
+ asmc_mb_sysctl_fanminspeed, \
+ asmc_mb_sysctl_fanmaxspeed, \
+ asmc_mb_sysctl_fantargetspeed
+
#define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \
asmc_mbp_sysctl_light_right, \
asmc_mbp_sysctl_light_control
@@ -158,6 +167,12 @@ struct asmc_model asmc_models[] = {
ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
},
+ {
+ "MacBook3,1", "Apple SMC MacBook Core 2 Duo",
+ ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
+ ASMC_MB31_TEMPS, ASMC_MB31_TEMPNAMES, ASMC_MB31_TEMPDESCS
+ },
+
{
"MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)",
ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
@@ -260,12 +275,30 @@ struct asmc_model asmc_models[] = {
ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS
},
+ {
+ "MacBookAir5,1", "Apple SMC MacBook Air 11-inch (Mid 2012)",
+ ASMC_SMS_FUNCS_DISABLED,
+ ASMC_FAN_FUNCS2,
+ ASMC_LIGHT_FUNCS,
+ ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
+ },
+
+ {
+ "MacBookAir5,2", "Apple SMC MacBook Air 13-inch (Mid 2012)",
+ ASMC_SMS_FUNCS_DISABLED,
+ ASMC_FAN_FUNCS2,
+ ASMC_LIGHT_FUNCS,
+ ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
+ },
+
{ NULL, NULL }
};
#undef ASMC_SMS_FUNCS
+#undef ASMC_SMS_FUNCS_DISABLED
#undef ASMC_FAN_FUNCS
+#undef ASMC_FAN_FUNCS2
#undef ASMC_LIGHT_FUNCS
/*
@@ -275,6 +308,7 @@ static device_method_t asmc_methods[] = {
DEVMETHOD(device_probe, asmc_probe),
DEVMETHOD(device_attach, asmc_attach),
DEVMETHOD(device_detach, asmc_detach),
+ DEVMETHOD(device_resume, asmc_resume),
{ 0, 0 }
};
@@ -301,6 +335,8 @@ static char *asmc_ids[] = { "APP0001", NULL };
static devclass_t asmc_devclass;
+static unsigned int light_control = 0;
+
DRIVER_MODULE(asmc, acpi, asmc_driver, asmc_devclass, NULL, NULL);
MODULE_DEPEND(asmc, acpi, 1, 1, 1);
@@ -581,6 +617,17 @@ asmc_detach(device_t dev)
return (0);
}
+static int
+asmc_resume(device_t dev)
+{
+ uint8_t buf[2];
+ buf[0] = light_control;
+ buf[1] = 0x00;
+ asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
+ return (0);
+}
+
+
#ifdef DEBUG
void asmc_dumpall(device_t dev)
{
@@ -879,7 +926,7 @@ out:
snprintf(buf, sizeof(buf), "key %d is: %s, type %s "
"(len %d), data", number, key, type, maxlen);
for (i = 0; i < maxlen; i++) {
- snprintf(buf2, sizeof(buf), " %02x", v[i]);
+ snprintf(buf2, sizeof(buf2), " %02x", v[i]);
strlcat(buf, buf2, sizeof(buf));
}
strlcat(buf, " \n", sizeof(buf));
@@ -1324,17 +1371,16 @@ asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS)
device_t dev = (device_t) arg1;
uint8_t buf[2];
int error;
- static unsigned int level;
int v;
- v = level;
+ v = light_control;
error = sysctl_handle_int(oidp, &v, 0, req);
if (error == 0 && req->newptr != NULL) {
if (v < 0 || v > 255)
return (EINVAL);
- level = v;
- buf[0] = level;
+ light_control = v;
+ buf[0] = light_control;
buf[1] = 0x00;
asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
}
diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h
index 368575b..f67ee16 100644
--- a/sys/dev/asmc/asmcvar.h
+++ b/sys/dev/asmc/asmcvar.h
@@ -144,7 +144,19 @@ struct asmc_softc {
"Northbridge Point 2", "Heatsink 1", \
"Heatsink 2", "Memory Bank A", }
-#define ASMC_MBP_TEMPS { "TB0T", "Th0H", "Th1H", "Tm0P", \
+#define ASMC_MB31_TEMPS { "TB0T", "TN0P", "Th0H", "Th1H", \
+ "TM0P", NULL }
+
+#define ASMC_MB31_TEMPNAMES { "enclosure", "northbridge1", \
+ "heatsink1", "heatsink2", \
+ "memory", }
+
+#define ASMC_MB31_TEMPDESCS { "Enclosure Bottomside", \
+ "Northbridge Point 1", \
+ "Heatsink 1","Heatsink 2" \
+ "Memory Bank A", }
+
+#define ASMC_MBP_TEMPS { "TB0T", "Th0H", "Th1H", "Tm0P", \
"TG0H", "TG0P", "TG0T", NULL }
#define ASMC_MBP_TEMPNAMES { "enclosure", "heatsink1", \
@@ -337,3 +349,24 @@ struct asmc_softc {
#define ASMC_MBA3_TEMPDESCS { "Enclosure Bottom", "TB1T", "TB2T", \
"TC0D", "TC0E", "TC0P" }
+
+#define ASMC_MBA5_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", \
+ "TC0D", "TC0E", "TC0F", "TC0P", \
+ "TC1C", "TC2C", "TCGC", "TCSA", \
+ "TCXC", "THSP", "TM0P", "TPCD", \
+ "Ta0P", "Th1H", "Tm0P", "Tm1P", \
+ "Ts0P", "Ts0S", NULL }
+
+#define ASMC_MBA5_TEMPNAMES { "enclosure1", "enclosure2", "enclosure3", "TC0C", \
+ "cpudiode", "cputemp1", "cputemp2", "cpuproximity", \
+ "cpucore1", "cpucore2", "cpupeci", "pecisa", \
+ "TCXC", "THSP", "memorybank", "pchdie", \
+ "Ta0P", "heatpipe", "mainboardproximity1", "mainboardproximity2", \
+ "palmrest", "memoryproximity" }
+
+#define ASMC_MBA5_TEMPDESCS { "Enclosure Bottom 1", "Enclosure Bottom 2", "Enclosure Bottom 3", "TC0C",\
+ "CPU Diode", "CPU Temp 1", "CPU Temp 2", "CPU Proximity", \
+ "CPU Core 1", "CPU Core 2", "CPU Peci Core", "PECI SA", \
+ "TCXC", "THSP", "Memory Bank A", "PCH Die", \
+ "Ta0P", "Heatpipe", "Mainboard Proximity 1", "Mainboard Proximity 2", \
+ "Palm Rest", "Memory Proximity" }
OpenPOWER on IntegriCloud