Commit 8978afef authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman

[PATCH] I2C: Cleanup lm78 init

This patch cleans the init part of the lm78 driver.

* Do not reset the chip.

* Get rid of useless code, which was accidentally left in when we
removed the limit initialization from the driver.

* Do not enable monitoring if it is already enabled (it wouldn't hurt,
but since we can avoid it at no cost...)

Similar changes were applied to the Linux 2.4 driver, which I
successfully tested on my own LM78 chip.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent fd01b12a
...@@ -692,26 +692,12 @@ static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value) ...@@ -692,26 +692,12 @@ static int lm78_write_value(struct i2c_client *client, u8 reg, u8 value)
/* Called when we have found a new LM78. It should set limits, etc. */ /* Called when we have found a new LM78. It should set limits, etc. */
static void lm78_init_client(struct i2c_client *client) static void lm78_init_client(struct i2c_client *client)
{ {
struct lm78_data *data = i2c_get_clientdata(client); u8 config = lm78_read_value(client, LM78_REG_CONFIG);
int vid;
/* Reset all except Watchdog values and last conversion values
This sets fan-divs to 2, among others */
lm78_write_value(client, LM78_REG_CONFIG, 0x80);
vid = lm78_read_value(client, LM78_REG_VID_FANDIV) & 0x0f;
if (data->type == lm79)
vid |=
(lm78_read_value(client, LM78_REG_CHIPID) & 0x01) << 4;
else
vid |= 0x10;
vid = VID_FROM_REG(vid);
/* Start monitoring */ /* Start monitoring */
lm78_write_value(client, LM78_REG_CONFIG, if (!(config & 0x01))
(lm78_read_value(client, LM78_REG_CONFIG) & 0xf7) lm78_write_value(client, LM78_REG_CONFIG,
| 0x01); (config & 0xf7) | 0x01);
} }
static struct lm78_data *lm78_update_device(struct device *dev) static struct lm78_data *lm78_update_device(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment