2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-03 15:55:15 +00:00

Discard unused variable in private driver data.

Less agressive initialization process (do not reset the chip,
        closes ticket #1154; preserve application mode)
        Fix temp1 (instead of temp2) limits being unsettable in application
        mode 2 (tickets #894 and #1219).
        Ensure that temp2 and in4 are not used at the same time (ticket
        #894).


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2516 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2004-05-09 07:24:37 +00:00
parent ca46e7476a
commit 5313a73781

View File

@@ -123,8 +123,6 @@ struct gl520_data {
struct semaphore update_lock; struct semaphore update_lock;
char valid; /* !=0 if following fields are valid */ char valid; /* !=0 if following fields are valid */
unsigned long last_updated; /* In jiffies */ unsigned long last_updated; /* In jiffies */
unsigned long last_updated_v00;
/* In jiffies (used only by rev00 chips) */
u8 voltage[5]; /* Register values; [0] = VDD */ u8 voltage[5]; /* Register values; [0] = VDD */
u8 voltage_min[5]; /* Register values; [0] = VDD */ u8 voltage_min[5]; /* Register values; [0] = VDD */
@@ -341,9 +339,15 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
data->sysctl_id = i; data->sysctl_id = i;
/* Initialize the GL520SM chip */ /* Initialize the GL520SM chip */
data->two_temps = 1;
data->alarm_mask = 0xff; data->alarm_mask = 0xff;
gl520_init_client(new_client); gl520_init_client(new_client);
if (data->two_temps)
data->voltage_max[4] = data->voltage_min[4] =
data->voltage[4] = 0;
else
data->temp_hyst[1] = data->temp_over[1] =
data->temp[1] = 0;
return 0; return 0;
/* OK, this is not exactly good programming practice, usually. But it is /* OK, this is not exactly good programming practice, usually. But it is
@@ -359,22 +363,24 @@ static int gl520_detect(struct i2c_adapter *adapter, int address,
} }
/* Called when we have found a new GL520SM. It should set limits, etc. */ /* Called when we have found a new GL520SM. */
static void gl520_init_client(struct i2c_client *client) static void gl520_init_client(struct i2c_client *client)
{ {
/* Power-on defaults (bit 7=1) */ struct gl520_data *data = (struct gl520_data *)(client->data);
gl520_write_value(client, GL520_REG_CONF, 0x80); u8 oldconf, conf;
/* No noisy output (bit 2=1), Comparator mode (bit 3=0), two fans (bit4=0), conf = oldconf = gl520_read_value(client, GL520_REG_CONF);
standby mode (bit6=0) */ data->two_temps = !(conf & 0x10);
gl520_write_value(client, GL520_REG_CONF, 0x04);
/* Never interrupts */ /* If IRQ# is disabled, we can safely force comparator mode */
gl520_write_value(client, GL520_REG_MASK, 0x00); if (!(conf & 0x20))
conf &= 0xf7;
/* Clear status register (bit 5=1), start (bit6=1) */ /* Enable monitoring if needed */
gl520_write_value(client, GL520_REG_CONF, 0x24); conf |= 0x40;
gl520_write_value(client, GL520_REG_CONF, 0x44);
if (conf != oldconf)
gl520_write_value(client, GL520_REG_CONF, conf);
} }
static int gl520_detach_client(struct i2c_client *client) static int gl520_detach_client(struct i2c_client *client)
@@ -481,18 +487,21 @@ static void gl520_update_client(struct i2c_client *client)
gl520_read_value(client, GL520_REG_VIN3); gl520_read_value(client, GL520_REG_VIN3);
/* Temp1 and Vin4 are the same input */ /* Temp1 and Vin4 are the same input */
data->temp[1] = gl520_read_value(client, GL520_REG_TEMP2); if (data->two_temps) {
data->temp[1] =
gl520_read_value(client, GL520_REG_TEMP2);
data->temp_over[1] = data->temp_over[1] =
gl520_read_value(client, GL520_REG_TEMP2_OVER); gl520_read_value(client, GL520_REG_TEMP2_OVER);
data->temp_hyst[1] = data->temp_hyst[1] =
gl520_read_value(client, GL520_REG_TEMP2_HYST); gl520_read_value(client, GL520_REG_TEMP2_HYST);
} else {
data->voltage[4] = data->voltage[4] =
gl520_read_value(client, GL520_REG_VIN4); gl520_read_value(client, GL520_REG_VIN4);
data->voltage_min[4] = data->voltage_min[4] =
gl520_read_value(client, GL520_REG_VIN4_MIN); gl520_read_value(client, GL520_REG_VIN4_MIN);
data->voltage_max[4] = data->voltage_max[4] =
gl520_read_value(client, GL520_REG_VIN4_MAX); gl520_read_value(client, GL520_REG_VIN4_MAX);
}
data->last_updated = jiffies; data->last_updated = jiffies;
data->valid = 1; data->valid = 1;
@@ -517,7 +526,7 @@ void gl520_temp(struct i2c_client *client, int operation, int ctl_name,
results[2] = TEMP_FROM_REG(data->temp[nr]); results[2] = TEMP_FROM_REG(data->temp[nr]);
*nrels_mag = 3; *nrels_mag = 3;
} else if (operation == SENSORS_PROC_REAL_WRITE) { } else if (operation == SENSORS_PROC_REAL_WRITE) {
if ((nr == 0) && (!data->two_temps)) if ((nr == 1) && (!data->two_temps))
return; return;
regnr = regnr =
nr == 0 ? GL520_REG_TEMP1_OVER : GL520_REG_TEMP2_OVER; nr == 0 ? GL520_REG_TEMP1_OVER : GL520_REG_TEMP2_OVER;
@@ -766,8 +775,12 @@ void gl520_config(struct i2c_client *client, int operation, int ctl_name,
if (!results[1]) { if (!results[1]) {
old |= 0x10; old |= 0x10;
data->two_temps = 0; data->two_temps = 0;
data->temp_hyst[1] = data->temp_over[1] =
data->temp[1] = 0;
} else { } else {
data->two_temps = 1; data->two_temps = 1;
data->voltage_max[4] = data->voltage_min[4] =
data->voltage[4] = 0;
} }
gl520_write_value(client, GL520_REG_CONF, old); gl520_write_value(client, GL520_REG_CONF, old);
} }