Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Aug 2022 13:55:40 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 00a59bf122d9 - stable/13 - asmc: Add support for MacBookPro6,2
Message-ID:  <202208081355.278Dtepn074558@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=00a59bf122d9ceb0d5847be9b465a9e684624e77

commit 00a59bf122d9ceb0d5847be9b465a9e684624e77
Author:     ed crowe <fbsdbug@edcrowe.com>
AuthorDate: 2022-07-25 15:35:46 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-08-08 13:52:13 +0000

    asmc: Add support for MacBookPro6,2
    
    Modify asmc_sms_printintr() to be silent when the ambient light sensor
    interrupt fires on this model, since the messages can otherwise fill up
    the dmesg.
    
    PR:             265005
    Reviewed by:    markj
    
    (cherry picked from commit 3416f5cde7a7e01b25b5f5fd240ae8aa12fd70bf)
---
 sys/dev/asmc/asmc.c    | 18 +++++++++++++++++-
 sys/dev/asmc/asmcvar.h | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c
index 2e824602b98c..6b4030215605 100644
--- a/sys/dev/asmc/asmc.c
+++ b/sys/dev/asmc/asmc.c
@@ -226,6 +226,12 @@ static const struct asmc_model asmc_models[] = {
 	  ASMC_MBP5_TEMPS, ASMC_MBP5_TEMPNAMES, ASMC_MBP5_TEMPDESCS
 	},
 
+	{
+	  "MacBookPro6,2", "Apple SMC MacBook Pro (Mid 2010, 15-inch)",
+	  ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS,
+	  ASMC_MBP62_TEMPS, ASMC_MBP62_TEMPNAMES, ASMC_MBP62_TEMPDESCS
+	},
+
 	{
 	  "MacBookPro8,1", "Apple SMC MacBook Pro (early 2011, 13-inch)",
 	  ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS,
@@ -1374,6 +1380,7 @@ asmc_sms_intrfast(void *arg)
 static void
 asmc_sms_printintr(device_t dev, uint8_t type)
 {
+	struct asmc_softc *sc = device_get_softc(dev);
 
 	switch (type) {
 	case ASMC_SMS_INTFF:
@@ -1385,8 +1392,17 @@ asmc_sms_printintr(device_t dev, uint8_t type)
 	case ASMC_SMS_INTSH:
 		device_printf(dev, "WARNING: possible shock!\n");
 		break;
+	case ASMC_ALSL_INT2A:
+		/*
+		 * This suppresses console and log messages for the ambient
+		 * light sensor for the only model known to generate this
+		 * interrupt.
+		 */
+		if (strcmp(sc->sc_model->smc_model, "MacBookPro6,2") == 0)
+			break;
+		/* FALLTHROUGH */
 	default:
-		device_printf(dev, "%s unknown interrupt\n", __func__);
+		device_printf(dev, "unknown interrupt: 0x%x\n", type);
 	}
 }
 
diff --git a/sys/dev/asmc/asmcvar.h b/sys/dev/asmc/asmcvar.h
index 533686d0c56b..769903701a99 100644
--- a/sys/dev/asmc/asmcvar.h
+++ b/sys/dev/asmc/asmcvar.h
@@ -109,6 +109,11 @@ struct asmc_softc {
 #define ASMC_SMS_INTHA		0x6f	/* High Acceleration Interrupt */
 #define ASMC_SMS_INTSH		0x80	/* Shock Interrupt */
 
+/*
+ * Light Sensor.
+ */
+#define ASMC_ALSL_INT2A		0x2a	/* Ambient Light related Interrupt */
+
 /*
  * Keyboard backlight.
  */
@@ -232,6 +237,33 @@ struct asmc_softc {
 				  "Heatsink 2", "Memory Controller", \
 				  "PCI Express Slot Pin", "PCI Express Slot (unk)" }
 
+#define ASMC_MBP62_TEMPS	{ "TB0T", "TB1T", "TB2T", \
+				  "TC0C", "TC0D", "TC0P", \
+				  "TC1C", "TG0D", "TG0P", \
+				  "TG0T", "TMCD", "TP0P", \
+				  "TPCD", "Th1H", "Th2H", \
+				  "Tm0P", "Ts0P", "Ts0S" }
+
+#define ASMC_MBP62_TEMPNAMES	{ "enclosure_bottom_0", "enclosure_bottom_1", \
+				  "enclosure_bottom_2", "cpu0", \
+				  "cpu_diode", "cpu_proximity", \
+				  "cpu1", "gpu_diode", \
+				  "gpu_pin", "gpu_transistor", \
+				  "TMCD", "pch_controller_proximity", \
+				  "pch_die", "heatsink1", \
+				  "heatsink2", "memory-controller", \
+				  "palmrest", "memoryproximity" }
+
+#define ASMC_MBP62_TEMPDESCS	{ "Enclosure Bottom 0", "Enclosure Bottom 1", \
+				  "Enclosure Bottom 2", "CPU 0", \
+				  "CPU Diode", "CPU Proximity", \
+				  "CPU 1", "GPU Diode", \
+				  "GPU Pin", "GPU Transistor", \
+				  "TMCD", "PCH Controller Proximity", \
+				  "PCH Die", "Heat Sink 1", \
+				  "Heat Sink 2", "Memory Controller", \
+				  "Palm Rest", "Memory Proximity" }
+
 #define ASMC_MBP81_TEMPS	{ "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \
 				  "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \
 				  "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202208081355.278Dtepn074558>