From f6edfe75bdf8ab9ec7f0c42d6ffa027fee6821e9 Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 30 Oct 1999 21:26:21 +0000 Subject: [PATCH] (mds) Add support for the Asus AS99127F. Treat as an I2C-only W83782D for now. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@614 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 4 +-- README | 20 ++++++++------- doc/chips/SUMMARY | 1 + doc/chips/w83781d | 9 +++++-- kernel/chips/w83781d.c | 50 +++++++++++++++++++++++++------------- lib/chips.c | 2 ++ lib/chips.h | 2 ++ prog/detect/sensors-detect | 24 ++++++++++++++---- prog/sensors/chips.c | 3 ++- prog/sensors/main.c | 3 ++- 10 files changed, 81 insertions(+), 37 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d92f5f38..85f3fe27 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -25,8 +25,8 @@ problems. Extended support for GL518SM and GL520SM sensors. * Mark D. Studebaker Author of the i2c-ali15x3 bus driver and the i2c-i810 bus driver. - Added w83782d, w83783s, and w83627hf support to the w83781d driver. - Added max1617 and thmc10 support to the adm1021 driver. + Added w83782d, w83783s, w83627hf, and as99127f support to the w83781d driver. + Added max1617, thmc10, gl523sm, and lm84 support to the adm1021 driver. Added lm81 support to the adm9240 driver. Author of the decode-xeon.pl xeon EEPROM decoder. * Geert Uytterhoeven diff --git a/README b/README index ff2c9882..c7b9f2ad 100644 --- a/README +++ b/README @@ -27,25 +27,27 @@ module piix4 is renamed i2c-piix4, module isa is renamed i2c-isa, and module bit-mb is renamed i2c-via. You have been warned. At least the following SMBus adapters are supported: - Intel PIIX4 (used in most Intel chipsets) - Intel ICH (used in the Intel 810 and 810E chipsets) Acer Labs M1541 and M1543C (used in the Aladdin IV, V and Pro 2 chipsets) + Apple Hydra (used on some PPC machines) + Intel ICH (used in the Intel 810 and 810E chipsets) + Intel PIIX4 (used in most Intel chipsets) VIA Technologies 82C586B (used in most VIA chipsets) VIA Technologies VT596A/B (used in some more modern VIA chipsets) - Apple Hydra (used on some PPC machines) At least the following hardware sensor chips are supported: - National Semicoductor LM75, LM77, LM78, LM78-J, LM79. LM80, LM81, and LM84 - Winbond W83781D, W83782D, W83783S, and W83627HF - Genesys Logic GL518SM (rev 00, 80), GL520SM, GL523SM Analog Devices ADM1021, ADM1022, and ADM9240 - SiS Southbridge (integrated in the chipset; the I2C adapter will also be - supported in the near future) - Maxim MAX1617 and MAX1617A + Asus AS99127F Dallas Semiconductor DS1780 Hewlett Packard Maxilife (several revisions) + Genesys Logic GL518SM (rev 00, 80), GL520SM, GL523SM Intel Xeon processor embedded sensors + Maxim MAX1617 and MAX1617A + National Semicoductor LM75, LM77, LM78, LM78-J, LM79. LM80, LM81, and LM84 + SiS Southbridge (integrated in the chipset; the I2C adapter will also be + supported in the near future) TI THMC10 and THMC50 + Winbond W83781D, W83782D, W83783S, and W83627HF + We also support some miscellaneous chips: Linear Technologies LTC1710 diff --git a/doc/chips/SUMMARY b/doc/chips/SUMMARY index ce6d481b..4c6e2e61 100644 --- a/doc/chips/SUMMARY +++ b/doc/chips/SUMMARY @@ -85,6 +85,7 @@ thmc50 thmc50 3 2 - 1 dac yes no w83781d + as99127f 3 9 3 2-4 pwm yes no w83781d 3 7 3 - yes yes w83782d 3 9 3 2-4 pwm yes yes w83783s 1-2 5-6 3 2 pwm yes no diff --git a/doc/chips/w83781d b/doc/chips/w83781d index f23ea1d6..8722bf7c 100644 --- a/doc/chips/w83781d +++ b/doc/chips/w83781d @@ -20,7 +20,11 @@ Supported chips: * Winbond W83627HF Prefix 'w83627hf' Addresses scanned: I2C 0x20 - 0x2f (inclusive), ISA 0x290 (8 I/O ports) - Datasheet: Possibly available on request from Winbond + Datasheet: Unavailable from Winbond + * Asus AS99127F + Prefix 'as99127f' + Addresses scanned: I2C 0x20 - 0x2f (inclusive) + Datasheet: Unavailable from Asus Author: Frodo Looijaard , Philip Edelbrock , @@ -55,12 +59,13 @@ Description ----------- This driver implements support for the Winbond W83781D, W83782D, -W8783S, and W83627HF chips. +W8783S, and W83627HF chips, and the Asus AS99127F. We will refer to them collectively as W8378* chips. There is quite some difference between these chips, but they are similar enough that it was sensible to put them together in one driver. The W83627HF chip is assumed to be identical to the W83782D. +The AS99127F chip is assumed to be identical to an I2C-only W83782D. Detection of these chips can sometimes be foiled because they can be in an internal state that allows no clean access. If you know the address diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index f15e2ad8..e291ad3a 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -23,11 +23,12 @@ /* Supports following chips: - Chip #vin #fanin #pwm #temp wchipid i2c ISA - w83781d 7 3 0 3 0x10 yes yes - w83627hf 9 3 2-4 3 0x20 yes yes (LPC) - w83782d 9 3 2-4 3 0x30 yes yes - w83783s 5-6 3 2 1-2 0x40 yes no + Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA + as99127f 9 3 2-4 3 0x20 0x12c3 yes no + w83781d 7 3 0 3 0x10 0x5ca3 yes yes + w83627hf 9 3 2-4 3 0x20 0x5ca3 yes yes (LPC) + w83782d 9 3 2-4 3 0x30 0x5ca3 yes yes + w83783s 5-6 3 2 1-2 0x40 0x5ca3 yes no */ @@ -62,7 +63,7 @@ static unsigned int normal_isa[] = {0x0290,SENSORS_ISA_END}; static unsigned int normal_isa_range[] = {SENSORS_ISA_END}; /* Insmod parameters */ -SENSORS_INSMOD_4(w83781d,w83782d,w83783s,w83627hf); +SENSORS_INSMOD_5(w83781d,w83782d,w83783s,w83627hf,as99127f); /* Many W83781D constants specified below */ @@ -646,6 +647,7 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, const char *type_name = ""; const char *client_name = ""; int is_isa = i2c_is_isa_adapter(adapter); + enum vendor {winbond, asus} vendid; if (!is_isa && ! i2c_check_functionality(adapter,I2C_FUNC_SMBUS_BYTE_DATA)) goto ERROR0; @@ -724,22 +726,32 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, } /* We have either had a force parameter, or we have already detected the - Winbond. Put it now into bank 0 */ + Winbond. Put it now into bank 0 and Vendor ID High Byte */ w83781d_write_value(new_client,W83781D_REG_BANK, - w83781d_read_value(new_client,W83781D_REG_BANK) & 0xf8); + (w83781d_read_value(new_client,W83781D_REG_BANK) & 0x78) | 0x80); /* Determine the chip type. */ if (kind <= 0) { + /* get vendor ID */ + val2 = w83781d_read_value(new_client,W83781D_REG_CHIPMAN); + if (val2 == 0x5c) + vendid = winbond; + else if (val2 == 0x12) + vendid = asus; + else + goto ERROR1; /* mask off lower bit, not reliable */ val1 = w83781d_read_value(new_client,W83781D_REG_WCHIPID) & 0xfe; - if (val1 == 0x10) + if (val1 == 0x10 && vendid == winbond) kind = w83781d; - else if (val1 == 0x30) + else if (val1 == 0x30 && vendid == winbond) kind = w83782d; - else if (val1 == 0x40) + else if (val1 == 0x40 && vendid == winbond && !is_isa) kind = w83783s; - else if (val1 == 0x20) + else if (val1 == 0x20 && vendid == winbond) kind = w83627hf; + else if (val1 == 0x20 && vendid == asus && !is_isa) + kind = as99127f; else { if (kind == 0) printk("w83781d.o: Ignoring 'force' parameter for unknown chip at" @@ -760,6 +772,9 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, } else if (kind == w83627hf) { type_name = "w83627hf"; client_name = "W83627HF chip"; + } else if (kind == as99127f) { + type_name = "as99127f"; + client_name = "AS99127F chip"; } else { #ifdef DEBUG printk("w83781d.o: Internal error: unknown kind (%d)?!?",kind); @@ -1043,7 +1058,7 @@ void w83781d_init_client(struct i2c_client *client) w83781d_write_value(client,W83781D_REG_IN_MAX(6), IN_TO_REG(W83782D_INIT_IN_MAX_6)); } - if ((type == w83782d) || (type == w83627hf)) { + if ((type == w83782d) || (type == w83627hf) || (type == as99127f)) { w83781d_write_value(client,W83781D_REG_IN_MIN(7), IN_TO_REG(W83781D_INIT_IN_MIN_7)); w83781d_write_value(client,W83781D_REG_IN_MAX(7), @@ -1104,7 +1119,8 @@ void w83781d_update_client(struct i2c_client *client) data->in[i] = w83781d_read_value(client,W83781D_REG_IN(i)); data->in_min[i] = w83781d_read_value(client,W83781D_REG_IN_MIN(i)); data->in_max[i] = w83781d_read_value(client,W83781D_REG_IN_MAX(i)); - if((data->type != w83782d) && (data->type != w83627hf) && (i == 6)) + if((data->type != w83782d) && (data->type != w83627hf) && + (data->type != as99127f) && (i == 6)) break; } for (i = 1; i <= 3; i++) { @@ -1115,8 +1131,8 @@ void w83781d_update_client(struct i2c_client *client) for (i = 1; i <= 4; i++) { data->pwm[i-1] = w83781d_read_value(client,W83781D_REG_PWM(i)); if(((data->type == w83783s) || - (((data->type == w83782d) || (data->type == w83627hf)) && - i2c_is_isa_client(client))) + (((data->type == w83782d) || (data->type == w83627hf) || + data->type == as99127f) && i2c_is_isa_client(client))) && i == 2) break; } @@ -1146,7 +1162,7 @@ void w83781d_update_client(struct i2c_client *client) } data->alarms = w83781d_read_value(client,W83781D_REG_ALARM1) + (w83781d_read_value(client,W83781D_REG_ALARM2) << 8); - if ((data->type == w83782d) || (data->type == w83627hf)) { + if ((data->type == w83782d) || (data->type == w83627hf) || data->type == as99127f) { data->alarms |= w83781d_read_value(client,W83781D_REG_ALARM3) << 16; } i = w83781d_read_value(client,W83781D_REG_BEEP_INTS2); diff --git a/lib/chips.c b/lib/chips.c index 78e80cc9..04077740 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -1536,6 +1536,8 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_W83783S_PREFIX, w83783s_features }, /* Cheat on 627HF for now - no separate #defines */ { SENSORS_W83627HF_PREFIX, w83782d_features }, + /* Cheat on1627HF for now - no separate #defines */ + { SENSORS_AS99127F_PREFIX, w83782d_features }, { SENSORS_ADM9240_PREFIX, adm9240_features }, { SENSORS_DS1780_PREFIX, ds1780_features }, { SENSORS_ADM1021_PREFIX, adm1021_features }, diff --git a/lib/chips.h b/lib/chips.h index 7cd8f20a..cf01ffc2 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -366,9 +366,11 @@ /* Winbond W83782D chips */ /* Cheat on 627HF for now - no separate #defines */ +/* Cheat on 127F for now - no separate #defines */ #define SENSORS_W83782D_PREFIX "w83782d" #define SENSORS_W83627HF_PREFIX "w83627hf" +#define SENSORS_AS99127F_PREFIX "as99127f" #define SENSORS_W83782D_IN0 1 /* R */ #define SENSORS_W83782D_IN1 2 /* R */ diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 9f448df3..b8bcb63e 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -230,6 +230,13 @@ use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect isa_detect => sub { w83781d_isa_detect 3, @_ }, alias_detect => sub { w83781d_alias_detect 3, @_ }, } , + { + name => "Asus AS99127F", + driver => "w83781d", + i2c_addrs => [0x00..0x68,0x6a..0x7f], + i2c_driver_addrs => [0x20..0x2f], + i2c_detect => sub { w83781d_detect 4, @_}, + } , { name => "Genesys Logic GL518SM Revision 0x00", driver => "gl518sm", @@ -1264,7 +1271,8 @@ sub lm80_detect return (3); } -# $_[0]: Chip to detect (0 = W83781D, 1 = W83782D, 2 = W83783S, 3 = W83627HF) +# $_[0]: Chip to detect (0 = W83781D, 1 = W83782D, 2 = W83783S, +# 3 = W83627HF, 4 = AS99127F) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[2]: Address @@ -1275,8 +1283,7 @@ sub lm80_detect # 0x4a: I2C addresses of emulated LM75 chips # 0x4e: Vendor ID byte selection, and bank selection # 0x4f: Vendor ID -# 0x58: Device ID (only when in bank 0); both 0x10 and 0x11 is seen for -# W83781D though Winbond documents 0x10 only. +# 0x58: Device ID (only when in bank 0); ignore LSB. # Note: Fails if the W8378xD is not in bank 0! # Note: Detection overrules a previous LM78 detection sub w83781d_detect @@ -1286,14 +1293,21 @@ sub w83781d_detect return unless i2c_smbus_read_byte_data($file,0x48) == $addr; $reg1 = i2c_smbus_read_byte_data($file,0x4e); $reg2 = i2c_smbus_read_byte_data($file,0x4f); - return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xa3) or - (($reg1 & 0x80) == 0x80 and $reg2 == 0x5c); + if ($chip < 3) { + return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xa3) or + (($reg1 & 0x80) == 0x80 and $reg2 == 0x5c); + } + if ($chip == 4) { + return unless (($reg1 & 0x80) == 0x00 and $reg2 == 0xc3) or + (($reg1 & 0x80) == 0x80 and $reg2 == 0x12); + } return unless ($reg1 & 0x07) == 0x00; $reg1 = i2c_smbus_read_byte_data($file,0x58) & 0xfe; return if $chip == 0 and $reg1 != 0x10; return if $chip == 1 and $reg1 != 0x30; return if $chip == 2 and $reg1 != 0x40; return if $chip == 3 and $reg1 != 0x20; + return if $chip == 4 and $reg1 != 0x20; $reg1 = i2c_smbus_read_byte_data($file,0x4a); @res = (8); push @res, ($reg1 & 0x07) + 0x48 unless $reg1 & 0x08; diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 6f86c060..a0798eac 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -811,7 +811,8 @@ void print_w83781d(const sensors_chip_name *name) int is82d, is83s; is82d = (!strcmp(name->prefix,"w83782d")) || - (!strcmp(name->prefix,"w83627hf")); + (!strcmp(name->prefix,"w83627hf")) || + (!strcmp(name->prefix,"as99127f")); is83s = !strcmp(name->prefix,"w83782s"); if (!sensors_get_feature(*name,SENSORS_W83781D_ALARMS,&cur)) alarms = cur + 0.5; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index 6fa7f414..1b5f952c 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -268,7 +268,8 @@ void do_a_print(sensors_chip_name name) else if ((!strcmp(name.prefix,"w83781d")) || (!strcmp(name.prefix,"w83782d")) || (!strcmp(name.prefix,"w83783s")) || - (!strcmp(name.prefix,"w83627hf"))) + (!strcmp(name.prefix,"w83627hf")) || + (!strcmp(name.prefix,"as99127f"))) print_w83781d(&name); else if (!strcmp(name.prefix,"maxilife-cg") || !strcmp(name.prefix,"maxilife-co") ||