From 25af13005892f88c168674c1b79cb2a50d7e0695 Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Wed, 18 Sep 2002 19:17:30 +0000 Subject: [PATCH] (Phil) Applied Alexander Malysh 's patch for MC1066 support. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1535 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 1 + doc/chips/adm1021 | 28 ++++++++++++++++++++++++++++ etc/sensors.conf.eg | 2 +- kernel/chips/adm1021.c | 18 ++++++++++++++++-- lib/chips.c | 1 + lib/chips.h | 1 + prog/detect/sensors-detect | 9 ++++++++- prog/sensors/main.c | 2 +- 8 files changed, 57 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 6871c420..b4cb489e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -76,4 +76,5 @@ problems. Added Asus ASB100 Bach support to the w83781d driver. * Alexander Malysh Author of the i2c-sis630 bus driver. + Added Onsemi MC1066 support to the adm1021 driver. diff --git a/doc/chips/adm1021 b/doc/chips/adm1021 index 79a32dfe..c33be445 100644 --- a/doc/chips/adm1021 +++ b/doc/chips/adm1021 @@ -45,6 +45,10 @@ Supported chips: Prefix `thmc10' Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e (inclusive) Datasheet: Publicly available at the TI website + * Onsemi MC1066 + Prefix `mc1066' + Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e (inclusive) + Datasheet: Publicly available at the Onsemi website Author: Frodo Looijaard and Philip Edelbrock @@ -73,6 +77,9 @@ Module Parameters List of adapter,address pairs to scan additionally * probe_range: short array (min = 1, max = 48) List of adapter,start-addr,end-addr triples to scan additionally +* read_only: int (0 = disable, 1 = enable , default 0) + Read only mode.This is useful for Laptop's if BIOS managed Thermal Zone (Fan on/off). + Otherwise it confuse BIOS by writing any limit register's. Description @@ -205,6 +212,27 @@ Chip `max1617a' alarms SENSORS_MAX1617A_ALARMS alarms:1 +Chip `mc1066' + LABEL LABEL CLASS COMPUTE CLASS ACCESS MAGNITUDE + temp NONE NONE R 0 + temp_low temp temp RW 0 + temp_over temp temp RW 0 + remote_temp NONE NONE R 0 + remote_temp_low remote_temp remote_temp RW 0 + remote_temp_over remote_temp remote_temp RW 0 + alarms NONE NONE R 0 + + LABEL FEATURE SYMBOL SYSCTL FILE:NR + temp SENSORS_MAX1617_TEMP temp:3 + temp_low SENSORS_MAX1617_TEMP_HYST temp:2 + temp_over SENSORS_MAX1617_TEMP_OVER temp:1 + remote_temp SENSORS_MAX1617_REMOTE_TEMP remote_temp:3 + remote_temp_low SENSORS_MAX1617_REMOTE_TEMP_HYST remote_temp:2 + remote_temp_over SENSORS_MAX1617_REMOTE_TEMP_OVER remote_temp:1 + alarms SENSORS_MAX1617_ALARMS alarms:1 + + + Old Documentation (may be outdated) ----------------------------------- diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 01225ce4..b4cadda2 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -1337,7 +1337,7 @@ chip "pcf8591-*" label aout "Output" set aout 0 -chip "adm1021-*" "adm1023-*" "max1617-*" "max1617a-*" "thmc10-*" "lm84-*" "gl523sm-*" +chip "adm1021-*" "adm1023-*" "max1617-*" "max1617a-*" "thmc10-*" "lm84-*" "gl523sm-*" "mc1066-*" label temp "Board" label remote_temp "CPU" diff --git a/kernel/chips/adm1021.c b/kernel/chips/adm1021.c index fa4432b3..c28d88b3 100644 --- a/kernel/chips/adm1021.c +++ b/kernel/chips/adm1021.c @@ -49,7 +49,7 @@ static unsigned int normal_isa[] = { SENSORS_ISA_END }; static unsigned int normal_isa_range[] = { SENSORS_ISA_END }; /* Insmod parameters */ -SENSORS_INSMOD_7(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm); +SENSORS_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm, mc1066); /* adm1021 constants specified below */ @@ -58,7 +58,7 @@ SENSORS_INSMOD_7(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm); #define ADM1021_REG_TEMP 0x00 #define ADM1021_REG_REMOTE_TEMP 0x01 #define ADM1021_REG_STATUS 0x02 -#define ADM1021_REG_MAN_ID 0x0FE /* 0x41 = AMD, 0x49 = TI, 0x4D = Maxim, 0x23 = Genesys */ +#define ADM1021_REG_MAN_ID 0x0FE /* 0x41 = AMD, 0x49 = TI, 0x4D = Maxim, 0x23 = Genesys , 0x54 = Onsemi*/ #define ADM1021_REG_DEV_ID 0x0FF /* ADM1021 = 0x0X, ADM1023 = 0x3X */ #define ADM1021_REG_DIE_CODE 0x0FF /* MAX1617A */ /* These use different addresses for reading/writing */ @@ -155,6 +155,9 @@ static void adm1021_die_code(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results); static void adm1021_update_client(struct i2c_client *client); +/* (amalysh) read only mode, otherwise any limit's writing confuse BIOS */ +static int read_only = 0; + /* This is the driver that will be inserted */ static struct i2c_driver adm1021_driver = { @@ -280,6 +283,8 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, if (adm1021_read_value (new_client, ADM1021_REG_CONV_RATE_R) == 0x00) kind = lm84; + else if (i == 0x54) + kind = mc1066; else kind = max1617; } @@ -305,6 +310,9 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, } else if (kind == gl523sm) { type_name = "gl523sm"; client_name = "GL523SM chip"; + } else if (kind == mc1066) { + type_name = "mc1066"; + client_name = "MC1066 chip"; } else { #ifdef DEBUG printk("adm1021.o: Internal error: unknown kind (%d)?!?", @@ -420,6 +428,9 @@ int adm1021_read_value(struct i2c_client *client, u8 reg) int adm1021_write_value(struct i2c_client *client, u8 reg, u16 value) { + if (read_only > 0) + return 0; + return i2c_smbus_write_byte_data(client, reg, value); } @@ -641,6 +652,9 @@ MODULE_AUTHOR ("Frodo Looijaard and Philip Edelbrock "); MODULE_DESCRIPTION("adm1021 driver"); +MODULE_PARM(read_only, "i"); +MODULE_PARM_DESC(read_only, "Don't set any values, read only mode"); + int init_module(void) { return sensors_adm1021_init(); diff --git a/lib/chips.c b/lib/chips.c index ac2a3a06..124c6b6c 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -2994,6 +2994,7 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_DS1780_PREFIX, ds1780_features }, { SENSORS_ADM1021_PREFIX, adm1021_features }, { SENSORS_MAX1617_PREFIX, max1617_features }, + { SENSORS_MC1066_PREFIX, max1617_features }, { SENSORS_MAX1617A_PREFIX, max1617a_features }, /* Cheat on LM84 for now - no separate #defines */ { SENSORS_LM84_PREFIX, adm1021_features }, diff --git a/lib/chips.h b/lib/chips.h index 390c3b82..5907d2a2 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -187,6 +187,7 @@ /* MAX1617 chips. */ #define SENSORS_MAX1617_PREFIX "max1617" +#define SENSORS_MC1066_PREFIX "mc1066" #define SENSORS_MAX1617_TEMP 51 /* R */ #define SENSORS_MAX1617_TEMP_HYST 52 /* RW */ diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index 1533f6ae..9933e960 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -909,6 +909,12 @@ use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], i2c_detect => sub { adm1021_detect 5, @_ }, }, + { + name => "Onsemi MC1066", + driver => "adm1021", + i2c_addrs => [0x18..0x1a,0x29..0x2b,0x4c..0x4e], + i2c_detect => sub { adm1021_detect 6, @_ }, + }, { name => "Analog Devices ADM1022", driver => "thmc50", @@ -2262,7 +2268,7 @@ sub adm1024_detect } # $_[0]: Chip to detect -# (0 = ADM1021, 1 = MAX1617, 2 = MAX1617A, 3 = THMC10, 4 = LM84, 5 = GL523) +# (0 = ADM1021, 1 = MAX1617, 2 = MAX1617A, 3 = THMC10, 4 = LM84, 5 = GL523, 6 = MC1066) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. # $_[2]: Address @@ -2284,6 +2290,7 @@ sub adm1021_detect return if $chip == 5 and i2c_smbus_read_byte_data($file,0xfe) != 0x23; return if $chip == 2 and i2c_smbus_read_byte_data($file,0xfe) != 0x4d and i2c_smbus_read_byte_data($file,0xff) != 0x01; + return if $chip == 6 and i2c_smbus_read_byte_data($file,0xfe) != 0x54; # The remaining things are flaky at best. Perhaps something can be done # with the fact that some registers are unreadable? return if (i2c_smbus_read_byte_data($file,0x02) & 0x03) != 0; diff --git a/prog/sensors/main.c b/prog/sensors/main.c index e31a2283..e7d64d40 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -301,7 +301,7 @@ void do_a_print(sensors_chip_name name) else if (!strcmp(name.prefix,"adm1021") || !strcmp(name.prefix,"max1617") || !strcmp(name.prefix,"max1617a") || !strcmp(name.prefix, "thmc10") || !strcmp(name.prefix,"lm84") || !strcmp(name.prefix, "gl523") || - !strcmp(name.prefix, "adm1023")) + !strcmp(name.prefix, "adm1023") || !strcmp(name.prefix, "mc1066")) print_adm1021(&name); else if (!strcmp(name.prefix,"adm9240") || !strcmp(name.prefix,"ds1780") ||