2195 lm75 ignores the half degree bit in writes
Reviewed by: Jason King <
[email protected]>
Reviewed by: Garrett D'Amore <
[email protected]>
Reviewed by: Albert Lee <
[email protected]>
Reviewed by: Joshua M. Clulow <
[email protected]>
Approved by: Robert Mustacchi <
[email protected]>
--- a/usr/src/uts/sun4u/io/i2c/clients/lm75.c Fri Mar 02 19:01:23 2012 -0500
+++ b/usr/src/uts/sun4u/io/i2c/clients/lm75.c Tue Jun 21 04:40:44 2011 -0700
@@ -293,10 +293,21 @@
unitp->lm75_name));
return (ENOMEM);
}
+
+ /* BEGIN CSTYLED */
+ /*
+ * The temperature is 16bits where the top 9 are a twos-complement
+ * word with the the least significant bit used to indicate 0.5C
+ *
+ * |15|14|13|12|11|10| 9| 8| 7| 6| 5| 4| 3| 2| 1| 0|
+ * |-----------------------------------------------|
+ * |+-| Temperature | Unused |
+ */
+ /* END CSTYLED */
i2c_tran_pointer->i2c_flags = I2C_WR;
i2c_tran_pointer->i2c_wbuf[0] = (uchar_t)reg;
- i2c_tran_pointer->i2c_wbuf[1] = (temp16 >> 1);
- i2c_tran_pointer->i2c_wbuf[2] = ((temp16 & 0xFE) << 7);
+ i2c_tran_pointer->i2c_wbuf[1] = ((temp16 >> 1) & 0xff);
+ i2c_tran_pointer->i2c_wbuf[2] = ((temp16 & 0x1) << 7);
err = i2c_transfer(unitp->lm75_hdl, i2c_tran_pointer);
i2c_transfer_free(unitp->lm75_hdl, i2c_tran_pointer);