mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-10-30 13:00:30 +00:00
Clean init function:
* Do not reset the chip. * Preserve configuration bits we don't explicitely write to. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2736 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
5609f38225
commit
d49077fd70
1 file changed
+11
-8
+11
-8
@@ -504,15 +504,11 @@ static int lm87_write_value(struct i2c_client *client, u8 reg, u8 value)
|
||||
return i2c_smbus_write_byte_data(client, reg, value);
|
||||
}
|
||||
|
||||
/* Called when we have found a new LM87. It should set limits, etc. */
|
||||
/* Called when we have found a new LM87. */
|
||||
static void lm87_init_client(struct i2c_client *client)
|
||||
{
|
||||
struct lm87_data *data = client->data;
|
||||
|
||||
/* Reset all except Watchdog values and last conversion values
|
||||
This sets fan-divs to 2, among others. This makes most other
|
||||
initializations unnecessary */
|
||||
lm87_write_value(client, LM87_REG_CONFIG, 0x80);
|
||||
u8 reg;
|
||||
|
||||
/* Setup Channel Mode register for configuration of monitoring
|
||||
* Default is 00000000b
|
||||
@@ -526,8 +522,10 @@ static void lm87_init_client(struct i2c_client *client)
|
||||
* bit 7 - Configures VID/IRQ input as interrupts if = 1
|
||||
*/
|
||||
|
||||
/* Preserve 4 MSB */
|
||||
reg = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
|
||||
/* I know, not clean, but it works. :'p */
|
||||
lm87_write_value(client, LM87_REG_CHANNEL_MODE,
|
||||
lm87_write_value(client, LM87_REG_CHANNEL_MODE, (reg & 0xf0) |
|
||||
#ifdef LM87_AIN1
|
||||
0x01
|
||||
#else
|
||||
@@ -556,7 +554,12 @@ static void lm87_init_client(struct i2c_client *client)
|
||||
data->vrm = DEFAULT_VRM;
|
||||
|
||||
/* Start monitoring */
|
||||
lm87_write_value(client, LM87_REG_CONFIG, 0x01);
|
||||
reg = lm87_read_value(client, LM87_REG_CONFIG);
|
||||
if (!(reg & 0x01)) {
|
||||
printk(KERN_INFO "lm87.o: Monitoring starts\n");
|
||||
lm87_write_value(client, LM87_REG_CONFIG,
|
||||
(reg & 0x7e) | 0x01);
|
||||
}
|
||||
}
|
||||
|
||||
static void lm87_update_client(struct i2c_client *client)
|
||||
|
||||
Reference in new issue
Block a user