Add 2.4 kernel and user-space support for the Winbond W83687THF

chip. Needs testing.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3226 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2006-01-10 11:17:17 +00:00
1 parent 9f9be64fab
commit b36654cb3b
11 files changed
+86 -26

No files matched your search

+61 -13
View File
@@ -27,6 +27,7 @@
w83627hf 9 3 2 3 0x20 0x5ca3 no yes(LPC)
w83627thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
w83637hf 7 3 3 3 0x80 0x5ca3 no yes(LPC)
w83687thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
w83697hf 8 2 2 2 0x60 0x5ca3 no yes(LPC)
For other winbond chips, and for i2c support in the above chips,
@@ -63,7 +64,7 @@ static unsigned int normal_isa[] = { 0, SENSORS_ISA_END };
static unsigned int normal_isa_range[] = { SENSORS_ISA_END };
/* Insmod parameters */
SENSORS_INSMOD_4(w83627hf, w83627thf, w83697hf, w83637hf);
SENSORS_INSMOD_5(w83627hf, w83627thf, w83697hf, w83637hf, w83687thf);
static int init = 1;
MODULE_PARM(init, "i");
@@ -97,6 +98,10 @@ static int VAL; /* The value to read/write */
#define W83627THF_GPIO5_IOSR 0xf3 /* w83627thf only */
#define W83627THF_GPIO5_DR 0xf4 /* w83627thf only */
#define W83687THF_VID_EN 0x29 /* w83687thf only */
#define W83687THF_VID_CFG 0xF0 /* w83687thf only */
#define W83687THF_VID_DATA 0xF1 /* w83687thf only */
static inline void
superio_outb(int reg, int val)
{
@@ -135,6 +140,7 @@ superio_exit(void)
#define W627THF_DEVID 0x82
#define W697_DEVID 0x60
#define W637_DEVID 0x70
#define W687THF_DEVID 0x85
#define WINB_ACT_REG 0x30
#define WINB_BASE_REG 0x60
/* Constants specified below */
@@ -194,11 +200,11 @@ superio_exit(void)
#define W83627HF_REG_PWM1 0x5A
#define W83627HF_REG_PWM2 0x5B
#define W83627THF_REG_PWM1 0x01 /* 697HF and 637HF too */
#define W83627THF_REG_PWM2 0x03 /* 697HF and 637HF too */
#define W83627THF_REG_PWM3 0x11 /* 637HF too */
#define W83627THF_REG_PWM1 0x01 /* 697HF/637HF/687THF too */
#define W83627THF_REG_PWM2 0x03 /* 697HF/637HF/687THF too */
#define W83627THF_REG_PWM3 0x11 /* 637HF/687THF too */
#define W83627THF_REG_VRM_OVT_CFG 0x18 /* 637HF too */
#define W83627THF_REG_VRM_OVT_CFG 0x18 /* 637HF/687THF too */
static const u8 regpwm_627hf[] = { W83627HF_REG_PWM1, W83627HF_REG_PWM2 };
static const u8 regpwm[] = { W83627THF_REG_PWM1, W83627THF_REG_PWM2,
@@ -314,7 +320,7 @@ struct w83627hf_data {
Default = 3435.
Other Betas unimplemented */
u8 vrm;
u8 vrm_ovt; /* Register value, 627thf & 637hf only */
u8 vrm_ovt; /* Register value, 627THF/637HF/687THF only */
};
@@ -363,7 +369,7 @@ static struct i2c_driver w83627hf_driver = {
/* The /proc/sys entries */
/* WARNING these are copied from w83781d.c and have not been renamed.
Note that the 627hf and 697hf are supported by both drivers.
Note that the 627hf is supported by both drivers.
Do not make incompatible changes here or we will have errors
in the generated file ../include/sensors.h !!!
*/
@@ -522,7 +528,7 @@ static ctl_table w83697hf_dir_table_template[] = {
};
/* no in5 and in6 */
/* We use this one for W83637HF too */
/* We use this one for W83637HF and W83687THF too */
static ctl_table w83627thf_dir_table_template[] = {
{W83781D_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real,
&i2c_sysctl_real, NULL, &w83627hf_in},
@@ -594,7 +600,8 @@ static int __init w83627hf_find(int sioaddr, int *address)
superio_enter();
val= superio_inb(DEVID);
if(val != W627_DEVID && val !=W627THF_DEVID && val != W697_DEVID && val != W637_DEVID) {
if (val != W627_DEVID && val != W627THF_DEVID && val != W697_DEVID
&& val != W637_DEVID && val != W687THF_DEVID) {
superio_exit();
return -ENODEV;
}
@@ -653,6 +660,8 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
kind = w83627thf;
else if(val == W637_DEVID)
kind = w83637hf;
else if (val == W687THF_DEVID)
kind = w83687thf;
superio_select(W83627HF_LD_HWM);
if((val = 0x01 & superio_inb(WINB_ACT_REG)) == 0)
@@ -689,6 +698,9 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
} else if (kind == w83637hf) {
type_name = "w83637hf";
client_name = "W83637HF chip";
} else if (kind == w83687thf) {
type_name = "w83687thf";
client_name = "W83687THF chip";
} else {
goto ERROR1;
}
@@ -714,7 +726,8 @@ int w83627hf_detect(struct i2c_adapter *adapter, int address,
w83697hf_dir_table_template :
(kind == w83627hf) ?
w83627hf_dir_table_template :
/* w83627thf table also used for 637 */
/* w83627thf table also used for 637HF
and 687THF */
w83627thf_dir_table_template,
THIS_MODULE)) < 0) {
err = i;
@@ -834,6 +847,38 @@ exit:
return res;
}
static int w83687thf_read_vid(struct i2c_client *client)
{
int res = 0xff;
superio_enter();
superio_select(W83627HF_LD_HWM);
/* Make sure these GPIO pins are enabled */
if (!(superio_inb(W83687THF_VID_EN) & (1 << 2))) {
#ifdef DEBUG
printk(KERN_DEBUG "w83627hf: VID disabled, no VID "
"function\n");
#endif
goto exit;
}
/* Make sure the pins are configured for input */
if (!(superio_inb(W83687THF_VID_CFG) & (1 << 4))) {
#ifdef DEBUG
printk(KERN_DEBUG "w83627hf: VID configured as output, "
"no VID function\n");
#endif
goto exit;
}
res = superio_inb(W83687THF_VID_DATA) & 0x3f;
exit:
superio_exit();
return res;
}
static int w83627hf_write_value(struct i2c_client *client, u16 reg, u16 value)
{
int word_sized;
@@ -888,10 +933,13 @@ static void w83627hf_init_client(struct i2c_client *client)
data->vid = (lo & 0x0f) | ((hi & 0x01) << 4);
} else if (w83627thf == data->type) {
data->vid = w83627thf_read_gpio5(client);
} else if (w83687thf == data->type) {
data->vid = w83687thf_read_vid(client);
}
/* Read VRM & OVT Config only once */
if (w83627thf == data->type || w83637hf == data->type)
if (w83627thf == data->type || w83637hf == data->type
|| w83687thf == data->type)
data->vrm_ovt =
w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG);
else
@@ -959,8 +1007,8 @@ static void w83627hf_update_client(struct i2c_client *client)
for (i = 0; i <= 8; i++) {
/* skip missing sensors */
if (((data->type == w83697hf) && (i == 1)) ||
((data->type == w83627thf || data->type == w83637hf) &&
(i == 5 || i == 6)))
((data->type == w83627thf || data->type == w83637hf
|| data->type == w83687thf) && (i == 5 || i == 6)))
continue;
data->in[i] =
w83627hf_read_value(client, W83781D_REG_IN(i));