Re: adt7460 temperature target

[email protected] Sun, 3 Dec 2023 02:30:51 +0000 (UTC)
Newsgroups gmane.os.openbsd.ppc
Message-ID <3b3b60c837d24cd9@pg4>
Hello again. I've been trying to gather dmesgs online and it seems
that the only macppc computers with this driver are powerbooks and
ibooks, not Nuno's model, for instance.

I think it's reasonable to do this with an ifdef, what do you think?

Index: dev/i2c/adt7460.c
===================================================================
RCS file: /cvs/src/sys/dev/i2c/adt7460.c,v
retrieving revision 1.22
diff -u -p -r1.22 adt7460.c
--- dev/i2c/adt7460.c	6 Apr 2022 18:59:28 -0000	1.22
+++ dev/i2c/adt7460.c	3 Dec 2023 02:28:11 -0000
@@ -34,6 +34,9 @@
 #define ADT7460_REM1_TEMP	0x25
 #define ADT7460_LOCAL_TEMP	0x26
 #define ADT7460_REM2_TEMP	0x27
+#define ADT7460_REM1_TEMP_TRG	0x68
+#define ADT7460_LOCAL_TEMP_TRG	0x67
+#define ADT7460_REM2_TEMP_TRG	0x69
 #define ADT7460_TACH1L		0x28
 #define ADT7460_TACH1H		0x29
 #define ADT7460_TACH2L		0x2a
@@ -196,6 +199,18 @@ adt_attach(struct device *parent, struct
 			return;
 		}
 	}
+
+#ifdef __macppc__
+	for (cmd = ADT7460_LOCAL_TEMP_TRG; cmd <= ADT7460_REM2_TEMP_TRG; cmd++){
+		data = 46; /* temperature target in deg C */
+		if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
+		    sc->sc_addr, &cmd, sizeof cmd, &data, sizeof data, 0)) {
+			iic_release_bus(sc->sc_tag, 0);
+			printf(": cannot set temperature target register\n");
+			return;
+		}
+	}
+#endif
 
 	iic_release_bus(sc->sc_tag, 0);