# HG changeset patch # User Richard Lowe # Date 1308656444 25200 # Node ID ab0e9bcbdf3e365f94d79916e2779ecaf478b0f2 # Parent 1e93e74c836a11d8b6220fbbd0cc5d3682c396f4 2195 lm75 ignores the half degree bit in writes Reviewed by: Jason King Reviewed by: Garrett D'Amore Reviewed by: Albert Lee Reviewed by: Joshua M. Clulow Approved by: Robert Mustacchi diff -r 1e93e74c836a -r ab0e9bcbdf3e usr/src/uts/sun4u/io/i2c/clients/lm75.c --- 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);