View | Details | Raw Unified | Return to bug 209156
Collapse All | Expand All

(-)sys/dev/asmc/asmc.c (-5 / +51 lines)
Lines 63-68 Link Here
63
static int 	asmc_probe(device_t dev);
63
static int 	asmc_probe(device_t dev);
64
static int 	asmc_attach(device_t dev);
64
static int 	asmc_attach(device_t dev);
65
static int 	asmc_detach(device_t dev);
65
static int 	asmc_detach(device_t dev);
66
static int 	asmc_resume(device_t dev);
66
67
67
/*
68
/*
68
 * SMC functions.
69
 * SMC functions.
Lines 137-146 Link Here
137
#define ASMC_SMS_FUNCS	asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
138
#define ASMC_SMS_FUNCS	asmc_mb_sysctl_sms_x, asmc_mb_sysctl_sms_y, \
138
			asmc_mb_sysctl_sms_z
139
			asmc_mb_sysctl_sms_z
139
140
141
#define ASMC_SMS_FUNCS_DISABLED NULL,NULL,NULL
142
140
#define ASMC_FAN_FUNCS	asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
143
#define ASMC_FAN_FUNCS	asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, asmc_mb_sysctl_fansafespeed, \
141
			asmc_mb_sysctl_fanminspeed, \
144
			asmc_mb_sysctl_fanminspeed, \
142
			asmc_mb_sysctl_fanmaxspeed, \
145
			asmc_mb_sysctl_fanmaxspeed, \
143
			asmc_mb_sysctl_fantargetspeed
146
			asmc_mb_sysctl_fantargetspeed
147
148
#define ASMC_FAN_FUNCS2	asmc_mb_sysctl_fanid, asmc_mb_sysctl_fanspeed, NULL, \
149
			asmc_mb_sysctl_fanminspeed, \
150
			asmc_mb_sysctl_fanmaxspeed, \
151
			asmc_mb_sysctl_fantargetspeed
152
144
#define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \
153
#define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \
145
			 asmc_mbp_sysctl_light_right, \
154
			 asmc_mbp_sysctl_light_right, \
146
			 asmc_mbp_sysctl_light_control
155
			 asmc_mbp_sysctl_light_control
Lines 158-163 Link Here
158
	  ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
167
	  ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS
159
	},
168
	},
160
169
170
	{
171
	  "MacBook3,1", "Apple SMC MacBook Core 2 Duo",
172
	  ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL,
173
	  ASMC_MB31_TEMPS, ASMC_MB31_TEMPNAMES, ASMC_MB31_TEMPDESCS
174
	},
175
161
	{ 
176
	{ 
162
	  "MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)",
177
	  "MacBookPro1,1", "Apple SMC MacBook Pro Core Duo (15-inch)",
163
	  ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
178
	  ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
Lines 260-271 Link Here
260
	  ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS
275
	  ASMC_MBA3_TEMPS, ASMC_MBA3_TEMPNAMES, ASMC_MBA3_TEMPDESCS
261
	},	
276
	},	
262
277
278
	{
279
	  "MacBookAir5,1", "Apple SMC MacBook Air 11-inch (Mid 2012)",
280
	  ASMC_SMS_FUNCS_DISABLED,
281
	  ASMC_FAN_FUNCS2, 
282
	  ASMC_LIGHT_FUNCS,
283
	  ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
284
	},	
285
286
	{
287
	  "MacBookAir5,2", "Apple SMC MacBook Air 13-inch (Mid 2012)",
288
	  ASMC_SMS_FUNCS_DISABLED,
289
	  ASMC_FAN_FUNCS2, 
290
	  ASMC_LIGHT_FUNCS,
291
	  ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS
292
	},	
293
263
	
294
	
264
	{ NULL, NULL }
295
	{ NULL, NULL }
265
};
296
};
266
297
267
#undef ASMC_SMS_FUNCS
298
#undef ASMC_SMS_FUNCS
299
#undef ASMC_SMS_FUNCS_DISABLED
268
#undef ASMC_FAN_FUNCS
300
#undef ASMC_FAN_FUNCS
301
#undef ASMC_FAN_FUNCS2
269
#undef ASMC_LIGHT_FUNCS
302
#undef ASMC_LIGHT_FUNCS
270
303
271
/*
304
/*
Lines 275-280 Link Here
275
	DEVMETHOD(device_probe,		asmc_probe),
308
	DEVMETHOD(device_probe,		asmc_probe),
276
	DEVMETHOD(device_attach,	asmc_attach),
309
	DEVMETHOD(device_attach,	asmc_attach),
277
	DEVMETHOD(device_detach,	asmc_detach),
310
	DEVMETHOD(device_detach,	asmc_detach),
311
	DEVMETHOD(device_resume,	asmc_resume),
278
312
279
	{ 0, 0 }
313
	{ 0, 0 }
280
};
314
};
Lines 301-306 Link Here
301
335
302
static devclass_t asmc_devclass;
336
static devclass_t asmc_devclass;
303
337
338
static unsigned int light_control = 0;
339
304
DRIVER_MODULE(asmc, acpi, asmc_driver, asmc_devclass, NULL, NULL);
340
DRIVER_MODULE(asmc, acpi, asmc_driver, asmc_devclass, NULL, NULL);
305
MODULE_DEPEND(asmc, acpi, 1, 1, 1);
341
MODULE_DEPEND(asmc, acpi, 1, 1, 1);
306
342
Lines 581-586 Link Here
581
	return (0);
617
	return (0);
582
}
618
}
583
619
620
static int
621
asmc_resume(device_t dev)
622
{
623
    uint8_t buf[2];
624
    buf[0] = light_control;
625
    buf[1] = 0x00;
626
    asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
627
    return (0);
628
}
629
630
584
#ifdef DEBUG
631
#ifdef DEBUG
585
void asmc_dumpall(device_t dev)
632
void asmc_dumpall(device_t dev)
586
{
633
{
Lines 879-885 Link Here
879
		snprintf(buf, sizeof(buf), "key %d is: %s, type %s "
926
		snprintf(buf, sizeof(buf), "key %d is: %s, type %s "
880
		    "(len %d), data", number, key, type, maxlen);
927
		    "(len %d), data", number, key, type, maxlen);
881
		for (i = 0; i < maxlen; i++) {
928
		for (i = 0; i < maxlen; i++) {
882
			snprintf(buf2, sizeof(buf), " %02x", v[i]);
929
			snprintf(buf2, sizeof(buf2), " %02x", v[i]);
883
			strlcat(buf, buf2, sizeof(buf));
930
			strlcat(buf, buf2, sizeof(buf));
884
		}
931
		}
885
		strlcat(buf, " \n", sizeof(buf));
932
		strlcat(buf, " \n", sizeof(buf));
Lines 1324-1340 Link Here
1324
	device_t dev = (device_t) arg1;
1371
	device_t dev = (device_t) arg1;
1325
	uint8_t buf[2];
1372
	uint8_t buf[2];
1326
	int error;
1373
	int error;
1327
	static unsigned int level;
1328
	int v;
1374
	int v;
1329
1375
1330
	v = level;
1376
	v = light_control;
1331
	error = sysctl_handle_int(oidp, &v, 0, req);
1377
	error = sysctl_handle_int(oidp, &v, 0, req);
1332
1378
1333
	if (error == 0 && req->newptr != NULL) {
1379
	if (error == 0 && req->newptr != NULL) {
1334
		if (v < 0 || v > 255)
1380
		if (v < 0 || v > 255)
1335
			return (EINVAL);
1381
			return (EINVAL);
1336
		level = v;
1382
		light_control = v;
1337
		buf[0] = level;
1383
		buf[0] = light_control;
1338
		buf[1] = 0x00;
1384
		buf[1] = 0x00;
1339
		asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
1385
		asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, sizeof buf);
1340
	}
1386
	}
(-)sys/dev/asmc/asmcvar.h (-1 / +34 lines)
Lines 144-150 Link Here
144
				  "Northbridge Point 2", "Heatsink 1", \
144
				  "Northbridge Point 2", "Heatsink 1", \
145
				  "Heatsink 2", "Memory Bank A", }
145
				  "Heatsink 2", "Memory Bank A", }
146
146
147
#define ASMC_MBP_TEMPS		{ "TB0T", "Th0H", "Th1H", "Tm0P", \
147
#define ASMC_MB31_TEMPS		{ "TB0T", "TN0P",  "Th0H", "Th1H", \
148
				  "TM0P", NULL }
149
150
#define ASMC_MB31_TEMPNAMES	{ "enclosure", "northbridge1", \
151
				  "heatsink1", "heatsink2", \
152
				  "memory", }
153
154
#define ASMC_MB31_TEMPDESCS	{ "Enclosure Bottomside", \
155
				  "Northbridge Point 1", \
156
				  "Heatsink 1","Heatsink 2" \
157
				  "Memory Bank A", } 
158
159
#define ASMC_MBP_TEMPS		{ "TB0T", "Th0H", "Th1H", "Tm0P",	\
148
				  "TG0H", "TG0P", "TG0T", NULL }
160
				  "TG0H", "TG0P", "TG0T", NULL }
149
161
150
#define ASMC_MBP_TEMPNAMES	{ "enclosure", "heatsink1", \
162
#define ASMC_MBP_TEMPNAMES	{ "enclosure", "heatsink1", \
Lines 337-339 Link Here
337
349
338
#define	ASMC_MBA3_TEMPDESCS	{ "Enclosure Bottom", "TB1T", "TB2T", \
350
#define	ASMC_MBA3_TEMPDESCS	{ "Enclosure Bottom", "TB1T", "TB2T", \
339
				  "TC0D", "TC0E", "TC0P" }
351
				  "TC0D", "TC0E", "TC0P" }
352
353
#define	ASMC_MBA5_TEMPS		{ "TB0T", "TB1T", "TB2T", "TC0C", \
354
                         	  "TC0D", "TC0E", "TC0F", "TC0P", \
355
	                          "TC1C", "TC2C", "TCGC", "TCSA", \
356
	                          "TCXC", "THSP", "TM0P", "TPCD", \
357
	                          "Ta0P", "Th1H", "Tm0P", "Tm1P", \
358
	                          "Ts0P", "Ts0S", NULL }
359
360
#define	ASMC_MBA5_TEMPNAMES	{ "enclosure1", "enclosure2", "enclosure3", "TC0C", \
361
	                          "cpudiode", "cputemp1", "cputemp2", "cpuproximity", \
362
	                          "cpucore1", "cpucore2", "cpupeci", "pecisa", \
363
	                          "TCXC", "THSP", "memorybank", "pchdie", \
364
	                          "Ta0P", "heatpipe", "mainboardproximity1", "mainboardproximity2", \
365
	                          "palmrest", "memoryproximity" }
366
367
#define	ASMC_MBA5_TEMPDESCS	{ "Enclosure Bottom 1", "Enclosure Bottom 2", "Enclosure Bottom 3", "TC0C",\
368
	                          "CPU Diode", "CPU Temp 1", "CPU Temp 2", "CPU Proximity", \
369
	                          "CPU Core 1", "CPU Core 2", "CPU Peci Core", "PECI SA", \
370
	                          "TCXC", "THSP", "Memory Bank A", "PCH Die", \
371
	                          "Ta0P", "Heatpipe", "Mainboard Proximity 1", "Mainboard Proximity 2", \
372
	                          "Palm Rest", "Memory Proximity" }

Return to bug 209156