Mercurial > illumos > illumos-gate
changeset 13632:ab0e9bcbdf3e
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>
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Tue, 21 Jun 2011 04:40:44 -0700 |
parents | 1e93e74c836a |
children | 7d8ad953b304 |
files | usr/src/uts/sun4u/io/i2c/clients/lm75.c |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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);