summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRichard Lowe <richlowe@richlowe.net>2011-06-21 04:40:44 -0700
committerRichard Lowe <richlowe@richlowe.net>2011-06-21 04:40:44 -0700
commit686928d476b99b8b21fe0d4ae0ddcc1936cd0bd6 (patch)
tree1106a1c1ea3d778a62f286ba68bc19762f3b6c0c /usr/src
parent15e1afcd5e908ae29b1e6018838638befdc225a2 (diff)
downloadillumos-joyent-686928d476b99b8b21fe0d4ae0ddcc1936cd0bd6.tar.gz
2195 lm75 ignores the half degree bit in writes
Reviewed by: Jason King <jason.brian.king@gmail.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: Albert Lee <trisk@nexenta.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/sun4u/io/i2c/clients/lm75.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr/src/uts/sun4u/io/i2c/clients/lm75.c b/usr/src/uts/sun4u/io/i2c/clients/lm75.c
index a116540f09..c5f94eac09 100644
--- a/usr/src/uts/sun4u/io/i2c/clients/lm75.c
+++ b/usr/src/uts/sun4u/io/i2c/clients/lm75.c
@@ -293,10 +293,21 @@ lm75_set16(intptr_t arg, int reg, struct lm75_unit *unitp, int mode) {
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);