mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-13 17:00:15 +00:00
GL518SM fixes
* Better VDD internal computation, as described in the data sheet; * Fixed the config file to reflect the above change; * The library read the wrong file to get its gl518sm alarm data. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@150 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
95961de807
commit
14992732d9
6 files changed
+35
-20
No files matched your search
+14
-8
@@ -63,6 +63,9 @@
|
||||
#define IN_TO_REG(val) ((((val)*10+8)/19) & 0xff)
|
||||
#define IN_FROM_REG(val) (((val)*19)/10)
|
||||
|
||||
#define VDD_TO_REG(val) ((((val)*10+11)/23) & 0xff)
|
||||
#define VDD_FROM_REG(val) (((val)*23)/10)
|
||||
|
||||
#define DIV_TO_REG(val) ((val)==8?3:(val)==4?2:(val)==1?0:1)
|
||||
#define DIV_FROM_REG(val) (1 << (val))
|
||||
|
||||
@@ -84,7 +87,7 @@
|
||||
#define GL518_INIT_VIN_1 300
|
||||
#define GL518_INIT_VIN_2 300
|
||||
#define GL518_INIT_VIN_3 300
|
||||
#define GL518_INIT_VDD 300
|
||||
#define GL518_INIT_VDD 500
|
||||
|
||||
#define GL518_INIT_PERCENTAGE 10
|
||||
|
||||
@@ -313,8 +316,8 @@ int gl518_attach_adapter(struct i2c_adapter *adapter)
|
||||
(IN_TO_REG(GL518_INIT_VIN_MAX_3) << 8) |
|
||||
IN_TO_REG(GL518_INIT_VIN_MIN_3));
|
||||
gl518_write_value(new_client,GL518_REG_VDD_LIMIT,
|
||||
(IN_TO_REG(GL518_INIT_VDD_MAX) << 8) |
|
||||
IN_TO_REG(GL518_INIT_VDD_MIN));
|
||||
(VDD_TO_REG(GL518_INIT_VDD_MAX) << 8) |
|
||||
VDD_TO_REG(GL518_INIT_VDD_MIN));
|
||||
/* Clear status register (bit 5=1), start (bit6=1) */
|
||||
gl518_write_value(new_client,GL518_REG_CONF,0x24);
|
||||
gl518_write_value(new_client,GL518_REG_CONF,0x44);
|
||||
@@ -504,12 +507,15 @@ void gl518_vin(struct i2c_client *client, int operation, int ctl_name,
|
||||
*nrels_mag = 2;
|
||||
else if (operation == SENSORS_PROC_REAL_READ) {
|
||||
gl518_update_client(client);
|
||||
results[0] = IN_FROM_REG(data->voltage_min[nr]);
|
||||
results[1] = IN_FROM_REG(data->voltage_max[nr]);
|
||||
results[0] = nr?IN_FROM_REG(data->voltage_min[nr]):
|
||||
VDD_FROM_REG(data->voltage_min[nr]);
|
||||
results[1] = nr?IN_FROM_REG(data->voltage_max[nr]):
|
||||
VDD_FROM_REG(data->voltage_max[nr]);
|
||||
if ((data->revision == 0x00) && (nr != 3))
|
||||
results[2] = 0;
|
||||
else
|
||||
results[2] = IN_FROM_REG(data->voltage[nr]);
|
||||
results[2] = nr?IN_FROM_REG(data->voltage[nr]):
|
||||
VDD_FROM_REG(data->voltage[nr]);
|
||||
*nrels_mag = 3;
|
||||
} else if (operation == SENSORS_PROC_REAL_WRITE) {
|
||||
regnr=nr==0?GL518_REG_VDD_LIMIT:nr==1?GL518_REG_VIN1_LIMIT:nr==2?
|
||||
@@ -517,11 +523,11 @@ void gl518_vin(struct i2c_client *client, int operation, int ctl_name,
|
||||
if (*nrels_mag == 1)
|
||||
old = gl518_read_value(client,regnr) & 0xff00;
|
||||
if (*nrels_mag >= 2) {
|
||||
data->voltage_max[nr] = IN_TO_REG(results[1]);
|
||||
data->voltage_max[nr] = nr?IN_TO_REG(results[1]):VDD_TO_REG(results[1]);
|
||||
old = data->voltage_max[nr] << 8;
|
||||
}
|
||||
if (*nrels_mag >= 1) {
|
||||
data->voltage_min[nr] = IN_TO_REG(results[0]);
|
||||
data->voltage_min[nr] = nr?IN_TO_REG(results[0]):VDD_TO_REG(results[0]);
|
||||
old |= data->voltage_min[nr];
|
||||
gl518_write_value(client,regnr,old);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user