From b36654cb3b636299116c3a39a074fac7f3f116a9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 10 Jan 2006 11:17:17 +0000 Subject: [PATCH] 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 --- README | 2 +- doc/chips/SUMMARY | 3 +- doc/chips/w83627hf | 11 ++++-- kernel/chips/w83627hf.c | 74 +++++++++++++++++++++++++++++++------- lib/chips.c | 1 + lib/chips.h | 1 + mkpatch/Config.in | 2 +- mkpatch/mkpatch.pl | 8 ++--- prog/detect/sensors-detect | 3 +- prog/sensors/chips.c | 6 ++-- prog/sensors/main.c | 1 + 11 files changed, 86 insertions(+), 26 deletions(-) diff --git a/README b/README index 3bd9c7de..366b9fb2 100644 --- a/README +++ b/README @@ -97,7 +97,7 @@ At least the following hardware sensor chips are supported: TI THMC10 and THMC50 VIA Technologies VT1211, VT8231 and VT82C686A/B embedded sensors Winbond W83781D, W83782D, W83783S, W83791D, W83792D, - W83627HF, W83627THF, W83637HF, and W83697HF + W83627HF, W83627THF, W83637HF, W83687THF and W83697HF We also support some miscellaneous chips: diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index 048f713d..5a84cd56 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -235,8 +235,9 @@ vt8231 w83627hf w83627hf 3 9 3 2 pwm no yes (LPC) - w83627thf 3 7 3 3 pwm no yes (LPC) + w83627thf 3 7 3 3 dac no yes (LPC) w83637hf 3 7 2 3 pwm no yes (LPC) + w83687thf 3 7 3 3 pw/da no yes (LPC) w83697hf 2 8 2 2 pwm no yes (LPC) w83781d diff --git a/doc/chips/w83627hf b/doc/chips/w83627hf index 53268656..f9836f5d 100644 --- a/doc/chips/w83627hf +++ b/doc/chips/w83627hf @@ -20,6 +20,10 @@ Supported chips: Prefix: 'w83637hf' Addresses scanned: ISA address retrieved from Super I/O registers Datasheet: http://www.winbond.com/PDF/sheet/w83637hf.pdf + * Winbond W83687THF + Prefix: 'w83687thf' + Addresses scanned: ISA address retrieved from Super I/O registers + Datasheet: Provided by Winbond on request Authors: Frodo Looijaard , Philip Edelbrock , and Mark Studebaker @@ -46,6 +50,9 @@ Module Parameters * force_w83637hf: short array (min = 1, max = 48) List of adapter,address pairs which are unquestionably assumed to contain a `w83637hf' chip +* force_w83687thf: short array (min = 1, max = 48) + List of adapter,address pairs which are unquestionably assumed to contain + a `w83687thf' chip * ignore: short array (min = 1, max = 48) List of adapter,address pairs not to scan * ignore_range: short array (min = 1, max = 48) @@ -63,8 +70,8 @@ Description ----------- This driver implements support for ISA accesses *only* for -the Winbond W83627HF, W83627THF, W83697HF and W83637HF Super I/O chips. -We will refer to them collectively as Winbond chips. +the Winbond W83627HF, W83627THF, W83697HF, W83637HF and W83687THF +Super I/O chips. We will refer to them collectively as Winbond chips. This driver supports ISA accesses, which should be more reliable than i2c accesses. Also, for Tyan boards which contain both a diff --git a/kernel/chips/w83627hf.c b/kernel/chips/w83627hf.c index 1707fe48..846c6d56 100644 --- a/kernel/chips/w83627hf.c +++ b/kernel/chips/w83627hf.c @@ -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)); diff --git a/lib/chips.c b/lib/chips.c index e46210af..1b7adc9f 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -5568,6 +5568,7 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_W83627THF_PREFIX, w83782d_features }, /* Cheat on 83637HF for now - no separate #defines */ { SENSORS_W83637HF_PREFIX, w83782d_features }, + { SENSORS_W83687THF_PREFIX, w83782d_features }, /* Same as W83627THF */ { SENSORS_W83791D_PREFIX, w83791d_features }, { SENSORS_W83792D_PREFIX, w83792d_features }, { SENSORS_W83L785TS_PREFIX, w83l785ts_features }, diff --git a/lib/chips.h b/lib/chips.h index 8c403a84..d0e46955 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -575,6 +575,7 @@ #define SENSORS_W83627HF_PREFIX "w83627hf" #define SENSORS_W83627THF_PREFIX "w83627thf" #define SENSORS_W83637HF_PREFIX "w83637hf" +#define SENSORS_W83687THF_PREFIX "w83687thf" #define SENSORS_W83791D_PREFIX "w83791d" diff --git a/mkpatch/Config.in b/mkpatch/Config.in index c032216e..a68449eb 100644 --- a/mkpatch/Config.in +++ b/mkpatch/Config.in @@ -51,7 +51,7 @@ if [ "$CONFIG_I2C_PROC" = "m" -o "$CONFIG_I2C_PROC" = "y" ] ; then dep_tristate ' VIA VT8231 Integrated Sensors' CONFIG_SENSORS_VT8231 $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA dep_tristate ' Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F' CONFIG_SENSORS_W83781D $CONFIG_I2C $CONFIG_I2C_PROC dep_tristate ' Winbond W83792D' CONFIG_SENSORS_W83792D $CONFIG_I2C $CONFIG_I2C_PROC - dep_tristate ' Winbond W83627HF, W83627THF, W83697HF' CONFIG_SENSORS_W83627HF $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA + dep_tristate ' Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF' CONFIG_SENSORS_W83627HF $CONFIG_I2C $CONFIG_I2C_PROC $CONFIG_I2C_ISA dep_tristate ' Winbond W83L785TS-S' CONFIG_SENSORS_W83L785TS $CONFIG_I2C $CONFIG_I2C_PROC bool 'Other I2C devices' CONFIG_SENSORS_OTHER if [ "$CONFIG_SENSORS_OTHER" = "y" ] ; then diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index 3a05e054..bf9a92b1 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -716,12 +716,12 @@ CONFIG_SENSORS_W83792D in the lm_sensors package, which you can download at http://www.lm-sensors.nu/ -Winbond W83627HF, W83627THF, W83637HF, W83697HF +Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF CONFIG_SENSORS_W83627HF If you say yes here you get support for the Winbond W836x7 series - of sensor chips: the W83627HF, W83627THF, W83637HF and W83697HF. - This can also be built as a module which can be inserted and removed - while the kernel is running. + of sensor chips: the W83627HF, W83627THF, W83637HF, W83687THF and + W83697HF. This can also be built as a module which can be inserted + and removed while the kernel is running. You will also need the latest user-space utilities: you can find them in the lm_sensors package, which you can download at diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 619b68ae..8afda306 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -1807,8 +1807,7 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect }, { name => "Winbond W83687THF Super IO Sensors", - driver => "to-be-written", # w83627hf - # A datasheet would be needed to confirm this + driver => "w83627hf", devid => 0x85, logdev => 0x0b, }, diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 51d85d1a..6010ba0d 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -2193,10 +2193,12 @@ void print_w83781d(const sensors_chip_name *name) is82d = (!strcmp(name->prefix,"w83782d")) || (!strcmp(name->prefix,"w83627hf")) || (!strcmp(name->prefix,"w83637hf")) || - (!strcmp(name->prefix,"w83627thf")); + (!strcmp(name->prefix, "w83627thf")) || + (!strcmp(name->prefix, "w83687thf")); is83s = !strcmp(name->prefix,"w83783s"); is627thf = (!strcmp(name->prefix,"w83627thf")) || - (!strcmp(name->prefix,"w83637hf")); + (!strcmp(name->prefix, "w83637hf")) || + (!strcmp(name->prefix, "w83687thf")); is697hf = !strcmp(name->prefix,"w83697hf"); if (!sensors_get_feature(*name,SENSORS_W83781D_ALARMS,&cur)) diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 1ece756e..c97226d7 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -368,6 +368,7 @@ struct match matches[] = { { "w83627thf", print_w83781d }, { "w83637hf", print_w83781d }, { "w83697hf", print_w83781d }, + { "w83687thf", print_w83781d }, { "w83627ehf", print_w83627ehf }, { "w83791d", print_w83781d }, { "w83792d", print_w83792d },