From e58bec5c896179e88796e225acda4d3b912ba171 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 2 May 2004 19:02:00 +0000 Subject: [PATCH] Forcibly enable in7, in8, in10 and temp3 at init time. They are internal so they have to exist. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2506 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/pc87360.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/kernel/chips/pc87360.c b/kernel/chips/pc87360.c index 69b8c26a..311a5a5b 100644 --- a/kernel/chips/pc87360.c +++ b/kernel/chips/pc87360.c @@ -201,6 +201,7 @@ static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, u8 reg); static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank, u8 reg, u8 value); +static void pc87360_init_client(struct i2c_client *client); static void pc87360_update_client(struct i2c_client *client); static int pc87360_find(u8 *devid, int *address); @@ -572,6 +573,8 @@ int pc87360_detect(struct i2c_adapter *adapter, int address, #endif } + pc87360_init_client(new_client); + if ((i = i2c_register_entry((struct i2c_client *) new_client, type_name, template)) < 0) { err = i; @@ -643,6 +646,64 @@ static void pc87360_write_value(struct pc87360_data *data, u8 ldi, u8 bank, up(&(data->lock)); } +static void pc87360_init_client(struct i2c_client *client) +{ + struct pc87360_data *data = client->data; + u8 reg; + + if (data->innr >= 10) { + /* Forcibly enable in7 (Vsb) */ + reg = pc87360_read_value(data, LD_IN, 7, + PC87365_REG_IN_STATUS); + if (!(reg & 0x01)) { +#ifdef DEBUG + printk(KERN_DEBUG "pc87360.o: Forcibly enabling " + "in7 (Vsb)\n"); +#endif + pc87360_write_value(data, LD_IN, 7, + PC87365_REG_IN_STATUS, + (reg & 0x68) | 0x87); + } + /* Forcibly enable in8 (Vdd) */ + reg = pc87360_read_value(data, LD_IN, 8, + PC87365_REG_IN_STATUS); + if (!(reg & 0x01)) { + pc87360_write_value(data, LD_IN, 8, + PC87365_REG_IN_STATUS, + (reg & 0x68) | 0x87); +#ifdef DEBUG + printk(KERN_DEBUG "pc87360.o: Forcibly enabling " + "in8 (Vdd)\n"); +#endif + } + /* Forcibly enable in10 (AVdd) */ + reg = pc87360_read_value(data, LD_IN, 10, + PC87365_REG_IN_STATUS); + if (!(reg & 0x01)) { + pc87360_write_value(data, LD_IN, 10, + PC87365_REG_IN_STATUS, + (reg & 0x68) | 0x87); +#ifdef DEBUG + printk(KERN_DEBUG "pc87360.o: Forcibly enabling " + "in10 (AVdd)\n"); +#endif + } + } + if (data->tempnr >= 3) { + /* Forcibly enable temp3 (PC87366 temperature) */ + reg = pc87360_read_value(data, LD_TEMP, 2, + PC87365_REG_TEMP_STATUS); + if (!(reg & 0x01)) { + pc87360_write_value(data, LD_TEMP, 2, + PC87365_REG_TEMP_STATUS, 0xCF); +#ifdef DEBUG + printk(KERN_DEBUG "pc87360.o: Forcibly enabling " + "temp3 (PC87366 temperature)\n"); +#endif + } + } +} + static void pc87360_update_client(struct i2c_client *client) { struct pc87360_data *data = client->data;